akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

char s[100010];
int main(){
	int n,k;
	scanf("%d%d%s",&n,&k,s);	
	int cnt=0;
	int i=0;
	while(i<n){
		while(i<n&&s[i]=='R')i++;
		while(i<n&&s[i]=='L')i++;
		cnt++;
	}
	ll temp=min(k,max(cnt-2,0));
	k-=temp;
	cnt-=temp;
	
	ll ans=1e9;
	if(cnt>2){
		//kが足りない
		ans=n-cnt*2+(s[0]=='L')+(s[n-1]=='R');
	}else if(cnt==2){
		int aaa=(s[0]=='L')+(s[n-1]=='R');
		if(aaa==2){
			if(k)ans=n-1;
			else ans=n-2;
		}else if(aaa==1){
			if(k)ans=n-1;
			else ans=n-3;
		}else{
			if(k>=2)ans=n-1;
			else if(k==1)ans=n-2;
			else ans=n-4;
		}
	}else if(cnt==1){
		if(s[0]!=s[n-1]&&k==0)ans=n-2;
		else ans=n-1;
	}
	printf("%d",ans);
}

Measured memory_bytes: 256
if __name__ == '__main__':
    n = int(input())
    s = input()
    k = int(input())
    sk = s[k-1]
    anslst = []
    for i in s:
        if sk != i:
            anslst.append("*")
        else:
            anslst.append(sk)
    for a in anslst:
        print(a, end="")
    print("\n")

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)

using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int, int>;
using vpii=vector<pii>;

template<class T,class U>ostream&operator<<(ostream&os,const pair<T,U>p){os<<"("<<p.fst<<", "<<p.scd<<")";return os;}
template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
template<typename T>T&max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T&min(T&a,T&b){if(a < b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a < b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a > b){a=b;return true;}return false;}

constexpr int inf = 1e9;
constexpr ll linf = 3e18;
constexpr double eps = 1e-9;

int dp[15][1125];
vi primes;

void sieve()
{
    bool p[1301];

    rep(i, 1301) p[i] = true;

    p[0] = p[1] = false;

    for (int i = 2; i <= 1300; ++i) {
        if (!p[i]) continue;

        for (int j = i + i; j <= 1300; j += i) {
            p[j] = false;
        }
    }

    for (int i = 2; i <= 1125; ++i) if (p[i]) {
        primes.PB(i);
    }
}

int main()
{
    sieve();

    dp[0][0] = 1;

    for (int i = 0; i < primes.size(); ++i) {
        for (int j = 14; j >= 1; --j) {
            for (int k = 0; k <= 1120; ++k) {
                if (k - primes[i] >= 0) dp[j][k] += dp[j - 1][k - primes[i]];
            }
        }
    }

    int n, k;

    while (cin >> n >> k, n && k) {
        cout << dp[k][n] << endl;
    }
}

Measured memory_bytes: 3120
#include<bits/stdc++.h>
using ll = long long;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define ALL(x) x.begin(),x.end()

#define INF (int)1e9 //10^9:∞
#define LLINF (long long)1e12
#define MOD (int)1e9+7 //10^9+7:合同式の法
#define PI 3.141592653589
#define PB push_back
#define F first
#define S second
#define __MAGIC__ ios::sync_with_stdio(false);cin.tie(nullptr);

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define Graph vector<vector<int>>
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VPII vector<pair<int,int>>

#define DDD fixed<<setprecision(10)

using namespace std;
/*..................DEFINE GLOBAL VARIABLES...................*/


/*.....................DEFINE FUNCTIONS ......................*/



/*.........................kemkemG0...........................*/
signed main() {
	__MAGIC__


	int g[4][4];
	FOR(i, 1, 3)FOR(j, 1, 3) {
		cin >> g[i][j];
	}
	int a1, a2, a3;

	int maxb1 = INF;
	FOR(i, 1, 3) {maxb1 = min(maxb1, g[i][1]);}
	bool ok = false;
	FOR(b1, 0, maxb1) {
		a1 = g[1][1] - b1;
		a2 = g[2][1] - b1;
		a3 = g[3][1] - b1;
		if (	g[1][2] - a1 == g[2][2] - a2 && g[2][2] - a2 == g[3][2] - a3

		        &&		 g[1][3] - a1 == g[2][3] - a2 && g[2][3] - a2 == g[3][3] - a3 ) {ok = true; break;}
	}
	YesNo(ok)













	return 0;
}













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

int main(void){
  vector<bool> tiles;
  int length;
  bool tile;
  char c;
  for(length = 0; (c = getchar()) != '\n'; length++){
    tiles.emplace_back(c == '0');
  }
  bool diff = true;
  int count = 0;
  for(int i = 0; i < length; i++){
    if(tiles[i] != diff) count++;
    diff = !diff;
  }

  if(length - count > count)
    cout << count << endl;
  else
    cout << length - count << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(){
    int i,cnt,len;

    while(1){
        char input[1000];
        if(scanf("%s",input)==EOF) break;
        len=strlen(input);
        int plus=1;
        for(i=0;i<len/2;i++){
            if(input[i]!=input[len-i-1]){
                plus = 0;
                break;
            }
        }
        cnt+=plus;
    }
    printf("%d\n",cnt);
    return 0;
}

Measured memory_bytes: 536
#include<bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;

#define endl            "\n"
#define forn(i,x,n)     for(int i=x; i<n; i++)
#define forit(it, m)    for(decltype(m)::iterator it = m.begin(); it!=m.end(); ++it)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void zeus()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}



int32_t main() {

    zeus();
    int n; cin >> n;

    string s[n];

    int cnt1 = 0, cnt2 = 0, cnt3 = 0, cnt4 = 0;
    forn(i, 0, n) {
        cin >> s[i];
        if (s[i] == "AC")
            cnt1++;
        else if (s[i] == "WA")
            cnt2++;
        else if (s[i] == "TLE")
            cnt3++;
        else
            cnt4++;

    }

    cout << "AC x " << cnt1 << endl;
    cout << "WA x " << cnt2 << endl;
    cout << "TLE x " << cnt3 << endl;
    cout << "RE x " << cnt4 << endl;




}

Measured memory_bytes: 6788
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T>inline bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>inline bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int main(void) {
    string s;
    cin >> s;
    REP(i, 5) printf("%c", s[i]);
    printf(" ");
    REP(i, 7) printf("%c", s[i + 6]);
    printf(" ");
    REP(i, 5) printf("%c", s[i + 14]);
    puts("");
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <random>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0)
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli n, m;
lli a[10];
lli cost[] = { 0,2,5,5,4,5,6,3,7,6 };
lli dp[10005];

int main() {
  cin >> n >> m;
  for (lli i=0; i<m; ++i) cin >> a[i];
  sort(&a[0], &a[m], greater<lli>());
  fill(&dp[0], &dp[10001], -1e16);
  dp[0] = 0;
  for (lli i=0; i<m; ++i) {
    lli x = a[i];
    for (lli j=cost[x]; j<=n; ++j) {
      dp[j] = max(dp[j], dp[j-cost[x]] + 1);
    }
  }

  cerr << dp[n] << endl;

  for (lli r=n; r>0; ) {
    for (lli i=0; i<m; ++i) {
      lli x = a[i];
      if (r-cost[x] >= 0 && dp[r] == dp[r-cost[x]] + 1) {
        cout << x;
        r -= cost[x];
        break;
      }
    }
  }
  cout << '\n';
  return 0;
}


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

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

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

void foo(const pair<ll, vector<int>>& v) {
    printf("%lld: ", v.first);
    for (const int& i : v.second) {
        printf("%d ", i);
    }
    cout << endl;
}

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);

    map<ll, vector<int>> mi, mj;

    rep(i, n) { cin >> a[i]; }
    ll l, r;
    rep(i, n) {
        l = i + 1 + a[i];
        r = i + 1 - a[i];

        mi[l].push_back(i + 1);
        mj[r].push_back(i + 1);
    }

    // cout << "mi" << endl;
    // for (const auto& v : mi) {
    //     foo(v);
    // }
    // cout << "mj" << endl;
    // for (const auto& v : mj) {
    //     foo(v);
    // }
    //
    ll ans = 0;
    for (const auto& v : mi) {
        ll idx = v.first;
        auto it = mj.find(idx);
        if (it != mj.end()) {
            ans += v.second.size() * it->second.size();
        }
    }
    cout << ans << endl;

    return 0;
}


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

signed main() {
  int N; cin >> N;
  vector<int> A(N);
  for(int i=0; i<N; i++) cin >> A[i];
  
  int ans = 2e9;
  for(int i=0; i<N; i++) {
    int c = 0;
    while(A[i] % 2 == 0) {c++; A[i]/=2; }
    ans = min(ans,c);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i=0; i<(int)(n); i++)
#define REP2(i,x,n) for(int i=x; i<(int)(n); i++)
using ll = long long;
int main(){
    ll N=0;
    cin >> N;
    vector<ll> diameter(N);

    REP(i,N){
        cin >> diameter.at(i);
    }

    sort(diameter.begin(), diameter.end());
    reverse(diameter.begin(), diameter.end());

    ll count=1;

    REP(i,N-1){
        if(diameter.at(i) != diameter.at(i+1)){
            count++;
        }
    }

    cout << count << endl;

}

Measured memory_bytes: 636
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;
typedef unsigned long long ull;

int main() {

	ll N,H; cin >> N >> H;
	vector < ll > a(N),b(N);
	REP(i,N) cin >> a[i] >> b[i];

	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	reverse(b.begin(), b.end());

	ll max_a = a.back();

	ll ans = 1e18;
	ll sum = 0;
	REP(i,N + 1) {
		ll anst = i;
		ll left_h = H - sum;
		if (left_h < 0) left_h = 0;
		anst += left_h / max_a + (left_h % max_a > 0 ? 1 : 0);
		ans = min(ans, anst);
		if (i < N) sum += b[i];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
#!/usr/local/bin/python3
# coding: utf-8

ha = input()
kita = ha.split(" ")
roop = 0
isR = False
if(int(kita[1]) == 0):
    print(kita[0])
else:
    koi = input()
    n = koi.split(" ")

    while(True):
        a = True
        for num in n:
            if(int(kita[0])-roop == int(num)):
                a = False
        if(a):
            print(int(kita[0])-roop)
            break
        a = True
        for num in n:
            if(int(kita[0])+roop == int(num)):
                a = False
        if(a):
            print(int(kita[0])+roop)
            break
        roop += 1

Measured memory_bytes: 9240
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

class C {
    static StreamWriter Out = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    static void Main(string[] args) {
        int A, B;
        Input(out A, out B);
        for(double i = 0; i < 10000; i++) {
            if(Math.Floor(i * 0.08) == A && Math.Floor(i * 0.1) == B) {
                Console.WriteLine(i);
                return;
            }
        }
        Console.WriteLine(-1);
        Out.Flush();
    }
    static T ChangeT<T>(string s) => (T)Convert.ChangeType(s, typeof(T));
    static void Input<A>(out A a) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
    }
    static void Input<A, B>(out A a, out B b) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
    }
    static void Input<A, B, C>(out A a, out B b, out C c) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
    }
    static void Input<A, B, C, D>(out A a, out B b, out C c, out D d) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
    }
    static void Input<A, B, C, D, E>(out A a, out B b, out C c, out D d, out E e) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
    }
    static void Input<A, B, C, D, E, F>(out A a, out B b, out C c, out D d, out E e, out F f) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
        f = ChangeT<F>(words[5]);
    }
    static void InputArray<T>(out T[] array) {
        array = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries).Select(s => ChangeT<T>(s)).ToArray();
    }
    static void Print<T>(T s) => Out.WriteLine(s);
    static void Print<T>(params T[] s) => Out.WriteLine(string.Join(" ", s));
    static void Print<T>(IEnumerable<T> e) => Out.WriteLine(string.Join(" ", e));
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	int a,b;
	for(a = 0;a <= 1000;a++){
		for(b = 0;b < a;b++){
			if(pow(a,5) - pow(b,5) == n){
				cout << a << ' ' << b << endl;
				return 0;
			}
			if(pow(a,5) + pow(b,5) == n){
				cout << a << ' ' << -b << endl;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 4100
# -*- coding: utf-8 -*-
import sys
import fractions
import collections
sys.setrecursionlimit(200000)
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def fi(): return float(input())
def mfi(): return map(float, input().rstrip().split())
def lmfi(): return list(map(float, input().rstrip().split()))
def li(): return list(input().rstrip())
def debug(*args, sep=" ", end="\n"): print("debug:", *args, file=sys.stderr, sep=sep, end=end) if not __debug__ else None
def exit(*arg): print(*arg); sys.exit()
# template

def factorize(n: int):
    """
    与えられた自然数を素因数分解する。返り値は素因数をキーに持ち指数を持つ defaultdict

    Parameters
    ----------
        n : int
            素因数分解したい整数

    Returns
    -------
        defaultdict
            素因数分解の結果。
    """
    res = collections.defaultdict(int)
    i = 2
    while i * i <= n:
        while n % i == 0:
            n //= i
            res[i] += 1
        i += 1
    if n != 1:
        res[n] += 1
    return res

def main():
    A, B = mi()
    G = fractions.gcd(A, B)
    mp = factorize(G)
    print(max(len(mp) + 1, 1))
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 64876
n = gets.to_i

rs = []
names = []
n.times do |i|
    name, score = gets.split
    rs.push([name, score.to_i, i+1])
    names.push(name)
end

names.uniq!
names.sort!

names.each do |name| 
    targets = rs.find_all { |i| i[0] == name }
    targets.sort! {|a, b| b[1]  <=> a[1] }
    targets.each {|i| puts i[2] }
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
//increase stack size
#pragma comment(linker, "/STACK:16777216")

ll mxm() {return LLONG_MIN;}
template<typename... Args>
ll mxm(ll a, Args... args) { return max(a,mxm(args...)); }

ll mnm() {return LLONG_MAX;}
template<typename... Args>
ll mnm(ll a, Args... args) { return min(a,mnm(args...)); }

template<class T> ostream& operator<<(ostream& os,vector<T> V){
	os<<"[ ";for(auto v:V)os<<v<<" ";return os<<"]";
}
template<class L,class R> ostream& operator<<(ostream& os,pair<L,R> P){
	return os<<"("<<P.first<<","<<P.second<<")";
}

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__,__VA_ARGS__)
template<typename Arg1>
void __f(const char* name,Arg1&& arg1){
	cout<<name<<" : "<<arg1<<endl;
}
template <typename Arg1,typename... Args>
void __f(const char* names,Arg1&& arg1,Args&&... args){
	const char* comma=strchr(names+1,',');cout.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1,args...);
}
#else
#define trace(...) 1
#endif

#define ld long double
#define pll pair<ll,ll>
#define ii pair<int,int>
#define vll vector<ll>
#define vii vector<ii>
#define vi vector<int>
#define vpll vector<pll>
#define vld vector<ld>
#define vvld vector<vld>
#define vvi vector<vi>
#define vvll vector<vll>
#define vvpll vector<vpll>
#define vvii vector<vii>
#define I insert
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x)	x.begin(),x.end()

const int mod=1e9+7;
// 128 bit: __int128
inline int add(int a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int sub(int a,int b){a-=b;if(a<0)a+=mod;return a;}
inline int mul(int a,int b){return (a*1ll*b)%mod;}
inline int power(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline int inv(int a){return power(a,mod-2);}

struct compare{
	bool operator() (const int &a,const int &b) const{
		return a>b;
	}
};

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<setprecision(25);
	int n;
	cin >> n;
	n %= 10;
	if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9)
		cout << "hon" << endl;
	else if(n == 3)
		cout << "bon" << endl;
	else cout << "pon" << endl;			
}

Measured memory_bytes: 3636
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main() {
	int i,c,m, f, r;
	char result[100];
	i = 0;
	while (1) {
		scanf("%d %d %d", &m, &f, &r);
		if (m == -1 && f == -1 && r == -1) {
			break;
		}
		if (m==-1||f==-1){
			result[i] = 'F';
		} else if (80 <= m + f ) {
			result[i] = 'A';

		}else if (65<=m + f && m + f < 80) {
			result[i] = 'B'; 
		}else if (50 <=m + f  && m + f < 65) {
			result[i] = 'C'; 
		}else if (30 <= m+f && m + f < 50) {
			if (50 <= r) {
				result[i] = 'C';
			}else{
				result[i] = 'D';
			}
			
		}
		else if (30 > m + f ) {
			result[i] = 'F'; 
		}
		i++;
	}
	c = i;
	for (i = 0; i < c; i++) {
		printf("%c\n", result[i]);
	}

}

Measured memory_bytes: 1824
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_20180929
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = int.Parse(Console.ReadLine());
            var result = s;
            while(!isSameAll(result))
            {
                result++;
            }
            Console.WriteLine(result);
        }

        static bool isSameAll(int x)
        {
            var x1 = x % 10;
            var x2 = (x / 10) % 10;
            var x3 = (x / 10) / 10;
            if (x1 == x2&& x2 == x3)
            {
                return true;
            }
            return false;
        }
    }
}


Measured memory_bytes: 11092
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  int red = 0;
  map<int,int> mp;
  for(int i=0;i<N;i++){
    int a;
    cin >> a;
    if(1<=a && a<=399) mp[0]++;
    else if(400<=a && a<=799) mp[1]++;
    else if(800<=a && a<=1199) mp[2]++;
    else if(1200<=a && a<=1599) mp[3]++;
    else if(1600<=a && a<=1999) mp[4]++;
    else if(2000<=a && a<=2399) mp[5]++;
    else if(2400<=a && a<=2799) mp[6]++;
    else if(2800<=a && a<=3199) mp[7]++;
    else if(3200<=a) red++;
  }

  int mn,mx;
  if((int)mp.size() == 0) mn = 1;
  else mn = (int)mp.size();
  mx = (int)mp.size() + red;

  cout << mn << " " << mx << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;
long a[10100];

int main()
{
	int N;
	int i, cnt = 0;
	cin >> N;
	for(i = 1; i <= N; i++) {
		cin >> a[i];
		while(a[i] % 2 == 0) {
			a[i] /= 2;
			cnt ++;
		}
	}
	cout << cnt << endl;
	return 0;	
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <queue>
#include <stack>

using namespace std;

typedef int itn;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef map<int, int> M;
typedef pair<int, int> P;
typedef stack<int> S;
typedef queue<int> Q;

const LL MOD = 1000000007;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    set<char> s;
    for (int i = 0; i < n; ++i)
    {
        char c;
        cin >> c;
        s.insert(c);
    }
    if (s.size() == 3) cout << "Three" << endl;
    else cout << "Four" << endl;
    
    return 0;
}


Measured memory_bytes: 256
n, k, q = map(int, input().split())
L = [k for i in range(n)]
a = [int(input()) for i in range(q)]

for i in a:
    L[i-1] = L[i-1] + 1

for i in range(len(L)):
    if q  < L[i]:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 10512
#include<bits/stdc++.h>                                                      
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector<int> p(N);
  for(int i=0; i<N; i++){
    cin >> p.at(i);
  }
  int max=0;
  int ans=0;
  for(int i=0; i<N; i++){
    if(p.at(i)>max){
      max=p.at(i);
      ans=i;
    }
  }
  int sum=0;
  for(int i=0; i<N; i++){
    if(i!=ans){
      sum+=p.at(i);
    }
  }
  sum=sum+(max/2);
  cout << sum << endl;
}


Measured memory_bytes: 256
/*
 _____ _             _              _           _ 
|_   _| |__   ___   / \   _ __  ___| |__  _   _| |
  | | | '_ \ / _ \ / _ \ | '_ \/ __| '_ \| | | | |
  | | | | | |  __// ___ \| | | \__ \ | | | |_| | |
  |_| |_| |_|\___/_/   \_\_| |_|___/_| |_|\__,_|_|                                                

*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll,ll>
#define msi         map<string,ll>
#define mis         map<ll, string>
#define rep(i,a,b)    for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)
#define trav(a, x) 	for(auto& a : x)
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pair<ll, ll>>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define max(a,b)	(a>b?a:b)
#define min(a,b)	(a<b?a:b)

/*	For Debugging	*/
#define DEBUG 		cerr<<"\n>>>I'm Here<<<\n"<<endl;
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl;
#define what_is(x)  cerr << #x << " is " << x << endl;

std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define DECIMAL(n)  cout << fixed ; cout << setprecision(n);
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace __gnu_pbds;
using namespace std;
#define PI 3.141592653589793
#define N  100005

void solve()
{
	vi v(3);
	rep(i,0,3)
	{
		cin>>v[i];
	}
	cout<<v[2]<<" "<<v[0]<<" "<<v[1]<<endl;
	return;
}
int main()
{
	FAST
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		solve();
	}
	TIME
	return 0;
}

Measured memory_bytes: 256
def candidates_of_no_shortest_paths(N: int, M: int, edges: list)->int:
    INF = float('inf')

    d = [[0 if i == j else INF for i in range(N)] for j in range(N)]

    for u, v, c in edges:
        d[u-1][v-1] = d[v-1][u-1] = c

    # warshall-floyd
    for k in range(N):
        for u in range(N):
            for v in range(N):
                if d[u][v] > d[u][k] + d[k][v]:
                    d[u][v] = d[u][k] + d[k][v]

    def used(edge: tuple)->bool:
        u, v, c = edge
        for s in range(N):
            if d[s][u-1] + c == d[s][v-1]:
                return True
        return False

    return sum(not used(edge) for edge in edges)


if __name__ == "__main__":
    M = 0
    N, M = map(int, input().split())
    edges = [tuple(int(s) for s in input().split()) for _ in range(M)]
    ans = candidates_of_no_shortest_paths(N, M, edges)
    print(ans)


Measured memory_bytes: 3440
#include<stdio.h>

static const int N = 500;
static const int INFTY = (1<<21);

#define NIL -1

int p[100];
int key[100];
int n;


main(){

  int i,j,a,b,c,sum;
  int M[100][100];
  int l[100];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for (j=0;j<n;j++){
      scanf("%d",&a);
      M[i][j] = (a==-1)?INFTY:a;

    }
  }



  for(c=0;c<n;c++){
    key[c]=100000000;

    p[c]=NIL;

    l[c]=NIL;
  }
  key[0]=0;

  while(1){
    int c=NIL;
    int b=100000000;


    for(i=0;i<n;i++){
     

      if(key[i]<b && l[i]==NIL){
	b=key[i];
	c=i;
      }
    }
	
      
    
    if(c==NIL){
      break;
    }

    for(b=0;b<n;b++){
      if(M[c][b] < key[b] && l[b]==NIL){
	key[b]=M[c][b];
	p[b]=c;
      }
    }
    l[c]=0;
  }


  sum = 0;

  for ( i = 0; i < n; i++ ){
    if ( p[i] != -1 ) sum += M[i][p[i]];
  }

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

  return 0;
}

Measured memory_bytes: 640
import collections

n=int(input())
a=list(map(int,input().split()))
c = collections.Counter(a)
k=list(c.items())

total=0
for i in k:
  total+=i[1]*(i[1]-1)
total//=2

for i in range(n):
  d=c[a[i]]-1
  print(total-d)

Measured memory_bytes: 29112
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
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 main(){
    ios::sync_with_stdio(false);
    string s,t;
    cin >> s >> t;
    int ans = t.size();
    for(int i = 0; i + t.size()-1 < s.size(); i++) {
        int ans_tmp = 0;
        for(int j = 0; j < t.size(); j++) {
            if(t[j] != s[i+j]) ans_tmp++;
        }
        chmin(ans, ans_tmp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3652
import math

a, b = [int(x) for x in input().split()]

mina, maxa = math.ceil(a / 0.08), math.ceil((a+1) / 0.08)-1
minb, maxb = b * 10, (b+1) * 10 -1

if minb <= maxa and minb >= mina:
    print(minb)
elif mina <= maxb and mina >= minb:
    print(mina)
else:
    print(-1)

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <string>
#include <numeric>
#include <algorithm>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <complex>
#include <ctime>
#define ll long long
#define N 100010
using namespace std;
set<pair<int,int> > s;
set<pair<int,int> >::iterator it;
int a[N];

int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
    {
        scanf("%d",a+i);
        s.insert(make_pair(a[i],i));
    }
    int i=0;
    for(it=s.begin();it!=s.end();++it)
    {
        i++;
        printf("%d%c",it->second,i==n?'\n':' ');
    }

	return 0;
}


Measured memory_bytes: 8804
using System;
using System.Collections.Generic;
class Program
    {
        static void Main(string[] args)
        {
            string[] input1 = Console.ReadLine().Split(' ');
            int x = int.Parse(input1[0]);
            int y = int.Parse(input1[1]);
            int z = int.Parse(input1[2]);
            int n = int.Parse(input1[3]);

            string[] inputA = Console.ReadLine().Split(' ');
            long[] a = new long[x];
            for(int i=0; i<x; i++) a[i] = long.Parse(inputA[i]);
            Array.Sort(a);

            string[] inputB = Console.ReadLine().Split(' ');
            long[] b = new long[y];
            for(int i=0; i<y; i++) b[i] = long.Parse(inputB[i]);
            Array.Sort(b);

            string[] inputC = Console.ReadLine().Split(' ');
            long[] c = new long[z];
            for(int i=0; i<z; i++) c[i] = long.Parse(inputC[i]);
            Array.Sort(c);

            long[] ans = new long[1000000];
            int p = 0;

            for (int i=x-1; i>=0; i--)
            {
                for (int j=y-1; j>=0; j--)
                {
                    for (int k=z-1; (x-i) * (y-j) * (z-k) <= n && k >=0; k--)
                    {
                        ans[p] = a[i] + b[j] + c[k];
                        p++;
                    }

                }
            }
            Array.Sort(ans);
            for (int i=0; i < n; i++) Console.WriteLine(ans[1000000 - i - 1]);

            
            

            
            


            
        }
    }
    //mcs Main.cs
    //mono Main.exe

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

int main() {
  int N;
  cin >> N;
  vector<int> a(3*N);
  for(int i=0;i<3*N;i++){
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  long sum=0;
  for(int i=N;i<3*N;i+=2){
    sum+=a[i];
  }
  cout << sum;
}


Measured memory_bytes: 1408
#include <iostream>
#include <stdio.h>
#include <math.h>

using namespace std;
int main() {
	int n, d;
	int count = 0;
	int x, y;

	cin >> n >> d;
		
	for (int i = 0; i < n; i++) {
		cin >> x >> y;
		if (sqrt(pow(x, 2) + pow(y, 2)) <= d)
			count++;
	}
	cout << count;

	return 0;
}


Measured memory_bytes: 3684
d = int(input())
c = list(map(int,input().split()))
ans = []
pen = [0]*26
for i in range(d):
    s = list(map(int,input().split()))
    sp = sum(pen)
    temp = -(10**9)
    for j in range(26):
        if s[j]-sp+pen[j] > temp:
            temp = s[j]-sp+pen[j]
            tempans = j+1
    ans += [tempans]
    for j in range(26):
        pen[j] += c[j]
        pen[tempans-1] = 0
for i in ans:
    print(i)

Measured memory_bytes: 9184
#include<stdio.h>
#include<string.h>
struct _data{
	char hit[10];
	int money;
}typedef _data;
_data d[105];
int isHit(char hit[],int n){
	int i;
	for(i=7;i>=0;i--){
		if(d[n].hit[i]=='*')break;
		else if(d[n].hit[i]!=hit[i])return 0;
	}
	return 1;
}
int main(){
	int n,m,i,j,money,sum;
	char hit[10],num[10];
	for(;scanf("%d %d",&n,&m)&&(n||m);){
		sum=0;
		for(i=0;i<n;i++){
			scanf("%s %d",hit,&money);
			strcpy(d[i].hit,hit);
			d[i].money=money;
		}
		for(i=0;i<m;i++){
			scanf("%s",num);
			for(j=0;j<n;j++){
				if(isHit(num,j))sum+=d[j].money;
			}
		}
		printf("%d\n",sum);
	}
	return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>

#ifdef WIN32
	#define LL "%I64d"
#else
	#define LL "%lld"
#endif

#ifdef CT
	#define debug(...) printf(__VA_ARGS__)
	#define setfile() 
#else
	#define debug(...)
	#define filename ""
	#define setfile() freopen(filename".in", "r", stdin); freopen(filename".out", "w", stdout)
#endif

#define R register
#define getc() (_S == _T && (_T = (_S = _B) + fread(_B, 1, 1 << 15, stdin), _S == _T) ? EOF : *_S++)
#define dmax(_a, _b) ((_a) > (_b) ? (_a) : (_b))
#define dmin(_a, _b) ((_a) < (_b) ? (_a) : (_b))
#define cmax(_a, _b) (_a < (_b) ? _a = (_b) : 0)
#define cmin(_a, _b) (_a > (_b) ? _a = (_b) : 0)
#define cabs(_x) ((_x) < 0 ? (- (_x)) : (_x))
char _B[1 << 15], *_S = _B, *_T = _B;
inline int F()
{
	R char ch; R int cnt = 0; R bool minus = 0;
	while (ch = getc(), (ch < '0' || ch > '9') && ch != '-') ;
	ch == '-' ? minus = 1 : cnt = ch - '0';
	while (ch = getc(), ch >= '0' && ch <= '9') cnt = cnt * 10 + ch - '0';
	return minus ? -cnt : cnt;
}
int a[1000010];
int main()
{
//	setfile();
	R int n = F(), k = 1;
	R long long ans = 0;
	for (R int i = 1; i <= n; ++i)
	{
		a[i] = F();
		if (a[i] > k)
		{
			ans += (a[i] - 1) / k;
			if ((a[i] - 1) / k > 0) a[i] = 1;
			cmax(k, a[i] + 1);
		}
		else if (a[i] == k) ++k;
	}
	printf("%lld\n", ans );
	return 0;
}


Measured memory_bytes: 640
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

class Main {
    static long MOD = (long)Math.pow(10, 9) + 7;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int cur = 1;
        for (int i=0; i<N; i++) {
            if(cur == in.nextInt()) {
                cur++;
            }
        }
        if (cur==1) System.out.println(-1);
        else System.out.println(N-cur+1);
    }
}

Measured memory_bytes: 62732
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

// CHECK THE LIMITS
typedef long long ll;

const int MOD = 1000000007;
const ll INFLL = 1e18;
const int INF = 1e9;
const int NMAX = 1000001;

int gcd(int a, int b) {
  return b ? gcd(b, a%b) : a;
} 

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
	int a,b;
	cin >> a >> b;
	cout << 1LL*a*b / gcd(a,b);


    return 0;
}

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

using namespace std;
const long long INF = (long long) (1e18)+1;

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

  int ans = 0;
  ans += (n * (n-1) / 2); // 偶数のみ
  ans += (m * (m-1) / 2); // 奇数のみ
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <iterator>
#include <cstdlib>
#include <algorithm>
using namespace std;

typedef vector<int> vint;

vint input(int sz){
	string s;
	getline(cin, s);
	stringstream ss1(s), ss2;
	istream_iterator<int> b(ss1), e;
	vint v(b, e);
	if(cin.eof() || v.size() != sz){ throw ""; }
	for(int i = 0; i < sz; ++i){
		if(i){ ss2 << ' '; }
		ss2 << v[i];
	}
	string t = ss2.str();
	if(s != t){ throw 0; }
	return v;
}

int main(){
	int q = input(1)[0];
	for(int i = 0; i < q; ++i){
		vector<int> v = input(3);
		int c = v[0], a = v[1], n = v[2];
		int z = min(c, min(a, n));
		c -= z;
		int t = min(c / 2, a - z);
		z += t + (c - t * 2) / 3;
		cout << z << '\n';
	}

	cin.peek();
	if(!cin.eof()){
		exit(EXIT_FAILURE);
	}
}

Measured memory_bytes: 1252
// Date: 2020-04-12

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
#define IO freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout)
#define FIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
#define per(i, b, a) for(int i = int(b); i >= int(a); --i)
#define D(x) cout << #x << " = " << x << endl;
#define mem(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)x.size())
#define mk make_pair
#define pb push_back
#define fi first
#define se second
const LL INF = 1e18;
const LL mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int N = 2e5 + 10;
template <typename T> void chkmax(T &x, T y) { x = max(x, y); }
template <typename T> void chkmin(T &x, T y) { x = min(x, y); }
LL qpow(LL x, LL y, LL MOD) {LL a=1; while(y){ if(y&1) a=a*x%MOD; x=x*x%MOD; y>>=1; } return a;}

int val[N];
int main() {
    int n, k;
    cin >> n >> k;
    LL ans = 0;
    rep(i, 1, k) val[i] = i;
    rep(i, 1, k) {
        ans = ((ans + val[i] * qpow(k/i, n, mod) % mod) % mod + mod) % mod;
        for(int j = i+i; j <= k; j += i) val[j] -= val[i];
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 3980
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;

long long gcd(long long a, long long b) {
   if (a % b == 0) return b;
   else return gcd(b, a % b);
}

long long lcm(long long a, long long b) {
   return a * b / gcd(a, b);
}


int main() {
    long long a, b; cin >> a >> b;
    cout << lcm(a, b) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define FILE_READ_IN freopen("input.txt","r",stdin);
#define FILE_READ_OUT freopen("output.txt","w",stdout);
#define Fast ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define deb(x) cout<<#x<<" "<<x<<endl;
#define all(v) v.begin(),v.end()
#define endl '\n'
using namespace __gnu_pbds;
using namespace std;

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

void judge() {
#ifndef ONLINE_JUDGE
	FILE_READ_IN
	FILE_READ_OUT
#endif
}

int main() {
	Fast;
	int t = 1;
	judge();
	// cin >> t;
	while (t--) {
		ll n;
		cin >> n;
		ll a[n + 1];
		for (ll i = 1; i <= n; i++)cin >> a[i];
		ll dp[n + 1] = {};
		dp[1] = 1000;
		for (ll i = 2; i <= n; i++) {
			for (ll j = i - 1; j > 0; j--) {
				dp[i] = max(dp[i], (dp[j] / a[j]) * a[i] + dp[j] % a[j]);
				dp[i] = max(dp[j], dp[i]);
			}
		}
		cout << dp[n] << endl;
	}
}


Measured memory_bytes: 3616
import sys
import math
import itertools

N=int(input())
if(N%4==0):
    x=3*N//4
    print(x,x,x)
    exit()
for x in range(3501):
    if(4*x-2*N>0 and (N*x)%(4*x-2*N)==0):
        h=(N*x)//(4*x-2*N)
        print(h,x,x)
        exit()
for h,n in itertools.product(range(1,3501)[::-1],range(1,3501)[::-1]):
    x=N*h*n
    y=4*n*h-N*n-N*h
    if(y>0 and x%y==0):
        print(h,n,x//y)
        break
"""
4/N=1/h+1/n+1/w
4/N=(nw+hw+hn)/nhw
4nhw/N=nw+hw+hn
4nhw=Nnw+Nhw+Nhn
(4nh-Nn-Nh)w=Nhn
w=Nhn/(4nh-Nn-Nh)

4/N=3/x
4x/N=3
4x=3N
h,n,w=3N/4  (N%4==0)

4/N=1/h+2/x
4/N-2/x=1/h
(4x-2N)/Nx=1/h
h=Nx/(4x-2N)
"""


Measured memory_bytes: 41964
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container;

void main()
{
    auto nk = readln.split.to!(long[]);
    auto N = nk[0];
    auto K = nk[1];
    writeln(N <= K ? 1 : 0);
}


Measured memory_bytes: 2484
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
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;}

// 0 false, 1 true 
// string to int : -48
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

ll n;
void dfs(string s, char c){
    if(s.size() == n){
        cout << s << endl;
        return;
    }else{
        for(char i = 'a'; i <= c+1; i++){
            string t = s;
            t += i;
            if(i == c+1){
                dfs(t, c+1);
            }else{
                dfs(t, c);
            }
        }
    }
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    cin >> n;

    string s = "";
    dfs(s, 'a'-1);

}

Measured memory_bytes: 1536
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int W = sc.nextInt();
        int H = sc.nextInt();
        int N = sc.nextInt();

        int [][] points=new int[N][3];

        for(int i=0;i<N;i++){
            points[i][0]=sc.nextInt();
            points[i][1]=sc.nextInt();
            points[i][2]=sc.nextInt();
        }

        int x0 = 0;
        int y0 = 0;
        int x1 = W;
        int y1 = H;

        for(int i=0;i<N;i++){

            switch (points[i][2]){
                case 1:
                    if(points[i][0]>x0) {
                        x0 = points[i][0];
                    }
                        break;
                case 2:
                    if(points[i][0]<x1) {
                        x1 = points[i][0];
                    }
                    break;
                case 3:
                    if(points[i][1]>y0) {
                        y0 = points[i][1];
                    }
                    break;
                case 4:
                    if(points[i][1]<y1) {
                        y1 = points[i][1];
                    }
                    break;
            }


        }


        if(x0<x1&&y0<y1){
            System.out.println((x1-x0)*(y1-y0));
        }
        else{
            System.out.println(0);
        }

        sc.close();

    }

}


Measured memory_bytes: 10824
n, t = map(int, input().split())
a = list(map(int, input().split()))

cmax = [0] * (n+1)
for i in reversed(range(n)):
    cmax[i] = max(a[i], cmax[i+1])

m = 10 ** 18
d = 0
ans = 0
for i in range(n):
    if d == cmax[i+1] - a[i]:
        ans += 1
    elif d < cmax[i+1] - a[i]:
        d = cmax[i+1] - a[i]
        ans = 1
print(ans)

Measured memory_bytes: 15020
//C
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
ll N,M;
vector<pll> A;



int main(){
    cin >> N >> M;
    A.resize(N);
    for(int i=0;i<N;i++)cin >> A[i].first >> A[i].second;
    
    sort(A.begin(),A.end());
    //for(int i=0;i<N;i++) cout<< A[i].first << A[i].second << endl;

    long long ans = 0; int i=0;
    while(M>0){
        long long  hon;
        hon = min(M,A[i].second);
        ans += A[i].first*hon;
        M -= A[i].second;
        i++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    REP(i, ty - sy) {
        cout << "U";
    }
    REP(i, tx - sx) {
        cout << "R";
    }
    REP(i, ty - sy) {
        cout << "D";
    }
    REP(i, tx - sx + 1) {
        cout << "L";
    }
    REP(i, ty - sy + 1) {
        cout << "U";
    }
    REP(i, tx - sx + 1) {
        cout << "R";
    }
    cout << "DR";
    REP(i, ty - sy + 1) {
        cout << "D";
    }
    REP(i, tx - sx + 1) {
        cout << "L";
    }
    cout << "U\n";
    return 0;
}


Measured memory_bytes: 256