akhauriyash/Code-Regression huggingface dataset:
//omajinai c++ atcoder
#include <iostream> 
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<cmath>
#include<iomanip>
#include<type_traits>
//#include<numbers>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define itn int
#define yes() printf("Yes\n")
#define no() printf("No\n")
typedef long long ll;
constexpr auto mod = 1000000007;
using namespace std;

int main() {


    long double pi=3.141592653589793;
    double r;
    cin>>r;
    cout<<2*pi*r;
}

Measured memory_bytes: 3784
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <string>
#include <math.h>
#include <vector>
#include <cstdlib>
#include <queue>
#include <iomanip> //小数点以下を表示させる(setprecision())

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n';

typedef long long ll;

using namespace std;

int main()
{

    int W, H, x, y;
    cin >> W >> H >> x >> y;

    int same = 0;
    if (2 * x == W && 2 * y == H)
    {
        same = 1;
    }
    double ans = 1.*H * W / 2;

    cout << fixed;
    cout << setprecision(8) << ans << ' ';
    cout << same << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#define INF 999999999
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
/*---------------------------------------------------*/

int m,n;

void solve(){
  int p=0;
  vector<bool> x(7368792,0);
  for(int i=m;i<=7368792;i++){
    if(!x[i]){
      p++;
      if(p==n+1){printf("%d\n",i);return;}
      for(int j=i+i;j<=7368792;j+=i)x[j]=true;
    }
  }
}

int main(){
  while(scanf("%d%d",&m,&n)){
    if(m==0&&n==0)break;
    if(m>=n){printf("%d\n",m+n);continue;}
    solve();
  }
  return 0;
}

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

string s,p,n;
int ans;

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	
	cin>>s;
	for(int i=0;i<(int)s.size();i++)
	{
		n+=s[i];
		if(n!=p)
		{
			ans++;
			p=n;n="";
		}
	}
	cout<<ans;
	
	return 0;
}

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

int main(){
  int h,w;
  
  while(1){
    cin >> h >> w;
    if(h==0 && w==0) break;
    
    for(int i=0;i<h;i++){
      if(i==0) {
	for(int j=0;j<w;j++)
	  if(j==w-1) cout << "#" << endl;
	  else cout << "#";
      }
      else if(i==h-1){
	for(int j=0;j<w;j++)
	if(j==w-1) cout << "#" << endl;  
	else cout << "#";
      }
      else{
	for(int j=0;j<w;j++){
	  if(j==0) cout << "#";
	  else if(j==w-1) cout << "#" << endl;
	  else cout << ".";
	}
      }
    }
    cout << endl;
  }
  return 0;
}

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

using namespace std;

#define boost ios::sync_with_stdio(0);cin.tie(0);
#define forn(i,n) for ( int i=0 ; i < n ; i++ )
#define all(a) (a).begin(), (a).end()
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define ll long long
#define endl '\n'
#define mod 1000000007

#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}

int main()
{
	//freopen ("f.in","r",stdin);
 	//freopen ("f.out","w",stdout);
	boost
	//code
	int n,a,b;
	cin >> n >> a >> b;
	cout << min(a,b) << " " << max(0,a+b-n) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
const int INT_INF = 1001001001;
//stoi(s) : string→int stoll(s) :string→longlong
const double PI=3.14159265358979323846;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int dp[1000010];

int main(){
    int n;
    cin >> n;
    for(int i=0;i<1000010;i++){
        dp[i] = INT_INF;
    }
    dp[0] = 0;
    dp[1] = 1;
    for(int i=0;i<=n;i++){
        chmin(dp[i+1],dp[i] + 1);
        for(int j=1;j<=7;j++){
            int q = i + pow(6,j);
            chmin(dp[q],dp[i] + 1 );
        }
        for(int j=1;j<=6;j++){
            int q = i + pow(9,j);
            chmin(dp[q],dp[i] + 1);
        }
    }
    cout << dp[n] << endl;
}

Measured memory_bytes: 4096
using System;
using System.Text;

namespace AtCoder.Problems
{
    /// <summary>
    /// ABC 045 C - たくさんの数式
    /// </summary>
    /// <remarks>
    /// https://atcoder.jp/contests/arc061/tasks/arc061_a
    /// </remarks>
    public class ProblemD
    {
        public static void Main(string[] args)
        {
            var s = new SolveD();
            s.Solve();
        }

        public class Scanner
        {
            private string[] _s;
            private int _i;
            private readonly char[] _separators = new char[] { ' ' };

            public Scanner()
            {
                _s = new string[0];
                _i = 0;
            }

            public string Next()
            {
                if (_i < _s.Length) return _s[_i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();
                _s = st.Split(_separators, StringSplitOptions.RemoveEmptyEntries);
                if (_s.Length == 0) return Next();
                _i = 0;
                return _s[_i++];
            }

            public int NextInt() => int.Parse(Next());
            public long NextLong() => long.Parse(Next());
            public ulong NextULong() => ulong.Parse(Next());
            public double NextDouble() => double.Parse(Next());

            public int[] GetIntArray(int n, int add = 0)
            {
                int[] array = new int[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = NextInt() + add;
                }
                return array;
            }

            public long[] GetLongArray(int n, long add = 0)
            {
                long[] array = new long[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = NextLong() + add;
                }
                return array;
            }

            public double[] GetDoubleArray(int n, double add = 0)
            {
                double[] array = new double[n];
                for (int i = 0; i < n; i++)
                {
                    array[i] = NextDouble() + add;
                }
                return array;
            }
        }
    }

    public class SolveD
    {
        public void Solve()
        {
            var cin = new ProblemD.Scanner();
            var s = cin.Next();

            var result = GetAnswer(s);
            Console.WriteLine(result);
        }

        public long GetAnswer(string s)
        {
            var sb = new StringBuilder();
            var answer = 0L;

            Action add = () =>
            {
                answer += long.Parse(sb.ToString());
                sb.Clear();
            };

            for (uint bit = 0; bit < 1 << (s.Length - 1); bit++)
            {
                for (int i = 0; i < s.Length; i++)
                {
                    sb.Append(s[i]);
                    if ((bit & (1 << i)) != 0) { add(); }
                }
                add();
            }
            return answer;
        }
    }
}


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

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

    if (k % 2 == 0)
        cout << (k / 2) * (k / 2) << endl;
    else
        cout << ((k / 2) * ((k + 1) / 2)) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<double,double> pdd;
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) ll(i.size())
#define FOR(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (ll i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef tmd
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
// const ll MAXN = 

ll k , a , b , ans;
/********** Good Luck :) **********/
int main()
{
    IOS();
    cin >> k >> a >> b;
    ll tk = k;
    if (k >= a - 1) {
        k -= a - 1;
        ans += a;
        ans += (k / 2) * (b - a);
        ans += k & 1;
    }

    debug(ans);

    cout << max(ans,tk+1) << endl;
    return 0;
}


Measured memory_bytes: 256
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

#include<bits/stdc++.h>
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/detail/standard_policies.hpp>*/

#define sz(s) (int)(s.size())
#define all(s) s.begin(), s.end()
#define rep(a, b, c) for(int a = b; a <= c; ++a)
#define per(a, b, c) for(int a = b; a >= c; --a)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;
//using namespace __gnu_pbds;

typedef unsigned long long ull;
typedef long long ll;
/*typedef tree<pair<int, int>, 
null_type, less<pair<int, int>>, 
rb_tree_tag, tree_order_statistics_node_update>
ordered_set;*/
//find_by_order() order_of_key()

const double eps = 1e-7;
const int mod = 1e9+7, MXN = 5e5+17;
const int dx[] = {0,0,1,-1}, dy[] = {1,-1,0,0};

template<typename T>inline bool updmin(T &a, const T &b) {return a > b ? a = b,1 : 0;}
template<typename T>inline bool updmax(T &a, const T &b) {return a < b ? a = b,1 : 0;}

int32_t main() { _
#ifdef DanQQQQQ
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
#endif
	double a, b, h; cin >> a >> b >> h;
	cout << setprecision(6) << (a+b)*h/2.0;
	return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ in >> p.first >> p.second; return in; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
template <char d = ' ', class T>
ostream& operator << (ostream& out, vector<T>& v){ for(auto& e : v){ out << e << d; } return out; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> v(3); cin >> v;
    int k; cin >> k;
    sort(v.begin(), v.end());
    cout << v[0] + v[1] + (v[2] << k) << '\n';
}


Measured memory_bytes: 256
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>

#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>

#include <cmath>
#include <numeric>
#include <random>
#include <cstring>
#include <cassert>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

// type
#include <cstdint>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

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

    vector<int> B;
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        cnt++;
        if (i == N-1 || A[i] == A[i+1]) {
            B.push_back(cnt);
            cnt = 0;
        }
    }

    int M = B.size();
    if (M < 3) {
        cout << N << endl;
        return 0;
    }

    int mx = -1;
    for (int i = 0; i < M-2; i++) {
        mx = max(mx, B[i] + B[i+1] + B[i+2]);
    }

    cout << mx << endl;
}


Measured memory_bytes: 4224
//compiledef
#include <bits/stdc++.h>
#define rep(i, n) for(i=0;i<(n);i++)
#define per(i, n) for(i=(n);i>0;i--)
#define repx(i, n, x) for(i=(x);i<(n);i++)
#define xper(i, n, x) for(i=(n);i>(x);i--)
#define pback push_back

//c++def
using namespace std;
typedef long long int ll;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const int NN = -1;
typedef struct{
	int parent;
	int left;
	int right;
	int depth;
	int height;
}node;
node u[25000];
void checkdepth(int nd, int dp){
	if(nd == NN) return;
	u[nd].depth = dp;
	checkdepth(u[nd].left, dp+1);
	checkdepth(u[nd].right, dp+1);
}

int checkheight(int nd){
	int h1 = 0;
	int h2 = 0;
	if(u[nd].right != NN) h1 = checkheight(u[nd].right)+1;
	if(u[nd].left  != NN) h2 = checkheight(u[nd].left)+1;
	return u[nd].height = max(h1, h2);
}

int getsib(int c){
	if(u[c].parent == NN) return NN;
	if(u[u[c].parent].left == c && u[u[c].parent].right != NN) return u[u[c].parent].right;
	if(u[u[c].parent].right == c && u[u[c].parent].left != NN) return u[u[c].parent].left;
	return NN;
}
void preorder(int x){
	if(x == NN) return;
	printf(" %d", x);
	preorder(u[x].left);
	preorder(u[x].right);
}
void inorder(int x){
	if(x == NN) return;
	inorder(u[x].left);
	printf(" %d", x);
	inorder(u[x].right);
}
void posorder(int x){
	if(x == NN) return;
	posorder(u[x].left);
	posorder(u[x].right);
	printf(" %d", x);
}
int main(){
	int n, x, i, l, r;
	int root = 0;
	cin >> n;
	rep(i, n){
		u[i].parent=NN;
	}
	rep(i, n){
		scanf("%d %d %d", &x, &l, &r);
		u[x].left = l;
		u[x].right = r;
		if(l != NN) u[l].parent = x;
		if(r != NN) u[r].parent = x;
	}
	rep(i, n)if(u[i].parent == NN) root = i;
	cout << "Preorder" <<endl;
	preorder(root);
	cout <<endl;
	cout <<"Inorder" << endl;
	inorder(root);
	cout << endl;
	cout <<"Postorder" << endl;
	posorder(root);
	cout << endl;
}










Measured memory_bytes: 3236
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#include <deque>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

deque<int> a;

int main()
{
	int n;
	ll ans=0;
	
	cin>>n;
	for(int i=0;i<n;i++)
	{
		int b;
		cin>>b;
		a.push_back(b);
	}
	while(!a.empty())
	{
		ans++;
		if(a.size()>1)
		{
			while(a[0]==a[1] && a.size()>1)
				a.pop_front();
			if(a.size()==1)
				break;
			if(a[0]<a[1])
			{
				while(a[0]<=a[1])
				{
					a.pop_front();
					if(a.size()==1)
					{
						break;
					}
				}
			}else if(a[0]>a[1]){
				while(a[0]>=a[1])
				{
					a.pop_front();
					if(a.size()==1)
					{
						break;
					}
				}
			}
			a.pop_front();
		}else{
			a.pop_front();
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
Scanf.scanf "%s" (fun s ->
    let n = String.length s in
    let rec loop i acc =
        if i = n then acc < 8 else
            loop (i + 1) (acc + if s.[i] = 'x' then 1 else 0)
    in
    print_endline @@ if loop 0 0 then "YES" else "NO"
)

Measured memory_bytes: 3688
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Integer N = sc.nextInt();
        Integer Q = sc.nextInt();
        String S = sc.next();

        Integer[] l = new Integer[Q], r = new Integer[Q];
        for(int i = 0; i < Q; i++){
            l[i] = sc.nextInt();
            r[i] = sc.nextInt();
        }

        int[] a = new int[N];
        int count = 0;
        for(int i = 1; i < N; i++){
            if(S.charAt(i-1) == 'A' && S.charAt(i) == 'C'){
                count++;
                a[i] = count;
            } else {
                a[i] = count;
            }
        }

        for(int i = 0; i < Q; i++){
            System.out.println(a[r[i]-1] - a[l[i]-1]);
        }

    }
}

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

signed main(){
  string A,B,C;
  cin>>A>>B>>C;
  if(A[A.size()-1]==B[0]&&B[B.size()-1]==C[0])cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}

Measured memory_bytes: 3596
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rep3(var, min, max) for (ll (var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll (var) = (max) - 1; (var) + 1 > (min); --(var))
#define Mp(a,b) make_pair((a),(b))
#define F first
#define S second
#define Icin(s) ll (s);cin>>(s);
#define Scin(s) ll (s);cin>>(s);
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll MOD = 1e9 + 7;
ll INF =1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    V vec(n);
    ll a=0;
    rep(i,n){
        ll x;cin>>x;
        a^=x;
    }
    if(a==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


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

vector<ll>divisor(ll n){
	vector<ll>res;
	for(ll i=1;i*i<=n;i++){
		if(n%i==0){
			res.push_back(i);
			if(i!=n/i)res.push_back(n/i);
		}
	}
	return res;
}

int a[600];

int main(){
	int n,K;cin>>n>>K;
	int sum=0;
	rep(i,n){
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	auto v=divisor(sum);
	int Max=0;
	for(int m:v){
		int cnt=0;
		rep(i,n){
			cnt+=a[i]%m;
		}
		if(cnt%m)continue;
		ll A=0;
		sort(a,a+n,[&](int b,int c){return b%m>c%m;});
		rep(i,min(n,cnt/m)){
			A+=m-a[i]%m;
		}
		A+=max(0,cnt/m-n)*m;
		if(A<=K)Max=max(Max,m);
	}
	cout<<Max<<endl;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int h, w, a[500][500];
vector<array<int, 4>> v;

int main() {
	cin >> h >> w;
	inc(i, h) {
	inc(j, w) {
		cin >> a[i][j];
	}
	}
	
	inc(i, h) {
		if(i % 2 == 0) {
			inc(j, w) {
				if(a[i][j] % 2 == 1) {
					if(i == h - 1 && j == w - 1) { break; }
					
					int ii, jj;
					if(j < w - 1) { ii = i; jj = j + 1; } else { ii = i + 1; jj = j; }
					
					v.PB({ i, j, ii, jj });
					a[i][j]--;
					a[ii][jj]++;
				}
			}
		} else {
			dec(j, w) {
				if(a[i][j] % 2 == 1) {
					if(i == h - 1 && j == 0) { break; }
					
					int ii, jj;
					if(j > 0) { ii = i; jj = j - 1; } else { ii = i + 1; jj = j; }
					
					v.PB({ i, j, ii, jj });
					a[i][j]--;
					a[ii][jj]++;
				}
			}
		}
	}
	/*
	inc(i, h) {
	inc(j, w) {
		cout << a[i][j] << " ";
	} cout << endl;
	} cout << endl;
	*/
	cout << v.size() << "\n";
	inc(i, v.size()) {
		inc(j, 4) { cout << (j == 0 ? "" : " ") << v[i][j] + 1; } cout << "\n";
	}
	
	return 0;
}


Measured memory_bytes: 5104
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 0
constexpr int kMod = 1000000007;
typedef long long LL;

std::vector<std::vector<int>> edges;

int dfs(int v, std::set<int> visited) {
  visited.insert(v);
  if (visited.size() == edges.size() - 1) return 1;

#if DEBUG
  std::cout << v << ":";
  for (int x : edges[v]) {
    if (visited.count(x)) continue;
    std::cout << x << " ";
  }
  std::cout << std::endl;
#endif

  int sum = 0;
  for (int x : edges[v]) {
    if (visited.count(x)) continue;
    sum += dfs(x, visited);
  }
  return sum;
}

int main() {
  int N, M; std::cin >> N >> M;
  edges = std::vector<std::vector<int>>(N+1);

  for (int m = 0; m < M; ++m) {
    int a, b; std::cin >> a >> b;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }

  std::set<int> visited;
  std::cout << dfs(1, visited) << std::endl;
}


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

int main() {
	int a;
	while (cin >> a, a) {
		int A = 0, B = 0;
		for (int b = 0; b < a; b++) {
			int c, d;
			cin >> c >> d;
			if (c > d)A += c + d;
			else if (c < d)B += c + d;
			else { A += c; B += d; }
		}
		cout << A << " " << B << endl;
	}
}

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

#define FOR(i, a, b) for(int i = a; i < b; i ++)
#define FORN(i, a, b) for(int i = a; i <= b; i ++)
#define FORD(i, a, b) for(int i = a-1; i >= b; i --)
#define FORE(i, b) for(auto &i:b)
#define REP(i, b) FOR(i, 0, b)
#define REPN(i, b) FORN(i, 0, b)
#define SQ(i) (i*i)
#define ALL(a) a.begin(), a.end()
#define ALLA(a,n) a, a+n
#define SORT(a) sort(ALL(a))
#define SORTA(a, n) sort(ALLA(a, n))
#define REV(a) reverse(ALL(a))
#define REVA(a, n) reverse(ALLA(a, n))
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define IN(a, b) (a.find(b) != a.end())
#define BACK(a) a.back(); a.RB()
#define QBACK(a) a.top(); a.pop()
#define PRINT(a) FORE(i, a) cout << i << " "; cout << endl

#define PB  push_back
#define RB  pop_back
#define RF  pop_front
#define INS insert
#define F   first
#define S   second
#define UM  unordered_map
#define US  unordered_set
#define PQ  priority_queue

#define IO ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<ll,ll> pll;
typedef queue<int> qi;
typedef queue<double> qd;
typedef queue<ll> qll;
typedef US<int> si;
typedef US<double> sd;
typedef US<ll> sll;
typedef vector<vi> mi;
typedef vector<vd> md;
typedef vector<vll> mll;
typedef vector<pi> vpi;
typedef vector<pd> vpd;
typedef vector<pll> vpll;

int main(){
  IO; int N, t; cin >> N; si s;
  REP(i, N){ cin >> t; s.INS(t); }
  cout << (s.size() == N ? "YES" : "NO");
}


Measured memory_bytes: 8520
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int n,a[200005],ans[200005];
int main(void){
	cin>>n;
	for(int i=0;i<n-1;i++){
		cin>>a[i];
		ans[a[i]]++;
	}
	for(int i=1;i<=n;i++){
		cout<<ans[i]<<endl;
	}
	
}


Measured memory_bytes: 5156
#include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int p, j;
    while(cin >> p){
        int inp;
        rep(i, 2){
            cin >> inp;
            if(p > inp) p = inp;
        }
        cin >> j >> inp;
        j = min(j ,inp);
        cout << p + j - 50<< endl;
    }
}

Measured memory_bytes: 1160
N = int(input())

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

dp = [0] * N
dp[0] = 1000

for i in range(1, N):
    dp[i] = dp[i - 1]
    t = dp[i - 1] + (A[i] - A[i - 1]) * (dp[i - 1] // A[i - 1])
    dp[i] = max(dp[i], t)

print(dp[-1])


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

using namespace std;

int main() {
  char c;
  cin >> c;
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
    cout << "vowel";
  } else {
    cout << "consonant";
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define light ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define pb push_back
#define all(c) c.begin(),c.end()
#define PI 3.14159265358979323846
const ll MAX = 1e4+10;
const ll INF = 1e18;
const ll MOD = 1e9+7;

vector<int> digits;
int d,n;
int dp[MAX][110][2];

ll digitdp(int pos,int sum,int flag)
{
    if(pos==n)
    {
        if(sum==0)
            return 1;
        return 0;
    }
    if(dp[pos][sum][flag]!=-1)
        return dp[pos][sum][flag];
    int limit = (flag==1)?digits[pos]:9;
    ll tot = 0;
    for(int i=0;i<=limit;i++)
    {
        if(digits[pos]==i)
            tot=(tot+digitdp(pos+1,(sum+i)%d,flag))%MOD;
        else
            tot=(tot+digitdp(pos+1,(sum+i)%d,0))%MOD;
    }
        return dp[pos][sum][flag] = tot;
}

int main()
{
    memset(dp,-1,sizeof(dp));
    int i,j,l;
    string k;
    cin >> k >> d;
    l = k.length();
    for(i=0;i<l;i++)
        digits.pb(k[i]-'0');
    n = digits.size();
    ll ans = (digitdp(0,0,1)-1+MOD)%MOD;
    cout << ans;
}

Measured memory_bytes: 13116
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
#include <vector>
#include <utility>
#include <climits>
#include <numeric>
#define ll long long
#define INF INT_MAX 
using namespace std;
int main(){
    int N;
    cin >> N;
    string a,b,c;
    cin >> a >> b >> c;
    int ab=0,bc=0,ca=0;
    for(int i=0;i<N;i++){
        if(a[i]!=b[i]&&b[i]!=c[i]&&c[i]!=a[i]){
            ab+=2;
        }else if(a[i]==b[i]&&b[i]==c[i]){
        }else{
            ab++;
        }
    }
       cout << ab << endl;
}

Measured memory_bytes: 256
import sys
import math
#a,b= map(int,input().split())
#li= [int(x) for x in input().split()]
a=input()
b=len(a)
e=[]
count=0
if b%2==0:
  c=a[math.floor(b/2):]
  f=int(b/2)
  f+=1
else:
  b+=1
  c=a[math.floor(b/2):]
  f=int(b/2)
e = list(reversed(c))
d=list(a)
#print(str(d)+"  "+str(e))
for i in range(f-1):
  if d[i]==e[i]:
    continue
  else:
    count+=1
print(count)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main () {
  int N;
  cin >> N;
  char domino[100][100];
  for (int j = 0; j < 2; j ++) {
    for (int i = 0; i < N; i ++) {
      cin >> domino[j][i];
    }
  }
  ll mod = 1e9 + 7;
  ll dp[100];
  bool same = domino[0][0] == domino[1][0];
  if (same) dp[1] = 3;
  else dp[1] = 6;
  for (int i = 1; i < N; i ++) {
    if (!same) {
      dp[i + 1] = dp[i];
      i ++;
    }
    int p = i + 1;
    if (same) {
      dp[p] = dp[i] * 2;
    }
    else {
      if (domino[0][i] == domino[1][i]) {
        dp[p] = dp[i];
      }
      else {
        dp[p] = dp[i] * 3;
      }
    }
    same = domino[0][i] == domino[1][i];
    dp[p] %= mod;
  }
  cout << dp[N] << endl;
}


Measured memory_bytes: 3644
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <math.h>
#include <unordered_map>
#include <algorithm>

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
inline int gcd(int a,int b){return b?gcd(b,a%b):a;}
inline int lcm(int a,int b){return a*b/gcd(a,b);}
typedef long long ll;
typedef std::vector<int> VI;
typedef std::pair<int, int> PII;

using namespace std;

int main()
{
  int N;
  cin >> N;
  int n = N;
  int count = 0;
  for (int i=1;i<=N;i++)
  {
    if (i==10) {
      i=99;
      continue;
    } else if (i==1000) {
      i = 9999;
      continue;
    } else if (i==100000) break;
    count++;
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
e = [[int(i) for i in input().split()] for i in range(N)]
mar=e[0][0]
mmv=e[0][1]
for i in range(N):
    if e[i][0] > mar:
        mar =e[i][0]
        mmv=e[i][1]
print(mar+mmv)


Measured memory_bytes: 21168
s = list(input())
ls = list("abcdefghijklmnopqrstuvwxyz")
m_cnt = 10 ** 9
for t in ls:
    if t in s:
        ss = s.copy()
        cnt = 0
        while True:
            sss = [""] * (len(ss) - 1)
            b = True
            for i in range(len(sss)):
                if ss[i] == t or ss[i+1] == t:
                    sss[i] = t
                else:
                    sss[i] = ss[i]
                    b = False
            if b:
                m_cnt = min(m_cnt, cnt if cnt == 0 else cnt + 1)
                break
            else:
                ss = sss.copy()
                cnt += 1
print(m_cnt)


Measured memory_bytes: 3064
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random

# List of ints
def LI(): return list(map(int, sys.stdin.readline().split()))

# Single int
def I(): return int(sys.stdin.readline())

# List, which contains Lists of chars (not strings)
def LS():return list(map(list, sys.stdin.readline().split()))

# Single List of chars (not strings)
def S(): return list(sys.stdin.readline())[:-1]

# List of "n" integers from "n" lines.
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
# List of "n" Lists of integers
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l


# Runtime Complexity: O(?)
# Space Complexity: O(?)
# Solution
s = sys.stdin.readline().split()[0]
lines_count = I()

chars = deque(s)

def prepend(chars, ch):
    chars.appendleft(ch)

def append(chars, ch):
    chars.append(ch)

actions = {
    1: prepend,
    2: append
}

for i in range(lines_count):
    line = LS()

    if len(line) == 1:
        actions[1], actions[2] = actions[2], actions[1]
    else:
        if line[1][0] == '1':
            actions[1](chars, line[2][0])
        else:
            actions[2](chars, line[2][0])

chars = list(chars)
if actions[1] == append:
    chars.reverse()

print(''.join(chars))

Measured memory_bytes: 9204
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}

//            0  1  2  3  4  5  6  7  8  9
ll match[] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
ll dp[11000];
ll N , M ;
vector<ll> matchNum;
map<ll,ll> A;

bool func1(ll a, ll b){
    return A[a] > A[b];
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    rep(i, 11000) dp[i] = -100;
    rep(i, 10) A[i] = 0;

    cin >> N >> M ;

    rep(i, M){
        ll inp; cin >> inp;
        matchNum.pb(match[inp]);
        A[match[inp]] = max(A[match[inp]], inp);
    }

    rmsame(matchNum);
    dp[0] = 0;
    rep(i, N + 1){
        if(dp[i] == -100) continue;
        rep(j, matchNum.size()){
            ll num = matchNum[j];
            if ((i + num) <= N)dp[i + num] = max(dp[i] + 1, dp[i + num]);
        }
    }

    sort(all(matchNum), func1);

    vector<ll> ans;
    while(N != 0){
        rep(i, matchNum.size()){
            ll num = matchNum[i];
            if(N-num < 0) continue;
            if(dp[N - num] == dp[N]-1){
                ans.pb(A[num]);
                N -= num;
                break;
            }
        }
    }

    sort(rall(ans));
    rep(i, ans.size()) cout << ans[i];
    cout << endl;

    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;

namespace MyProgram{
    class AtCoder{
        static void Main(string[] args){
            int[] input = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
            int N = input[0];
            int K = input[1];
            int[] A = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
            Console.WriteLine(Math.Ceiling((double)(N-1)/(K-1)));

            
        }
    } 
}


Measured memory_bytes: 16864
from bisect import bisect
a,b,q=map(int,input().split())

s=[-float('inf')]+[int(input()) for i in range(a)]+[float('inf')]
t=[-float('inf')]+[int(input()) for i in range(b)]+[float('inf')]


for i in range(q):
  x=int(input())
  l=bisect(s,x)
  r=bisect(t,x)
  
  ans=float('inf')
  
  for L in [s[l],s[l-1]]:
    for R in [t[r],t[r-1]]:
      ans=min(ans,abs(x-L)+abs(L-R),abs(x-R)+abs(R-L)) 
      
  print(ans)
      

Measured memory_bytes: 99236
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793
 
   
int main(){
 int n,m;
 cin >> n ;
 vector<ll> d(n);
 rep(i,n)cin >>d[i];
 cin >> m;
 vector<ll> t(m);
 rep(i,m)cin >> t[i];

 if(n<m)cout << "NO" << endl;
 else{
     map<ll,int> cnt;
     rep(i,n){
         if(cnt.count(d[i]))cnt.at(d[i])++;
         else cnt[d[i]]=0;
     }
     bool a=true;
     rep(i,m){
         if(cnt.count(t[i]) && cnt.at(t[i])==0)cnt.erase(t[i]);
         else if(cnt.count(t[i])){
             cnt.at(t[i])--;
         }
         else{
             a=false;
             break;
         }
     }
     if(a)cout << "YES" << endl;
     else cout << "NO" << endl;
 }
} 
    

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

int main(){
  int K,S,count = 0;
  cin >> K >> S;
  for(int i = 0; i <= K; i++){
    for(int j = 0; j <= K; j++){
      int k = S - i - j;
      if(k >= 0 && k <= K){
        count++;
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns, OverloadedStrings #-}
import Control.Arrow
import Control.Monad.Fix
import Data.Int
import Data.Foldable
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as B
import Data.ByteString.Internal (accursedUnutterablePerformIO)
import qualified Data.Set as S
import System.IO.Unsafe
import Debug.Trace

unew :: VUM.Unbox a => Int -> VUM.IOVector a
unew !n = accursedUnutterablePerformIO $ VUM.unsafeNew n

uread :: VUM.Unbox a => Int -> VUM.IOVector a -> a
uread !i !v = accursedUnutterablePerformIO $ VUM.unsafeRead v i

uwrite :: VUM.Unbox a => Int -> a -> VUM.IOVector a -> VUM.IOVector a
uwrite !i !a !v =
  accursedUnutterablePerformIO $ VUM.unsafeWrite v i a >> return v

uthaw :: VUM.Unbox a => VU.Vector a -> VUM.IOVector a
uthaw !v = accursedUnutterablePerformIO $ VU.unsafeThaw v

ufreeze :: VUM.Unbox a => VUM.IOVector a -> VU.Vector a
ufreeze !v = accursedUnutterablePerformIO $ VU.unsafeFreeze v

uset :: VUM.Unbox a => a -> VUM.IOVector a -> VUM.IOVector a
uset !a !v = accursedUnutterablePerformIO $ VUM.set v a >> return v

solve :: B.ByteString -> B.ByteString -> B.ByteString
solve !s !t = walk
 where
  toIndex !i !j = j * succ (B.length s) + i

  ifoldlB :: (a -> Int -> Char -> a) -> a -> B.ByteString -> a
  ifoldlB !f !x !bs =
    snd $ B.foldl' (\(!i, !acc) !ch -> (i + 1, f acc i ch)) (0, x) bs

  dp :: VU.Vector Int16
  dp = ufreeze $ ifoldlB
    ( \(!dp) !i !si -> ifoldlB
      ( \(!dp) !j !tj -> uwrite
        (toIndex (i + 1) (j + 1))
        ( if si == tj
          then uread (toIndex i j) dp + 1
          else max (uread (toIndex (i + 1) j) dp) (uread (toIndex i (j + 1)) dp)
        )
        dp
      )
      dp
      t
    )
    ( foldl'
      (\(!dp) (!i) -> uwrite (toIndex i 0) 0 $ uwrite (toIndex 0 i) 0 dp)
      (unew $ succ (B.length s) * succ (B.length t))
      [0 .. B.length s]
    )
    s

  walk =
    fst
      $ B.unfoldrN (fromIntegral $ dp VU.! toIndex (B.length s) (B.length t))
                   (\(x:xs) -> Just $ (,) (B.index s x) xs)
      $ fst
      $ fix
          ( \(!f) (!acc, (!i, !j)) -> if i == 0 || j == 0
            then (acc, (i, j))
            else if s `B.index` (i - 1) == t `B.index` (j - 1)
              then f ((i - 1) : acc, (i - 1, j - 1))
              else if dp VU.! toIndex (i - 1) j < dp VU.! toIndex i (j - 1)
                then f (acc, (i, j - 1))
                else f (acc, (i - 1, j))
          )
          ([], (B.length s, B.length t))

main = do
  s <- B.getLine
  t <- B.getLine
  B.putStrLn $ solve s t


Measured memory_bytes: 19452
#include<stdio.h>
int main(){
	int sum=100000,i,j,n;

	scanf("%d",&n);
	for(i=0;n>i;i++){
		sum=sum+(sum*0.05);
		if(sum%1000>0){
			sum=sum-(sum%1000)+1000;
		}
	}
	printf("%d\n",sum);
	
	return 0;

}

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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

struct Node {
    vector<int> edges;
    int fennec;
    int snuke;

    Node() {
        fennec = snuke = -1;
    }
};

void Fennec(int depth, int i, vector<Node>& nodes, vector<bool>& visited) {
    if(visited[i])return;
    visited[i] = true;
    nodes[i].fennec = depth;
    for(auto edge : nodes[i].edges) {
        Fennec(depth + 1, edge, nodes, visited);
    }
}

void Snuke(int depth, int i, vector<Node>& nodes, vector<bool>& visited) {
    if(visited[i])return;
    visited[i] = true;
    nodes[i].snuke = depth;
    for(auto edge : nodes[i].edges) {
        Snuke(depth + 1, edge, nodes, visited);
    }
}

int main() {
    int N;
    cin >> N;
    vector<Node> nodes(N + 1);
    REP(i, N - 1) {
        int a, b;
        cin >> a >> b;
        nodes[a].edges.push_back(b);
        nodes[b].edges.push_back(a);
    }
    vector<bool> vf(N + 1, false), vs(N + 1, false);
    Fennec(0, 1, nodes, vf);
    Snuke(0, N, nodes, vs);

    int f = 0;
    FOR(i, 1, N + 1) {
        if(nodes[i].snuke >= nodes[i].fennec) {
            f++;
        }
    }
    int s = N - f;
    if(s < f) {
        cout << "Fennec" << endl;
    }else{
        cout << "Snuke" << endl;
    }
    return 0;
}



Measured memory_bytes: 11264
/*
     Author:Raghav Bansal
     IIIT Una
                  */
#include <bits/stdc++.h>
#define int long long int
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define BOLT ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define X first
#define Y second
#define endl "\n"
using namespace std;
void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> done(n + 1);
    for (int i = 1; i <= k; i++) {
        int d;
        cin >> d;
        for (int j = 1; j <= d; j++) {
            int x;
            cin >> x;
            done[x] = 1;
        }
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (!done[i]) {
            ans++;
        }
    }
    cout << ans << endl;
}
int32_t main() {
    BOLT;
    solve();
}


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

long long int  nChoosek( int n, int k )
{
    if (k > n) return 0;
    if (k * 2 > n) k = n-k;
    if (k == 0) return 1;

    int result = n;
    for( int i = 2; i <= k; ++i ) {
        result *= (n-i+1);
        result /= i;
    }
    return result;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int N, M;
    cin >> N >> M;
    long long int sum = 0;
    sum+= nChoosek(N, 2);
    sum+= nChoosek(M, 2);

    cout << sum <<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
int gi() { 
	int res = 0, w = 1; 
	char ch = getchar(); 
	while (ch != '-' && !isdigit(ch)) ch = getchar(); 
	if (ch == '-') w = -1, ch = getchar(); 
	while (isdigit(ch)) res = res * 10 + ch - '0', ch = getchar(); 
	return res * w; 
} 
const int MAX_N = 1e5 + 5; 
int N, a[MAX_N];
void doit() {
	int g = 0;
	for (int i = 1; i <= N; i++) g = __gcd(g, a[i]); 
	for (int i = 1; i <= N; i++) a[i] /= g; 
} 
int main () { 
#ifndef ONLINE_JUDGE 
    freopen("cpp.in", "r", stdin); 
#endif 
	N = gi(); 
	for (int i = 1; i <= N; i++) a[i] = gi();
	int now = 0; 
	while (1) {
		bool flag = 0; 
		int cnt1 = 0, cnt2 = 0, p = 0; 
		for (int i = 1; i <= N; i++) { 
			if (a[i] & 1) p = i, cnt1++; 
			else cnt2++; 
			if (a[i] == 1) flag = 1; 
		} 
		if (flag) return puts((cnt2 & 1) ^ now ? "First" : "Second") & 0; 
		if (cnt2 & 1) return puts(now ? "Second" : "First") & 0; 
		if (cnt1 > 1 && !(cnt2 & 1)) return puts(now ? "First" : "Second") & 0; 
		a[p]--, doit(), now ^= 1; 
	} 
    return 0; 
} 

Measured memory_bytes: 3992
/* ex3_3
        fmuacshai */

#include<stdio.h>
//math関数を導入
#include<math.h>
int main(void){
    //整数n、進数k、桁数mを整数定義
    int n,k,m;
    //nの入力
    scanf("%d",&n);
    //kの入力
    scanf("%d",&k);
    //mの初期設定
    m=1;
    //(m+1)桁の最小の数字以上であるかチェック
    while(n>=pow(k,m)){
        m=m+1;
    }
    //求めた桁数mの出力
    printf("%d\n",m);
    return 0;
}
    
    

Measured memory_bytes: 128
import java.util.*;

import static java.lang.System.*;

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

        long[] a = new long[5];
        long min = Long.MAX_VALUE;
        for (int i = 0; i < 5; i++) {
            a[i] = sc.nextLong();
            min = Math.min(min, a[i]);
        }

        long bottleNeck = (long) Math.ceil((double) N / min);
        out.println(bottleNeck + 4);
    }
}

Measured memory_bytes: 23764
#include <iostream>
#include <set>
#include <vector>

using namespace std;


int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    bool flag=true;
    long long count=0;
    for(int i=0;i<n;i++){
        cin >> a[i];
        if(i==0){
            b[i]=0;
            if(a[i]!=0){
                flag=false;
            }
        }else{
            if (a[i]-a[i-1]>1)flag=false;
            if (a[i]>i)flag=false;
            b[i]=b[i-1]+((a[i]-a[i-1]==1)? 0 : 1);
            count+=a[i-1]*((a[i]-a[i-1]==1)? 0 : 1);
            if (i-a[i]<0 /*|| b[i]-b[i-a[i]]>1*/){//ほんまか？
                flag=false;
            }
        }
    }
    count+=a[n-1];
    if(flag){
        cout << count <<endl;
    }else{
        cout << -1 <<endl;
    }
    return 0;
}

Measured memory_bytes: 1920
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var s string
	fmt.Scan(&s)

	ans := make([]int, len(s))
	for i := 0; i < len(s); i++ {
		if s[i] == 'R' {
			j := 0
			for s[i+j+1] == 'R' {
				j++
			}
			ans[i+j] += (j + 1) - (j+1)/2
			ans[i+j+1] += (j + 1) / 2
			i += j
		} else {
			j := 0
			for i+j+1 < len(s) && s[i+j+1] == 'L' {
				j++
			}
			ans[i] += (j + 1) - (j+1)/2
			ans[i-1] += (j + 1) / 2
			i += j
		}
	}

	wr := bufio.NewWriter(os.Stdout)
	for i, v := range ans {
		wr.WriteString(strconv.Itoa(v))
		if i < len(ans)-1 {
			wr.WriteString(" ")
		} else {
			wr.WriteString("\n")
		}
	}
	wr.Flush()
}


Measured memory_bytes: 2432