akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7+1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
typedef list <ll> lst;

ll n,m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

/*--------------------template--------------------*/

ll a[105];

int main()
{
	while (1) {
		cin >> n >> k;
		if (n == 0 && k == 0) {
			return 0;
		} else {
			fill(a, a + 105, 0);
			ll ma = 0;
			REP(i, n)
			{
				cin >> m;
				REP(j, m)
				{
					ll b;
					cin >> b;
					a[b]++;
				}
			}
			ll p;
			REP(i, 105)
			{
				if (ma < a[i]) {
					ma = a[i];
					p = i;
				}
			}
			if (ma < k) {
				cout << 0 << endl;
			} else {
				cout << p << endl;
			}
		}
	}
}

Measured memory_bytes: 3088
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) (signed)((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int MOD = 1000000007;

#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"  << " " << __FILE__ << endl;

signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);

    int n;
    cin >> n;
    VI x(n);
    REP(i, n) {
        cin >> x[i];
    }

    int t = 1;
    int ans = 1;
    int l = n;
    FOR(i, 1, n) {
        if (x[i-1] < 2 * t - 1 || x[i] < 2 * t) {
            ans *= t;
            ans %= MOD;
            l--;
        } else {
            t++;
        }
    }
    for (int i = l; i > 0; --i) {
        ans *= i;
        ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;

string TASHIZAN(string a, string b) {
  int maxlen = max(a.size(), b.size()) + 1;
  vector< int > ret(maxlen, 0);
  string ans;
  reverse(a.begin(), a.end()), reverse(b.begin(), b.end());
  for(int i = 0; i < a.size(); i++) ret[i] = a[i] - '0';
  for(int i = 0; i < b.size(); i++) ret[i] += b[i] - '0';
  for(int i = 0; i < maxlen - 1; i++) {
    ans += (ret[i] % 10) + '0';
    ret[i + 1] += ret[i] / 10;
  }
  if(ret[maxlen - 1]) ans += ret[maxlen - 1] + '0';
  reverse(ans.begin(), ans.end());
  return ans;
}

int main() {
  string M;
  cin >> M;
  string N = M;
  for(int i = 0; i < 8; i++) N = TASHIZAN(N, M);

  auto check = [&](int v) {
    v *= 9;
    string S = TASHIZAN(N, to_string(v));
    for(int i = 0; i < S.size(); i++) {
      v -= S[i] - '0';
      if(v < 0) return false;
    }
    return true;
  };

  int ok = 500001, ng = 0;
  while(ok - ng > 1) {
    int mid = (ok + ng) / 2;
    if(check(mid)) ok = mid;
    else ng = mid;
  }
  cout << ok << endl;
}

Measured memory_bytes: 5408
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <cstring>
#include <cctype>
#include <sstream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <complex>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for(int i = a; i < (int)b; i++)
#define pb push_back
#define mp make_pair
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
const int INF = 1<<28;
const ll MOD = 1000000007;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

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

	vi v1, v2;
	for(int i=0; i*i*i <= 151200; i++)
		v1.pb(i*i*i);
	for(int i=0; i*(i+1)*(i+2)/6 <= 151200; i++)
		v2.pb(i*(i+1)*(i+2)/6);

	int n;
	while(cin >> n, n) {
		int ans = 0;
		REP(i, v1.size())
			REP(j, v2.size())
				if(v1[i] + v2[j] <= n && v1[i] + v2[j] > ans) {
					ans = v1[i] + v2[j];
				}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1220
def count(i, d):
    return int(i // d * (d / 2)) + max(int(i % d + 1 - d / 2), 0)


a, b = map(int, input().split(' '))

l = ['0' for i in range(40)]

for i in range(40):
    bb = count(b, 2**(i + 1))
    aa = count(a - 1, 2**(i + 1))
    if (bb - aa) % 2 == 0:
        l[i] = '0'
    else:
        l[i] = '1'
l.reverse()
print(int(''.join(l), 2))


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

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

    int count = 0;
    int z;
    
    for(int x = 0; x <= k; x++){
        for(int y = 0; y <= k; y++){
            z = s - x - y;
            if(z >= 0 and z <= k){
                count++;
            }
        }
    }

    printf("%d\n", count);

    return 0;
}

Measured memory_bytes: 256
n,c = map(int,input().split())

t = [[0 for i in range(100001)] for j in range(c)]

for i in range(n):
    si,ti,ci = map(int,input().split())
    for j in range(si,ti+1):
        t[ci-1][j] = 1
ans = 0
for i in range(100001):
    ans = max(ans,sum(t[j][i] for j in range(c)))
print(ans)

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

namespace _0103
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int n = RInt();

            int inning = 0;
            int outCnt = 0;
            int score = 0;
            int onBase = 0;
            while (inning < n)
            {
                string result = RSt();
                switch (result)
                {
                    case "HOMERUN":
                        score += onBase + 1;
                        onBase = 0;
                        break;

                    case "HIT":
                        if (onBase < 3) onBase++;
                        else score++;
                        break;

                    case "OUT":
                        outCnt++;
                        if(outCnt == 3)
                        {
                            Console.WriteLine(score);
                            inning++;
                            outCnt = 0;
                            score = 0;
                            onBase = 0;
                        }
                        break;
                }
            }
            
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



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

int n, a[100005], b[100005], c[100005], dp[100005][2][2][2];

int fn(int i, int ah, int bh, int ch) {
    if (i == n) return 0;
    if (~dp[i][ah][bh][ch]) return dp[i][ah][bh][ch];
    int& y = dp[i][ah][bh][ch];
    if (ah ) y = max(fn(i + 1, 0, 0, 1) + c[i], fn(i + 1, 0, 1, 0) + b[i]);
    if (bh) y = max(fn(i + 1, 1, 0, 0) + a[i], fn(i + 1, 0, 0, 1) + c[i]);
    if (ch) y = max(fn(i + 1, 1, 0, 0) + a[i], fn(i + 1, 0, 1, 0) + b[i]);
    return y;
}

int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d%d%d", &a[i], &b[i], &c[i]);
    }
    memset(dp, -1, sizeof dp);
    printf("%d\n", max(fn(0, 0, 0, 1), max(fn(0, 0, 1, 0), fn(0, 0, 0, 1))));
    return 0;
}

Measured memory_bytes: 12288
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
#define vall(x) (x).begin(), (x).end()
using namespace std;
using lli = long long int;
void YESNO(bool), YesNo(bool);
template <class T1, class T2>
bool chmin(T1 &l, const T2 &r);
template <class T1, class T2>
bool chmax(T1 &l, const T2 &r);
template <class T1, class T2>
void vadd(vector<T1> &v, T2 x);

#define int long long int
lli po[200005] = {};
lli inv(lli p)
{
  lli n = 2017;
  lli ret = 1;
  while (n)
  {
    if (n & 1)
      ret *= p;
    p *= p;
    p %= 2019;
    ret %= 2019;
    n /= 2;
  }
  return ret;
}
void solve(string S)
{
  map<lli, lli> m;
  int n = S.size();
  lli mod = 0;
  po[0] = 1;
  rep(i, n + 1) po[i + 1] = (po[i] * 10) % 2019;
  lli ret = 0;
  m[0] = 1;
  rrep(i, n)
  {
    mod += lli(S[i] - '0') * po[n - 1 - i];
    mod %= 2019;
    ret += m[mod];
    m[mod]++;
  }
  // m[0]++;
  // rep(i, 2019)
  // {
  //   ret += m[i] * (m[i] - 1) / 2;
  // }
  // lli ret = m[0];
  // lli base = 0;
  // rrep(i, n)
  // {
  //   base += lli(S[i] - '0') * po[n - 1 - i];
  //   base %= 2019;
  //   ret += m[base] * (m[base] - 1) / 2;
  //   // ret += m[inv(po[i + 1])] * m[inv(po[i + 1])];
  // }
  cout << ret;
}

signed main()
{
  string S;
  cin >> S;
  solve(S);
  return 0;
}

// -- lib
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }

template <class T1, class T2>
bool chmin(T1 &l, const T2 &r)
{
  return (l > r) ? (l = r, true) : false;
}

template <class T1, class T2>
bool chmax(T1 &l, const T2 &r)
{
  return (l < r) ? (l = r, true) : false;
}

template <class T1, class T2>
void vadd(vector<T1> &v, T2 x)
{
  for (auto &s : v)
    s += T2(x);
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,m;cin>>n>>m;
    vector<ll> h(n);rep(i,n)cin>>h[i];
    vector<ll> M(n,0);
    rep(i,m){
        ll a,b;cin>>a>>b;
        a--;b--;
        M[a]=max(M[a],h[b]);
        M[b]=max(M[b],h[a]);
    }
    ll ans = 0;
    for(int i=0; i<n; i++)if(h[i]>M[i])ans++;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 4784
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        if (N == 1) {
            System.out.println("Yes");
            System.out.println(2);
            System.out.println("1 1");
            System.out.println("1 1");
            return;
        }
        int pair = -1;
        for (int i = 2; i <= N; i++) {
            if ( i * (i - 1) / 2 == N) {
                pair = i;
                break;
            }
        }
        if (pair == -1) {
            System.out.println("No");
            return;
        }
        List<Integer>[] ans = new List[pair];
        for (int i = 0; i < pair; i++) {
            ans[i] = new ArrayList<>();
        }
        int current = 1;
        for (int i = 0; i < pair; i++) {
            for (int j = i + 1; j < pair; j++) {
                ans[i].add(current);
                ans[j].add(current);
                current += 1;
            }
        }
        System.out.println("Yes");
        System.out.println(pair);
        for (int i = 0; i < pair; i++) {
            StringBuilder sb = new StringBuilder();
            sb.append(ans[i].size());
            sb.append(" ");
            for (int j = 0; j < ans[i].size(); j++) {
                sb.append(ans[i].get(j));
                sb.append(" ");
            }
            System.out.println(sb.substring(0, sb.length()-1));
        }
    }
}


Measured memory_bytes: 45288
//#pragma optimization_level 3
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#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>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordset;
*/

#define fr first
#define sc second
#define vec vector
#define pb push_back
#define pii pair<int, int>
#define fo(x,y) for(int x = 1 ; x <= y ; ++x)
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;

typedef long long ll;
typedef unsigned int uint;
const int nmax = 200005;
const ll linf = LLONG_MAX;
const int mod = 1e9+7;
const int inf = INT_MAX;

ll n , a;
int main(){
    cin >> n >> a;
    cout << (n + a - 1)/a << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"  
char ch[20000010];
//std::vector<int> v, a;

int main(){
  
	#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);  
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);  
#endif
       ios_base::sync_with_stdio(false);    
       cin.tie(NULL);
       /*
int t;
cin>>t;
while(t--){
	int n;
	cin>>n;
	string s;
	cin>>s;
	string s1  = "";
	if(s.size() == 1){
		cout<<1<<endl;
	}
	for(int i = 1 ; i<=n; i+= 2){
		s1 += '1';
	}
	for(int i = 2 ; i <= n ; i+= 2){
		s1 += '0';
	}
	cout<<s1<<endl;  
}
}
*/
       int sum = 0;
       cin>>ch;
int len = strlen(ch);
for(int i = 0 ; i< len ;i++){
	sum += ch[i] - '0';  
}
if(sum % 9 == 0){    
	cout<<"Yes"<<endl;
}  
else{
	cout<<"No"<<endl;
}
}

Measured memory_bytes: 3752
n = int(input())
l = list(map(int, input().split()))
print(*l)
for i in range(1,n):
    v=l[i]
    j=i-1
    while j>=0 and v<l[j]:
        l[j+1]=l[j]
        j-=1
    l[j+1]=v
    print(*l)
        



Measured memory_bytes: 5980
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long

const int maxn = 1e6 + 7;
const LL INF = 1e18;

///dp[0][i] 第i位给s[i] - '0'张10^i张，不用找
///dp[1][i] 第i位给1张10^(i+1)张，找10 - (s[i] - '0')张，共1 + 10 - (s[i] - '0')
LL dp[2][maxn];
char s[maxn];

int main() {
    while(~scanf("%s",s + 1)) {
        s[0] = '0';
        int len = strlen(s + 1);
        dp[0][len] = s[len] - '0';
        dp[1][len] = 10 - (s[len] - '0');
        for(int i = len - 1 ; i >= 0 ; i--) {
            dp[0][i] = min(dp[0][i+1] + (s[i] - '0') , dp[1][i+1] + (s[i] - '0' + 1));
            dp[1][i] = min(dp[0][i+1] + 10 - (s[i] - '0') , dp[1][i+1] + 10 - (s[i] - '0' + 1));
        }
        printf("%lld\n",min(dp[0][0],dp[1][0]));
    }
    return 0;
}


Measured memory_bytes: 16896
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
int i;
#define rep2(i, a, b) for(i = a; i <= b; ++i)
#define rep(i, n) for(i = 0; i < n; ++i)
using namespace std;
// _________コーディングはここから！！___________
template <const int sz = 5 * 10000000, typename T = long long> struct IO {
    char reader[sz], writer[sz];
    char *now, *now2 = writer;
    IO() {
        reader[fread(reader, sizeof(char), sizeof(char) * sz, stdin)];
        now = reader;
    }
    inline T read() {
        while(*now && *now <= 32) now++;
        if(*now == '-') {
            now++;
            T res = 0;
            while('0' <= *now and *now <= '9') { res = res * 10 + *now++ - '0'; }
            return -res;
        } else {
            T res = 0;
            while('0' <= *now and *now <= '9') { res = res * 10 + *now++ - '0'; }
            return res;
        }
    }
    inline string read_str() {
        string res;
        while(*now and *now != '\n' and *now != ' ') res += *now++;
        now++;
        return res;
    }
    inline void write(T x, char margin = ' ') {
        if(x == 0) {
            putchar('0');
            putchar(margin);
            return;
        }
        if(x < 0) {
            putchar('-');
            x = -x;
        }
        while(x) {
            *now2 = '0' + x % 10;
            now2++;
            x /= 10;
        }
        do {
            now2--;
            putchar(*now2);
        } while(now2 != writer);
        putchar(margin);
    }
    inline void write_str(string s, char margin = ' ') {
        for(auto c : s) putchar(c);
        putchar(margin);
    }
};
IO io;
inline int read() { return io.read(); }
inline void write(int x) { io.write(x); }
inline void write(int x, char c) { io.write(x, c); }
constexpr int N = 500003;
int c[N];
struct T {
    int l, r, idx;
    constexpr bool operator<(const T &rhs) const noexcept { return r < rhs.r; }
} q[N];
int ans[N], last[N], dat[N];

inline void dec(int k) {
    for(++k; k < N; k += k & -k) --dat[k];
}
inline int sum(int k) {
    int res = 0;
    for(++k; k > 0; k -= k & -k) res += dat[k];
    return res;
}
int n, Q, now = 1;

// 頑張れ！！
#pragma GCC target("avx2")
#pragma GCC optimize("unroll-loops")
// 頑張れ！！

main() {
    n = read(), Q = read();
    rep2(i, 1, n) c[i] = read();
    rep(i, Q) q[i].l = read(), q[i].r = read() + 1, q[i].idx = i;
    sort(q, q + Q);
    int now = 1;
    rep(i, Q) {
        for(; now < q[i].r; ++now) {
            if(last[c[now]]) dec(last[c[now]]);
            last[c[now]] = now;
        }
        ans[q[i].idx] = sum(q[i].r - 1) - sum(q[i].l - 1) + q[i].r - q[i].l;
    }
    rep(i, Q) write(ans[i], '\n');
}


Measured memory_bytes: 26700
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define REP(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define INF 10000000
#define ll long long

using namespace std;

typedef pair<int, int> P;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

int N;
vector <ll int> v;

int main(){
    scanf("%d", &N);
    REP(i, N){
        ll int tmp;
        scanf("%lld", &tmp);
        v.push_back(tmp);
    }

    sort(v.begin(), v.end());

    ll int d = v.back();
    v.pop_back();

    if(d % 2 == 0){
        ll int middle = d / 2;
        auto itr = upper_bound(v.begin(), v.end(), middle);
        ll int b = *itr;
        --itr;
        ll int a = *itr;
        if((middle - a) <= (b - middle)) printf("%lld% lld", d, a);
        else printf("%lld% lld\n", d, b);
    } else {
        ll int middle1 = d / 2;
        ll int middle2 = middle1 + 1;
        auto itr2 = lower_bound(v.begin(), v.end(), middle2);
        ll int b = *itr2;
        auto itr3 = upper_bound(v.begin(), v.end(), middle2);
        --itr3;
        ll int a = *itr3;
        if((middle1 - a) <= (b - middle2)) printf("%lld% lld", d, a);
        else printf("%lld% lld\n", d, b);
    }

	return 0;
}

Measured memory_bytes: 1400
import math

def is_prime(num):
    if num == 2:
        return True
    elif num < 2 or num % 2 == 0:
        return False
    else:
        i = 3
        while i <= math.sqrt(num):
            if num % i == 0:
                return False
            i += 2
    return True


if __name__ == '__main__':
    n = int(input())
    prime_numbers = []

    for i in range(n):
        num = int(input())
        if is_prime(num):
            prime_numbers.append(num)

    print(len(prime_numbers))



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

int main() {
    long long a;
    long long b;
    long long c;
    long long d;
    std::cin >> a >> b >> c >> d;
    std::vector<long long> v(4);
    v[0] = a * c;
    v[1] = a * d;
    v[2] = b * c;
    v[3] = b * d;
    long long max = v[0];
    for (long long& i : v) {
        if (max < i) {
            max = i;
        }
    }
    std::cout << max << std::endl;
    return 0;
}

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

int main(){
    int ans;
    rep(i,5) {
        int x;
        cin >> x;
        if(x == 0) ans = i+1;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
signed main()
{
	long long n,p,ans=1;
	cin>>n>>p;
	if (n==1){
		cout<<p;
		return 0;
	}
	for (int i=2;i<10000000;i++){
		int d=0;
		while (p%i==0)	p=p/i,d++;
		while (d>=n)  ans*=i,d-=n;
		//cout<<i<<endl;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//cout << fixed << setprecision(10);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int h, w;
string board[110];
bool goodx[110], goody[110];

int main () {
  cin >> h >> w;
  rep(i,h) cin >> board[i];
  rep(i,h) {
    rep(j,w) {
      if (board[i][j] == '#') {
        goodx[i] = true;
        goody[j] = true;
      }
    }
  }
  rep(i,h) {
    if (goodx[i]) {
      rep(j,w) {
        if (goody[j]){
          cout << board[i][j];
        }
      }
      cout << '\n';
    }
  }
  return 0;
}

Measured memory_bytes: 256
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7

N,W = MAP()
weight=[]
value=[]
for i in range(N):
    w,v = MAP()
    weight.append(w)
    value.append(v)

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

for i in range(N):
    for sum_w in range(W+1):
        if sum_w-weight[i]>=0:
            dp[i+1][sum_w] = max(dp[i+1][sum_w],dp[i][sum_w-weight[i]]+value[i])

        dp[i+1][sum_w] = max(dp[i+1][sum_w],dp[i][sum_w])

print(dp[N][W])

Measured memory_bytes: 120684
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr = ds.begin(); itr != ds.end(); ++itr)
#define mp make_pair
#define INF 2000000000
#define INFL 2000000000000000000LL
#define EPS 1e-9
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<double> > vvd;
typedef vector<vector<P> > vvP;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;
typedef pair<int, pair<int, int> > Edge;
typedef vector<Edge> vE;
typedef priority_queue<Edge, vector<Edge>, greater<Edge> > pqlE;


//#define DEBUG

#ifdef DEBUG
#define dprintf printf
#define dbg 
#define drepl(i,a,b) repl(i,a,b)
#define drep(i,n) rep(i,n)
#else
#define dprintf (true)?0:printf
#define dbg if(false)
#define drepl(i,a,b) int i; if(false)
#define drep(i,n) int i; if(false)
#endif // DEBUG



int main() {
	int N;
	cin >> N;
	vi a(N);
	rep(i, N) {
		cin >> a[i];
	}
	if (N == 1) {
		cout << 1 << endl;
		return 0;
	}
	int diff = 0;
	int ans = 1;
	rep(i, N - 1) {
		if (diff == 0) {
			if (a[i + 1] > a[i]) {
				diff = 1;
			}
			else if (a[i + 1] < a[i]) {
				diff = -1;
			}
		}
		else if (diff == 1) {
			if (a[i + 1] < a[i]) {
				diff = 0;
				ans++;
			}
		}
		else {
			if (a[i + 1] > a[i]) {
				diff = 0;
				ans++;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main() {
	ll a,b,c,x;
	cin>>a>>b>>c>>x;
	if(a<b && b<c)
		cout<<"Yes";
	else {
		while(x!=0) {
			if(b<=a) {
				b*=2;
				x--;
			}
			else if(b>a && c<=b) {
				c*=2;
				x--;
			}
			else {
				c*=2;
				x--;
				// break;
			}
		}
		if(a<b && b<c)
			cout<<"Yes";
		else 
			cout<<"No";
	}
} 

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <string>
#include <limits.h>

using namespace std;

int main()
{
    
	int n, a, b;
	cin >> n >> a >> b;

	if ((a ^ b) & 1) {
		cout << "Borys" << endl;
	}
	else {
		cout << "Alice" << endl;
	}


	return 0;

}




Measured memory_bytes: 256
fun main(args:Array<String>) {
    val abcde = (1..5).map { readLine()!!.toInt() }
    val tmp = abcde.map { if(it%10==0) it else (it/10+1)*10 }.sum()
    val ans = tmp - (10 - (abcde.map { it%10 }.filter { it > 0 }.min()?:10))
    println(ans)
}

Measured memory_bytes: 35456
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int p[] = new int[N];
		int ans = 0;
		for(int i = 0; i < N; i++){
			p[i] = stdIn.nextInt();
			if(p[i]-i != 1){
				ans++;
			}
		}
		if(ans == 2 || ans == 0){
			System.out.println("YES");
		}
		else{
			System.out.println("NO");
		}
		stdIn.close();
	}
}

Measured memory_bytes: 35792
#include <stdio.h>

int main()
{
    int a[3][3],card[3][3] = {0};

    int i,j;

    for (i = 0; i < 3; i++)
    {
        for (j = 0; j < 3; j++)
        {
            scanf("%d",&a[i][j]);
        }
    }
    
    int n,b[100];
    scanf("%d",&n);
    for (i = 0; i < n; i++)
    {
        scanf("%d",&b[i]);
    }
    
    int k;
    for (i = 0; i < n; i++)
    {
        for (j = 0; j < 3; j++)
        {
            for (k = 0; k < 3; k++)
            {
                if(b[i] == a[j][k])
                {
                    card[j][k] = 1;
                }
            }
        }
    }
    for (i = 0; i < 3; i++)
    {
        if(card[i][0] == 1 && card[i][1] == 1 && card[i][2] == 1)break;
        if(card[0][i] == 1 && card[1][i] == 1 && card[2][i] == 1)break;
        if(card[0][0] == 1 && card[1][1] == 1 && card[2][2] == 1)break;
        if(card[0][2] == 1 && card[1][1] == 1 && card[2][0] == 1)break;
    }

    if(i == 3)printf("No");
    else printf("Yes");
    
}


Measured memory_bytes: 128
n = int(input())
s = input()
cnt_max = 0
for i in range(1,n):
  s_1 = set(s[:i])
  s_2 = set(s[i:])
  cnt = 0
  for p in s_1:
    if p in s_2:
      cnt += 1
  cnt_max = max(cnt ,cnt_max)
print(cnt_max)
  
  

Measured memory_bytes: 2940
import Foundation
func toTuple<T>(_ args: [T]) -> (T, T) { (args[0], args[1]) }
func toTuple<T>(_ args: [T]) -> (T, T, T) { (args[0], args[1], args[2]) }
func toTuple<T>(_ args: [T]) -> (T, T, T, T) { (args[0], args[1], args[2], args[3]) }
func readInts() -> [Int] { readLine()!.split(separator: " ").map { Int($0)! } }
func readDoubles() -> [Double] { readLine()!.split(separator: " ").map { Double($0)! } }

_ = readLine()!
let ai = readInts()
if ai.contains(0) {
  print(0)
  exit(0)
}
var result = 1
for a in ai {
  let ans = result &* a
  if ans < result || ans > 1_000_000_000_000_000_000 {
    print(-1)
    exit(0)
  }
  result = ans
}
print(result)

Measured memory_bytes: 20164
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    int arr[100001];
    cin >> n;
    for(int i=1;i<=n;i++){
    	cin >> arr[i];

    }
    int out = 0;
    for(int i=1;i<=n;i++){
    	if(arr[i]==i && arr[i+1]==i+1){
    		out++;
    		i++;
    	}
    	else if(arr[i] == i) out++;
    }
    cout << out;

    return 0;
}

Measured memory_bytes: 640
N,Y=map(int,input().split())

answer=[-1,-1,-1]
for x in range(N+1):    
    for y in range(N-x+1):
        z=N-x-y
        A=Y-10000*x-5000*y-1000*z
        if A==0:
            answer=[x, y, z]

print(*answer)

Measured memory_bytes: 9176
import sys
import numpy as np
sys.setrecursionlimit(100000000)
from collections import defaultdict
import collections
d = defaultdict(int)
d_TF = defaultdict(bool)

n,m = map(int,input().split())
ps = []
for i in range(m):
    ps.append(list(map(str,input().split())))

    if ps[i][1] == 'AC':
        d_TF[ps[i][0]] = True

    if d_TF[ps[i][0]] == False and ps[i][1] == 'WA':
        d[ps[i][0]] += 1



#print(d)

ansAC = 0
ansWA = 0
for key in d_TF:
    if d_TF[key] == True:
        ansAC += 1
        ansWA += d[key]

print(ansAC,ansWA)

Measured memory_bytes: 59508
N,i,j,k;
long long A[301][301],inf=1e15,z;
main(){
	for(scanf("%d",&N);i++<N;){
		for(j=0;j++<N;){
			scanf("%d",A[i]+j);
		}
	}
	for(;k++<N;){
		for(i=0;i++<N;){
			if(i==k)continue;
			for(j=0;j++<N;){
				if(j==k||j==i||A[i][j]==inf)continue;
				if(A[i][j]==A[i][k]+A[k][j]){
					A[i][j]=inf;
				}else if(A[i][j]>A[i][k]+A[k][j]){
					return!puts("-1");
				}
			}
		}
	}
	for(i=0;i++<N;){
		for(j=0;j++<N;){
			z+=A[i][j]==inf?0:A[i][j];
		}
	}
	printf("%lld",z/2);
}


Measured memory_bytes: 896
using System;
class ProgramC
    {
        static void Main(string[] args)
        {
            
            string input = Console.ReadLine();
            int n = int.Parse(input);

            string[] input_a = Console.ReadLine().Split(' ');
            long[] a = new long[n + 1];
            for(int i = 0;i < n + 1;i++)
                a[i] = long.Parse(input_a[i]);
            
            string[] input_b = Console.ReadLine().Split(' ');
            long[] b = new long[n];
            for(int i = 0;i < n;i++)
                b[i] = long.Parse(input_b[i]);
            
            long count = 0;

            if(a[0] >= b[0])
            {
                count += b[0];
                b[0] = 0;
            }
            else
            {
                count += a[0];
                b[0] -= a[0];
            }
            
            for(int i = 1;i < n;i++)
            {
                
                if(a[i] >= b[i - 1])
                {
                    count += b[i - 1];
                    a[i] -= b[i - 1];
                    b[i - 1] = 0;
                }
                else
                {
                    count += a[i];
                    b[i - 1] -= a[i];
                    a[i] = 0;
                }

                if(a[i] >= b[i])
                {
                    count += b[i];
                    a[i] -= b[i];
                    b[i] = 0;
                }
                else
                {
                    count += a[i];
                    b[i] -= a[i];
                    a[i] = 0;
                }
            }

            if(a[n] >= b[n - 1])
            {
                count += b[n -1];
                a[n] -= b[n - 1];
                b[n -1] = 0;
            }
            else
            {
                count += a[n];
                b[n -1] -= a[n];
                a[n] = 0;
            }
            Console.WriteLine(count);
        }
    }

Measured memory_bytes: 35792
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
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 main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;
    vector<int> D(N);
    for (auto &&i : D) {
        cin >> i;
    }
    int M;
    cin >> M;
    vector<int> T(M);
    for (auto &&i : T) {
        cin >> i;
    }
    SORT(D);
    SORT(T);
    REP(i, M) {
        int t = upper_bound(ALL(T), T[i]) - lower_bound(ALL(T), T[i]);
        int d = upper_bound(ALL(D), T[i]) - lower_bound(ALL(D), T[i]);
        if (d < t) {
            std::cout << "NO" << '\n';
            return 0;
        }
        i += t - 1;
    }

    std::cout << "YES" << '\n';

    return 0;
}

Measured memory_bytes: 1792
def main():
    N = int(input())
    A = list(map(int, input().split()))
    res = 0
    i = 0
    while i < N:
        if A[i] == i + 1:
            res += 1
            i += 2
        else:
            i += 1
    print(res)

if __name__ == '__main__':
    main()



Measured memory_bytes: 14004
n,m,k=map(int,input().split())
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
uf=UnionFind(n)
arr=[0]*n
for i in range(m):
    a,b=map(int, input().split())
    uf.union(a-1,b-1)
    arr[a-1]+=1
    arr[b-1]+=1
for i in range(k):
    c,d=map(int, input().split())
    if uf.same(c-1,d-1):
        arr[c-1]+=1
        arr[d-1]+=1
for i in range(n):
    print(uf.size(i)-arr[i]-1)

Measured memory_bytes: 79936
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int X, A;
  cin >> X >> A;
  cout << (X < A ? 0 : 10) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 9999999999;
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;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }



int main() {
  ll x,y; cin >>x >>y;
  int res = 0;
  while (x <= y){
    res++;
    x *= 2;
  }
  cout <<res <<endl;
}

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

int main() {
  int n;
  cin >> n;
  if (n % 1111 == 0 || n % 1000 % 111 == 0 || n / 10 % 111 == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" <<endl;
  }
}

Measured memory_bytes: 256
def make2d(m,n)
  Array.new(m).map{Array.new(n,0)}
end


def min(x,y)
  if x > y
    return y
  else
    return x
  end
end


def g()
  1
end

def q(c,d)
   if c == d
       return 0
   else
       return 1
   end
end

def align_ed(s,t)
  m = s.length()
  n = t.length()
  a = make2d(m+1,n+1)                               #?????????????????¨??§a[m][n]?????§??????????????????
  a[0][0] = 0
  for j in 1..n
    a[0][j] = a[0][j-1] + g()
  end
  for i in 1..m
    a[i][0] = a[i-1][0] + g()
  end
  for i in 1..m 
    for j in 1..n
      x = a[i-1][j-1] + q(s[i-1],t[j-1])            #a[i][j]???ij???s???i????????¨t???j????????????????????????s???i????????¨t???j?????????????????????s[i-1],t[j-1]????????§???????????????????????????
      y = a[i][j-1] + g()                           
      z = a[i-1][j] + g()
      a[i][j] = min(x,min(y,z))
    end
  end
  a[-1][-1]
end
=begin
def traceback_ed(a,s,t)
  u = ""
  v = ""
  i = s.length()
  j = t.length()
  while i>0 || j>0
    if j>0 && a[i][j] == a[i][j-1] + g()
      u = "-"           + u
      v = t[j-1 .. j-1] + v
      j = j - 1 # go up
    else
      if i>0 && j>0 &&
         a[i][j] == a[i-1][j-1] + q(s[i-1], t[j-1])
        u = s[i-1 .. i-1] + u
        v = t[j-1 .. j-1] + v
        j = j - 1 # go up
        i = i - 1 # go left
        
        
      else
        if i>0 && a[i][j] == a[i-1][j] + g()
          u = s[i-1 .. i-1] + u
          v = "-"           + v
          i = i - 1 # go left
          
        end
      end
    end
  end
  [u,v]
end

def align_dp_ed(s,t)
  traceback_ed(align_ed(s,t),s,t)
end
=end

s1 = gets.chomp
s2 = gets.chomp
puts align_ed(s1,s2)

Measured memory_bytes: 16588
#include <stdio.h>

int main(void) {
	int query;
	int i,start,sum;
	int count;
	while(1) {
		scanf("%d",&query);
		if(query==0)break;
		count=0;
		start=0;
		sum=0;
		for(i=1;i<query;i++) {
			sum+=i;
			while(sum>query)sum-=start++;
			if(sum==query)count++;
		}
		printf("%d\n",count);
	}
	return 0;
}

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

public class Main {

	public static void main(String[] args) {
		FastReader in = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		int n = in.nextInt();
		int[] a = in.readArray(n);
		long ans = 0;
		int max = -1;
		for(int x:a) {
			max = Math.max(max,x);
			ans += max - x;
		}
		out.println(ans);
		out.close();
	}

	static final Random random=new Random();
	//	static void ruffleSort(Pair[] a) {
	//		int n=a.length;//shuffle, then sort 
	//		for (int i=0; i<n; i++) {
	//			int oi=random.nextInt(n);
	//			Pair temp=a[oi];
	//			a[oi]=a[i]; a[i]=temp;
	//		}
	//		Arrays.sort(a);
	//	}
	static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort 
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
	static void ruffleSort(char[] a) {
		int n=a.length;//shuffle, then sort 
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n);
			char temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
	static class FastReader 
	{ 
		BufferedReader br; 
		StringTokenizer st; 

		public FastReader() 
		{ 
			br = new BufferedReader(new
					InputStreamReader(System.in)); 
		} 

		String next() 
		{ 
			while (st == null || !st.hasMoreElements()) 
			{ 
				try
				{ 
					st = new StringTokenizer(br.readLine()); 
				} 
				catch (IOException  e) 
				{ 
					e.printStackTrace(); 
				} 
			} 
			return st.nextToken(); 
		} 

		int nextInt() 
		{ 
			return Integer.parseInt(next()); 
		} 

		long nextLong() 
		{ 
			return Long.parseLong(next()); 
		} 

		double nextDouble() 
		{ 
			return Double.parseDouble(next()); 
		} 

		String nextLine() 
		{ 
			String str = ""; 
			try
			{ 
				str = br.readLine(); 
			} 
			catch (IOException e) 
			{ 
				e.printStackTrace(); 
			} 
			return str; 
		} 

		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
	}
}

//class Pair implements Comparable<Pair>{
//    int a;
//    int b;
//    public Pair(int a, int b) {
//        this.a = a;
//        this.b = b;
//    }
//    public int compareTo(Pair o) {
//        if(this.a==o.a)
//            return this.b - o.b;
//        return this.a - o.a;
//    }   
//}

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

#define For(i, j, k) for(int i = j; i <= k; i++)
#define Forr(i, j, k) for(int i = j; i >= k; i--)

using namespace std;

const int N = 1e6 + 10;
const int Mod = 998244353;

int mul(long long x, int y){
	return x * y % Mod;
}

void add(int &x, int y){
	x += y;
	if(x >= Mod) x -= Mod;
}

int Pow(int x, int e){
	int ret = 1;
	while(e){
		if(e & 1) ret = mul(ret, x);
		x = mul(x, x);
		e >>= 1;
	}
	return ret;
}

int fac[N], rfac[N];

inline int C(int n, int m){
	if(m < 0 || n < m) return 0;
	return mul(fac[n], mul(rfac[m], rfac[n - m]));
}	

int n, m;

int main(){
	scanf("%d%d", &n, &m);
	if(n > m) swap(n, m);

	fac[0] = 1;
	For(i, 1, n + m) fac[i] = mul(fac[i - 1], i);
	rfac[n + m] = Pow(fac[n + m], Mod - 2);
	Forr(i, n + m, 1) rfac[i - 1] = mul(rfac[i], i);

	int ans = 0, now = 0, dx = 0, dy = 0;
	For(i, 1, n + m){
		if(i & 1){
			int x = i / 2;
			add(dx, mul(C(n + m - 1 - x * 2, n - x), !x ? 1 : C(x * 2 - 1, x)));
			add(dy, mul(C(n + m - 1 - x * 2, m - x), !x ? 1 : C(x * 2 - 1, x)));
		}
		else{
			int x = i / 2, y = i / 2 - 1;
			add(dx, Mod - mul(C(x + y - 1, x - 1), C(n + m - 1 - x - y, n - x)));
			swap(x, y);
			add(dy, Mod - mul(C(x + y - 1, y - 1), C(n + m - 1 - x - y, m - y)));
		}

		add(now, dx);
		add(now, dy);
		add(ans, mul(now, mul(rfac[i], fac[i - 1])));
	}

	printf("%d\n", mul(ans, Pow(C(n + m, n), Mod - 2)));
	return 0;
}

Measured memory_bytes: 8064
#include <iostream>
#include <stdio.h>
using namespace std;

int c[256];
int main(){
	char s[100001];
	cin >> s;

	for (int i=0; s[i]!=0; i++) {
		c[s[i]] = 1;
	}

	for (char j='a'; j<='z'; j++) {
		if (c[j] == 0) {
			printf("%c\n", j);
			return 0;
		}
	}
	cout << "None" << endl;

	return 0;
}



Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>

const char roma[7] = {'I', 'V', 'X', 'L', 'C', 'D', 'M'};
const int cost[7] = {1, 5, 10, 50, 100, 500, 1000};

int main(){
	std::string str;
	while(std::cin >> str){
		int res = 0;

		for(int i = 0; i < str.size(); i++){
			int a = 0, b = 0;
			a = std::find(roma, roma + 7, str[i]) - roma;

			if(i == str.size() - 1)res += cost[a];
			else {
				b = std::find(roma, roma + 7, str[i + 1]) - roma;
				if(a >= b)res += cost[a];
				else if(a < b)res += (cost[b] - cost[a]), i++;
			}
		}

		std::cout << res << std::endl;
	}
	return 0;
}

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

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

/*{
  }*/

using vi = vector<int>;
using vvi = vector<vi>;
using P = pair<int,int>;

int n, a, b;
int h[101010];

bool check(int x){
  int sum = 0;
  rep(i, 0, n){
    sum += (max(0LL, h[i] - x*b) + a-b-1) / (a-b);
  }
  return sum <= x;
}

signed main() {
  cin >> n >> a >> b;
  rep(i, 0, n) cin >> h[i];

  int l = 0, r = 1e10;
  while(r-l > 1){
    int m = (l+r)/2;
    if(check(m)) r = m;
    else l = m;
  }

  cout << r << endl;

  return 0;
}



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

typedef long long ll;
#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n)   for(int i=(int)0; i<(int)n; i++)
#define llrep(i,n)   for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n) for(int i=(int)m; i<(int)n; i++)
#define all(var)     (var).begin(), (var).end()
#define prt(var)     cout << var << endl
#define prt_dbl(i,var) cout<<fixed<<setprecision(i)<<var<<endl;

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

int main(){
  ll N;
  vector<ll> A(5,0);
  cin>>N>>A.at(0)>>A.at(1)>>A.at(2)>>A.at(3)>>A.at(4);
  ll m = min(A.at(0),min(A.at(1),min(A.at(2),min(A.at(3),A.at(4)))));
  ll ans = 5;
  if(N%m!=0){
    ans+=N/m;
  }else{
    ans+=N/m-1;
  }

  cout<<ans<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000
using ll = long long ;

using namespace std;

int main(){
    int n;
    cin >> n;
    if (n<=9) cout << n << endl;
    else if (n<=99) cout << 9 << endl;
    else if (n<=999) cout << n-100+10 << endl;
    else if (n<=9999) cout << 909 << endl;
    else if (n<=99999) cout << n-10000+910 << endl;
    else cout << 90909 << endl;
}

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

int main(void){
    int n,m;
    cin >> n;
    vector<string> s(n);
    for(int i=0; i<n; i++){
        cin >> s.at(i);
    }
    cin >> m;
    vector<string> t(m);
    for(int i=0; i<m; i++){
        cin >> t.at(i);
    }

    int ans = 0;
    
    for(int i=0; i<n; i++){
        int cnt = 0;
        for(int j=0; j<n; j++){
            if(s.at(j) == s.at(i)){
                cnt++;
            }
        }
        for(int j=0; j<m; j++){
            if(t.at(j) == s.at(i)){
                cnt--;
            }
        }
        if(cnt > ans){
            ans = cnt;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256