akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define send {ios_base::sync_with_stdio(false);}
#define help {cin.tie(NULL); cout.tie(NULL);}
#define f first
#define s second
#define getunique(v) {sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end());}
typedef long long ll;
typedef long double lld;
typedef unsigned long long ull;
 
template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v);
template<typename A, typename B> ostream& operator<<(ostream &cout, pair<A, B> const &p) { return cout << "(" << p.f << ", " << p.s << ")"; }
template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v) {
	cout << "["; for(int i = 0; i < v.size(); i++) {if (i) cout << ", "; cout << v[i];} return cout << "]";
}
template<typename A, typename B> istream& operator>>(istream& cin, pair<A, B> &p) {
	cin >> p.first;
	return cin >> p.second;
}
 
mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());
// mt19937 rng(61378913);
/* usage - just do rng() */
 
void usaco(string filename) {
  // #pragma message("be careful, freopen may be wrong")
	freopen((filename + ".in").c_str(), "r", stdin);
	freopen((filename + ".out").c_str(), "w", stdout);
}

#include <atcoder/all>
using namespace atcoder;
 
const lld pi = 3.14159265358979323846;
// const ll mod = 1000000007;
// const ll mod = 998244353;
// ll mod;
 


ll n, m, k, q, l, r, x, y, z;
const ll template_array_size = 1e6 + 1531;
ll a[template_array_size];
ll b[template_array_size];
ll c[template_array_size];
string s, t;
ll ans = 0;



void solve(int tc = 0) {
	cin >> n;
	
	n = 2 * n;
	
	vector<ll> divs;
	
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			divs.push_back(i);
			divs.push_back(n / i);
		}
	}
	
	getunique(divs);
	
	ll ans = 2 * n;
	
	for (ll x: divs) {
		ll v1 = x;
		ll v2 = n / x;
		
		vector<ll> a = {0, v2 - 1};
		vector<ll> b = {v1, v2};
		
		pair<ll, ll> r = crt(a, b);
		
		if (r.f != 0 && r.s != 0) ans = min(ans, r.f);
	}
	
	cout << ans << '\n';
}
 
int main() {
	#ifdef galen_colin_local
		auto begin = std::chrono::high_resolution_clock::now();
	#endif
	
	send help
 
	#ifndef galen_colin_local
		// usaco("moop");
	#endif
	
	// usaco("cowland");
	
	// freopen("tc.cpp", "r", stdin);
 
	
	
	int tc = 1;
	// cin >> tc;
	for (int t = 0; t < tc; t++) solve(t);
	
	#ifdef galen_colin_local
		auto end = std::chrono::high_resolution_clock::now();
		cout << setprecision(4) << fixed;
		// cout << "Execution time: " << std::chrono::duration_cast<std::chrono::duration<double>>(end - begin).count() << " seconds" << endl;
	#endif
} 

Measured memory_bytes: 3832
package main

import (
	"fmt"
)

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

	var ans int
	var now int
	var used bool
	var b int
	for i := 0; i < len(a)-1; i++ {
		b = a[i]
		if used {
			b = a[i] + now
		}
		if b > a[i+1] {
			ans += b - a[i+1]
			now = b - a[i+1]
			used = true
		} else {
			used = false
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 6472
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const ll INF = 1E+18;


int main(){
    int n, t;
    cin >> n >> t;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    set<int> s;
    int m = 0;
    rrep(i, n) {
        if (i!=n-1) {
            chmax(m, *s.rbegin()-a[i]);
        }
        s.insert(a[i]);
    }
    map<ll, ll> mp;
    vector<ll> sum(n+1);
    vector<ll> rsum(n+1);
    rep(i, n) {
        sum[i+1] = sum[i] + mp[a[i]-m];
        mp[a[i]]++;
        //debug(sum[i+1]);
    }
    mp.clear();
    rrep(i, n) {
        rsum[i] = rsum[i+1] + mp[a[i]+m];
        mp[a[i]]++;
        //debug(rsum[i]);
    }
    ll ans = INF;
    rep(i, n+1) {
        chmin(ans, sum[i]+rsum[i]);
    }
    ans++;
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 22512
#include <stdio.h>
int main(void){
	long a,b,n,ans=0,c=0;
	scanf("%ld%ld%ld",&n,&a,&b);
	c+=a*(n/(a+b));
	if(n-(a+b)*(n/(a+b))<a+1) ans=c+n-(a+b)*(n/(a+b));
	else ans=c+a;
	printf("%ld",ans);
	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

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>; 
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(int i=x;i<y;i++)
#define frr(i,x,y) for(int i=x-1;i>=y;i--)
#define inf 1e18+1
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

void solve()
{
    ll x;
    cin>>x;
    if(x<600)
    {
        cout<<"8\n";
    }
    else if(x<800)
    {
        cout<<"7\n";
    }
    else if(x<1000)
    {
        cout<<"6\n";
    }
    else if(x<1200)
    {
        cout<<"5\n";
    }
    else if(x<1400)
    {
        cout<<"4\n";
    }
    else if(x<1600)
    {
        cout<<"3\n";
    }
    else if(x<1800)
    {
        cout<<"2\n";
    }
    else
        cout<<"1\n";

    return;
}
int main()
{
    IOS;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        //cout<<"Case #"<<pp-t<<":\n";
        solve();
    }
    return 0;
}
/* stuff you should look for
        * int overflow, array bounds
        * special cases (n=1?)
        * do smth instead of nothing and stay organized
        * WRITE STUFF DOWN
*/
/*
recursion - matrix exponential

*/
// BITMASK:
// 1)When some constrall is of the order of 15-20, think of bitmask DP.
// 2)When some constrall is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algorithm

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

int main(){

  cin.tie(0); //cin高速化
  ios::sync_with_stdio(false); //cin高速化
  
  int a,b;
  cin >> a >> b;
  cout << max (a+b , max(a-b,a*b)) << endl;
  return 0;
}
    

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var N int
	var S string
	fmt.Scan(&N, &S)
	sums := make(map[byte][]int, 0) // 文字種毎の累積和を求めておく
	sums['R'] = make([]int, N+1)
	sums['G'] = make([]int, N+1)
	sums['B'] = make([]int, N+1)
	for i := 0; i < N; i++ {
		if S[i] == 'R' {
			sums['R'][i+1] = sums['R'][i] + 1
			sums['G'][i+1] = sums['G'][i]
			sums['B'][i+1] = sums['B'][i]
		} else if S[i] == 'G' {
			sums['G'][i+1] = sums['G'][i] + 1
			sums['B'][i+1] = sums['B'][i]
			sums['R'][i+1] = sums['R'][i]
		} else {
			sums['B'][i+1] = sums['B'][i] + 1
			sums['G'][i+1] = sums['G'][i]
			sums['R'][i+1] = sums['R'][i]
		}
	}
	// fmt.Println("sums :")
	// fmt.Println(sums)
	patterns := []string{"RGB", "RBG", "GRB", "GBR", "BRG", "BGR"}
	ans := 0
	for p := 0; p < len(patterns); p++ {
		pat := patterns[p]
		for i := 0; i < len(S); i++ {
			if S[i] != pat[0] {
				continue
			}
			// パターンの最初の文字が一致,次の文字を探す
			for j := i + 1; j < len(S); j++ {
				if S[j] != pat[1] {
					continue
				}
				// この時点で最初の2文字の位置(i,j)が決まった
				k := j + (j - i)
				ans += sums[pat[2]][min(k, N)] - sums[pat[2]][j+1]
				if k < N {
					ans += sums[pat[2]][N] - sums[pat[2]][k+1]
				}
				// fmt.Printf("(%d,%d,%d) ans %d\n", i, j, k, ans)
			}
		}
	}
	fmt.Println(ans)
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}



Measured memory_bytes: 1976
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var NK = ReadLongs();
            long n = NK[0];
            long k = NK[1];

            long a = 1;
            long ans = 0;
            while (true)
            {
                ans++;
                a = a * k;

                if (a > n)
                {
                    WriteLine(ans);
                    return;
                }
            }
        }
        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

long long N;

int dfs(long long v, bool f_3, bool f_5, bool f_7) {
    if (v > N) return 0;
    return dfs(v * 10 + 3, true, f_5, f_7)
         + dfs(v * 10 + 5, f_3, true, f_7)
         + dfs(v * 10 + 7, f_3, f_5, true)
         + (f_3 && f_5 && f_7);
}

int main() {
    cin >> N;
    long long v = 0;
    cout << dfs(v, false, false, false) << endl;
    
}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define RVSORT(v) sort(v.rbegin(), v.rend());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

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

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  ll n;cin>>n;
  ll u,k;cin>>u>>k;
  u--;k--;
  vector<ll> v[n];
  REP(i,n-1){
    ll a,b;cin>>a>>b;
    a--;b--;
    v[a].pb(b);
    v[b].pb(a);
  }

  ll aoki[n];
  REP(i,n){
    aoki[i] = -1;
  }

  aoki[k] = 0;

  queue<ll> q;
  q.push(k);
  while(!q.empty()){
    ll l = q.front();
    ll now = aoki[l];
    q.pop();
    REP(i,v[l].size()){
      if(aoki[v[l][i]] == -1){
        aoki[v[l][i]] = now + 1;
        q.push(v[l][i]);
      }
    }
  }

  

  ll taka[n];
  REP(i,n){
    taka[i] = -1;
  }

  taka[u] = 0;
  q.push(u);

  while(!q.empty()){
    ll l = q.front();
    ll now = taka[l];
    q.pop();
    REP(i,v[l].size()){
      ll next = v[l][i];
      if(taka[next] == -1 && aoki[next] >= now + 1){
        taka[next] = now + 1;
        if(aoki[next] > now + 1)q.push(next);
      }
    }
  }

  /*REP(i,n){
    ll t = aoki[i] - taka[i];
    t--;
    taka[i] += t;
  }*/


  /*REP(i,n){
    cout<<i+1<<" aoki= "<<aoki[i]<<" taka= "<<taka[i]<<endl;
  }*/

  /*ll ans = 0;
  REP(i,n){
    ans = max(ans,taka[i]);
  }
  cout<<ans<<endl;*/

  ll ans = 1;
  REP(i,n){
    if(taka[i] != -1){
      ans = max(ans,aoki[i]);
    }


  }

  cout<<ans-1<<endl;
  

  return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7;

signed main()
{
	IO_OP;
	
	int n;
	cin >> n;
	int ans = 0, mn = INF;
	for(int i=0;i<n;i++) {
		int t;
		cin >> t;
		if(t < mn) {
			mn = t;
			ans++;
		}
	}	
	cout << ans << endl;
	
}





Measured memory_bytes: 256
#include<stdio.h>
  
int main(void){
int a,b,c,i;
while(scanf("%d %d\n",&a,&b)!=EOF){
c=a+b;
for(i=0;c!=0;i++) c=(int)(c/10);
printf("%d\n",i);
}
    return 0;
}

Measured memory_bytes: 2600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 2e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int r, d, x2000;
    cin >> r >> d >> x2000;
    int ans[11] = {};
    ans[0] = x2000;
    rep(i, 1, 11) {
        ans[i] = r * ans[i - 1] - d;
    }
    rep(i, 1, 11) {
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
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 / gcd(a,b)*b;}
ll gcd(ll a,ll b){
if(a==0||b==0)return max(a,b);
if(b>a)swap(a,b);
 while(1){
        if(a%b!=0){
            ll tmp=b;b=a%b;
            a=tmp;
        }else{
            return b;
        }
    }
}
int main(){

    ll n;
    cin>>n;
    vector<ll> v(n,0);
    vector<ll> g(n+1,0);

    bool f = false;
    rep(i,n){
        cin>>v[i];
        if(i==0)g[0]=v[i];
        g[i+1]=gcd(g[i],v[i]);
    }

    if(g[n]==1)f=true;


    vector<bool> fa(1000001,false);
    bool k = true;
    rep(i,n){
        ll a = v[i];
        for(int i=2;i<=sqrt(a);i++){
            if(a%i==0){
                if(!fa[i]){fa[i]=true;}
                else{k=false;break;}
                while(a%i==0)a/=i;
            }

        }
        if(a!=1){
            if(!fa[a]){fa[a]=true;}
            else{k=false;break;}
        }


    }
    if(k){
        cout<<"pairwise coprime"<<endl;
    }else if(f){
        cout<<"setwise coprime"<<endl;
    }else{
        cout<<"not coprime"<<endl;
    }





    
return 0;
}


Measured memory_bytes: 19084
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
	int n;
	cin >> n;
	vl a(n),s(n+1);
	rep(i, n) {
		cin >> a[i];
		s[i+1] += a[i] + s[i];
	}
	ll ans = 1e18;
	REP(i, 0, n-1) {
		ans = min(ans, abs(s[i+1]-(s[n]-s[i+1])));
		//cout << s[i+1] << " " << (s[n]-s[i+1]) << endl;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    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;
    }
}

// 二項係数計算
long long 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;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int N; cin >> N;
    vector<vector<int> > A(2,vector<int>(N));
    for(int j=0;j<2;j++){
        for(int i=0;i<N;i++){
            cin >> A[j][i];
        }
    }
    int out=0;
    for(int i=0;i<N;i++){
        int tmp=0;//A[0][0];
        for(int j=0;j<N;j++){
            if(i>j) tmp += A[0][j];
            else if(i==j) tmp += A[0][j]+A[1][j];
            else tmp += A[1][j];
        }
        if(tmp>out) out = tmp;
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	ULL M = 1000000007;

	void Solve() {
		ULL dp[4] = {}; dp[0] = 1;
		string T; cin >> T;
		rep(i, T.size()) {
			if (T[i] == 'A') {
				dp[1] += dp[0];
				dp[1] %= M;
			}
			else if (T[i] == 'B') {
				dp[2] += dp[1];
				dp[2] %= M;
			}
			else if (T[i] == 'C') {
				dp[3] += dp[2];
				dp[3] %= M;
			}
			else {
				dp[3] = dp[3] * 3 + dp[2]; dp[3] %= M;
				dp[2] = dp[2] * 3 + dp[1]; dp[2] %= M;
				dp[1] = dp[1] * 3 + dp[0]; dp[1] %= M;
				dp[0] *= 3; dp[0] %= M;
			}
		}
		cout << dp[3] << endl;
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 512
#include <stdio.h>

int main(){
    int a, b, c, temp;
    int n, i;
    
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%d %d %d", &a, &b, &c);
        if(a > c){
            temp = c;
            c = a;
            a = temp;
        }
        if(b > c){
            temp = c;
            c = b;
            b = temp;
        }
        if(a * a + b * b == c * c){
            printf("YES\n");
        }else{
            printf("NO\n");
        }
    }

    return 0;
}

Measured memory_bytes: 576
#include"bits/stdc++.h"
using namespace std;

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

template <typename T>
bool chmax(T& a, const T& b) {
	if (a < b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}

template <typename T>
bool chmin(T& a, const T& b) {
	if (a > b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}


int main() {
	int X=0;
	int max_x = 1;
	cin >> X;
	if (X > 2) {
		int x = sqrt(X);
		for (int i = x; i > 1; i--) {
			for (int j = 2; j < 11; j++) {
				if (X >= pow(i,j)) {
					max_x = max(max_x, int(pow(i, j)));
				}
			}
		}
	}
	cout << max_x << endl;
	return 0;
}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] arr = reader.readLine().split(" ");
        int a = Integer.parseInt(arr[0]);
        int p = Integer.parseInt(arr[1]);
        System.out.println((3 * a + p) / 2);
    }
}


Measured memory_bytes: 23124
#include     <bits/stdc++.h>
#define len(v) ((int)((v).size()))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define chmax(x, v) x = max((x), (v))
#define chmin(x, v) x = min((x), (v))
#define FOR(s,n) for(int i=s;i<n;i++)
using namespace std;
#define ll long long

int main() {
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll p=a*c;
	ll q=a*d;
	ll r=b*c;
	ll s=b*d;
	cout<<max(p,max(q,max(r,s)));
    return 0;
}




Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a, b, c;
	cin >> a >>b >>c;
	if(a==b&&a!=c||a==c&&a!=b||b==c&&a!=b)
		cout<<"Yes\n";
	else cout<<"No\n"; 
	return 0;
}

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

from heapq import heappush, heappop

queue = []
for a in A:
  heappush(queue, -a)

for i in range(M):
  x = -heappop(queue)
  heappush(queue, -(x // 2))

print(-sum(queue))

Measured memory_bytes: 14096
# include <bits/stdc++.h>
# define rep(i,a,b) for(int i=(a);i<=(b);++i)
using namespace std;
int N;
int countd(int x){
	int v=0;
	while(x){ v+=x%10; x/=10; }
	return v;
}
int main(){
	scanf("%d",&N);
	int ans = countd(1)+countd(N-1);
	int mini = 1;
	rep(a,2,N-1){
		ans = min(ans,countd(a)+countd(N-a));
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
n,y=map(int,input().split())
for i in range(y//10000+1):
    for j in range((y-10000*i)//5000+1):
        if 10000*i+5000*j+1000*(n-i-j)==y:
            print(i,j,n-i-j)
            exit()
print("-1 -1 -1")

Measured memory_bytes: 2940
import itertools
import copy
N = int(input())
dic = {}
ans = [1 for _ in range(N)]
trueans = 0
for i in range(N):
  a = int(input())
  dic[i] = []
  for _ in range(a):
    x, y = input().split()
    dic[i].append((int(x),int(y)))
 
def check(dic, ans):
  for k, v in dic.items():
    for x, y in v:
      if ans[k] == 1:
        if ans[x-1] != y:
          return False
  return True
 
slist = []
for i in range(1, N+1):
  slist.append(i)
if check(dic, ans):
  print(N)
else:
  while(True):
    for i in range(1, N+1):
      tmp = list(itertools.combinations(slist,i))
      for t in tmp:
        anstmp = copy.deepcopy(ans)
        for t in t:
          anstmp[t-1] = 0
          flag = check(dic, anstmp)
          if flag:
            break
        if flag:
          break
      if flag:
        trueans = N - i
        break
    if flag:
      break
    break
  print(trueans)

Measured memory_bytes: 5744
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.TreeMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Comparator;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int D = Integer.parseInt(in.next());
            int[] c = new int[26];
            for (int i = 0; i < 26; i++) {
                c[i] = Integer.parseInt(in.next());
            }
            Map<Integer, Integer> s = new TreeMap<>(new Comparator<Integer>() {

                public int compare(Integer integer, Integer t1) {
                    if (t1.compareTo(integer) == 0) {
                        return 0;
                    } else if (t1.compareTo(integer) > 0) {
                        return 1;
                    } else {
                        return -1;
                    }
                }
            });
            int[] t = new int[D];
            for (int i = 0; i < D; i++) {
                s.clear();
                for (int j = 0; j < 26; j++) {
                    s.put(Integer.parseInt(in.next()), j + 1);
                }
                for (Integer k : s.keySet()) {
                    t[i] = s.get(k);
                    break;
                }
            }

            // 出力
            for (int i = 0; i < D; i++) {
                out.println(t[i]);
            }

        }

    }
}



Measured memory_bytes: 42908
import numpy as np
n, k = map(int, input().split())
P = list(map(int, input().split()))
P = list(map(lambda x: (x + 1) * x / 2 / x, P))
P = np.array([0] + P)
P = np.cumsum(P)
ans = np.zeros(n - (k - 1))
for i in range(n - (k - 1)):
    ans[i] = P[k + i] - P[i]
print(np.max(ans))

Measured memory_bytes: 50324
#include<stdio.h>
int main(void){
    int a,b;
    scanf("%d %d",&a,&b);
    if(a<b){
        printf("a < b\n");
    }else if(a>b){
        printf("a > b\n");
    }else if(a==b){
        printf("a == b\n");
    }
    return 0;
}


Measured memory_bytes: 2000
#include<cstdio>
#include<queue>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=510,inf=1e9;
struct fk{int to,nxt,w;}e[200010];
int head[N],cnt=1;
int dis[N],n,m,Sx,Sy,Tx,Ty,S,T,ans;
char s[N][N];
queue<int> q;
void add(int u,int v,int w){e[++cnt].to=v;e[cnt].nxt=head[u];e[cnt].w=w;head[u]=cnt;}
bool bfs(){
    memset(dis,63,sizeof(dis));
    dis[S]=0;q.push(S);
    while(!q.empty()){
        int u=q.front();q.pop();
        for(int i=head[u],v;i;i=e[i].nxt)
            if(e[i].w&&dis[v=e[i].to]>dis[u]+1)
                dis[v]=dis[u]+1,q.push(v);
    }
    return dis[T]<inf;
}
int dfs(int u,int flow){
    if(u==T||!flow)return flow;
    int now=0;
    for(int i=head[u],v;i;i=e[i].nxt)
        if(e[i].w&&dis[v=e[i].to]==dis[u]+1){
            int f=dfs(v,min(flow-now,e[i].w));
            e[i].w-=f;e[i^1].w+=f;now+=f;
        }
    if(!now)dis[u]=-1;
    return now;
}
void dinic(){for(;bfs();ans+=dfs(S,inf));}
int main(){
    scanf("%d%d",&n,&m);S=0;T=n+m+1;
    for(int i=1;i<=n;i++)
        scanf("%s",s[i]+1);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            if(s[i][j]=='S')Sx=i,Sy=j;
            else if(s[i][j]=='T')Tx=i,Ty=j;
            else if(s[i][j]=='o')add(i,j+n,1),add(j+n,i,0),add(j+n,i,1),add(i,j+n,0);
    if(Sx==Tx||Sy==Ty){puts("-1");return 0;}
    add(S,Sx,inf);add(Sx,S,0);
    add(S,Sy+n,inf);add(Sy+n,S,0);
    add(Tx,T,inf);add(T,Tx,0);
    add(Ty+n,T,inf);add(T,Ty+n,0);
    dinic();
    printf("%d\n",ans);
}


Measured memory_bytes: 768
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String Nb1 = scan.next();
		int N = Integer.valueOf(Nb1);
		int[] nb = new int[N];

		for (int i = 0; i < N; i++) {
			String Nb = scan.next();
			nb[i] = Integer.valueOf(Nb);
		}
		int a;
		int b;
		int count = 0;
		int renzoku = 0;
		for (int i = 0; i < N - 1; i++) {
			a = nb[i];
			b = nb[i + 1];
			if (renzoku == 2) {
				renzoku = 0;
			}
			if (renzoku == 1) {
				renzoku = 2;
			}
			if (a == b && renzoku == 0) {
				count++;
				renzoku++;
			}

		}

		System.out.println(count);

	}
}

Measured memory_bytes: 22228
// 見せてやるぜ、奇跡ってやつをよぉ……
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vll a(n); REP(i, n) cin >> a[i];

    ll low = 0, high = n;
    while (low < high) {
        ll mid = (low + high) >> 1;

        set< P<ll, ll> > ad;
        bool is_val = true;
        rep(i, 1, n) {
            if (a[i] <= a[i - 1]) {
                while (ad.size() > 0 && (*ad.rbegin()).first > a[i]) ad.erase(*ad.rbegin());
                for (ll j = a[i]; j >= 0; j--) {
                    if (j == 0) {
                        is_val = false;
                    } else {
                        if (ad.size() > 0 && (*ad.rbegin()).first == j) {
                            if ((*ad.rbegin()).second < mid - 1) {
                                P<ll, ll> end = *ad.rbegin();
                                ad.erase(*ad.rbegin());
                                end.second++;
                                ad.insert(end);
                                break;
                            } else {
                                ad.erase(*ad.rbegin());
                            }
                        } else {
                            if (mid == 1) {
                                is_val = false;
                            } else {
                                ad.insert(make_pair(j, 1));
                            }
                            break;
                        }
                    }
                }
            }
        }

        if (!is_val) low = mid + 1;
        else high = mid;
    }

    if (high == 0) high++;
    cout << high << '\n';
    return 0;
}


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

int main()
{
	int64_t n;
	string s;
	cin >> n >> s;

	vector<vector<int64_t>> p(10);
	for (int64_t i = 0; i < n; i++)
	{
		p[s[i] - '0'].emplace_back(i);
	}

	int64_t ans = 0;

	for (int64_t i = 0; i < 1000; i++)
	{
		vector<int64_t> as = {i / 100, i / 10 % 10, i % 10};
		[&] {
			for (int64_t j = 0, k = -1; j < 3; j++)
			{
				auto itr = upper_bound(p[as[j]].begin(), p[as[j]].end(), k);
				if (itr == p[as[j]].end())
				{
					return;
				}
				k = *itr;
			}
			ans++;
		}();
	}

	cout << ans << endl;

	return 0;
}

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

typedef long long ll;

string solve(ll n)
{
    ll x = 26;
    int cnt = 1;
    while (n > x)
    {
        n -= x;
        x = x * 26;
        cnt ++;
    }

    n -= 1;
    string ans = "";
    while (n)
    {
        ans = (char)('a' + (n % 26ll)) + ans;
        n /= 26;
    }
    // cout << ans << endl;
    // cout << (cnt - ans.length()) << endl;
    int len = cnt - ans.length();
    for (int i = 0; i < len; i ++)
        ans = 'a' + ans;
    return ans;
    
}

int main()
{
    ll n;
    cin >> n;
    cout << solve(n) << endl;
    // n --;
    // if (n == 0)
    // {
    //     cout << 'a' << endl;
    //     return 0;
    // }
    // string ans;
    // while (n)
    // {

    //     ans = (char)('a' + (n % 26ll)) + ans;
    //     n /= 26;
    // }
    // cout << ans << endl;
    
}

Measured memory_bytes: 3632
//by Top1
#include <bits/stdc++.h>
          
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define cerr cout
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
      
const int inf = (1e9) + 1;
const int mod = 479001599;
const int maxn = 1e6 + 111;
        
using namespace std;          

int k, n, a[maxn], dp[maxn], b[maxn], ans = inf;
 
void solve(){     
	cin >> k >> n;

	for (int i = 1; i <= n; i++)
		cin >> a[i];

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

	for (int i = 1; i <= n; i++)
		ans = min(ans, dp[n] - b[i]);

	cout << ans;
}                              
      
main(){
    boost;
    
    int q = 1;
 
    //cin >> q;
    
    while (q--){
        solve();
    }
}

Measured memory_bytes: 9984
# coding: utf-8
# Your code here!

import sys
readline = sys.stdin.readline
read = sys.stdin.read

#n,*a = [int(i) for i in read().split()]
#a = [int(i) for i in readline().split()]
#n = int(input())

n,*a = [int(i) for i in read().split()]

ok = 1
for i in a:
    if i%2==0:
        if i%3!=0 and i%5!=0:
            ok = 0
            break

if ok:
    print("APPROVED")
else:
    print("DENIED")



Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) {}
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if(par[x] < 0)
            return x;
        else
            return par[x] = root(par[x]);
    }

    bool issame(int x, int y) { return root(x) == root(y); }

    bool merge(int x, int y) {
        x = root(x);
        y = root(y);
        if(x == y)
            return false;
        if(par[x] > par[y])
            swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) { return -par[root(x)]; }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    vector<ll> a(N);
    for(auto &it : a) {
        cin >> it;
    }
    UnionFind uf(N);
    for(int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y;
        uf.merge(x, y);
    }
    map<int, vector<int>> forest;
    for(int i = 0; i < N; i++) {
        forest[uf.root(i)].emplace_back(a[i]);
    }
    if(forest.size() == 1) {
        cout << 0 << "\n";
        return 0;
    }
    ll ans = 0;
    for(auto &t : forest) {
        sort(RALL(t.second));
        ans += t.second.back();
        t.second.pop_back();
    }
    vector<ll> kouho;
    for(auto t : forest) {
        for(auto i : t.second) {
            kouho.emplace_back(i);
        }
    }
    sort(ALL(kouho));
    if(kouho.size() + 2 < forest.size()) {
        cout << "Impossible\n";
        return 0;
    }
    for(int i = 0; i < (int)forest.size() - 2; i++) {
        ans += kouho[i];
    }
    cout << ans << "\n";
}

Measured memory_bytes: 15324
N, X, Y = map(int, input().split())
X -= 1
Y -= 1

def min_dist(i, j):
    d1 = abs(i - j)

    d2 = abs(X - i) + abs(Y - j) + 1

    return min(d1, d2)


ans = [0] * N

for i in range(N):
    for j in range(i+1, N):
        ans[min_dist(i, j)] += 1

[print(a) for a in ans[1:]]

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

int main() {
    // 頂点数と辺数
    int N, x, y; cin >> N >> x >> y;

    // グラフ入力受取 (ここでは無向グラフを想定)
    Graph G(N);
    for (int i = 0; i < N-1; ++i) {
        G[i].push_back(i+1);
        G[i+1].push_back(i);
    }
    G[x-1].push_back(y-1);
    G[y-1].push_back(x-1);

    vector<int> ds(N);
    rep(i, N){
        // BFS のためのデータ構造
        vector<int> dist(N, -1); // 全頂点を「未訪問」に初期化
        queue<int> que;

        // 初期条件 (頂点 0 を初期ノードとする)
        dist[i] = 0;
        que.push(i); // 0 を橙色頂点にする

        // BFS 開始 (キューが空になるまで探索を行う)
        while (!que.empty()) {
            int v = que.front(); // キューから先頭頂点を取り出す
            que.pop();

            // v から辿れる頂点をすべて調べる
            for (int nv : G[v]) {
                if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない

                // 新たな白色頂点 nv について距離情報を更新してキューに追加する
                dist[nv] = dist[v] + 1;
                que.push(nv);
            }
        }

        // 結果出力 (各頂点の頂点 0 からの距離を見る)
        for (int v = 0; v < N; ++v) ds[dist[v]]++;
    }
    int ans = 0;
    for (int i = 1; i < N; i++){
        ans = ds[i]/2;
        cout << ans << endl;
    }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int power(int x){
    return (x * x * x * x * x);
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        int p = 1;
        vector<int> v;
        map<int, int> mp;
        while(power(p) < 1e12){
            v.pb(power(p));
            mp[power(p)] = p;
            p++;
        }
        p = -1;
        while(power(p) > -1e12){
            v.pb(power(p));
            mp[power(p)] = p;
            p--;
        }
        v.pb(0);
        sort(all(v));
        mp[0] = 0;
        int x;
        cin >> x;
        pair<int, int> ans;
        for(auto &it : v){
            if(mp.find(it + x) != mp.end()){
                ans = {mp[it], mp[it + x]};
            }
        }
        cout << max(ans.ff, ans.ss) << ' ' << min(ans.ff, ans.ss) << '\n';
    }
}


Measured memory_bytes: 34512
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define  mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int a,b,c;cin>>a>>b>>c;
    for(int i=1;i<100000;i++){
        if(i*a%b==c){
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint 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;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 

  int main(){
      lint n,k;
      cin>>n>>k;
      lint a[n];
      lint f[n];
      rep(i,n)cin>>a[i];
      rep(i,n)cin>>f[i];
      sort(a,a+n);
      sort(f,f+n,greater<lint>());
      lint left=-1,right=INF;
      while(right-left>1){
       lint mid=(right+left)/2;
       lint count=0;
       rep(i,n){
           count+=max(0LL,(a[i]*f[i]-mid+f[i]-1)/f[i]);
       }   
       if(count>k)left=mid;
       else right=mid;
      }
      cout<<right<<endl;
      }
      

Measured memory_bytes: 6816
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
   int x,p,z;
   cin>>x;
   if(x==0)
    cout<<"0";
   else
   {
       p=x/500*1000;
       z=(x-(p/2));
       z/=5;
       z*=5;
       cout<<p+z;
   }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;
};
int main() {
  string s;
  cin >> s;
  stack<char> ans{};
  REP(i, s.size()) {
    if (s[i] == '1') {
      ans.push('1');
    } else if (s[i] == '0') {
      ans.push('0');
    } else {
      if (!ans.empty()) ans.pop();
    }
  }
  vector<char> a(0);
  while (!ans.empty()) {
    a.push_back(ans.top());
    ans.pop();
  }
  reverse(a.begin(), a.end());
  REP(i, a.size()) { cout << a[i]; }
  cout << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

//繰り返し自乗法
ll mpow(ll x, ll n) {
  ll ans=1;
  while(n>0) {
    if(n&1) {
      ans=ans*x%mod;
    }
    x=x*x%mod;
    n>>=1;
  }
  return ans;
}

//階乗,factで初期化
vec tfact(1e7+1);
void fact(ll n) {
  for(ll i=0;i<=n;i++) {
    if(i==0) {
      tfact[i]=1;
    }
    else {
      tfact[i]=tfact[i-1]*i%mod;
    }
  }
}

//nCk 繰り返し高速
ll comb(ll n, ll k) {
  return tfact.at(n)*mpow(tfact.at(k),mod-2)%mod*mpow(tfact.at(n-k),mod-2)%mod;
}

int main() {
  ll h,w,a,b;
  cin >> h >> w >> a >> b;
  fact(h+w);
  ll ans=0;
  for(ll i=b+1;i<=w;i++) {
    (ans+=comb(h-a-1+i-1,i-1)*comb(a-1+(w-i),a-1)%mod)%=mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 78336
#include<iostream>
#include<string>
using namespace std;
int main(){
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  int a=A*B;
  int b=C*D;
  if(a>=b){
    cout<<a<<endl;
  }
  else{
    cout<<b<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
K=int(input())

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

ans=0
re=[1373253, 1422195, 1453816, 1502376, 1553361, 1595437, 1629570, 1691292, 1726717, 1782111, 1827492, 1887772, 1925853, 1986837, 2033674, 2089776, 2145333, 2197483, 2246640, 2332104, 2379085, 2434833, 2490534, 2554600, 2609625, 2693919, 2742052, 2813988, 2875245, 2952085, 3003306, 3096024, 3157249, 3224511, 3306240, 3388576, 3444609, 3533637, 3591322, 3693924, 3767085, 3842623, 3912324, 4027884, 4102093, 4181949, 4270422, 4361548, 4427853, 4548003, 4616104, 4718640, 4812789, 4918561, 5003286, 5131848, 5205481, 5299011, 5392008, 5521384, 5610705, 5739009, 5818390, 5930196, 6052893, 6156139, 6239472, 6402720, 6493681, 6623853, 6741078, 6864016, 6953457, 7094451, 7215016, 7359936, 7475145, 7593865, 7689630, 7886244, 7984165, 8130747, 8253888, 8403448, 8523897, 8684853, 8802826, 8949612, 9105537, 9267595, 9376656, 9574704, 9686065, 9827097, 9997134, 10174780, 10290813, 10493367, 10611772, 10813692]

if K < 102:
    for a in range(1,K+1):
        for b in range(1,K+1):
            hoge=gcd(a,b)
            for c in range(1,K+1):
                g=gcd(hoge,c)
                ans += g
else:
    ans=re[K-101]



print(ans)

Measured memory_bytes: 9308