akhauriyash/Code-Regression huggingface dataset:
/*

    author : s@if

*/

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

#define 		NIL 			-1
#define		 	fi	 		    first
#define 		sec 			second
#define 		MAX 			INT_MAX
#define			INF 			99999999
#define 		ll 			    long long
#define 		PI 			    acos(-1.0)
#define			MOD 			1000000007
#define 		PLL 			pair<ll,ll>
#define 		PII			    pair<int,int>
#define 		ull 			unsigned long long
#define 		For(i,a,b) 		for(int i=a;i<=(int)b;i++)
typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update> new_data_set;

//*find_by_order(k)  gives the kth element;
//order_of_key(item)   gives the index(number of element strictly less than item) of item;


inline int in() {int x; scanf("%d", &x); return x; }
bool Check(int N , int pos)	{	return (bool) (N & (1<<pos));}
int Set(int N, int pos) {	return N = N | (1<<pos);}

int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};
int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};
int hr[]={-2,-2,-1,+1,+2,+2,-1,+1};
int hc[]={+1,-1,+2,+2,-1,+1,-2,-2};
int dx[]={+1,-1,+0,+0};
int dy[]={+0,+0,+1,-1};

const int MAXN = (int)1e5+9;

int main()
{
/*	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);  */

    int i,j,k,l,m,n,p,q,x,y,u,v,r,tc,t;

    string s; cin>>s; n = s.size();

    int ara[n+9]; ara[n] = 0;

    for(i=n-1; i>=0; )
    {
        int cnt1 = 0, cnt2 = 0; j = i;

        while(j>=0 && s[j]=='>'){
            j--; cnt1++;
        }

        while(j>=0 && s[j]=='<'){
            j--; cnt2++;
        }

        k = i;

        for(p=k, q=1; q<cnt1; q++, p--)
            ara[p] = q;
        ara[p] = max(cnt1, cnt2); p--;

        for(q=1, v = cnt2-1; q<=cnt2; q++, p--)
        {
            ara[p] = v; v--;
        }

        i = j;
    }

    ll ans = 0;
    for(i=0; i<=n; i++){
       // cout<<ara[i]<<" ";
        ans+=ara[i];
    }

   // cout<<endl;

    cout<<ans<<endl;

  //  main();

    return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)


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

int main() {
  int n, o = INT_MAX, r, s, t;
  cin >> n;
  for(int i = 0; i <= n; i++) {
    s = n - i;
    t = i;
    r = 0;
    while(s) {
      r += s % 6;
      s /= 6;
    }
    while(t) {
      r += t % 9;
      t /= 9;
    }
    o = min(o, r);
  }
  cout << o << endl;
}

Measured memory_bytes: 256
N,K = map(int, input().split())
xy = []
for _ in range(N):
    xy.append( tuple(map(int, input().split())) )
xs,ys = map(list, zip(*xy))
xs.sort()
ys.sort()
grid = [[0]*(N+1) for _ in range(N+1)] # compressed coordinate
# 座標圧縮
# 圧縮するときに1-indexにしとくと矩形領域の計算が楽になる
for x,y in xy:
    i = xs.index(x)
    j = ys.index(y)
    grid[j+1][i+1] = 1
    
# print(grid)

# 2次元累積和
for h in range(N+1):
    for w in range(1,N+1):
        grid[h][w] += grid[h][w-1]
for w in range(N+1):
    for h in range(1,N+1):
        grid[h][w] += grid[h-1][w]

#print(grid)
ans = float('inf')
for l in range(N):
    for r in range(l+1,N):
        for b in range(N):
            for t in range(b+1,N):
                cnt = grid[t+1][r+1] - grid[b][r+1] - grid[t+1][l] \
                      + grid[b][l]
                xl,xr = xs[l],xs[r]
                yb,yt = ys[b],ys[t]
                if cnt>=K:
                    ans = min(ans, (xr-xl)*(yt-yb))
print(ans)

Measured memory_bytes: 3064
using System;
using System.Linq;

class Program {
  static void Main() {
    var s = int.Parse(Console.ReadLine());
    var a = s / 100;
    var b = s % 100;
    if (1 <= a && a <= 12 && 1 <= b && b <= 12) {
      Console.WriteLine("AMBIGUOUS");
    } else if (1 <= a && a <= 12) {
      Console.WriteLine("MMYY");
    } else if (1 <= b && b <= 12) {
      Console.WriteLine("YYMM");
    } else {
      Console.WriteLine("NA");
    }
  }
}

Measured memory_bytes: 11092
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <queue>
#include <climits>
#include <stack>
#include <string>
#include <set>
#include <cmath>
#include <map>
#include <numeric>
#include <random>
#include <memory>
#include <chrono>
#include <iterator>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
#define mp make_pair
#define pb push_back
#define sz(x) int((x).size())


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int S = 2e5 + 7;
const int inf = INT_MAX / 3;
const ll INF = LLONG_MAX / 3;
const int MOD = 1e9 + 7;


signed main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	cout << fixed << setprecision(9);
	ios::sync_with_stdio(false);
	cin.tie();
	cout.tie();

	string s;
	cin >> s;

	if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) {
		cout << "Bad\n";
	}
	else {
		cout << "Good\n";
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
struct edge{ll to,cost;};
const int inf = 1<<28;
const ll INF = 1LL<<53;
const int COMBMAX = 500005;
const ll MOD = 1e9+7;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;++i)
#define repf(i,n) for(int i=0;i<=n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define eachdo(v, e) for(const auto& e : v)
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (ll)distance(v.begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (ll)distance(v.begin(), upper_bound((v).begin(), (v).end(), e))
ll mpow(ll a, ll n,ll mod=MOD){ll res=1;while(n>0){if(n&1)res=res*a%mod;a=a*a%mod;n>>=1;}return res;}
template<class T1, class T2> ll bcount(T1 v, T2 a){return upper_index(v,a)-lower_index(v,a);} 
template<class T> bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
template<class T> void debug2(T v){rep(i,v.size()){rep(j,v[i].size())cout<<v[i][j]<<" ";cout<<endl;}}
template<class T> void rdv(T &v){rep(i,v.size())cin>>v[i];}
template<class T> void rdvv(T &v){rep(i,v.size()){rep(j,v[i].size())cin>>v[i][j];}}
// multimap
// mmap.emplace(key,value);
// auto ngw = list.equal_range("");
// for(auto e = ngw.first; it != ngw.second ; ++e)

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;

    UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }

    ll find(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }

    bool merge(ll x, ll y) {
        x = find(x);
        y = find(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return find(x) == find(y);
    }

    ll size(ll x) {
        return siz[find(x)];
    }
};


int main(){
    ll N,M; cin >> N >> M;
    vl p(N); rdv(p);
    UnionFind uf(N);
    rep(i,M){
        ll a,b; cin >> a >> b;
        uf.merge(--a,--b);
    }
    ll ans = 0;
    rep(i,N) if(uf.issame(i,--p[i])) ++ans;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int N; cin >> N;
    vector<int> a(N);
    rep(i,N) cin >> a[i];
    sort(a.begin(),a.end());
    rep(i,N-1){
        if(a[i] == a[i+1]){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;

}
    



Measured memory_bytes: 1152
using System;
using System.Linq;

namespace ITP1_4_D
{
    class Program
    {
        static void Main(string[] args)
        {
            int number = int.Parse(Console.ReadLine());
            int[] data = new int[number];
            data = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();
            int max = int.MinValue;
            int min = int.MaxValue;
            long sum = 0;
            foreach(var i in data)
            {
                if (max < i) max = i;
                if (i < min) min = i;
                sum += i;
            }
            Console.WriteLine(min + " " + max + " " + sum);
        }
    }
}

Measured memory_bytes: 10564
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int count = 0;
		int[] flag = new int[101];
		for(int i = 0; i < N; i++) {
			int d = sc.nextInt();
			flag[d] = 1;
		}

		for(int i = 1; i < 101; i++) {
			count += flag[i];
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 35900
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a <= b * c)puts("Yes");
    else puts("No");
}


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

int N,K;
int a[107] = {};
LLI dp[100007][107] = {};

void add( int x, int y, int d) {
	if( x == 0) {
		dp[x][y] += d;
		dp[x][y] %= MOD;
		return;
	}
	while( x <= K) {
		dp[x][y] += d;
		dp[x][y] %= MOD;
		x += x & (-x);
	}
}

LLI ps( int x, int y) {
	LLI ret = 0;
	while( x) {
		ret += dp[x][y];
		ret %= MOD;
		x -= x & (-x);
	}
	ret += dp[x][y];
//	printf("query :: %d\n", ret);
	return ret;
}

LLI query( int l, int r, int y) {
	if( l == 0)
		return ps( r, y);
	else
		return ( ( ps( r, y) - ps( l-1, y) ) % MOD + MOD ) % MOD;
//		return  ps( r, y) - ps( l-1, y);
}

int main() {
	
	int i,j;
	
	cin >> N >> K;
	for( i=1; i<=N; i++)
		cin >> a[i];
	
	add( 0, 0, 1);
	for( i=1; i<=N; i++) {
		for( j=0; j<=K; j++) {
			LLI d = query( max( 0, j-a[i]), j, i-1);
			add( j, i, d);
		}
	}
	
	LLI ans = query( K, K, N);
//	for( i=0; i<=N; i++) {
//		printf("%d >>> ", i);
//		for( j=0; j<=K; j++) {
//			printf("%d ", query( j, j, i));
//		}
//		printf("\n");
//	}
//	for( i=0; i<=N; i++) {
//		printf("%d >>> ", i);
//		for( j=0; j<=K; j++) {
//			printf("%d ", dp[i][j]);
//		}
//		printf("\n");
//	}
	printf("%lld\n", ans);
	
	return 0;
}

Measured memory_bytes: 87352
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

LL N;

int main(void)
{
	cin >> N;
	LL s = (LL)sqrt(N);
	LL big = 0;
	for (LL i = 1; i <= s; ++i) {
		if (N % i == 0) {
			++big;
			if (N != i * i) {
				++big;
			}
		}
	}
	big--;
	LL small = 0;
	for (LL i = 2; i <= s; ++i) {
		if (N % i == 0) {
			++small;
			while (N % i == 0)N /= i;
		}
	}
	if (N != 1)++small;
	cout << small << " " << big << endl;
	return 0;
}



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

int main(){
    int t[101][101], r, c;
    cin >> r >> c;
    for(int i = 0; i < r; i++){
        for(int j = 0; j < c; j++){
            cin >> t[i][j];
        }
    }

    for(int i = 0; i <= r; i++)
        t[i][c] = 0;
    for(int j = 0; j <= c; j++)
        t[r][j] = 0;
    
    for(int i = 0; i < r; i++){
        for(int j = 0; j < c; j++){
            t[i][c] += t[i][j];
            t[r][j] += t[i][j];
            t[r][c] += t[i][j];
        }
    }

    for(int i = 0; i <= r; i++){
        for(int j = 0; j <= c; j++){
            if(j) cout << " ";
            cout << t[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define M1 					1000000007
#define M2 					998244353
#define ll 					long long int
#define pll 				pair<ll,ll>
#define mll 				map<ll,ll>
#define F 					first
#define S 					second
#define PB 					push_back
#define mp 					make_pair
#define lb 					lower_bound
#define ub 					upper_bound
#define V(a) 				vector<a>
#define endl 				'\n'
#define test(t) 			while(t--)
#define PI 					acos(-1.0)
#define rep(i,a,b) 			for(ll i=a;i<b;i++)
#define repp(i,b,a) 		for(ll i=b-1;i>=a;i--)
#define clr(ar, val)		memset(ar, val, sizeof(ar))
#define setbits(x) 			__builtin_popcountll(x)
#define zrobits(x) 			__builtin_ctzll(x)
#define ps(y) 				fixed << setprecision(y)
#define all(x) 				begin(x),end(x)
#define allr(x) 			rbegin(x),rend(x)
const int inf= 				0x3f3f3f3f;
const ll INF= 				0x3f3f3f3f3f3f3f3f;
const int dx[4]= 			{ 0, -1, 0, 1 };
const int dy[4]= 			{ -1, 0, 1, 0 };

unsigned  int  randInt (){ 
    static  unsigned  int  tx  =  123456789 ,  ty = 362436069 ,  tz = 521288629 ,  tw = 88675123 ; 
    unsigned  int  tt  =  ( tx ^ ( tx << 11 )); 
    tx  =  ty ;  ty  =  tz ;  tz  =  tw ; 
    return  (  tw = ( tw^ ( tw >> 19 )) ^ ( tt ^ ( tt >> 8 ))  ); 
}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T>
#define o_set(T) tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

ll floor_div(ll a, ll b) {
	return a / b - (((a ^ b) < 0) and a % b);
}
ll ceil_div(ll a, ll b){
    return a / b + (((a ^ b) >= 0) and a % b);
}

inline void INP()
{
	#ifndef ONLINE_JUDGE
	    freopen("input.txt","r",stdin);   
	    freopen("output.txt","w",stdout);
	#endif 
}

void solve()
{
    ll n;
    cin >> n;
    map<string,bool> m;
    ll ans = 0;
    rep(i,0,n){
        string s;
        cin >> s;
        if (!m[s]) ans++;
        m[s] = 1;
    }
    cout << ans;

}

int32_t main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    test(t){
        solve();
    }
    return 0;
}

Measured memory_bytes: 19244
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <regex>

#define FOR(i, f, n) for(int (i) = (f); (i) < (n); (i)++)
#define RFOR(i, f, n) for(int (i) = (f); (i) >= (n); (i)--)
#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define RREP(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for(int (i) = (n); (i) >= 0; (i)++)
#define p(...) printf(__VA_ARGS__); cout << endl;
#define in(...) __VA_ARGS__; input__(__VA_ARGS__);
#define input(...) in(__VA_ARGS__)
#define out(...) output__(__VA_ARGS__);
#define output(...) out(__VA_ARGS__)
#define list_input(x, n) x[(n)]; for(int (i) = 0; (i) < (n); (i)++) cin >> x[i];
#define lambda(a, b, c) [](const a, const b){ return c ;}
#define key(t, x, compare) [](const t& a, const t& b){ return a x compare b x ;}

using namespace std;

using pii = pair<int, int>;

template <class... T>
void input__(T &...a) {
  for(auto v: {&a...}) {
    cin >> *v;
  }
}

template <class... T>
void output__(T ...a) {
  for(auto v: {a...}) {
    cout << v << " ";
  }
  cout << endl;
}

int main(){
  int in(a, b, c);
  out(abs(a - b) < abs(a - c) ? "A" : "B")
}


Measured memory_bytes: 256
a,b,m=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

MIN=min(A)+min(B)

for i in range(m):
    x,y,c=map(int,input().split())
    x-=1
    y-=1
    MIN=min(MIN,A[x]+B[y]-c)
print(MIN)

Measured memory_bytes: 18612
using System;
using System.Collections.Generic;
using static System.Console;
using System.Linq;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            string str = cin.ReadLine;
            string res = "";
            for (int i = 0; i < str.Length; i++)
            {
                if (i % 2 == 0)
                {
                    res += str[i];
                }
            }

            WriteLine(res);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


Measured memory_bytes: 34900
#include <cstdio>

int main()
{
	char ch;

	while ((ch = getchar()) != EOF)
	{
		if (ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A) ch ^= 0x20;
		printf("%c",ch);
	}

	return 0;
}

Measured memory_bytes: 2624
{-# LANGUAGE BangPatterns #-}
import Data.Int
import Control.Monad
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as VM
import qualified Data.ByteString.Char8 as BS

solve :: Int -> Int -> V.Vector (Int,Int) -> V.Vector Int64
solve n m edges = V.create $ do
  -- m 番目の島から順番に島同士が「繋がっていく」と考える

  -- j = assocs ! i : i 番目の島の親が j
  -- assocs <- VM.new n
  -- forM_ [0..n-1] $ \i -> VM.write assocs i i
  assocs <- V.thaw $ V.enumFromN 0 n

  -- numberOfElements ! i : i番目の島と同じ連結成分に属する島の個数
  numberOfElements <- VM.replicate n 1

  rank <- VM.replicate n (0 :: Int)

  let getRoot !i = do
        !j <- VM.read assocs i
        if i == j
          then return i
          else do k <- getRoot j
                  VM.write assocs i k
                  return k

      -- i 番目の島と j 番目の島を繋いで、新たに繋がった組み合わせの個数を返す
      unify !i !j = do
        !i' <- getRoot i
        !j' <- getRoot j
        if i' == j'
          then return 0
          else do
          !ri <- VM.read rank i'
          !rj <- VM.read rank j'
          !k <- case compare ri rj of
                  EQ -> do VM.write rank i' (ri + 1)
                           return i'
                  LT -> return j'
                  GT -> return i'
          VM.write assocs i' k
          VM.write assocs j' k
          !n1 <- VM.read numberOfElements i'
          !n2 <- VM.read numberOfElements j'
          VM.write numberOfElements k (n1 + n2)
          return $! n1 * n2
  result <- VM.new m
  VM.write result (m-1) $ fromIntegral n * (fromIntegral n - 1) `quot` 2
  forM_ [m-1,m-2..1] $ \i -> do
    let (a,b) = edges V.! i
    convenience <- unify a b
    prevInconveniences <- VM.read result i
    VM.write result (i-1) (prevInconveniences - convenience)
  return result

readIntPair :: IO (Int, Int)
readIntPair = do
  [a,b] <- BS.words <$> BS.getLine
  case (BS.readInt a, BS.readInt b) of
    (Just (a', _), Just (b', _)) -> return (a',b')

main = do
  (n,m) <- readIntPair -- 2 <= n <= 10^5, 1 <= m <= 10^5
  edges <- V.replicateM m $ do
    (a,b) <- readIntPair
    return (a-1, b-1)
  -- maxIncovenience < n * (n - 1) / 2 < 10^10 (2^32 < 10^10)
  let result = solve n m edges
  V.forM_ result print


Measured memory_bytes: 6908
import queue
from collections import deque
import sys
input = sys.stdin.readline

def main():
    n, q = map(int, input().split())
    edge = [[] for _ in range(n)]
    for i in range(n-1):
        a, b = map(int, input().split())
        edge[a-1].append(b-1)
        edge[b-1].append(a-1)

    ans = [0]*n
    checked = [0]*n
    checked[0] = 1
    for i in range(q):
        p, q = map(int, input().split())
        ans[p-1] += q

    ans_q = deque([(0, ans[0])])
    while len(ans_q) > 0:
        start = ans_q.popleft()
        cost = start[1]
        ans[start[0]] = cost
        for e in edge[start[0]]:
            if checked[e] == 0:
                checked[e] = 1
                ans_q.append((e, cost+ans[e]))

    for i in range(n):
        print(ans[i], end=' ')
    print()

if __name__ == '__main__':
    main()


Measured memory_bytes: 65460
n = int(input())
lis = [int(input()) for i in range(n)]

ans = 0
for i in range(n):
    temp, mod = divmod(lis[i], 2)
    ans += temp
    if i < n-1 and lis[i+1] != 0:
        lis[i+1] += mod

print(ans)

Measured memory_bytes: 13020
#include <bits/stdc++.h>
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(2)<<(x)
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define inf std::numeric_limits<int>::max();
#define highest_2_pow(n)  __builtin_clzll((long long)0)- __builtin_clzll((long long)n) - 1
//-----------------------------------------------------------------------------------------------------
#define lli long long int 
#define int long long
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define vi vector<int>
#define vlli vector<long long int>
#define si set<int>
#define slli set<long long int>
#define mt make_tuple
#define mp make_pair
#define eb emplace_back
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll
//---------------------------------------------------
using namespace std;
// GCD and LCM are available
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << endl;
err(++it, args...);
}

void faster(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
#define MAX_W 1e5
void solve(){
    int n,w;
    cin>>n>>w;
    vi wgt(n+1);
    vi val(n+1);
    rep(i,0,n) cin>>wgt[i+1]>>val[i+1];
    vector<vi> dp(n+1,vi(1e5+1,0));
    rep(i,0,MAX_W+1) dp[0][i] = 0;
    rep(i,0,n) dp[i][0] = 0;
    rep(i,1,n+1){
        rep(j,1,w+1){
            dp[i][j] = dp[i-1][j];
            if(wgt[i]<=j)
                dp[i][j] = max(dp[i][j],dp[i-1][j-wgt[i]]+val[i]);
        }
    }
    cout<<dp[n][w]<<endl;

}
signed main()
{
    faster();
    int t=1;
    //cin>>t;
    while(t--) solve();
}

Measured memory_bytes: 83172
#include<stdio.h>
int main(){
  char a[3][3];
  int i=0;
    scanf("%c%c%c\n",&a[0][0],&a[0][1],&a[0][2]);
    scanf("%c%c%c\n",&a[1][0],&a[1][1],&a[1][2]);
    scanf("%c%c%c",&a[2][0],&a[2][1],&a[2][2]);

  printf("%c%c%c\n",a[0][0],a[1][1],a[2][2]);
  return 0;
}


Measured memory_bytes: 128
using System;
using System.Linq;

namespace CSharp
{
    class Program
    {
        static void Main()
        {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var N = input[0];
            var R = input[1];

            if (N >= 10)
            {
                Console.WriteLine($"{R}");
            }
            else
            {
                Console.WriteLine($"{R + 100 * (10 - N)}");
            }
        }
    }
}

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

// input
ll A, B;


void input() {
    cin >> A >> B;
}


ll solve(ll x) {
    ll ret = 0;
    while ((x - 3) % 4 != 0) {
        ret ^= x;
        x--;
    }
    return ret;
}


int main() {
    input();
    ll ans = solve(A - 1) ^ solve(B);
    cout << ans << endl;
}


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

using namespace std;
#define ll long long int
int const mod=1000000007;

int main()
{
    ll n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    ll m=a[0],ans=0;
    for(int i=1;i<n;i++)
    {
        m=max(a[i],m);
        ans=ans+(m-a[i]);
        //cout<<ans<<" ";
    }
    cout<<ans;
}


Measured memory_bytes: 5188
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
	public static void main (String[] args) {
		//code
	Scanner in=new Scanner(System.in);
        int t,k,i=0,j=0,sum=0;
        double m;
        long l=0;
            int n=in.nextInt();
            int a[]=new int[n];
            for(i=0;i<n;i++)
            {
                a[i]=in.nextInt();
                
            }
          i=0;
            while(i<n-1)
            {
               if(a[i]>a[i+1])
               {
                   l+=a[i]-a[i+1];
                  // System.out.println("l="+l);
                   a[i+1]=a[i];
                  // System.out.println("a[i+1]="+a[i+1]);
               }i++;
            }
            System.out.println(l);

               
	}
}

Measured memory_bytes: 60456
#include <bits/stdc++.h>
#define fto(i,a,b) for(int i=a; i<=b;++i)
#define fdto(i,a,b) for(int i=a; i>=b;--i)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define maxn 100009
#define gb(i,j) ((i>>j)&1)
#define name "a"
#define endl '\n'

using namespace std;

int n,m,L,a[100],b[100],c[100];

main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> L;
    --L;
    n=20;
    fto(i,2,n){
        ++m;
        a[m]=i-1;
        b[m]=i;
        c[m]=0;
    }
    int t=log2(L);
    fto(i,0,t-1){
        ++m;
        a[m]=20-i-1;
        b[m]=20-i;
        c[m]=(1<<i);
    }
    int tg=(1<<t);
    for(int i=t-1; i>=0; --i)
    if(gb(L,i)){
        ++m;
        a[m]=1;
        b[m]=20-i;
        c[m]=tg;
        tg+=(1<<i);
    }
    ++m;
    a[m]=1;
    b[m]=20;
    c[m]=tg;
    cout << n <<' '<<m <<endl;
    fto(i,1,m) cout << a[i] << ' '<< b[i] <<' '<< c[i]<<endl;
    return 0;
}


Measured memory_bytes: 384
import sys
import math
import bisect

def solve(a, b):
    if a % 3 == 0:
        return True
    if b % 3 == 0:
        return True
    if (a + b) % 3 == 0:
        return True
    return False

def main():
    a, b = map(int, input().split())
    if solve(a, b):
        print('Possible')
    else:
        print('Impossible')

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <stdio.h>
int main(void)


{
	int a, b, c;
	scanf("%d %d %d", &a,&b,&c);
	if((a<b)&&(b<c))
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 580
fn main() {
	let mut s = String::new();
	use std::io::Read;
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();

	let n: usize = s.next().unwrap().parse().unwrap();
	let k: usize = s.next().unwrap().parse().unwrap();
	let p: Vec<usize> = s
		.by_ref()
		.take(n)
		.map(|a| a.parse::<usize>().unwrap() - 1)
		.collect();
	let c: Vec<i64> = s.by_ref().take(n).map(|a| a.parse().unwrap()).collect();

	let mut uf = UnionFind::new(n);
	for (i, &p) in p.iter().enumerate() {
		uf.unite(i, p);
	}

	let mut calc = |first: usize| {
		let first_pos = p[first];
		let first_score = c[first_pos];
		let cycle = uf.size(first_pos);
		let mut k = k - 1;
		if cycle < k {
			let mut cur = 0;
			let mut pos = first_pos;
			for _ in 0..cycle {
				pos = p[pos];
				cur += c[pos];
			}
			let cycle_score = cur;
			let ans = if cycle_score > 0 {
				let mut cur = cycle_score * (k / cycle) as i64;
				let mut ans = cur;
				k -= k / cycle * cycle;
				let mut pos = first_pos;
				for _ in 0..k {
					pos = p[pos];
					cur += c[pos];
					if ans < cur {
						ans = cur;
					}
				}
				ans
			} else {
				let mut cur = 0;
				let mut pos = first_pos;
				let mut ans = 0;
				for _ in 0..cycle {
					pos = p[pos];
					cur += c[pos];
					if ans < cur {
						ans = cur;
					}
				}
				ans
			};
			ans + first_score
		} else {
			let mut cur = 0;
			let mut pos = first_pos;
			let mut ans = 0;
			for _ in 0..k {
				pos = p[pos];
				cur += c[pos];
				if ans < cur {
					ans = cur;
				}
			}
			ans + first_score
		}
	};

	let mut ans = std::i64::MIN;
	for i in 0..n {
		let r = calc(i);
		if ans < r {
			ans = r;
		}
	}
	println!("{}", ans);
}

pub struct UnionFind {
	data: Vec<i32>,
}

impl UnionFind {
	pub fn new(n: usize) -> UnionFind {
		UnionFind { data: vec![-1; n] }
	}

	pub fn unite(&mut self, x: usize, y: usize) -> bool {
		let x = self.find(x);
		let y = self.find(y);
		if x == y {
			false
		} else {
			let (x, y) = if self.data[x] > self.data[y] {
				(y, x)
			} else {
				(x, y)
			};
			self.data[x] += self.data[y];
			self.data[y] = x as i32;
			true
		}
	}

	pub fn find(&mut self, i: usize) -> usize {
		if self.data[i] < 0 {
			i
		} else {
			let p = self.data[i] as usize;
			self.data[i] = self.find(p) as i32;
			self.data[i] as usize
		}
	}

	pub fn size(&mut self, i: usize) -> usize {
		let i = self.find(i);
		(-self.data[i]) as usize
	}
}


Measured memory_bytes: 2324
import std;

ulong MAX = 100_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "cur", long, "prev");
alias PQueue(T, alias less = "a>b") = BinaryHeap!(Array!T, less);

void main()
{
    long n, k;
    scan(n, k);
    auto next = aryread.map!(x => x - 1).array();
    long[] tele;
    auto reached = new long[](n);
    long cur;
    while (!reached[cur])
    {
        tele ~= cur;
        reached[cur] = true;
        cur = next[cur];
    }
    auto nloops = tele[0 .. tele.countUntil(cur)], loops = tele[tele.countUntil(cur) .. $];
    if (k >= nloops.length)
    {
        k -= nloops.length;
        writeln(loops[k % loops.length] + 1);
    }
    else
    {
        writeln(nloops[k] + 1);
    }
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 15604
#include<iostream>
#include<cmath>
#include<vector>
using namespace std;
bool isPrime(int x)
{
	if (x % 2 == 0)
		return false;
	for (int i = 2; i <= sqrt(x); i++)
		if (x%i == 0)
			return false;
	return true;
}
int main()
{
	int n;
	cin >> n;
	vector<int> res;
	int temp = n;
	if (isPrime(n))
		res.push_back(n);
	else
	{
		for (int i = 2; i <= n; i++)
		{
			while (temp%i == 0)
			{
				res.push_back(i);
				temp /= i;
			}
			if (temp == 1)
				break;
		}
	}
	cout << n << ":";
	for (int i = 0; i < res.size(); i++)
	{
		cout << " ";
		cout << res[i];
	}
	cout << endl;
}


Measured memory_bytes: 3136
#include<bits/stdc++.h>
using namespace std;
const int N_MAX = 21;
const int M_MAX = pow(2,21);
int64_t dp[N_MAX][M_MAX];

int main(){
  int N;
  cin >> N;
  vector<vector<int>> vec(N,vector<int>(N));
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      cin >> vec[i][j];
    }
  }
  
  int64_t MOD = 1e9+7;
  
  for(int i=0; i<N; i++){
    int x = pow(2,i);
    for(int j=0; j<N; j++){
      int y = pow(2,j);
      if(vec[i][j]){
        dp[i][y] = 1;
        if(i != 0){
          for(int k=0; k<M_MAX; k++){
            dp[i][y | k] += dp[i-1][k];
            if(i == N-1){
              dp[i][y | k] %= MOD;
            }
          }
        }
      }
    }
  } 
  
  int M = pow(2,N);
  
  cout << dp[N-1][M-1] << endl;
  
}
    



Measured memory_bytes: 334080
from math import factorial
N, P = map(int, input().split())

A = list(map(lambda x: int(x) % 2, input().split()))

n0 = A.count(0)
n1 = A.count(1)
ans0 = 2 ** n0
ans1 = 0
for i in range(P, n1 + 1, 2):
    ans1 += factorial(n1) // (factorial(i) * factorial(n1 - i))
print(ans0 * ans1)


Measured memory_bytes: 3064
package main

import (
	"fmt"
	"sort"
)

const mod = 1e9 + 7

func main() {
	var n int
	fmt.Scan(&n)
	as := make([]int, n)
	for i := range as {
		fmt.Scan(&as[i])
	}

	sort.Ints(as)
	if n%2 == 1 {
		for i := range as {
			if as[i] != ((i+1)/2)*2 {
				fmt.Println(0)
				return
			}
		}
	} else {
		for i := range as {
			if as[i] != (i/2)*2+1 {
				fmt.Println(0)
				return
			}
		}
	}

	exp := -1
	if n%2 == 1 {
		exp = (n - 1) / 2
	} else {
		exp = n / 2
	}
	ans := 1
	for i := 0; i < exp; i++ {
		ans = (ans * 2) % mod
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5504
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    int a=0;
    if(N==1){
        cout<<4<<endl;
        return 0;
    }
    else if(N==2){
        cout<<4<<endl;
        return 0;
    }
    else if(N==4){
        cout<<4<<endl;
        return 0;
    }
    for(int i=0;i<999999;i++){
        if(N%2==0){
            N=N/2;
        }
        else{
            N=3*N+1;
        }
        if(N==1){
            break;
        }
        a++;
    }
    cout<<a+3<<endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

infants = [[i, A[i]] for i in range(N)]
infants.sort(key=lambda x:x[1], reverse=True)

dp = [[0 for _ in range(N+1)] for _ in range(N+1)]

for x in range(N):
    for y in range(N-x):
        pos, infant = infants[x+y]
        dp[x][y+1] = max(dp[x][y+1], dp[x][y]+infant*abs(N-1-y-pos))
        dp[x+1][y] = max(dp[x+1][y], dp[x][y]+infant*abs(pos-x))

ans = 0
for i in range(N):
    ans = max(ans, dp[i][N-i])
print(ans)

Measured memory_bytes: 102108
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<vector>
#include<ctime>
#define ll long long
#define pr(x) cerr<<#x<<"="<<x<<endl
using namespace std;
#define N 2010000
struct node
{
	ll to,next;
}e[N*3];
ll size,o,p,vis[N],tag[N],g[N],f,n,m,i,du[N],I,P,Q;
void add(ll o,ll p)
{
	e[++size].to=p;
	e[size].next=g[o];
	g[o]=size;
}
void dfs(ll x)
{
	vis[x]=1;
	for (ll k=g[x];k;k=e[k].next)
	{
		ll y=e[k].to;
		{
			if (vis[y]==0)
			{
				tag[y]=tag[x]^1;
				dfs(y);
			}
			else
			{
				if (tag[x]==tag[y]) f=0;
			}
		}
	}
}
int main()
{
	scanf("%lld %lld",&n,&m);
	for (i=1;i<=m;i++)
	{
		scanf("%lld %lld",&o,&p);
		add(o,p);
		add(p,o);
		du[o]++;du[p]++;
	}
	for (i=1;i<=n;i++)
	{
		if (vis[i]==1) continue;
		if (du[i]==0)
		{
			I++;
			continue;
		}
		f=1;
		dfs(i);
		if (f==1) Q++;
		else P++;
	}
	//pr(I);
	//pr(P);
	//pr(Q);
	ll ans=2*I*n-I*I+P*P+2*P*Q+2*Q*Q;
	printf("%lld\n",ans);
	return 0;
}

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

using namespace std;
int main()
{
    int a,b,c,d,e,f,g,h,i,j,k,l,m,n,t,x,y,z;
    
    cin>>n>>a>>b;
    
    x=max(a,b);
    
    y=min(a,b);
    
    z=x-y;
    

    if(z%2==0)
    {
        cout<<"Alice"<<endl;
    }
    else
        cout<<"Borys"<<endl;
        
}

Measured memory_bytes: 3584
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
using namespace std;
char s[200010];
int l,a[30];
int main()
{
	scanf("%s",&s);
	l=strlen(s);
	for (int i=0;i<l;i++)
	{
		a[s[i]-'a']++;
	}
	long long ans=1;
	for (int i=0;i<l;i++)
	{
		ans+=(long long)(l-i-a[s[i]-'a']);
		a[s[i]-'a']--;
	}
	printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
/*-----------------------*/
#define FAST        ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
#define endl        "\n"
#define ff          first
#define ss          second
#define cc(x)       cout<<#x<<"="<<x<<" ";
#define CC(x)       for(auto xx: x) cout<<xx<<" ";
#define ee          cout<<"\n";
#define ll          long long
#define ull         unsigned long long
#define pii         pair<int,int>
#define mp          make_pair
#define all(x)      x.begin(),x.end()
#define ps(x)       push(x)
#define psb(x)      push_back(x)
#define psf(x)      push_front(x)
#define pp          pop()
#define ppb         pop_back()
#define ppf         pop_front()
#define OK          cout<<"Ok"<<"\n";
#define TESTS       ll test;cin>>test;for(ll   tcase=1;tcase<=test;tcase++)
/*------------------------*/
#define MAX int(1e6)
    string s;
bool is_ok(int ss,int e)
{
    int cnt=(e-ss+1)/2;
    for(int i=ss,j=e;cnt--;i++,j--)
    {
        if(s[i]!=s[j]) return 0;
    }
    return 1;
}
int main()
{
    FAST
    ll n;
    cout.precision(12);cout<<fixed;
    cin>>n;
    double x= (double)n/3.0;
    cout<<x*x*x<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long int Int;
#define REP(i, j) for(Int i = 0; i < (Int)(j); ++i)
#define FOR(i, j, k) for(Int i = (Int)(j); i < (Int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef pair<Int, Int> P;
const Int D = 10;

Int getLen(Int n){
  Int len = 0, d = 0, m = 1;
  while(m <= n){
    ++d;
    Int l = min(10 * m - 1, n), a = l / 3 - (m - 1) / 3, b = l / 5 - (m - 1) / 5, c = l / 15 - (m - 1) / 15;
    len += (a + b) * 4 + (l - (m - 1) - a - b + c) * d;
    m *= 10;
  }
  return len;
}

string solve(Int N){
  Int l = 0, r = N;
  while(r - l > 1){
    Int m = (l + r) / 2;
    if(getLen(m) >= N) r = m;
    else l = m;
  }
  stringstream ss;
  FOR(i, r, r + 20) {
    if(i % 3 && i % 5) ss <<i;
    if(i % 3 == 0) ss <<"Fizz";
    if(i % 5 == 0) ss <<"Buzz";
  }
  return ss.str().substr(N - getLen(l) - 1, 20);
}

int main(){
  Int N; cin >>N;
  cout <<solve(N) <<endl;
  return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
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; }

int main() {
  int H, W, D;
  cin >> H >> W >> D;
  int A[H][W];
  REP(i, H) REP(j, W) cin >> A[i][j];
  pair<int, int> route[H*W];
  REP(i, H) {
    REP(j, W) {
      route[A[i][j] - 1] = make_pair(i, j);
    }
  }
  int cost[H*W*3];
  REP(i, D) cost[i] = 0;
  for (int i = D; i < H*W; i++) {
    cost[i] = abs(route[i].first - route[i-D].first) + abs(route[i].second - route[i-D].second);
  }
  REP(i, H*W) {
    cost[i+D] += cost[i];
  }



  int Q;
  cin >> Q;
  REP(i, Q) {
    int L, R;
    cin >> L >> R;
    cout << cost[R-1] - cost[L-1] << endl;
  }

  return 0;
}

Measured memory_bytes: 2560
h,w = map(int,input().split())
s = [[''for i in range(w+2)]for j in range(h+2)]
for i in range(h):
    s[i+1][1:w+1] = input()
for i in range(h):
    for j in range(w):
        if s[i+1][j+1] == '.' :
            s[i+1][j+1] = str(1*(sum(s[k+i][j:j+3].count('#')for k in range(3))))
    print(*s[i+1][1:w+1],sep='')
    

Measured memory_bytes: 3572
#include<iostream>

using namespace std;

int main()
{
    long long a, b, c;
    long long x, y, z;
    cin >> a;
    cin >> b;
    cin >> c;

    x = (a)/c;
//
//    if(a >= 1)
//        x = (a-1)/c;
//    else
//        x = ((a)/c);
     y = b/c;
//     z = y - x;

     if(a%c == 0)
        z = (y-x)+1;
     else
        z = y - x;

    cout << z << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,x;
	scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
	if(a<0){
		x=(a*-1*c)+d+(b*e);
	}
	if(a>0){
		x=(b-a)*e;
	}
	printf("%d\n",x);
	return 0;
}

Measured memory_bytes: 2696
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();

		int firstIndex = s.indexOf('A');
		int lastIndex = s.lastIndexOf('Z');

		int result = lastIndex - firstIndex +1;
		System.out.println(result);

	}

}


Measured memory_bytes: 28228
#include <cstdio>

int main(){
	int b,r,g,c,s,t,score;
	while(scanf("%d%d%d%d%d%d",&b,&r,&g,&c,&s,&t),b|r|g|c|s|t != 0){
		score = 100;
		score += b*(15+13*5);
		score += r*(15+13*3);
		score += g*7;
		score += c*2;
		score += s*3;
		score -= (t-b*5-r*3)*3;
		printf("%d\n",score);
	}

	return 0;
}

Measured memory_bytes: 2612
S = input()[::-1]
N = len(S)
l = [0]*2019
l[0] = 1
n = 0
d = 1

for i in range(N):
    n += int(S[i]) * d
    r = n % 2019
    l[r] += 1
    d = 10*d % 2019
    
out = 0    
for m in l:
    out += (m*(m-1))//2 
print(out)

Measured memory_bytes: 9336
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}
		int x = 1000;
		int c = 0;
		BigInteger X = new BigInteger("1000");
		BigInteger C = BigInteger.ZERO;
		for (int i = 0; i < N - 1; i++) {
			if (A[i] < A[i + 1] && X.divide(new BigInteger(Integer.toString(A[i]))).compareTo(BigInteger.ZERO) == 1) {
				C = X.divide(new BigInteger(Integer.toString(A[i])));
				X = X.subtract(C.multiply(new BigInteger(Integer.toString(A[i]))));
			} else if (A[i] > A[i + 1] && C.compareTo(BigInteger.ZERO) == 1) {
				X = X.add(C.multiply(new BigInteger(Integer.toString(A[i]))));
				C = BigInteger.ZERO;
			}
		}
		if (C.compareTo(BigInteger.ZERO) == 1) {
			X = X.add(C.multiply(new BigInteger(Integer.toString(A[N - 1]))));
			C = BigInteger.ZERO;
		}
		System.out.println(X);
	}

}

Measured memory_bytes: 35996
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<ll, ll> P;


int main(){
    string s, t, u;
    int a, b;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;
    if(s == u){
        a--;
    }
    if(t == u){
        b--;
    }

    cout << a << " " << b << endl;

    return 0;
}


Measured memory_bytes: 384
import scala.io.StdIn.{readInt, readLine}
import scala.collection.mutable
import scala.collection.immutable.{ListMap, SortedSet}

object Main extends App {

  val n     = readInt()
  val lines = Iterator.fill(n)(readLine())

  val cards = {
    val nums  = 1 to 13
    val cards = ListMap(
      "S" -> mutable.Set(nums: _*),
      "H" -> mutable.Set(nums: _*),
      "C" -> mutable.Set(nums: _*),
      "D" -> mutable.Set(nums: _*)
    )

    for {
      line          <- lines
      Array(suit, x) = line.split(" ")
    } {
      cards(suit) -= x.toInt
    }

    cards
  }

  for {
    (suit, xs) <- cards
    x          <- xs.to[SortedSet]
  } {
    println(s"$suit $x")
  }
}



Measured memory_bytes: 44252
while True:
    H,W = map(int,input().split())
    if H > 0 and W > 0:
        def check(h,w):
            if (h+w)%2 == 0:
                return'#'
            return'.'
        for h in range(H):
            for w in range(W):
                print(check(h,w),end='')
            print()
        print()
    
    if H == W == 0:
        break


Measured memory_bytes: 7004
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
 
using namespace std;
 
int main() {
	// 入力
    int A, B;
    cin >> A >> B;
 
    if (A<=8 && B<=8) cout << "Yay!";
    else cout << ":(";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  cin >>a;
  string as,eve;
  as = "Christmas";
  eve = " Eve";
  
  if (a == 25){
    cout << as << endl;
  }
  else if(a==24){
    cout << as + eve <<endl;
  }
  else if (a==23){
    cout << as + eve + eve<<endl;
  }
  else{
    cout << as + eve + eve + eve <<endl;
  }
}

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

int n, a[200000];

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i] = a[i] - i - 1;
	}
	sort(a, a + n);
	int b = a[n / 2];
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		ans += abs(a[i] - b);
	}
	cout << ans << endl;
	return 0;
}

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

int n;
long long ans;
long long num[25][25];
int main()
{
	int i,j;
	scanf("%d",&n);
	while(n--)
	{
		double t;
		scanf("%lf",&t);
		long long a=t*double(1e9)+0.5;
		int n2=1,n5=1;
		while(a%2==0)
		{
			a/=2;
			n2++;
		}
		while(a%5==0)
		{
			a/=5;
			n5++;
		}
		n2=min(19,n2);
		n5=min(19,n5);
		for(i=20-n2;i<=19;i++)
			for(j=20-n5;j<=19;j++)
				ans+=num[i][j];
		num[n2][n5]++;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 3816