akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

int main()
{
    int l[10];
    int v1, v2;
    char p;

    while( cin >> l[0] >> p >> l[1] >> p >> l[2] >> p >> l[3] >> p >> l[4] >> p >> l[5] >> p >> l[6] >> p >> l[7] >> p >> l[8] >> p >> l[9] >> p >> v1 >> p >> v2 )
    {
        double distance = 0;
        double x, y, h;

        for( int i = 0; i < 10; i++ )
            distance += l[i];

        h = distance / ( v1 + v2 );
        x = v1 * h;
        
        int section = 0;
        for( int i = 0; i < 10; i++ )
        {
            section++;
            x -= l[i];
            if( x <= 0 )
                break;
        }
        cout << section << endl;
    }
    return 0;
}


Measured memory_bytes: 3060
N = input()
N = int(N)
S = {}
for n in range(N):
  word = input()
  if word in S.keys():
    S[word] += 1
  else:
    S[word] = 1
max_value = max(S.values())
keys = sorted(list(S.keys()))
for word in keys:
  if S[word] == max_value:
    print(word)


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

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    int h;
    cin >> h;
    if (h >= k) ans++;
  }
  cout << ans << endl;
  return 0;
}



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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n,m;
    cin >> n >> m;
    vector<vector<pair<ll,ll>>> graph(n);
    for(i = 0;i < m;++i){
        ll l,r,d;
        cin >> l >> r >> d;
        --l;    --r;
        graph.at(l).emplace_back(r,d);
        graph.at(r).emplace_back(l,-d);
    }
    vector<ll> vdist(n, 1e14);
    for(i = 0;i < n;++i){
        if(vdist.at(i) != 1e14) continue;
        ll top = i;
        vdist.at(top) = 0;
        queue<ll> que;
        que.emplace(top);
        ll mind = 1e14;
        ll maxd = -1e14;
        while(!que.empty()){
            ll now = que.front();
            que.pop();
            ll dist = vdist.at(now);
            for(j = 0;j < graph.at(now).size();++j){
                ll next = graph.at(now).at(j).first;
                ll nd = graph.at(now).at(j).second;
                if(vdist.at(next) == 1e14){
                    vdist.at(next) = dist+nd;
                    que.emplace(next);
                    mind = min(dist+nd, mind);
                    maxd = max(dist+nd, maxd);
                }else{
                    if(dist + nd != vdist.at(next)){
                        cout << "No" << endl;
                        return 0;
                    }
                }
            }
        }
        if(maxd-mind > 1e9){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 14080
N, Ma, Mb = map(int, input().split())

sum_a = 0
sum_b = 0
A = []
B = []
C = []
for _ in range(N):
    a, b, c = map(int, input().split())
    sum_a += a
    sum_b += b
    A.append(a)
    B.append(b)
    C.append(c)

inf = 10 ** 9 + 7
# 3次元dpを考える
dp = [[[inf] * (sum_b + 1) for _ in range(sum_a + 1)] for _ in range(N + 1)]

dp[0][0][0] = 0
for i in range(N):
    for sa in range(sum_a):
        for sb in range(sum_b):
            if sa - A[i] >= 0 and sb - B[i] >= 0:
                dp[i + 1][sa][sb] = min(dp[i][sa - A[i]]
                                        [sb - B[i]] + C[i], dp[i][sa][sb])
            else:
                dp[i + 1][sa][sb] = min(dp[i][sa][sb], dp[i + 1][sa][sb])

ans = inf
for i in range(1, sum_a + 1):
    for j in range(1, sum_b + 1):
        if Ma * j == Mb * i:
            ans = min(ans, dp[N][i][j])

print(ans if ans != inf else -1)


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

using ll = long long;

using vi = vector<int>;
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()

using pi = pair<int,int>;
#define f first
#define s second
#define mp make_pair

// the code that we provide requires everything above this line to compile

int N, K;
int dp[100000], h[100000];

int main() {
    cin >> N >> K;
    for (int i = 0; i < N; i++)
        cin >> h[i];
    
    for (int i = 0; i < N; i++)
        dp[i] = INT_MAX;
    
    dp[0] = 0;
    for (int i = 1; i < N; i++)
        for (int j = 1; j <= min(i, K); j++)
            dp[i] = min(dp[i], dp[i - j] + abs(h[i - j] - h[i]));
    cout << dp[N - 1];
}


Measured memory_bytes: 4376
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    X,Y,Z = map(int,input().split())

    X,Y = Y,X
    X,Z = Z,X

    print(X,Y,Z)



main()


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>

#define INF 1010101010

using namespace std;

int main()
{
	int n;
	cin >> n;
	
	vector<int> dp(n + 1, INF);
	dp[0] = 0;
	for (int i = 1; i <= n; i++) {
		int p = 1;
		while (p <= i) {
			dp[i] = min(dp[i], dp[i - p] + 1);
			p *= 6;
		}
		p = 1;
		while (p <= i) {
			dp[i] = min(dp[i], dp[i - p] + 1);
			p *= 9;
		}
	}

	cout << dp[n] << endl;

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

vector<int> primes;

void getPrimes(int n) {
    for (int i = 2; i <= n; i++) {
        int cnt = 0;
        for (int j = 1; j <= i; j++) {
            if (i % j == 0) {
                cnt++;
            }
        }
        if (cnt == 2) {
            primes.push_back(i);
        }
    }
}

int main() {
    int n;
    cin >> n;
    ll mod = 1e9 + 7;
    getPrimes(n);
    ll ans = 1;
    int cnt[n + 1];
    for (int i = 0; i <= n; i++) {
        cnt[i] = 1;
    }
    for (int i = 2; i <= n; i++) {
        int num = i;
        for (int j = 0; j < primes.size(); j++) {
            while (num % primes[j] == 0) {
                num /= primes[j];
                cnt[primes[j]]++;
            }
        }
    }

    for (int i = 0; i <= n; i++) {
        ans *= cnt[i];
        ans %= mod;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, b;
    vector<vector<int>> a(3, vector<int>(3));
    vector<vector<bool>> punch(3, vector<bool>(3, false));
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            cin >> a[i][j];
        }
    }
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> b;
        for (int j = 0; j < 3; j++)
        {
            for (int k = 0; k < 3; k++)
            {
                if (b == a[j][k])
                {
                    punch[j][k] = true;
                }
            }
        }
    }
    if (punch[0][0] * punch[0][1] * punch[0][2] || punch[1][0] * punch[1][1] * punch[1][2] || punch[2][0] * punch[2][1] * punch[2][2] ||
        punch[0][0] * punch[1][0] * punch[2][0] || punch[0][1] * punch[1][1] * punch[2][1] || punch[0][2] * punch[1][2] * punch[2][2] ||
        punch[0][0] * punch[1][1] * punch[2][2] || punch[0][2] * punch[1][1] * punch[2][0])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  VI A(n);
  VVI x(n),y(n);
  rep(i,n){
    cin >> A[i];
    int xx,yy;
    rep(j,A[i]){
      cin >> xx >> yy;
      xx--;
      x[i].push_back(xx);
      y[i].push_back(yy);
    }
  }
  if(n == 1){
    cout << 1 << endl;
    return 0;
  }
  int ans = 0;
  rep(bit,1LL<<n){
    vector<bool> ok(n,false);
    int cnt = 0;
    rep(i,n){
      if( !!((bit>>i) & 1) == 1){
        ok[i] = true;
        cnt++;
      }
    }

    bool flag = true;
    rep(i,n){
      if( ok[i] ){
        rep(j,A[i]){
          if(ok[x[i][j]] != y[i][j]) flag = false;
        }
      }
    }
    if(flag) ans = max(ans,cnt);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>


int main(void){
int a,i;
float b,c,d,e,f,g,h,j;

scanf("%d",&a);
for(i = 1; i <= a; i++){
  scanf("%f %f %f %f %f %f %f %f",&b,&c,&d,&e,&f,&g,&h,&j);


  if((e - c)/(d - b) == (j - g)/(h - f))
   printf("YES\n");
  
  else
  printf("NO\n");
  
}
return 0;

}


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

string a, b;
int ans = -1;

int main() {
    cin >> a >> b;
    for(int start  = 0; start+b.length() <= a.length(); start++) {
        int changes = 0;
        for(int i = 0; i < b.length(); i++)
            if(b[i] != a[start+i])
                changes++;
        if(ans == -1 || changes < ans)
            ans = changes;

    }
    cout << ans;

}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int main() {
  int n,m;
  cin >> n >> m;
  vp p(m,P(0,0));
  rep(i,m) {
    int a,b;
    cin >> a >> b;
    p.at(i) = P(b,a);
  }

  int ans=0;
  sort(rng(p));

  int beam = p.at(0).fi-1;
  ans++;
  orep(i,m-1) {
    int hidari = p.at(i).se; int migi = p.at(i).fi;
    if(hidari<=beam) continue;
      beam=migi-1;
      ans++;
  }
  cout << ans << endl;



  return 0;
}


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

using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(nullptr); cout.tie(0)
#define endl "\n"
#define int long long
typedef vector<int> vi;
#define all(x) x.begin(),x.end()
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define OO 1e9
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
typedef long long ll;
#define in_range(x, y, r, c) ((x >= 0 && x < r && y >= 0 && y < c))


const double eps=1e-9;
const int MOD=1073741824;
const int N=30+9;
const int inf = 1<<30;


template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <typename T> T exp(T b, T p){T x = 1;while(p){if(p&1)x=(x*b);b=(b*b);p=p>>1;}return x;}
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
void boostIO() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
int32_t main() {
    boostIO();
int n,mx1=-inf,mx2=-inf;
cin>>n;
vi arr(n),q(n);
    for (int i = 0; i < n; ++i) {
        cin>>arr[i];
        q[i]=arr[i];
    }
    sort(all(arr));
    for (int i = 0; i < n; ++i) {
        if(q[i]==arr[n-1])cout<<arr[n-2]<<endl;
        else cout<<arr[n-1]<<endl;
    }
}

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

namespace ConsoleApp1 {
    public class Class {
        static void Main(string[] args) {
            var XN = RL<int>();
            if(XN[1] == 0) {
                Console.Write(XN[0]);
                return;
            }
            var A = RL<int>();
            var t = new int[102];
            for (var i = 0; i < XN[1]; i++) {
                t[A[i]]--; 
            }
            var ans = 1000;
            for (var i = 0; i < t.Length; i++) {
                if(t[i] == 0) {
                    if (Math.Abs(XN[0] - i) < Math.Abs(XN[0] - ans)) {
                        ans = i;
                    }
                }
            }
            if(ans == 1000 ) {
                Console.Write(XN[0]);
                return;
            }
            Console.Write(ans);
        }

        static T[] RL<T>() where T : IComparable {
            if (typeof(T) == typeof(int)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(int.Parse).ToArray();
            }
            if (typeof(T) == typeof(long)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(long.Parse).ToArray();
            }
            if (typeof(T) == typeof(double)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(double.Parse).ToArray();
            }
            if (typeof(T) == typeof(decimal)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(decimal.Parse).ToArray();
            }
            return (T[])(object)Console.ReadLine().Trim().Split().ToArray();
        }
    }
}

Measured memory_bytes: 28252
process.stdin.resume();
process.stdin.setEncoding('utf8');
// Your code here!

function main(input) {
    var arg = input.split('\n').map((n) => parseInt(n));
    var ans = 0
    for (var f = 0; f <= arg[0]; f++){
        for (var h = 0; h <= arg[1]; h++){
            for(var o = 0; o <= arg[2]; o++){
                if (500 * f + 100 * h + 50 * o === arg[3]){
                    ans += 1;
                }
            }
        }
    }
    console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7628
using System;

namespace B___Polygon
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var input = Console.ReadLine().Split(' ');
            var max = int.Parse(input[0]);
            var sum = 0;
            for(var i=0;i<n;i++)
            {
                max=Math.Max(int.Parse(input[i]), max);
                sum += int.Parse(input[i]);
            }
            if(sum-max>max)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }


        }
    }
}

Measured memory_bytes: 11092
from copy import copy
N, K = map(int, input().split())

p = [int(e) for e in input().split()]

now_sum = sum(p[0:K])
now_max = copy(now_sum)


for i in range(K,N):
    now_sum = now_sum - p[i - K] + p[i]
    if now_sum > now_max:
        now_max = copy(now_sum)

print((K + now_max)/2)

Measured memory_bytes: 25572
/*
https://beta.atcoder.jp/contests/abc085/tasks
*/
#include<iostream>
#include<string>
using namespace std;

int main(){
  string str;
  cin>>str;
  for(int i=0;i<str.size();i++)
    if(str[i]=='7') {str[i]='8';break;}

  cout<<str<<"\n";
}


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

int main()
{
    std::uint64_t X;
    std::cin >> X;

    std::uint64_t a = (X / 500) * 1000;
    X %= 500;
    a += (X / 5) * 5;

    std::cout << a << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mkp make_pair
#define rint register int
#define INF ((1 << 30) - 1)
#define FI(n) FastIO::read(n)
#define FO(n) FastIO::write(n)
#define Pair pair < int, int >
#define mst(a,b) memset(a,b,sizeof(a))
#define foR(i, k, j) for(rint i = (k); i >= (j); i--)
#define For(i, k, j) for(rint i = (k); i <= (j); i++)
#define Foe(i, u) for(rint i = lst[u], v = e[i].v; i; i = e[i].nxt, v = e[i].v)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define file(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout)
#define ull unsigned ll
const int P = 998244353; //
using namespace std;
inline void ckmax(int &a, int b) {a = max(a, b);}
inline void ckmin(int &a, int b) {a = min(a, b);}
inline void mulmod(int &a, int b) {a = 1ll * a * b % P;}
inline void addmod(int &a, int b) {int t = a + b; a = (t >= P ? t - P : t); }
inline int ksm(int a, int b) {int ans=1; for(;b;b>>=1) {if(b&1) ans=1ll*ans*a%P;a=1ll*a*a%P;}return ans;}
inline int inv(int a) {return ksm(a, P-2);}

inline void printarray(int *a, int n) {For(i, 1, n) fprintf(stderr, "%d ", a[i]); fprintf(stderr, "\n");}
namespace FastIO {
    const int SIZE=1<<16; char buf[SIZE], obuf[SIZE], str[64]; int bi=SIZE, bn=SIZE, opt;
    int read(char *s) {
        while (bn) {for (;bi<bn&&buf[bi]<=' ';bi++);if (bi<bn) break; bn=fread(buf,1,SIZE,stdin),bi=0;}
        int sn=0;while (bn) {for (;bi<bn&&buf[bi]>' ';bi++) s[sn++]=buf[bi];if (bi<bn) break; bn=fread(buf,1,SIZE,stdin),bi=0;}s[sn]=0;return sn;
    }
    bool read(int& x) {if(x)x=0;int bf=0,n=read(str); if(!n) return 0; int i=0; if (str[i]=='-') bf=1,i=1; for(x=0;i<n;i++) x=x*10+str[i]-'0'; if(bf) x=-x; return 1;}
    void write(int x) {
        if(!x) obuf[opt++] = '0'; else {if(x<0) obuf[opt++]='-',x=-x;int sn=0; while(x)str[sn++]=x%10+'0',x/=10;for (int i=sn-1;i>=0;i--) obuf[opt++]=str[i];}
        if (opt>=(SIZE>>1)){fwrite(obuf, 1, opt, stdout); opt=0;}
    }
    void write(char x) {obuf[opt++]=x;if (opt>=(SIZE>>1)){fwrite(obuf, 1, opt, stdout); opt=0;}}
    void Fflush() { if (opt) fwrite(obuf, 1, opt, stdout); opt=0;}
};
inline int gcd(int a, int b) {
	return !b ? a : gcd(b, a % b);
}
signed main()
{
    #ifndef ONLINE_JUDGE
        file("pro");
    #endif
    int x; cin >> x;
	cout << 360 / gcd(x, 360) << endl;
    return FastIO::Fflush(), 0;
}
/*
Think twice :
mod ?
INF ?
n = 1 ?
long long ?
Fastio::Fflush() ?
*/


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define per1(i,n) for(int i=n;i>0;i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vec A(n);
    rep(i,n) cin>>A[i];
    sort(all(A),greater<ll>());
    ll ans=0;
    rep(i,n) ans+=A[i/2];
    cout<<ans-A[0];
}

Measured memory_bytes: 4764
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std ;
#define int long long
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define mod 1000000007

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

int n ;
int arr[1000005] ;
int freq[1000005] ;
string str ;
set<int> hf(int num)
{
    set<int> ret ;
    if(num == 1)
        return ret ;
    if(num%2 == 0)
    {
        ret.insert(2) ;
        while(num%2 == 0)
            num /= 2 ;
    }
    for(int i=3 ; i*i<=num ; i+=2)
    {
        if(num%i==0)
        {
            ret.insert(i) ;
            while(num%i == 0)
                num /= i ;
        }
    }
    if(num>1)
        ret.insert(num) ;
    return ret ;
}
void solve()
{
    cin >> n ;
    for(int i=1 ; i<=n ; i++)
        cin >> arr[i] ;
    int f = 0 ;
    for(int i=1 ; i<=n ; i++)
    {
        set<int> ret = hf(arr[i]) ;
        for(auto it : ret)
        {
            freq[it]++ ;
            if(freq[it]>1)
                f=1 ;
        }
    }
    if(!f)
    {
        cout << "pairwise coprime" ;
        return ;
    }
    int g = arr[1] ;
    for(int i=1 ; i<=n ; i++)
    {
        g = __gcd(g,arr[i]) ;
    }
    if(g == 1)
    {
        cout << "setwise coprime" ;
        return ;
    }
    cout << "not coprime" ;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int tt = 1;
	//cin >> tt ;
	while(tt--)
	{
	     solve() ;
	}
}


Measured memory_bytes: 19260
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <string>
#include <cmath>
#include <map>
#include <iomanip>
#include <tuple>
#include <functional>
#include <bitset>
#define INF 1000000009
#define LINF 1000000000000000009
#define double long double
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
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 (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

template<class T>
class segtree {
	int n;
	vector<T> data;
	T def;
	function<T(T, T)> operation;
	function<T(T, T)> update;
	T _query(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l) return def;
		if (a <= l && r <= b) return data[k];
		T c1 = _query(a, b, 2 * k + 1, l, (l + r) / 2);
		T c2 = _query(a, b, 2 * k + 2, (l + r) / 2, r);
		return operation(c1, c2);
	}
public:
	segtree(size_t _n, T _def, function<T(T, T)> _operation, function<T(T, T)> _update)
		:def(_def), operation(_operation), update(_update) {
		n = 1;
		while (n < _n) {
			n *= 2;
		}
		data = vector<T>(2 * n - 1, def);
	}
	void change(int i, T x) {
		i += n - 1;
		data[i] = update(data[i], x);
		while (i > 0) {
			i = (i - 1) / 2;
			data[i] = operation(data[i * 2 + 1], data[i * 2 + 2]);
		}
	}
	T query(int a, int b) {
		return _query(a, b, 0, 0, n);
	}
	T operator[](int i) {
		return data[i + n - 1];
	}
};

int main(){
	int n, m;
	string s;
	cin >> n >> m >> s;
	segtree<int> seg(n + 2, INF, [](int a, int b) {return min(a, b); }, [](int a, int b) {return b; });
	vector<int> ans(n + 1);
	seg.change(n, 0);
	ans[0] = n;
	for (int i = n - 1; i >= 0; i--) {
		if (s[i] == '0') {
			int c = seg.query(i + 1, min(i + m + 1, n + 1));
			seg.change(i, c + 1);
			if(c < INF) ans[c + 1] = i;
		}
	}
	if (seg[0] >= INF) {
		cout << -1 << endl;
		return 0;
	}
	for (int i = seg[0] - 1; i >= 0; i--) {
		cout << ans[i] - ans[i + 1] << ' ';
	}
	cout << endl;
}

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

int main() {
    int64_t x; cin >> x;
    for (int64_t a = 1; a <= 1000; a++) {
        for (int64_t b = -1000; b <= 1000; b++) {
            if (a*a*a*a*a - b*b*b*b*b == x) {
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }
}

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

int main() {
  int n, m;
  cin >> n >> m;
  if (n == m){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define ull unsigned long long
#define ld long double

#define mod 1000000007
#define EULER 2.7182818284
#define INF 1000000000

#define pb push_back
#define ins insert
#define IT iterator
#define PQ priority_queue

#define fi first
#define se second
#define maxe max_element
#define mine min_element
#define er erase
#define lb lower_bound
#define ub upper_bound

#define vi vector<int>
#define vll vector<ll>
#define vb vector<bool>
#define pi pair<int,int>
#define pll pair<ll,ll>


#define mem(v,i) memset(v,i,sizeof(v)) // v is array. To set all elements to 0 or -1 only. mem(arr,0);


#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORd(i,a,b) for(int i=(a);i>=(b);i--)
#define FORl(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORN(i,n) for(int i=(0);i<(n);i++)
#define FORR(i,n) for(int i=(n);i>=0;i--)
#define bs bitset
#define bpc(a) __builtin_popcount(a)

ll max(ll a,ll b)
{
    if(a>b)return a;return b;
}
ll min(ll a,ll b)
{
    if(a<b)return a;return b;
}

ll mypow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if(b==0)
    return a;
    return gcd(b,a%b);
}
//..............................!!!!!!Get ready to fight!!!!!!............................



int main()
{
    fast
    
    int A,B,C,D;
cin>>A>>B>>C>>D;
 int X=(A+D-1)/D;
 int Y=(C+B-1)/B;
 cout<<(X>=Y?"Yes":"No")<<"\n";
    return 0;
}

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

int main() 
{
    char s[10];
	cin>>s;
	for(int i=0;i<4;i++) 
	s[i]-='0';
	int a=s[0]*10+s[1];
	int b=s[2]*10+s[3];
	
	if (1<=a&&a<=12) 
	{
		if(1<=b&&b<=12)
		cout<<"AMBIGUOUS";
		else 
	cout<<"MMYY";
	} 
	else 
	{
		if(1<=b&&b<=12) 
		cout<<"YYMM";
		else 
		cout<<"NA";
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>

using namespace std;

typedef pair<int, int> P;
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define _1 first
#define _2 second
#define pb push_back
#define mod 1000000007
#define INF 1050000000

const int maxn = 1e5 + 10;
const int n = 50;

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

	int a, b; cin >> a >> b;

	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) Print("Possible");
	else Print("Impossible");

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>

#define ll long long int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

using namespace std;

int main(){
	int A,B,C;
	cin >> A >> B >> C;
	if((A<=C && C <= B) || (A>=C &&  C >= B)){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

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

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

    int ans = 0;
    n = N;
    while (n) {
        ans += n % 10;
        n /= 10;
    }

    if (N % ans == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


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

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

  sort(s, s+N);
  for(int i=0; i<N; i++){
    if(sum%10!=0)break;
    else if(s[i]%10!=0)sum-=s[i];
  }
  cout<<(sum%10==0?0:sum);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX (ll)(5e5 + 7)
#define INF (ll)(1e18 + 7)
#define MOD (ll)(1e9 + 7)

using namespace std;
using ll = long long;
using cd = complex<double>;

void f_io () {
	ios_base :: sync_with_stdio (false);
	cin.tie (nullptr);
}
ll ind[MAX];
int main () {
	ll n, x, m;
	cin >> n >> x >> m;
	vector<ll> ve;
	ve.push_back (x);
	ll st = 0;
	fill (ind, ind + MAX, -1);
	for (ll i = 2; i <= m; i++) {
		ll nw = (ve.back () * 1LL * ve.back ()) % m;
		if (ind[nw] >= 0) {
			st = ind[nw];
			break;
		}
		else {
			ind[nw] = ve.size ();
			ve.push_back (nw);
		}
	}
	ll ans = 0;
	for (ll i = 1; i < ve.size (); i++) {
		ve[i] += ve[i - 1];
	}
	if (min (st, n)) {
		ans = ve[min (st, n) - 1];
	}
	n -= min (n, st);
	ll aa = ans;
	if (n) {
		ans += (n / ((ll)ve.size () - st)) * 1LL * (ve.back () - ans);
		ll r = (n % ((ll)ve.size () - st));
		if (st + r - 1 >= 0) {
			ans += (ve[st + r - 1] - aa);
		}
	}
	cout << ans << "\n";
}


Measured memory_bytes: 7824
open Printf
open Scanf

let id x = x

let solve m n sg =
  let am = Array.make_matrix (n + 2) (n + 2) false in
  let que = Queue.create () in
  let ars = Array.make (n + 2) false in
  let arg = Array.make (n + 2) false in
  for i = 0 to n do
    for j = 1 to m do
      let k = if i + j >= n + 1 then n + 1 else i + j + sg.(i + j) in
      am.(i).(min (max 0 k) (n + 1)) <- true
    done
  done;
  Queue.push 0 que;
  ars.(0) <- true;
  while (not (Queue.is_empty que)) do
    let i = Queue.pop que in
    for j = 0 to n + 1 do
      if am.(i).(j) then
        begin
          if ars.(j) then ()
          else begin
              ars.(j) <- true;
              Queue.push j que
            end
        end
      else ()
    done
  done;
  Queue.push (n + 1) que;
  arg.(n + 1) <- true;
  while (not (Queue.is_empty que)) do
    let i = Queue.pop que in
    for j = 0 to n + 1 do
      if am.(j).(i) then
        begin
          if arg.(j) then ()
          else begin
              arg.(j) <- true;
              Queue.push j que
            end
        end
      else ()
    done
  done;
  let rec iter i =
    if i = n + 2 then printf "OK\n"
    else if ars.(i) && not arg.(i) then
      printf "NG\n"
    else iter (i + 1) in
  iter 0
    
let () = 
  let rec loop () = 
    let m = scanf "%d " id in
    if m = 0 then ()
    else
      begin
        let n = scanf "%d " id in
        let sg = Array.make (n + 2) 0 in
        for i = 1 to n do
          let d = scanf "%d " id in
          sg.(i) <- d
        done;
        solve m n sg;
        loop ()
      end
  in loop ()



Measured memory_bytes: 8428
import numpy as np
n,w,*wv=map(int,open(0).read().split())
wei=wv[0::2]
val=wv[1::2]
sack=np.array([float('inf') for i in range(sum(val)+1)])
sack[0]=0
for i in range(n):
  sack[val[i]:]=np.minimum(sack[val[i]:],sack[:-val[i]]+wei[i])
print(np.where(sack<=w)[0][-1])

Measured memory_bytes: 16232
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll n; cin >> n;
    string s; cin >> s;
    string t; cin >> t;
    string ans;
    REP(i, n){
        ans.push_back(s[i]);
        ans.push_back(t[i]);
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    int n;cin>>n;
    int d[n],ans=0;
    
    for(int i=0;i<n;++i){
        cin>>d[i];
    }
    
    for(int i=0;i<n;++i){
        for(int j=0;j<i;++j){
            ans+=d[i]*d[j];
        }
    }
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void) {
	char s[100000];
	scanf("%s", s);
	int i;
	int count = 0;
	for (i = 0; s[i] != '\0'; i++) {
		if (s[i] == '0' && s[i+1] == '0') {
			s[i+1] = '1';
			count++;
		} else if (s[i] == '1' && s[i+1] == '1'){
			s[i+1] = '0';
			count++;
		}
	}
	printf("%d\n", count);
	return 0;
}

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

using namespace std;

#define ll long long

int main(){
    int N, M;
    vector<string>A,B;

    cin >> N >> M;
    for(int i=0; i < N; ++i){
        string s;
        cin >> s;
        A.push_back(s);
    }
    for(int i=0; i < M; ++i){
        string s;
        cin >> s;
        B.push_back(s);
    }

    for(int i=0; i < N-M+1; ++i){
        for(int j=0; j<N-M+1; ++j){
            int flag = 1;
            for(int k = 0; k < M; ++k){
                for(int l = 0; l < M; ++l){
                    if(B[k][l]!=A[i+k][j+l])
                        flag = 0;
                }
            }
            if(flag){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    
    cout << "No" <<endl;

    return 0;
}

Measured memory_bytes: 256
import std.conv, std.functional, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.container, std.math, std.numeric, std.range, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }


enum MO = 10L^^9 + 7;

int N;
string S;

void main() {
  try {
    for (; ; ) {
      N = readInt();
      S = readToken();
      int[char] cnt;
      foreach (k; S) {
        ++cnt[k];
      }
      long ans = 1;
      foreach (k, v; cnt) {
        ans = ans * (v + 1) % MO;
      }
      ans -= 1;
      ans = (ans % MO + MO) % MO;
      writeln(ans);
    }
  } catch (EOFException e) {
  }
}


Measured memory_bytes: 508
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const int inf = 1e9+7;
const int N = 1e6+9;

void solve() {
    int a, b, n, m;
    cin>>n;
    ll s=0;
    map<ll, ll> mp;
    for(int i=0;i<n;++i) {
        cin>>a;
        mp[a]++;
        s+=a;
    }
    cin>>m;
    while(m--) {
        cin>>a>>b;
        ll x = mp[a];
        mp[a]=0;
        mp[b]+=x;

        ll p = x*a;
        ll q = x*b;
        if(b>=a) {
            ll d = b-a;
            s += x*d;
        }
        else {
            ll d = a-b;
            s -= x*d;
        }
        cout<<s<<endl;
    }
}
int main() {
    ios_base::sync_with_stdio(0);
    int T=1 ,cas=0;
    while(T--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 9464
#include<bits/stdc++.h>
#define rep(i,a) for(int i=0;i<a;i++)
#define VE vector<int>
using namespace std;
int main(){
    int n;
    cin >> n;
    VE vec(n,0);
    int count=0;//R nokosuu
    int count2=0;
    rep(i,n){
        char a;
        cin >>a;
        if(a=='W') {
            vec[i]=1;
        }
        else count++;
    }
    rep(i,count){
        if(vec[i]==1) count2++;
    }
    
    cout << count2 << endl;
}

Measured memory_bytes: 4040
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sn = new Scanner(System.in);
        Input input = InputParser.perse(sn, 3);
        sn.close();

        int h = input.getInt(1, 1);
        int w = input.getInt(2, 1);
        int n = input.getInt(3, 1);
        
        int max = Math.max(h, w);
        int min = n % max == 0 ? n / max : n / max + 1;
        System.out.println(min);
    }

    private static class InputParser {
        static Input perse(Scanner sn, int loop) {
            Input result = new Input();
            while (loop-- > 0) {
                String[] args = sn.nextLine().split(" ");
                result.addAll(args);
            }
            return result;
        }
    }

    private static class Input {
        private Map<Integer, Map<Integer, String>> inputs;
        private int now = 1;
        private int innerNext = 1;

        Input() {
            inputs = new HashMap<>();
            inputs.put(now, new HashMap<>());
        }

        void addAll(String[] args) {
            for (String str : args) {
                add(str);
            }
            next();
        }

        void add(String str) {
            inputs.get(now).put(innerNext++, str);
        }

        void next() {
            inputs.put(++now, new HashMap<>());
            innerNext = 1;
        }

        String getString(int i, int j) {
            return inputs.get(i).get(j);
        }

        int getInt(int i, int j) {
            return Integer.parseInt(getString(i, j));
        }

        double getDouble(int i, int j) {
            return Double.parseDouble(getString(i, j));
        }

        List<Integer> getIntLine(int i) {
            return inputs.get(i).entrySet().stream().map(e -> Integer.parseInt(e.getValue()))
                    .collect(Collectors.toList());
        }

        List<Integer> getIntVerticalLine(int line, int start, int size) {
            List<Integer> list = new ArrayList<>();
            for(int i = start; i < start + size; i++) {
                list.add(getInt(i, line));
            }
            return list;
        }
    }
}


Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<queue>

struct Node{
    int value = 0;
};

int main(void){
    int n, q;
    std::cin >> n >> q;
    std::vector<Node> node(n);
    std::vector<int> used(n);
    std::vector<std::vector<int>>edge(n);
    int a, b;
    for(int i = 0; i < n-1; i++){
        std::cin >> a >> b;
        a--;
        b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    int p, x;
    for(int i = 0; i < q; i++){
        std::cin >> p >> x;
        p--;
        node[p].value += x;
    }

    std::queue<int> que;
    que.push(0);
    used[0] = 1;
    while(!que.empty()){
        int cur = que.front(); que.pop();
        int size = edge[cur].size();
        used[cur] = 1;
        for(int i = 0; i < size; i++){
            int next = edge[cur][i];
            if(used[next]) continue;
            node[next].value += node[cur].value;
            que.push(next);
        }
    }

    for(int i = 0; i < n; i++){
        std::cout << node[i].value << " ";
    }
    std::cout << std::endl;

    return 0;
}

Measured memory_bytes: 17452
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll n;
    string s;
    cin>>n>>s;
    ll sum = 1;
    char bef = s[0];
    for(int i=0;i<s.size();i++){
        if(bef != s[i])sum++;
        bef = s[i];
    }
    cout<<sum<<endl;
   
}



Measured memory_bytes: 512
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

S = sys.stdin.buffer.readline().decode().rstrip()
T = S[::-1]

cnt = 0
for i in range(len(S)):
    cnt += S[i] != T[i]
ans = cnt // 2
print(ans)


Measured memory_bytes: 23244
#include<stdio.h>
#include<stdlib.h>

struct node{
	int key;
	struct node *parent;
	struct node *left;
	struct node *right;
};

typedef struct node *Node;

Node root,NIL;

Node find(Node u,int k){
	while(u != NIL && k != u->key){
		if(k < u->key){ u = u->left; }
		else{ u = u->right; }
	}
	return u;
}

void insert(int k){
	Node y = NIL;
	Node x = root;

	Node z = (Node)malloc(sizeof(struct node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;

	while(x != NIL){
		y = x;
		if(z->key < x->key){ x = x->left; }
		else{ x = x->right; }
	}
	z->parent = y;

	if(y == NIL){ root = z; }
	else if(z->key < y->key){ y->left = z; }
	else{ y->right = z; }
}

void inorder(Node u){
	if(u == NIL){ return; }
	inorder(u->left);
	printf(" %d",u->key);
	inorder(u->right);
}

void preorder(Node u){
	if(u == NIL){ return; }
	printf(" %d",u->key);
	preorder(u->left);
	preorder(u->right);
}

void print(){
	inorder(root);
	puts("");
	preorder(root);
	puts("");
}

int main(){
	int n,i,j,z,x;
	char s[10];

	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",s);
		if(s[0] == 'f'){
			scanf("%d",&x);
			Node t = find(root,x);
			if(t == NIL)printf("no\n");
			else printf("yes\n");
		}
		else if(s[0] == 'i'){
			scanf("%d",&z);
			insert(z);
		}
		else{ print(); }
	}
	return 0;
}



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


int main(){

    long a, b;
    cin >> a >> b;

    long z = max(a, b);
    long inc = max(a, b);

    while(true){
        if (z % a == 0 && z % b == 0) {
            break;
        }
        z += inc;
    }
    cout << z << endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define X first
#define Y second
#define pie 3.14159265358979323846
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int mod =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
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;
}

ll RS(ll N,ll P,ll M){
    if(P==0){
        return 1;
    }else{
        if(P%2==0){
            ll t=RS(N,P/2,M);
            return t*t%M;
        }else{
            return N*RS(N,P-1,M)%M;
        }
    }
}
bool greater_pair(pair<ll,ll> a,pair<ll,ll> b){
    if(a.first!=b.first){
        return a.first>b.first;
    }else{
        return a.second>b.second;
    }
}
int main() {
    ios::sync_with_stdio(false);
    ll A,B,N;
    cin>>A>>B>>N;
    ll ans=0;
    if(B==1){
        cout<<0<<endl;
        return 0;
    }
    if(N<B){
        //x=Nが最大値
        ans=A*N/B;
    }else{
        //x=B-1が最大値
        ans=A;
        if(A%B==0){
            ans-=A/B;
        }else{
            ans-=A/B+1;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

    public class Program
    {
        public static void Main(string[] args)
        {
            new C().test();
        }
    }

	public class C
	{
		public void test()
		{
			// N人の社員
			var input = CommonRead.ReadInt();
			var subordinate = CommonRead.ReadIntL();

			// 数字でグループ化
			var groupSub = subordinate.GroupBy(g => g)
				.Select(s=>new { key = s.Key, value = s.Count() }).
				ToDictionary(d=>d.key,d=>d.value);

			// 社員数分繰り返す
			for (var i =1; i < input+1; i++)
			{
				// 一致したら件数が出力される
				Console.WriteLine(groupSub.ContainsKey(i) ? groupSub[i] : 0);


			}

		}
	}

static class CommonRead
{
    public static string ReadStr()
    {
        return Console.ReadLine();
    }
    public static string[] ReadStrA()
    {
        return ReadStr().Split(' ');
    }
    public static List<string> ReadStrL()
    {
        return ReadStrA().ToList();
    }
    public static int ReadInt()
    {
        return Convert.ToInt32(ReadStr());
    }
    public static int[] ReadIntA()
    {
        return ReadStrA().Select(s => Convert.ToInt32(s)).ToArray();
    }
    public static List<int> ReadIntL()
    {
        return ReadStrA().Select(s => Convert.ToInt32(s)).ToList();
    }
    public static long ReadLong()
    {
        return Convert.ToInt64(ReadStr());
    }
    public static long[] ReadLongA()
    {
        return ReadStrA().Select(s => Convert.ToInt64(s)).ToArray();
    }
    public static List<long> ReadLongL()
    {
        return ReadStrA().Select(s => Convert.ToInt64(s)).ToList();
    }

    public static decimal ReadDecimal()
    {
        return Convert.ToDecimal(ReadStr());
    }
    public static decimal[] ReadDecimalA()
    {
        return ReadStrA().Select(s => Convert.ToDecimal(s)).ToArray();
    }
    public static List<decimal> ReadDecimalL()
    {
        return ReadStrA().Select(s => Convert.ToDecimal(s)).ToList();
    }

    public static double ReadDouble()
    {
        return Convert.ToDouble(ReadStr());
    }
    public static double[] ReadDoubleA()
    {
        return ReadStrA().Select(s => Convert.ToDouble(s)).ToArray();
    }
    public static List<double> ReadDoubleL()
    {
        return ReadStrA().Select(s => Convert.ToDouble(s)).ToList();
    }

}


Measured memory_bytes: 77872