akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <set>
#include <numeric>
#define rep(i,n) for (int i=0; i < (n); ++i)
#define all(a) a.begin(), a.end()
using ll = long long;
using namespace std;

const ll mx = 1e18;

int main(void) 
{
    int n; cin >> n;
    
    vector<ll> a(n); // vetctor<ll>
    rep(i,n) {
        cin >> a.at(i);
        if (a.at(i) == 0) {
            cout << 0 << endl;
            return 0;
        }
    }

    // 1e18; →　double であるらしい
    ll ans = 1;
    rep(i,n) {

        if (ans*a.at(i) > mx || a.at(i) > mx /ans) { //llに合わせてやる
            cout << -1 << endl;
            return 0;
        }
        ans *= a.at(i);
    }
    // cout << 1e18 << endl;

    
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 4048
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const string YES = "Yes";
const string NO = "No";

template <class InputIterator, class OutputIterator>
OutputIterator RLE(InputIterator start, InputIterator end, OutputIterator result)
{
    InputIterator cmp = start;
    size_t cnt = 0;

    while (start != end) {
        start++;
        cnt++;
        if (start == end || *start != *cmp) {
            *result++ = { *cmp, cnt };
            cmp = start;
            cnt = 0;
        }
    }

    return result;
}

void solve(std::string s, long long x, long long y)
{
    vector<pair<char, ll>> rle;
    RLE(begin(s), end(s), back_inserter(rle));

    ll turn =0;
    using std::swap;
    unordered_set<ll> x_cand;
    unordered_set<ll> y_cand;
    x_cand.insert(0);
    y_cand.insert(0);
    for (auto&& r : rle) {
        if (r.first == 'F') {
            if (turn == 0) {
                x_cand.clear();
                x_cand.insert(r.second);
            } else if (turn % 2 == 1) {
                unordered_set<ll> y_cand_n;
                for (auto yc : y_cand) {
                    y_cand_n.insert(yc + r.second);
                    y_cand_n.insert(yc - r.second);
                }
                swap(y_cand, y_cand_n);
            } else {
                unordered_set<ll> x_cand_n;
                for (auto xc : x_cand) {
                    x_cand_n.insert(xc + r.second);
                    x_cand_n.insert(xc - r.second);
                }
                swap(x_cand, x_cand_n);
            }
        }
        if (r.first == 'T') {
            turn += r.second;
        }
    }

    if (x_cand.count(x) > 0 && y_cand.count(y) > 0) {
        cout << YES << endl;
    } else {
        cout << NO << endl;
    }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    std::string s;
    std::cin >> s;
    long long x;
    scanf("%lld", &x);
    long long y;
    scanf("%lld", &y);
    solve(s, x, y);
    return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string s, t, B = "~";
bool isOK(string A1, string A2) {
	for (int i = 0; i < A1.size(); i++) {
		if (A1[i] != '?' && A1[i] != A2[i])return false;
	}
	return true;
}
int main() {
	cin >> s >> t;
	for (int i = 0; i <= (int)s.size() - (int)t.size(); i++) {
		string U = s.substr(i, t.size());
		if (isOK(U, t) == true) {
			string v = s;
			for (int j = i; j < i + t.size(); j++)v[j] = t[j - i];
			for (int j = 0; j < i; j++) { if (v[j] == '?')v[j] = 'a'; }
			for (int j = i + t.size(); j < v.size(); j++) { if (v[j] == '?')v[j] = 'a'; }
			B = min(B, v);
		}
	}
	if (B == "~")cout << "UNRESTORABLE" << endl;
	else cout << B << endl;
	return 0;
}


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


x = [list(input().split(" ")) for i in range(n)]

for i in range(n):
    x[i][1] = int(x[i][1])

test2 = sorted(x, key = lambda k:(k[0],-k[1]))

for i in range(n):
    print(x.index(test2[i]) + 1)

Measured memory_bytes: 3060
#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 ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,k;
  cin >> n >> k;
  int ans = 0;
  REP(i,n){
    int x;
    cin >> x;
    ans += min(x,k-x);
  }
  cout << ans*2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;

int main(void) {
    ios::sync_with_stdio(false);

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

    if(a <= 0 && b >= 0)cout << "Zero";
    else if(a > 0) cout << "Positive";
    else if(abs(a-b) % 2 == 0)cout << "Negative";
    else if(abs(a-b) % 2 == 1)cout << "Positive";

    return 0;
}

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

#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

//プロトタイプ宣言
void faster(void);
ll gcd(auto , auto);
ll get_digent(auto);
ll POW(auto , auto);
ll vec_max(auto & , string);
ll vec_min(auto & , string);

int main(){
  faster();
  int x,a;
  cin >> x >> a;
  cout << ((x >= a) ? 10 : 0) << endl;
}


























//以下、ライブラリ

//同期解除
void faster(void){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

//ユークリッドの互除法
ll gcd(auto a, auto b) {
  return (b ? gcd(b, a%b) : a);
} 

//桁数取得
ll get_digent(auto x){
  string s;
  s = to_string(x);
  ll digent = s.size();
  return digent;
} 

//べき乗計算
ll POW(auto x, auto y){
  if(y==0) return 1;
  if(y%2 == 1){
    ll temp = POW(x,y-1);
    return (temp*x);
  }
  else{
    ll temp = POW(x,y/2);
    return temp*temp;
  }
} 

//配列内の最大要素の添え字取得or要素取得
ll vec_max(auto &v, string s){
  auto itr = max_element(v.begin(),v.end());
  ll element = *itr;
  ll place = itr - v.begin();
  if(s == "element") return element;
  else if(s == "place") return place;
  else return -1;
}

//配列内の最小要素の添え字取得or要素取得
ll vec_min(auto &v, string s){
  auto itr = min_element(v.begin(),v.end());
  ll element = *itr;
  ll place = itr - v.begin();
  if(s == "element") return element;
  else if(s == "place") return place;
  else return -1;
}

Measured memory_bytes: 256
/*
      HET PAGHADAR
      DA-IICT
      @HET262
*/
 
#include<bits/stdc++.h>
using namespace std;
 
typedef long double ld;
typedef long long ll;
 
typedef vector<ll> vec;
#define INF LLONG_MAX
 
#define P pair<ll,ll>
#define int long long int
 
#define ff first
#define ss second
 
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
 
#define N 100005
#define MOD 1000000007

ll dp[N];
vector<vec> g(N);
bool visit[N];

ll dfs(ll x)
{
      visit[x]=1;
      ll mm=-1;
      
      for(auto X:g[x])
      {
            if(!visit[X])
                  mm=max(dfs(X),mm);
            else if(dp[X]!=-1)
                  mm=max(mm,dp[X]);
      }
      return dp[x]=mm+1;
}

signed main()
{
      FAST;
      
      ll n,m;
      cin>>n>>m;
      
      while(m--)
      {
            ll x,y;
            cin>>x>>y;
            g[x].push_back(y);
      }
      
      memset(visit,false,sizeof(visit));
      
      for(int i=1;i<=n;i++)
      {
            if(!visit[i])
            {
                  dfs(i);
            }
      }
      
      ll ans=0;
      for(int i=1;i<=n;i++)
      {
            ans=max(ans,dp[i]);
      }
      
      cout<<ans<<"\n";
      
}

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

using namespace std;

const int N = 1234567;

long long a[N], b[N];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int aa, bb;
    scanf("%d %d", &aa, &bb);
    a[i] = aa;
    b[i] = bb;
  }
  long long ans = 0;
  for (int i = n - 1; i >= 0; i--) {
    a[i] += ans;
    long long add = (b[i] - a[i] % b[i]) % b[i];
    ans += add;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;;
#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 INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

ll dp[51][2560];
ll c[51];
ll d[51];
ll suma = 0;
vector<PP> v[51];
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,m,s;cin >> n>> m >> s;
  rep(i,m){
    ll uu,vv,aa,bb;cin >> uu >> vv >> aa >> bb;
    suma += aa;
    uu--;vv--;
    v[uu].push_back(mp(vv, mp(aa,bb)));
    v[vv].push_back(mp(uu, mp(aa,bb)));
  }
  if(s>2555){
    s = 2555;
  }
  rep(i,n){
    ll cc,dd;cin >>cc >> dd;
    c[i] = cc;
    d[i] = dd;
  }
  rep(i,n){
    rep(j,2560){
      dp[i][j] = LINF;
    }
  }
  dp[0][s] = 0;
  queue<P> q;
  q.push(mp(0,s));
  while(q.size()){
    P tmp = q.front();
    q.pop();
    ll pos = tmp.first;
    ll mon = tmp.second;
    ll pc = c[pos];
    ll pd = d[pos];
    ll pmon = mon;
    for(ll i = 1; mon + i * pc<= 2555; i++){
      if(dp[pos][mon + i * pc] > dp[pos][mon] + i * pd){
        dp[pos][mon+i*pc] = dp[pos][mon] + i * pd;
        q.push(mp(pos, mon+i*pc));
      }
    }
    rep(i,v[pos].size()){
      ll to = v[pos][i].first;
      ll aa = v[pos][i].second.first;
      ll bb = v[pos][i].second.second;
      if(mon>=aa){
        if(dp[to][mon-aa] > dp[pos][mon] + bb){
          dp[to][mon-aa] = dp[pos][mon] + bb;
          q.push(mp(to,mon-aa));
        }
      }
    }
  }
  FOR(i,1,n){
    ll ans = LINF;
    rep(j,2560){
      ans = min(ans, dp[i][j]);
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 11316
//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define CLR(x) memset(x,0,sizeof x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 1000000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 1000000000
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
	if(x==0)
	return "0";
	string ret="";
	while(x){
		ret=ret+(char)(x%10+'0');
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string add(string a,string b){
	if(a=="")
	a="0";
	if(b=="")
	b="0";
	if(a.length()<b.length())
	swap(a,b);
	while(b.length()<a.length()){
		b='0'+b;
	}
	for(int i=0;i<a.length();i++){
		a[i]=a[i]+(b[i]-'0');
	}
	bool big=false;
	for(int i=a.length()-1;i>=0;i--){
		if(big){
			a[i]++;
		}
		big=false;
		if(a[i]>'9'){
			a[i]=a[i]-10;
			big=true;
		}
	}
	if(big)
	a='1'+a;
	return a;
}
string mul(string a,string b){
	vector<int> va,vb;
	if(a=="0" || b=="0")
	return "0";
	string ans;
	for(int i=0;i<a.length();i++){
		va.push_back(a[i]-'0');
	}
	for(int i=0;i<b.length();i++){
		vb.push_back(b[i]-'0');
	}
	reverse(va.begin(),va.end());
	reverse(vb.begin(),vb.end());
	vector<int> res;
	res.clear();
	res.resize(1005);
	for(int i=0;i<a.length();i++){
		for(int j=0;j<b.length();j++){
			res[i+j]+=(va[i]*vb[j]);
		}
	}
	for(int i=0;i<1005;i++){
		if(res[i]>9){
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	for(int i=0;i<1005;i++){
		ans+=(res[i]+'0');
	}
	reverse(ans.begin(),ans.end());
	int k=0;
	while(ans[k]=='0'){
		k++;
	}
	ans=ans.substr(k);
	return ans;
}
bool is_prime(int n){
	if(n<2)
    return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0)
    return false;
    return true;
}
const ll N = 100005;
 
ll n, ans, l[N], r[N];
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	scanf("%lld",&n);
	for(ll i=1;i<=n;i++) {
		scanf("%lld%lld",&l[i],&r[i]);
	}
	sort(l+1, l+1+n);
	sort(r+1, r+1+n);
	reverse(l+1, l+1+n);
	ll ans = 0;
	for(ll i=1;i<=n;i++) {
		l[i] = l[i-1] + l[i];
		r[i] = r[i-1] + r[i];
		ans = max({ans, l[i]-r[i], l[i-1]-r[i], l[i]-r[i-1]});
	}
	printf("%lld\n",2*ans);
	//system("pause");
	return 0;
}

Measured memory_bytes: 1792
'''A - Colorful Transceivers
https://atcoder.jp/contests/abc097/tasks/abc097_a

>>> main(4, 7, 9 ,3)
Yes
>>> main(100, 10, 1 ,2)
No
>>> main(10, 10, 10 ,1)
Yes
>>> main(1, 100, 2, 10)
Yes
'''


def main(a, b, c, d):
    if abs(a-c) <= d or abs(a-b) <= d and abs(b-c) <= d:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    a, b, c, d = map(int, input().split(' '))

    main(a, b, c, d)


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

ll mpow(ll x, ll n){ //x^n(mod mo) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % mo;
        x = x*x % mo;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b){
    //ll n = a-b;
    ll sa = 1,sb = 1;
    ll k = b;
    rep(i,k){
        sa *= a;
        sa %= mo;
        sb *= b;
        sb %= mo;
        a--;b--;
    }
    return (sa*mpow(sb, mo-2)) % mo;

}

int main(){
    ll X,Y;
    cin >> X >> Y;
    ll nmove = (X+Y)/3;
    ll n = abs(Y - X);
    ll m = (nmove + n)/2;
    //cout << nmove<< " " << m<<endl;
    if((X+Y)%3 != 0 || (m*1+2*(nmove-m) != X && m*1+2*(nmove-m) != Y)){
        cout << 0 << endl;
        return 0;
    }
    cout << comb(nmove,m) << endl;
    /*
    queue<P> que;
    map<P,int> co;
    que.push(P(0,0));
    while(!que.empty()){
        P p = que.front();
        que.pop();
        int x = p.first;
        int y = p.second;
        if(x+1 <= X && y+2 <= Y){
            que.push(P(x+1,y+2));
        }
        if(x+2 <= X && y+1 <= Y){
            que.push(P(x+2,y+1));
        }
        co[p]++;
    }
    cout << co[P(X,Y)] << endl;
    */
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n;
	scanf("%d",&n);
	int i;
	int l,r;
	int ans=0;
	for(i=0;i<n;i++)
	{
		scanf("%d %d",&l,&r);
		ans+=r-l+1;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
 
int main()
{
int i;
char moji[3][101];
int cnt[3];
 
for(i = 0; i < 3; i++){
scanf("%s", moji[i] );
cnt[i] = 0;
}
 
int pos = 0;
char c;
while (1){
c = moji[pos][cnt[pos]];
if (c == 'a'){
cnt[pos]++;
pos = 0;
}else if(c == 'b'){
cnt[pos]++;
pos = 1;
}else if(c == 'c'){
cnt[pos]++;
pos = 2;
}else if(c == '\0'){
if (pos == 0){
printf("A");
} else if (pos == 1){
printf("B");
} else if (pos == 2){
printf("C");
}
break;
}//if
}//while
return 0;
}

Measured memory_bytes: 128
//
//  main.cpp
//  ABC167D

#include <iostream>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
int main(int argc, const char * argv[]) {
    int n;
    ll k;
    cin >> n >> k;
    vector<int>A(n+1);
    rep(i,n){
        cin >> A.at(i+1);
    }
    A.at(0)=1; //  1 6 2 5 3 2 5 3 2 ....
    
    vector<int>s;
    vector<int>ord(n+1,-1);
    int head=0;
    while(ord.at(A.at(head))==-1){
        s.push_back(A.at(head));
        ord.at(A.at(head))=(int)s.size();
        head=A.at(head);
    }
    int lead=ord.at(A.at(head))-1;
    int loop=(int)s.size()-lead;
    
    if (k<(ll)s.size()) {
        cout<<s.at(k)<<endl;
    }else{
        k=k-lead;
        k=k%loop;
        cout<<s.at(lead+k)<<endl;
    }
    return 0;
}


Measured memory_bytes: 5444
#include<bits/stdc++.h>
#define fi first
#define se second
#define lc (x<<1)
#define rc (x<<1|1)
#define gc getchar()//(p1==p2&&(p2=(p1=buf)+fread(buf,1,size,stdin),p1==p2)?EOF:*p1++)
#define mk make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define IT iterator 
#define vi vector<int>
#define TP template<class o>
#define SZ(a) ((int)a.size())
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int N=2e5+10,size=1<<20,mod=998244353,inf=2e9;

//char buf[size],*p1=buf,*p2=buf;
template<class o> void qr(o &x) {
    char c=gc; x=0; int f=1;
    while(!isdigit(c)){if(c=='-')f=-1; c=gc;}
    while(isdigit(c)) x=x*10+c-'0',c=gc;
    x*=f;
}
template<class o> void qw(o x) {
    if(x/10) qw(x/10);
    putchar(x%10+'0');
}
template<class o> void pr1(o x) {
    if(x<0)x=-x,putchar('-');
    qw(x); putchar(' ');
}
template<class o> void pr2(o x) {
    if(x<0)x=-x,putchar('-');
    qw(x); putchar('\n');
}

int n,lx[N],ls[N],rx[N],rs[N],X[N],Y[N];
int find(int *a,int x) {return lower_bound(a+1,a+n+1,x)-a;}
struct rec {
    int x,y;
} a[N];
bool cmp1(rec a,rec b) {return a.x<b.x;}
int c[N];
void add(int x) {for( ;x<=n;x+=x&-x) c[x]++;}
int ask(int x) {int y=0; for( ;x;x-=x&-x) y+=c[x]; return y;}
int ask(int l,int r) {return ask(r)-ask(l-1);}

ll mult(ll a,ll b,ll p) {
    a=(a%p+p)%p; b=(b%p+p)%p;
    ll c=(ld)a*b/p;
    return a*b-c*p;
}
ll gcd(ll a,ll b) {return !a?b:gcd(b%a,a);}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
ll power(ll a,ll b=mod-2) {
    ll c=1;
    while(b) {
        if(b&1) c=c*a%mod;
        b /= 2; a=a*a%mod;
    }
    return c;
}
ll Power(ll a,ll b=mod-2) {
    ll c=1;
    while(b) {
        if(b&1) c=mult(c,a,mod);
        b /= 2; a=mult(a,a,mod);
    }
    return c;
}

int main() {
    qr(n);
    for(int i=1;i<=n;i++) qr(a[i].x),qr(a[i].y),X[i]=a[i].x,Y[i]=a[i].y;
    sort(X+1,X+n+1);  sort(Y+1,Y+n+1);
    for(int i=1;i<=n;i++) a[i].x=find(X,a[i].x),a[i].y=find(Y,a[i].y);
    sort(a+1,a+n+1,cmp1);
    for(int i=1;i<=n;i++) {
        lx[i]=ask(a[i].y);
        ls[i]=i-1-lx[i];
        add(a[i].y);
    }
    memset(c,0,sizeof c);
    ll t,ans=n*(t=power(2,n-1))%mod;
    for(int i=n;i;i--) {
        rx[i]=ask(a[i].y);
        rs[i]=(n-i)-rx[i];
        add(a[i].y);
        ll A=lx[i],B=ls[i],C=rs[i],D=rx[i];
        ans += t - power(2,A+B) - power(2,B+C) - power(2,C+D) - power(2,D+A) + power(2,A)+power(2,B)+power(2,C)+power(2,D)-1;
        ans %= mod;
    }
    pr2((ans+mod)%mod); return 0;
}


Measured memory_bytes: 10640
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	a, b, c := nextInt(), nextInt(), nextInt()
	fmt.Println(MinOf(a+b, b+c, c+a))
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}


Measured memory_bytes: 1808
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;

void test_case(){
	int a,b;
	cin >> a >> b;
	cout << a*b << endl;
}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
	int t=1;
	// cin >> t;

	while(t--) test_case();
	
	return 0;
}


Measured memory_bytes: 3612
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
#define Maxn 3010

int n, m, Row[Maxn][Maxn], Col[Maxn][Maxn], f[Maxn][Maxn][2][2], Res;
char D[Maxn][Maxn];

int main()
{
    scanf("%d%d", &n, &m); getchar();
    for (int i=1; i<=n; i++)
    {
        for (int j=1; j<=m; j++)
        {
            scanf("%c", &D[i][j]);
            if (D[i][j]=='W')
            {
                if ((i>=3) && (D[i-2][j]=='R') && (D[i-1][j]=='G'))
                    Row[i-2][j]=1;
                if ((j>=3) && (D[i][j-2]=='R') && (D[i][j-1]=='G'))
                    Col[i][j-2]=1;
            }
        }
        getchar();
    }
    /*
    for (int i=1; i<=n; i++)
    {
        for (int j=1; j<=m; j++) printf("(%d %d)", Row[i][j], Col[i][j]); printf("\n");
    }
    */
    for (int i=1; i<=n; i++)
    {
        for (int j=2; j<=m; j++)
        {
            f[i+1][j-1][0][0]=max(f[i][j][0][1], f[i][j][0][0]+Col[i][j]);
            f[i+1][j-1][1][0]=max(f[i][j][0][1], f[i][j][0][0])+Row[i][j];
            f[i+1][j-1][0][1]=max(f[i][j][1][0], f[i][j][1][1]);
            f[i+1][j-1][1][1]=max(f[i][j][1][0], f[i][j][1][1])+Row[i][j];
        }
        int L = max(max(f[i][1][0][0], f[i][1][0][1]), max(f[i][1][1][0], f[i][1][1][1]))+Row[i][1];
        Res+=max(f[i][1][0][0]+Col[i][1], L);
    }
    for (int i=1; i<=m; i++) Res+=f[n+1][i][0][0];
    printf("%d\n", Res);
}



Measured memory_bytes: 223168
import java.util.*;
import java.io.*;

public class Main {

	private static void solve(){
		//Implement solution here.
		int a = ni();
		System.out.println(a + a*a + a*a*a);
			
	}

	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		boolean hasNext = true;
		while(hasNext){
			solve();	
			try{
				br.mark(1);
				if(br.read() > 0){
					br.reset();			
					System.out.println("---");
				} else {
					hasNext = false;
				}
			}catch(Exception e){
				throw new RuntimeException(e);
			} 
		}
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 25372
package main

import "fmt"

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)

	if a == b && c != a ||
		b == c && c != a ||
		c == a && a != b {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}


Measured memory_bytes: 1768
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    int N; cin >> N;
    vector<int>H(N);
    int A;
    rep(i, N) {
        cin >> H[i];
        if (i == 0) {
            A = H[i];
            continue;
        }
        else {
            if (A > H[i]) {
                H[i]++;
            }
            A = max(A, H[i]);
        }
    }
    if (N != 1){
        REP(i, N) {
            if (H[i] < H[i - 1]) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3788
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=2e5+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
   }

void solve() {
   int k,a,b;
   cin>>k>>a>>b;
   if(a>b) swap(a,b);
   int x=k,flag=0;
   for(int i=1;;i++) {
	     if(x>a && x>b) break;
	    
	     if(x>=a && x<=b) {
			   flag=1;
			   break;
			 }
			 
		 x+=k;	           
	 }
	 	 
	 if(flag) cout<<"OK\n";
	 else cout<<"NG\n"; 
          
 }

    
int32_t main() {
	cool;
	int t=1;
	//cin>>t;
	while(t--)
	  solve();

return 0;	   
}


Measured memory_bytes: 3500
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()
int main(){
    char c;
    cin>>c;
    set<char>boin;
    boin.insert('a');
    boin.insert('i');
    boin.insert('u');
    boin.insert('e');
    boin.insert('o');
    if(boin.count(c)){
        cout<<"vowel"<<endl;
    }else{
        cout<<"consonant"<<endl;
        
    }
}


Measured memory_bytes: 3628
import fractions

a, b, c, d = map(int, input().split())

def func(n, x, y):
    lcm = x * y // fractions.gcd(x, y)
    return n - (n // x + n // y - n // lcm)

print(func(b, c, d) - func(a - 1, c, d))


Measured memory_bytes: 5304
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

#define debug(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(int i=0;i<(n);i++)
#define fori(a,b,i) for(int i=(a);i<=(b);i++)
#define ford(a,b,i) for(int i=(a);i>=(b);i--)
#define fast_io ios_base::sync_with_stdio(false) , cin.tie(NULL);


#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007

#define fir first
#define sec second
#define pb push_back
#define mp make_pair

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MII;
typedef set<int> SI;
typedef long long int llint;




int main(){
	llint p, n;
	cin>>p>>n;
	vector <llint> v(n);
	llint dis = 0;
	loop(i, n){
		cin>>v[i];
	}
	sort(v.begin(), v.end());
	llint mdis = 0;
	loop(i, n-1){
		mdis = max(mdis, abs(v[(i+1)%n] - v[i]));
	}
	mdis = max(mdis, p - v[n-1] + v[0]);
	cout<<p - mdis;
	return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<numeric>
#include<set>
#include<map>
#include<deque>
#include<list>
#include<forward_list>
#include<utility>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define ll long long
#define v vector<ll>
const ll w = (1e9 + 7);
using namespace std;
void fireman()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
struct great {
	//descending order
	bool operator()(int x, int y)
	{
		return x < y;
	}
};


struct small {
	//asecending order
	bool operator()(int x, int y)
	{
		return x > y;
	}
};

int prime(int x)
{
	bool b = true;
	if (x == 2)
	{
		return true;
	}
	else if (x == 1 || x % 2 == 0)
	{
		return false;
	}
	for (int i = 3; i * i <= x; i += 2)
	{
		if (x % i == 0)
		{
			b = false;
			return false;
			break;
		}
	}
	return true;
}
bool great1(int a, int b)
{
	//descending order 
	return a > b;
}
bool small1(int a, int b)
{
	//asecending order 
	return a < b;
}
/*int sum_range(ll i, ll j, ll k, ll l, vector<vector<ll>>& S) {
	return S[k][l] - S[k][j - 1] - S[i - 1][l] + S[i - 1][j - 1];
}*/
int main()
{
	fireman();
	string x, y;
	cin >> x >> y;
	int z = 0;
	for (int i = 0; i < x.length(); i++)
	{
		if (x[i] != y[i])
		{
			z++;
		}
	}
	cout << z << endl;

}







Measured memory_bytes: 3896
import java.util.*

fun main(args: Array<String>) {
  val scanner = Scanner(System.`in`)
  val list = ArrayList<Int>()

  var min = 10
  var sum = 0
  for (i in 0..4) {
    list.add(scanner.nextInt())
    min = if (list[i] % 10 != 0) { if (list[i] % 10 < min) list[i] % 10 else min } else min
    sum += if (list[i] % 10 != 0) (list[i] / 10 + 1) * 10 else list[i]
  }
  scanner.close()
  println(sum - 10 + min)
}


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

int dp[101][4][4][4];

int main(){
  int N;
  cin >> N;
  
  dp[0][3][3][3] = 1; //上からi桁目まで見たときその前の三桁の状態
  //A->0 G->1 C->2 T->3

  rep(l,N){
    rep(i,4){
      rep(j,4){
        rep(k,4){
          if(dp[l][i][j][k] == 0)continue;
          rep(a,4){
            if(a == 2 && i == 1 && j == 0)continue; //AGC
            if(a == 2 && i == 0 && j == 1)continue; //GAC
            if(a == 1 && i == 2 && j == 0)continue; //ACG
            if(a == 2 && i == 1 && k == 0)continue; //A○GC
            if(a == 2 && j == 1 && k == 0)continue; //AG○C

            dp[l+1][a][i][j] += dp[l][i][j][k];
            dp[l+1][a][i][j] %= MOD;
          }
        }
      }
    }
  }

  int res = 0;

  rep(c1,4)rep(c2,4)rep(c3,4)res += dp[N][c1][c2][c3],res %= MOD;
  
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define rep(i,a,b) for(int i=a;i<b;i+=1)
#define reps(i,a,b) for(int i=a;i>=b;i-=1)
#define vi vector<int>
#define pb push_back
#define in(x) int x; cin>>x;
#define mi unordered_map<int,int>
#define mem(x) memset(x, 0, sizeof(x))
using namespace std;

void helper(char s[], char t[], int n, int m){
	
	int arr[n+1][m+1];
	rep(i, 0, n+1) arr[i][0] = 0;
	rep(j, 1, m+1) arr[0][j] = 0;
	
	rep(i, 1, n+1)
	{
		rep(j, 1, m+1)
		{
			if(s[i-1] == t[j-1]) arr[i][j] = 1 + arr[i-1][j-1];
			else arr[i][j] = max(arr[i-1][j], arr[i][j-1]);	
		}
	}
	
	int len = arr[n][m];
	char ans[len+1];
	ans[len] = '\0';
	int i = n, j = m;
	while(i > 0 && j > 0)
	{
		if(s[i-1] == t[j-1])
		{
			ans[len-1] = s[i-1];
			i-=1;
			j-=1;
			len-=1;
		}
		else if(arr[i-1][j] > arr[i][j-1]) i-=1;
		else j-=1;
	}
	cout<<ans;
}

int32_t main(void){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	
	char s[3001], t[3001];
	cin>>s>>t;
	int n = strlen(s);
	int m = strlen(t);
	helper(s, t, n, m);
}

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

using namespace std;

int main() {
    unsigned long num, x;
    cin >> num >> x;
    
    vector<unsigned long> r;
    r.resize(num);

    for (auto&& e : r) {
        cin >> e;
        x -= e;
    }
    
    sort(r.begin(), r.end());
    
    cout << (num + x / r[0]) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		double[] ab = new double[2];
		ab[0] = (sc.nextDouble());
		ab[1] = (sc.nextDouble());
		int c = (int)(ab[0] * ab[1]);
		int d = (int)(2. * (ab[0] + ab[1]));
		System.out.print(c);
		System.out.print(" ");
		System.out.print(d);
		System.out.println();
	}
}


Measured memory_bytes: 27576
'use strict'

function main(input) {
  input = input
    .trim()
    .split(' ')
    .map(v => ~~v)
  // const tmp = input[0] - input[1]
  const a = input[0]
  const b = input[1]

  console.log(Math.max(a + b, a - b, a * b))
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 22080
#include <bits/stdc++.h>
using namespace std;
vector<int> p[300005];
int r[300005], c[300005];
int main(){
    int h, w, m;
    scanf("%d%d%d", &h, &w, &m);

    multiset<int> mx;
    for(int i=1;i<=m;i++){
        int x, y;
        scanf("%d%d", &x, &y);
        p[x].emplace_back(y);
        r[x]++;
        c[y]++;
    }
    for(int i=1;i<=300000;i++){
        if(c[i] != 0) mx.insert(c[i]);
    }
    int ans = 0;
    for(int i=1;i<=300000;i++){
        for(int j=0;j<p[i].size();j++){
            int y = p[i][j];
            mx.erase(mx.find(c[y]));
            c[y]--;
            mx.insert(c[y]);
        }

        ans = max(ans, r[i]+*mx.rbegin());

        for(int j=0;j<p[i].size();j++){
            int y = p[i][j];
            mx.erase(mx.find(c[y]));
            c[y]++;
            mx.insert(c[y]);
        }
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 36564
#include<iostream>
#include<stdio.h>
using namespace std;
int h,m,s,sum;
void pr(int x){
  if(x<10)cout<<"0";
  cout<<x;
}


void print(int x){
  pr(x/3600);
  cout<<':';
  pr(x/60%60);
  cout<<':';
  pr(x%60);
  cout<<endl;
}
int main(){
  while(cin>>h>>m>>s){
    if(h==-1&&m==-1&&s==-1)break;
    sum=h*60*60+m*60+s;
    sum=120*60-sum;
    print(sum);
    print(sum*3);
  }
  return 0;
}

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


using namespace std;

vector<vector<int>> vec(100007);
int n;

long long meme[100007][5];


long long solve(int index, int flag){
    if(index==n){
        return 0;
    }
    
    long long &res = meme[index][flag]; 
    
    if(res != -1){
        return res;
    }
    res = 0;
    
    if(flag!=0){
        res = max(res,vec[index][0]+solve(index+1,0));
    }
    if(flag!=1){
        res =  max(res,vec[index][1]+solve(index+1,1));
    }
    if(flag!=2){
        res =  max(res,vec[index][2]+solve(index+1,2));
    }
    return res;
}

int main(){
    cin>>n;
    int num1,num2,num3;
    memset(meme,-1,sizeof(meme));
    for(int i = 0 ; i<n ; i++){
        cin>>num1>>num2>>num3;
        vec[i].push_back(num1);
        vec[i].push_back(num2);
        vec[i].push_back(num3);
    }
    long long sol = solve(0,3);
    cout<<sol<<endl;
    return 0;
}

Measured memory_bytes: 20360
#include <iostream>
#include <string>
using namespace std;
int main(void){
    
    int a;
    string s;
    cin >> a >> s;
    
    for(int i=0; i < s.length(); ++i){
        char c = s[i]+a;
        if(c <= 'Z'){
            cout << c;
        }else{
            s[i]=c-26-a;
            i--;
            continue;
        }
    }
    return 0;
}


Measured memory_bytes: 256
from itertools import combinations

N = int(input())
cnt = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0}
for _ in range(N):
    s = input()
    if s[0] == "M":
        cnt["M"] += 1
    elif s[0] == "A":
        cnt["A"] += 1
    elif s[0] == "R":
        cnt["R"] += 1
    elif s[0] == "C":
        cnt["C"] += 1
    elif s[0] == "H":
        cnt["H"] += 1

comb = combinations(["M", "A", "R", "C", "H"], 3)
# print(list(comb))

ans = 0
for c in comb:  # 計10通り
    ans += cnt[c[0]] * cnt[c[1]] * cnt[c[2]]

print(ans)


Measured memory_bytes: 8996
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        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); }

        private static int Solve(long X, long Y)
        {
            for (int i = 0; true; ++i)
            {
                if (X > Y) { return i; }
                X *= 2;
            }
        }

        static void Main(string[] args)
        {
            long[] values = ReadLongs();
            Console.WriteLine(Solve(values[0], values[1]));
        }
    }
}


Measured memory_bytes: 13140
from math import gcd

k = int(input())
ans = 0
for a in range(1, k + 1):
    for b in range(1, k + 1):
        gcd_ab = gcd(a, b)
        for c in range(1, k + 1):
            ans += gcd(gcd_ab, c)
print(ans)

Measured memory_bytes: 9112
#include <stdio.h>
#include <string.h>
 
int main(void) {
    int input1 = 0;
    int input2 = 0;
    scanf("%d", &input1);
    scanf("%d", &input2);
    // printf("%d\n", inputN);
    // printf("%d\n", inputM);

    int inputAN;
    int sum = 0 ;
    for(int i=0; i<input2; ++i) {
        scanf("%d", &inputAN);
        sum += inputAN;
    }
    int result = 0;
    if(input1 > sum) {
        printf("No\n");
    }
    else {
        printf("Yes\n");
    }
    // printf("%d\n", result);
    return 0;
}

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

int main(){
  constexpr int Rcap= 3;
  constexpr int64_t nil= -1;
  int R,C,Nitem;
  cin >> R >> C >> Nitem;

  vector<vector<int64_t>> items(R, vector<int64_t>(C, nil));
  int bufx,bufy,bufv;
  for(int i=0; i<Nitem; i++){
    cin >> bufx >> bufy >> bufv;
    bufx--; bufy--; // 1-indexed -> 0-indexed
    items.at(bufx).at(bufy)= bufv;
  }

  vector<vector<int64_t>> dp(Rcap+1, vector<int64_t>(C, nil));
  for(int r=0; r<R; r++){
    vector<vector<int64_t>> buf(Rcap+1, vector<int64_t>(C, nil));
    for(int c=0; c<C; c++){
      int64_t buf0_r= nil;
      for(int pick=0; pick <= Rcap; pick++){
        buf0_r= max(buf0_r, dp.at(pick).at(c));
      }
      buf.at(0).at(c)= max(buf0_r, int64_t(0));
    }
    buf.at(1).at(0)= (items.at(r).at(0) != nil) ? buf.at(0).at(0)+ items.at(r).at(0)
                                                : nil;
    for(int c=1; c<C; c++){
      for(int pick=Rcap; pick>0; pick--){
        buf.at(pick).at(c)= (buf.at(pick-1).at(c-1)==nil) ? nil
                           :(items.at(r).at(c) != nil) ? max(buf.at(pick).at(c-1), max(buf.at(pick-1).at(c-1), buf.at(pick-1).at(c))+ items.at(r).at(c))
                                                       : buf.at(pick).at(c-1);
      }
    }

    dp= buf;
  }

  int64_t ans= nil;
  for(int pick=0; pick <= Rcap; pick++){
    ans= max(ans, dp.at(pick).back());
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 74212
#include <stdio.h>

#define N 100000

int CC[N] = {0};

void init() {
  int i;
  for (i = 0; i < N; ++i) {
    CC[i] = i;
  }
}

int find(int a) {
  if (a == CC[a]) {
    return a;
  }

  return CC[a] = find(CC[a]);
}

int isSame(int a, int b) {

  if (find(a) == find(b)) {
    return 1;
  } else {
    return 0;
  }
}

void unite(int a, int b) {
  a = find(a);
  b = find(b);

  if (a == b) return;

  CC[b] = a;
}

int main() {
  int n, m, q, i, j, k;
  init();
  scanf("%d %d", &n, &m);

  for (i = 0; i < m; ++i) {
    scanf("%d %d", &j, &k);
    unite(j, k);
  }

  scanf("%d", &q);

  for (i = 0; i < q; i++) {
    scanf("%d %d", &j, &k);
    if (isSame(j, k)) {
      printf("yes\n");
    } else {
      printf("no\n");
    }
  }

  return 0;
}

Measured memory_bytes: 972
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		String s = sc.nextLine();
		String p = sc.nextLine();

		String ss = s + s;

//		System.out.println(ss);

		if ( ss.matches(".*" + p + ".*") )
			System.out.println("Yes");
		else
			System.out.println("No");
	}

}

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

#define int long long
#define ff first
#define ss second
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x.size())
int powmod(int a,int l, int md){a%=md; int res=1;while(l){if(l&1)res=res*a%md;l/=2;a=a*a%md;}return res;}
int binpow(int a,int l){int res=1;while(l){if(l&1)res=res*a;l/=2;a=a*a;}return res;}
int invmod(int a, int md){return powmod(a,md-2,md);}
typedef long long ll; typedef unsigned long long ull; typedef long double ld;
typedef vector<int> vi; typedef pair<int, int> ii; typedef vector< ii > vii;
#define pb push_back
int __set(int b, int i) {return b|(1LL<<i);} //set ith bit
int __unset(int b, int i) {return b&(~(1UL<<i));}
int __check(int b, int i) {return b&(1LL<<i);} //returns 0 if ith bit is 0
int mulmod(int a, int b, int md) {return (((a%md)*(b%md))%md+md)%md;}
int addmod(int a, int b, int md) {return ((a%md+b%md)%md+md)%md;}
int submod(int a, int b, int md) {return (((a%md-b%md)%md)+md)%md;}
int divmod(int a, int b, int md) {return mulmod(a, powmod(b, md-2, md), md);} //if md is prime;
const ll inf = 0xFFFFFFFFFFFFFFFL; //very large number
priority_queue<int, vector<int>, greater<int> > pq; //for min priority_queue
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


signed main(void)
{
	IOS;
	int n; cin>>n;
	int s=0;
	for(int i = 1; i <= n; i++) {
		if(i%3 && i%5)
			s+=i;
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 3576
import fractions

A,B=map(int,input().split())
gcd=fractions.gcd(A,B)
ans=1

if gcd > 1:
  fact = 2
  tmp = gcd
  while(fact * fact <= gcd):
    if tmp % fact == 0:
      ans += 1
      while(tmp % fact == 0):
        tmp //= fact
    fact += 1
  if tmp > 1:
    ans += 1
print(ans)

Measured memory_bytes: 5432
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main(){
  int n, cen, cen2; lint ans = 0; cin >> n;
  v1li v(n), u(n); rep(i, n) cin >> v[i] >> u[i];
  sort(v.begin(), v.end()); sort(u.begin(), u.end());
  if(n & 1){
    cen = n / 2;
    ans = u[cen] - v[cen] + 1;
  }
  else{
    cen = n / 2 - 1; cen2 = cen + 1;
    ans = u[cen2] + u[cen] - v[cen2] - v[cen] + 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6428
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const ll INF = 1LL << 60;

int main() {
	int N, M;
	cin >> N >> M;
	ll sum = 0;
	priority_queue<int> Q;
	for (int i = 0; i < N; i++) {
		int A;
		cin >> A;
		sum += A;
		Q.push(A);
	}
	for (int i = 0; i < M; i++) {
		int x = Q.top(); Q.pop();
		int y = x / 2;
		sum -= x - y;
		Q.push(y);
	}
	cout << sum << endl;
}

Measured memory_bytes: 892
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<cmath>
#include<queue>
#include<limits>
#include<cassert>
#include<set>
#include<tuple>
#include<map>
#include<list>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;
typedef long long ll;

int main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	int dx = tx - sx;
	int dy = ty - sy;
	cout << string(dy, 'U') << string(dx, 'R');
	cout << string(dy, 'D') << string(dx, 'L');
	cout << 'L' << string(dy + 1, 'U') << string(dx + 1, 'R') << 'D';
	cout << 'R' << string(dy + 1, 'D') << string(dx + 1, 'L') << 'U';
	cout << endl;
	return 0;
}

Measured memory_bytes: 256