akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
#define inf 100000000/*10^8*/



////////////////////////////////////////
bool asc(const int a,const int b){return a>b;}

ll po(ll i,ll p){
    if(p==0)return 1;
    else if(p==1)return mod(i);
    else if(p%2==0)return mod(po(mod(mod(i)*mod(i)),p/2));
    else  return mod(mod(i)*mod(po(i,p-1)));
}

int main(){
    int n;cin>>n;
    int a[n];for(int i=0;i<=n-1;i++)cin>>a[i];sort(a,a+n,asc);ll ans=1;
    if(n%2==0){
        for(int i=0;i<=n-2;i=i+2){
            if(a[i]!=n-i-1||a[i+1]!=a[i]){
                cout<<0<<endl;return 0;
            }
        }
        ans=po(2,n/2);cout<<ans<<endl;
    }else{
        for(int i=0;i<=n-3;i=i+2){
            if(a[i]!=n-i-1||a[i+1]!=a[i]){
                cout<<0<<endl;return 0;
            }
        }
        if(a[n-1]!=0){
            cout<<0<<endl;return 0;
        }
        ans=po(2,n/2);cout<<ans<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 640
using System;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            string[] input = Console.ReadLine().Split(' ');
            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);
            int T = int.Parse(input[2]);

            int result = T / A * B;
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    vector<int> zero(N);
    RREP(i, N-1){
        if(A[i]==0) zero[i] = zero[i+1]+1;
    }

    ll ans = 0;
    REP(i, N){
        ll t = 0;
        ll n = 0;
        Rep(j, i, N){
            if(zero[j]){
                n+=zero[j];
                j+=zero[j]-1;
                continue;
            }
            bool f = true;
            REP(k, 21){
                if((t&(1LL<<k))&&(A[j]&(1LL<<k))){
                    f=false;
                    break;
                }
            }
            if(f){
                n++;
                t |= A[j];
            }else{
                break;
            }
        }
        ans += n;
    }
    pr(ans);
}

Measured memory_bytes: 2560
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long keta = Long.toString(n).length();
        long max = n/(long)Math.pow(10,keta-1);
        long ans = 0;

        for(long i = max;i >= 0;i--){
            String number = Long.toString(i);
            for(long j = 0;j < keta-1;j++){
                number += "9";
            }
            if(Long.parseLong(number) <= n){
                ans = i+9*(keta-1);
                break;
            }
        }
        System.out.println(ans);
        
    }
}

Measured memory_bytes: 21972
N=int(input())
a1,a2,a3,a4=0,0,0,0
for i in range(N):
  s=input()
  if s=="AC":
    a1+=1
  elif s=="WA":
    a2+=1
  elif s=="TLE":
    a3+=1
  else:
    a4+=1
print("AC x "+str(a1))
print("WA x "+str(a2))
print("TLE x "+str(a3))
print("RE x "+str(a4))

Measured memory_bytes: 74856
#include <iostream>
#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>
#include <math.h>
using namespace std;
#define int long long

signed main() {
    int A,B,C;
    cin>>A>>B>>C;

    if(A%2==0||B%2==0||C%2==0){
        cout<<0<<endl;
    }
    else{
        cout<<min(A,min(B,C))*((A+B+C)-(min(A,min(B,C))+max(A,max(B,C))))<<endl;
    }
}


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

int x;
struct Exam {
  ll b, l, u;
  ll score() {
    return u*x-(u-l)*b;
  }
};

bool operator<(Exam a, Exam b) {
  return a.score() > b.score();
}

Exam e[100000];

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int n;
  cin >> n >> x;
  ll need = 0;
  for (int i = 0; i < n; i++) {
    cin >> e[i].b >> e[i].l >> e[i].u;
    need += e[i].l*e[i].b;
  }
  sort(e, e+n);
  ll ans = 0;
  int i = 0;
  while (e[i].score() < need) {
    need -= e[i++].score();
    ans += x;
  }
  need -= e[i].score();
  ll best = 1e18;
  for (int j = 0; j < n; j++) {
    ll base = need+e[min(j,i)].score();
    ll v = min((base+(e[j].u-e[j].l)*e[j].b+e[j].u-1)/e[j].u,
	       (base+e[j].l-1)/e[j].l);
    best = min(best, v);
  }
  cout << ans+best << endl;
}


Measured memory_bytes: 2560
#coding:utf-8
#1_5_B 2015.4.1
while True:
    length,width = map(int,input().split())
    if length == width == 0:
        break
    print('#' * width)
    print(('#' + '.' * (width - 2) + '#\n') * (length - 2),end='')
    print('#' * width)
    print()

Measured memory_bytes: 6792
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using i64 = int64_t;
using f80 = __float80;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
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;}
template<typename T> ostream &operator<<(ostream &os, const vector< T > &v){
  rep(i,v.size()) os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template<typename T> istream &operator>>(istream &is, vector< T > &v){
  for(T &in : v) is >> in;
  return is;
}

vvi vA;

void bfn(vi A, i64 N, i64 M) {
  if(A.size() == N) {
    vA.emplace_back(A);
    return;
  }
  rep(i, A[A.size() - 1], M + 1){
    vi nA;
    for(auto &p : A) nA.emplace_back(p);
    nA.emplace_back(i);
    bfn(nA, N, M);
  }
  return;
}

void Main()
{
  i64 N, M, Q;
  cin >> N >> M >> Q;
  vvi ABCD(Q, vi(4));
  cin >> ABCD;

  vi A;
  A.emplace_back(1);

  bfn(A, N, M);

  i64 ans = 0;

  for(auto &p : vA){
    i64 ans_tmp = 0;
    rep(i,Q){
      if(p[ABCD[i][1]-1] - p[ABCD[i][0]-1] == ABCD[i][2]) ans_tmp += ABCD[i][3];
    }
    chmax(ans, ans_tmp);
  }

  cout << ans << "\n";




}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}

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

const int MOD = 998244353;

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

  int dp[N+1][S+1]; //dp[i][j] i番目までの数字の部分和jの組み合わせ数
  for (int i = 0; i <= S; i++) {
    dp[0][i]=0;
  }
  dp[0][0] = 1;

  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= S; j++) {
      dp[i+1][j] = 2*dp[i][j]%MOD;
      if (j-A[i]>=0 && dp[i][j-A[i]]>0) {
        dp[i+1][j] += dp[i][j-A[i]];
        dp[i+1][j] %= MOD;
      }
    }
  }
  
  cout << dp[N][S] << endl;

  return 0;
}

Measured memory_bytes: 38792
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

using ll = long long;
using ull = unsigned long long;

int main() {
    string s;
    int n, q, f;
    char c;
    bool flip = false;
    cin >> s >> n;
    list<char> ans;
    for (auto t : s) {
        ans.push_back(t);
    }
    while (n--) {
        cin >> q;
        if (q == 1) {
            flip = !flip;
        }
        else {
            cin >> f >> c;
            if (f == 1) {
                if (flip) {
                    ans.push_back(c);
                }
                else {
                    ans.push_front(c);
                }
            }
            else {
                if (flip) {
                    ans.push_front(c);
                }
                else {
                    ans.push_back(c);
                }
            }
        }
    }

    if (flip) {
        for (auto i = ans.rbegin(); i != ans.rend(); ++i) {
            cout << *i;
        }
    }
    else {
        for (auto i = ans.begin(); i != ans.end(); ++i) {
            cout << *i;
        }
    }
    cout << endl;

    return 0;
}

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

int main() {
    int A, B, M, a[100000], b[100000], c[100000], x[100000], y[100000];
    cin >> A >> B >> M;
    for (int i = 0; i < A; i++) cin >> a[i];
    for (int i = 0; i < B; i++) cin >> b[i];
    for (int i = 0; i < M; i++) cin >> x[i] >> y[i] >> c[i];

    int min_a = 100000, min_b = 100000;
    for (int i = 0; i < A; i++) {
        if (a[i] < min_a) min_a = a[i];
    }
    for (int i = 0; i < B; i++) {
        if (b[i] < min_b) min_b = b[i];
    }

    int min_cost = min_a + min_b;

    for (int i = 0; i < M; i++) {
        int cost_i = a[x[i]-1] + b[y[i]-1] - c[i];
        if (cost_i < min_cost) min_cost = cost_i;
    }

    cout << min_cost << endl;
    
    return 0;
}

Measured memory_bytes: 2176
#include <iostream>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	
	if(a != b) {
		cout << (a > b ? 2 * a - 1 : 2 * b - 1) << endl;
	}
	else {
		cout << 2 * a << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;
ll const N_MAX = 100000;
ll MEMO[N_MAX][2];

int main() {
  ll N;
  cin >> N;
  vector<ll> A, B, C;
  ll x;
  for (int i = 0; i < N; i++) {
    cin >> x;
    A.push_back(x);
  }
  for (int i = 0; i < N; i++) {
    cin >> x;
    B.push_back(x);
  }
  for (int i = 0; i < N; i++) {
    cin >> x;
    C.push_back(x);
  }
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  sort(C.begin(), C.end());
  ll ans = 0;
  for (int j = 0; j < N; j++) {
    // find A num
    ll left = -1, right = N, mid;
    while (right - left > 1) {
      mid = left + (right - left) / 2;
      if (A[mid] >= B[j]) {
        right = mid;
      } else {
        left = mid;
      }
    }
    ll A_num = right;

    // find C num
    left = -1, right = N;
    while (right - left > 1) {
      mid = left + (right - left) / 2;
      if (B[j] < C[mid]) {
        right = mid;
      } else {
        left = mid;
      }
    }
    ll C_num = N - right;
    ans += A_num * C_num;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3316
A = int(input())
B = int(input())
C = int(input())
X = int(input())
counts = 0

for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if (500*a + 100*b + 50*c) == X:
                counts += 1

print(counts)


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
using namespace std;

int GCD(int a, int b,vector<int> &x){
	while(1){
		if(a<b){
			swap(a,b);
		} 
		x.push_back((a-(a%b))/b);
		a=a%b;
		if(a==0){
			return b;
		}
	}
}

int main(){
	int a,b;
	vector<int> x;
	cin >> a >> b ;
	GCD(a,b,x);

	int n = x.size();
	int p=0,q=1,r=1,s=-x[0];

	for(int i=1;i<n;i++){
		int pp=p;
		int qq=q;
		int rr=r;
		int ss=s;
		p=rr;
		q=ss;
		r=pp-x[i]*rr;
		s=qq-x[i]*ss;
	}
	if(a>=b){
		cout << p << " " << q << endl;
	}else{
		cout << q << " " << p << endl;
	}

	return 0;
}

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

using ll = long long;
#define int long long
using P = pair<int, int>;

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, n, r) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const { return pow(MOD-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
template<typename T = int>
T in() {T a; cin >> a; return a;}
/***** MAIN *****/
signed main() {
  int a, b, c;
  cin >> a >> b >> c;
  int ans = b/a;
  cout << min(c, ans);
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 256
#define errOut(s) \
  { std::cerr << __LINE__ << ":" << #s << ":" << (s) << std::endl; }

#include <bits/stdc++.h>

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
//#include <boost/multi_array.hpp>
//#include <boost/optional.hpp>
//#include <boost/range/adaptors.hpp>
//#include <boost/range/algorithm.hpp>
//#include <boost/range/irange.hpp>
#pragma clang diagnostic pop

using namespace std;
template <size_t N, size_t MaxPrimeSize>
struct primes_t {
  constexpr static size_t maxPrimeSize = MaxPrimeSize;
  constexpr primes_t() : primes(), count(), notSieves() {
    primes[count++] = 2;
    notSieves[0] = notSieves[1] = true;
    for (int i = 2; i < N; i++) {
      if (notSieves[i]) {
        continue;
      }
      primes[count++] = i;
      for (int64_t j = 2; i * j < N; j++) {
        notSieves[i * j] = true;
      }
    }
  }
  int64_t primes[MaxPrimeSize];
  int count;

 private:
  bool notSieves[N];
};

static auto primes = primes_t<1000001, 1000000>{};

int64_t solve(int64_t const n) {
  int64_t ret = 0;
  for (int c = 1; c < n - 1; c++) {
    int64_t nn = n - c;
    int64_t cnt = 1;
    int64_t mx = int64_t(ceil(sqrt(nn * 1.0)));
    for (int i = 0; nn != 1; i++) {
      int64_t const p = primes.primes[i];
      if (nn % p != 0) {
        if (p > mx) {
          cnt *= 2;
          break;
        }
        continue;
      }
      int j = 0;
      while (nn % p == 0) {
        nn /= p;
        j++;
      }
      mx = int64_t(ceil(sqrt(nn * 1.0)));
      if (j > 0) {
        cnt *= (j + 1);
      }
    }
    ret += cnt;
  }
  ret++;
  return ret;
}

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

  int64_t n;
  std::cin >> n;
  auto const res = solve(n);
  std::cout << res << std::endl;
  return 0;
}


Measured memory_bytes: 12544
H,W=map(int,input().split())
ans=10**9
if H%3==0 or W%3==0:
    ans=0
else:
    if ans>H or ans>W:
        ans=min(H,W)
for i in range(H):
    a=(i+1)*W
    if W%2==0:
        b=(H-(i+1))*(W//2)
        c=(H-(i+1))*(W//2)
    else:
        b=(H-(i+1))*(W//2)
        c=(H-(i+1))*((W//2)+1)
    if ans>(max(a,b,c)-min(a,b,c)):
        ans=(max(a,b,c)-min(a,b,c))
W,H=H,W
for i in range(H):
    a=(i+1)*W
    if W%2==0:
        b=(H-(i+1))*(W//2)
        c=(H-(i+1))*(W//2)
    else:
        b=(H-(i+1))*(W//2)
        c=(H-(i+1))*((W//2)+1)
    if ans>(max(a,b,c)-min(a,b,c)):
        ans=(max(a,b,c)-min(a,b,c))
print(ans)

Measured memory_bytes: 3064
#!/usr/bin/env python3
from collections import defaultdict
import sys


YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str, T: str):
    d1 = defaultdict(set)
    for i, si in enumerate(S):
        d1[si].add(i)
    d2 = defaultdict(set)
    for i, ti in enumerate(T):
        d2[ti].add(i)
    print(
        YES if
        set(frozenset(s) for s in d1.values()) ==
        set(frozenset(s) for s in d2.values())
        else NO)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    solve(S, T)


if __name__ == '__main__':
    main()


Measured memory_bytes: 72924
#include <iostream>
#include <cstdio>
#include <fstream>

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <unordered_map>
#include <string>

#include <functional>
#include <utility>
#include <cmath>
#include <algorithm>
#include <iterator>
#include <iomanip>

#include <cassert>
#include <random>
#include <chrono>

#include <ccomplex>

using namespace std;

#define ll long long
#define prll pair<ll,ll>
#define m_p make_pair
#define INF (ll)1e18

const ll q = 239017;
const ll mod = 1e9 + 7;
const ll mod2 = 1e9 + 13;
const ll N = 1e6 + 100;
const ll M = 100;
const ll L = 26;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void $main()
{
	for (ll i = 1; i <= 5; ++i)
	{
		ll x; cin >> x;
		if (!x)
		{
			cout << i;
			exit(0);
		}
	}
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
#else
	//freopen("champions", "r", stdin);
	//freopen("club", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);

	$main();

	return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
using namespace std;

class S{
public:
  int A;
  int B;
  int C;

  bool operator < (const S& s) const {
    if(this->A<s.A)return true;
    if(this->A>s.A)return false;
    if(this->B<s.B)return true;
    if(this->B>s.B)return false;
    if(this->C<s.C)return true;
    if(this->C>s.C)return false;
    return false;
  }
};







S f(S& s){
  S tmp;
  tmp.A=s.B/2+s.C/2;
  tmp.B=s.A/2+s.C/2;
  tmp.C=s.A/2+s.B/2;
  s=tmp;
  return s;
}
bool g(S& s){
  if( s.A & 1 ||
      s.B & 1 ||
      s.C & 1 ){
    return false;
  }
  return true;
}
int main(void){

  S s;
  cin>>s.A>>s.B>>s.C;
  int cnt = 0;
  set<S> st;
  st.insert(s);
  while(g(s)){
    cnt++;
    f(s);
    if( st.count(s)){
      cnt= -1;
      break;
    }
    st.insert(s);
  }

  cout<<cnt<<endl;
  return 0;
}


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

int main(void) {
    string s;
    cin >> s;

    
    if (s[5] != '0')
        cout << "TBD" << endl;
    else if (s[6] >= '5')
        cout << "TBD" << endl;
    else
    {
        cout << "Heisei" << endl;
    }
    
    

    return 0;
}

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

int main(){
  string n;
  cin >> n;
  for(int i=0;i<n.size();i++){
    if(n[i]=='1'){
      n[i]='9';
    }else if(n[i]=='9'){
      n[i]='1';
    }
  }
  cout << n << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,W;
    cin>>n>>W;
    int w[100001];
    long long int v[100001];
    for(int i=1;i<=n;i++)
    {
        cin>>w[i];
        cin>>v[i];
    }
    long long int dp[n+1][W+1];
   
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=W;j++)
        {
            if(i==0||j==0)
            dp[i][j]=0;
            else if(w[i]<=j)
            dp[i][j]=max(dp[i-1][j-w[i]]+ v[i], dp[i-1][j]);
            else
            dp[i][j]=dp[i-1][j];
        }
    }
    cout<<dp[n][W]<<"\n";
}


Measured memory_bytes: 79104
#!/usr/bin/python3
# vim: set fileencoding=utf-8:
import sys
input = sys.stdin.readline

"""
H = int(input())
h = [int(ele) for ele in input().split()]
h = [0] + h
"""


def main():
    A = []
    X, Y = map(int, input().split())
    n = X
    A.append(n)

    while n * 2 <= Y:
        n = n*2
        A.append(n)

    print(len(A))


def bfs(queue):
    global yet, graph
    if len(queue) == 0:
        return
    yet.remove(queue[-1])

    for i, adjacency in enumerate(graph[queue[-1]]):
        if adjacency == 1 and (i in yet) and (i not in queue):  # 隣接かつ未探索であれば、stackにpush
            queue.appendleft(i)
    else:
        queue.pop()
        bfs(queue)


def dfs(stack):
    global yet, graph
    yet.remove(stack[-1])

    for i, adjacency in enumerate(graph[stack[-1]]):
        if adjacency == 1 and i in yet:  # 隣接かつ未探索であれば、stackにpush
            stack.append(i)
            dfs(stack)
    else:
        stack.pop()


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
        if i != n // i:
            divisors.append(n//i)
    return divisors


class Node():

    def __init__(self):
        self.idx = None
        self.left = None
        self.right = None
        self.parent = None
        return

    def pre_order(self):
        global pre_order_str
        pre_order_str += str(self.idx) + " "
        if self.left:
            self.left.pre_order()

        if self.right:
            self.right.pre_order()

    def in_order(self):
        global in_order_str

        if self.left:
            self.left.in_order()

        in_order_str += str(self.idx) + " "

        if self.right:
            self.right.in_order()

    def post_order(self):
        global post_order_str
        if self.left:
            self.left.post_order()

        if self.right:
            self.right.post_order()

        post_order_str += str(self.idx) + " "


class HeapHelper():
    """HeapContrler.
    完全二分木を二分ヒープで表現した配列 A に対して、
    HeapHelper.parent(idx) とするとそのノードの親の添字を返す
    存在しない場合は Falseを返す

    Returns:
        [type] -- [description]
    """

    def __init__(self):
        return

    @staticmethod
    def parent(i):
        if i == 1:
            return False

        return int(i/2)

    @staticmethod
    def left(i):
        l_idx = 2*i
        if H < l_idx:
            return False

        return l_idx

    @staticmethod
    def right(i):
        r_idx = 2*i + 1
        if H < r_idx:
            return False

        return r_idx


if __name__ == "__main__":
    main()


Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,m,ans=0;
    cin>>n>>m;
    if(n>=2)
    {
        ans+=(n*(n-1)/2);
    }
    if(m>=2)
    {
        ans+=(m*(m-1)/2);
    }
    cout<<ans;
}

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

int row[8];
bool col[8] , dpos[15] , dneg[15];

void printBoard(){
  for(int i=0; i<8; i++){
    for(int j=0; j<8; j++){
      if(row[i] == j)cout << 'Q';
      else cout << '.';
    }
    cout << endl;
  }

}


bool putQueen(int n){
  if(n==8){
    printBoard();
    return true;
  }

  if( row[n]!=-1 ){
    return putQueen(n+1);
  }

  
  for(int i=0; i<8; i++){
    if(col[i] || dpos[n+i] || dneg[n-i+7] )continue;

    row[n] = i;
    col[i] = dpos[n+i] = dneg[n-i+7] = true;
    if( putQueen(n+1) )return true;

    col[i] = false;
    dpos[n+i] =  false;
    dneg[n-i+7] = false;
  }

  row[n] = -1;
  return false;
}





int main(){

  int k,x,y;


  //init
  for(int i=0; i<8; i++){ row[i]=-1; col[i]=false; }
  for(int i=0; i<15; i++){ dpos[i] = dneg[i] = false; }
  
  //input
  cin >> k;
  for(int i=0; i<k; i++){
    cin >> y >> x;
    row[y] = x;
    col[x] = true;
    dpos[y+x] = dneg[y-x+7] = true;
    
  }

  //solve
  putQueen(0);

  return 0;
}



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

t = 0
h = 0

for _ in range(n):
    w = input().split()

    if w[0] == w[1]:
        t += 1
        h += 1
    else:
        sw = sorted(w)

        if w[0] == sw[0]:
            h += 3
        else:
            t += 3

print(str.format('{} {}', t, h))


Measured memory_bytes: 5592
#include <bits/stdc++.h>
#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 ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;

const ll MAXS = 3000;

using P = pair<ll, ll>;
//using Edge = pair<int, P>;
ll N,M,S;


struct Edge{
    ll to,money,time;
    bool operator<(const Edge &o) const{
        return money < o.money;
    }
};

template<class T> void dijkstra(vector<vector<Edge>>& G, int s, vector<T>& dis){
    S = min(S,MAXS);
    vector<vector<ll>> dp(N,vector<ll>(MAXS+1,LINF));
    dis.resize(N,LINF);
    priority_queue<pair<ll,P>, vector<pair<ll,P>>, greater<pair<ll,P>> > q;

    dp[0][S] = 0;

    q.push({0,{0,S}});
    while(!q.empty()){
        auto p = q.top(); q.pop();

        ll time = p.first;
        int v = p.second.first;//頂点
        ll s = p.second.second;//所持金


        if(time > dp[v][s]) continue;

        for(auto next: G[v]){
            if(0 <= s+next.money){//料金が範囲内なら
                
                if(s==MAXS && next.money>0) continue;//所持金を増やす必要がないならパス

                int next_S = min(MAXS, s+next.money);
                if(dp[next.to][next_S] > time+next.time){//更新可能なら
                    dp[next.to][next_S] = time+next.time;
                    q.push({time+next.time, {next.to, next_S}});
                }
            }
        }     
    }

    REP(i,N){
        REP(j,MAXS+1){
            dis[i] = min(dis[i], dp[i][j]);
        }
    }
}


int main() {
    cin >> N >> M >> S;
    vector<vector<Edge>> G(N);
    REP(i,M){
        ll u,v,a,b; cin >> u >> v >> a >> b;
        u--;
        v--;
        G[u].push_back({v,-a,b});
        G[v].push_back({u,-a,b});
    }
    REP(i,N){
        ll c,d; cin >> c >> d;
        G[i].push_back({i,c,d});
    }

    vector<ll> dis;
    dijkstra(G,0,dis);

    FOR(i,1,N) cout << dis[i] << endl;

    return 0;
}

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

int main()
{
  int L;
  while (cin >> L) {
    if (L == 0)
      break;

    int money = 0, ans = -1;
    for (int i = 0; i < 12; ++i) {
      int M, N;
      cin >> M >> N;
      money += M - N;
      if (money >= L && ans == -1)
	ans = i+1;
    }

    if (ans == -1)
      cout << "NA" << endl;
    else
      cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 0
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){n(1)(n(2).readFileSync("/dev/stdin","UTF-8").split("\n"))},function(e,t,n){"use strict";e.exports=function(e){for(var t=e[0],n=t.length,r=0;r<n-1;r++)if(t[r]==t[r+1])return void console.log("Bad");console.log("Good")}},function(e,t){e.exports=require("fs")}]);

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

using namespace std;

long long note[10000000+1];

int main() {
    int n;
    cin >> n;
    for(int i = 0; i < n+1; i++) {
        note[i] = 1;
    }
    for(int i = 2; i < n+1; i++) {
        for(int j = i; j < n+1; j+=i) {
            note[j]++;
        }
    }
    long long result = 0;
    for(long long i = 1; i < n+1; i++) {
        result += i * note[i];
    }

    cout << result << endl;
}

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

int main(){
    int n,q;
    vector<int> left, right;
    vector<int> count;
    string s;
    cin >> n >> q;
    left.resize(q);
    right.resize(q);
    count.resize(n);
    cin >> s;

    for(int i = 0; i < q; i++){
        cin >> left[i] >> right[i];
    }
    int a = 0;
    for(int i = 0; i < n; i++){
        if(s[i-1] == 'A' && s[i] == 'C'){
            a++;
        }
        count[i] = a;
    }

    for(int i = 0; i < q; i++){
        cout << count[right[i]-1] - count[left[i]-1] << endl;
    }

    return 0;
}


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

int main() {
  int a, b, x;
  cin >> a >> b;
  x = a * b;
  if (a * b % 2 == 1) {
    cout << "Odd" << endl;
  } else {
    cout << "Even" << endl;
  }
  return 0;
}


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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
#define VL vector<lol>
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
//繰り返し二乗法
int modPow(long long a, long long n, long long p) {
    if (n == 0) return 1; // 0乗にも対応する場合
    if (n == 1) return a % p;
    if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
    long long t = modPow(a, n / 2, p);
    return (t * t) % p;
}

int main()
{
    //lol result{0};
    lol n; cin >> n;
    bool a1 = false, a2 = false, a3 = false;
    REP(i, n)
    {
        int a, b; cin >> a >> b;
        if(a == b)
        {
            if(a2) a3 = true;
            else if(a1) a2 = true;
            else a1 = true;
        }
        else
        {
            a1 = false; a2 = false;
        }
        
    }
    if(a3) cout << "Yes" << endl;
    else cout << "No" << endl;

    //cout << result << endl;
    return 0;
}

Measured memory_bytes: 3620
import java.util.*;
class Main {
	public static void main (String[] args) throws java.lang.Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a[] = new int[n];
		for(int i = 0; i < n; i++) a[i] = sc.nextInt();
		for(int i = 0; i < n; i++) {
			if(i != 0) System.out.print(" ");
			System.out.print(a[n - i - 1]);
		}
		System.out.println();
	}
}


Measured memory_bytes: 26276
N, A, B = map(int, input().split())

if abs(A - B) % 2 == 0:
    print((abs(A - B) // 2))
else:
    ans = min(A - 1, N - B) + 1
    if A - 1 > N - B:
        ans += (N - A - ans) // 2
    else:
        ans += (B - 1 - ans) // 2
    print(ans)

Measured memory_bytes: 3060
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var n,m,x,y int
    fmt.Scan(&n,&m,&x,&y)
    ans := "War"
    var a = make([]int, n)
    var b = make([]int, m)
    for i:=0; i<n; i++{
        fmt.Scan(&a[i])
    }
    for i:=0; i<m; i++{
        fmt.Scan(&b[i])
    }
    sort.Ints(a)
    sort.Ints(b)
    if a[n-1]<b[0] && b[0]>x && b[0]<=y{
        ans = "No War"
    }
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func SortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}


Measured memory_bytes: 640
#include "bits/stdc++.h"

using namespace std;

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))
#define OUT(P) cout << (P) << endl
#define OUT2(P1, P2) cout << (P1) << " " << (P2) << endl
#define PRINT_ARRAY(P) for(int i=0; i<P.size(); i++) cout << P[i] << endl;
#define PRINT_ARRAY_INLINE(P) do { for(int i=0; i<P.size(); i++) cout << P[i] << " "; cout << endl; } while(0)
#define PRINT_ARRAY_WITH_LABEL(L, P) do { cout << L << ": "; PRINT_ARRAY_INLINE(P); cout << endl; } while(0)
typedef long long ll;

int sum_digits(int num);
template <class T>
vector<T> copy_vector(vector<T> vec);

int main() {
    int n;
    cin >> n;
    vector<int> h(n,0);
    for(int i=0; i<n; i++) {
        cin >> h[i];
    }
    int count = 0;
    for(int i=0; i<n; i++) {
        bool high = true;
        for(int j=0; j<=i; j++) {
           if(h[j] > h[i]) {
                high = false;
            } 
        }
        if(high == true) {
            count++;
        }
    }
    cout << count << endl;

    return 0;
}

/******************************/
/***** DECRARED FUNCTIONS *****/
/******************************/

int sum_digits(int num) {
    int rtn = 0;
    while(num != 0) {
        int tmp = num % 10; 
        rtn += tmp;
        num /= 10; 
    }   
    return rtn;
}
//int sum_digits(int num) {
//    int rtn = 0;
//    string num_str = to_string(num);
//    for(int i=0; i<num_str.size(); i++) {
//        rtn += num_str[i] - '0';
//    }   
//    return rtn;
//}

// vectorのコピー
template <class T>
vector<T> copy_vector(vector<T> vec) {
    vector<T> rtn;
    rtn.reserve(vec.size());
    copy(vec.begin(), vec.end(), back_inserter(rtn));
    return rtn;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  long long sum{0};
  cin>>n;
  for(int i=1;i<n;++i){
    if(n%i==0){
      sum+=n/i-1;
    }
    else{
      sum+=n/i;
    }
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 3596
from sys import stderr, setrecursionlimit
from functools import reduce
from operator import add
from math import sqrt, ceil
setrecursionlimit(2147483647)
def f(): return [int(i) for i in input().split()]
def debug(*x, sep=" ", end="\n"):
    for item in x:
        stderr.write(str(item))
        stderr.write(sep)
    stderr.write(end)


'''
n秒間で移動できる最大距離はn(n+1)/2

1 -> 1(r)
2 -> 2(n->r)
3 -> 2(r->r)
4 -> 3(l->r->r)
5 -> 3(n->r->r)
6 -> 3(r->r->r)
7 -> 4(n->n->r->r)
8 -> 4(r->n->r->r)
9 -> 4(n->r->r->r)
10 -> 4(r->r->r->r)
11 -> 5(n->r->n->r->r)
12 -> 5(n->n->r->r->r)


これを満たす最小のnっぽい。
n(n+1)/2=xを解くと、n>0よりx=ceil((-1+sqrt(1+8x))/2)
'''

print(ceil((-1+sqrt(1+8*int(input())))/2))

Measured memory_bytes: 3700
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

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

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

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	S, K := sc.nextStr(), sc.nextInt()
	for i, r := range S {
		if r != '1' {
			fmt.Fprintln(wtr, string(r))
			break
		}
		if i == K-1 {
			fmt.Fprintln(wtr, 1)
			break
		}
	}

	wtr.Flush()
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<climits>
#include<set>
#include<map>
#include<stack>
#define ll long long
using namespace std;

int main() {
	ll a, b, c, x, y, ans;
	cin >> a >> b >> c >> x >> y;
	ans =LLONG_MAX;
	for (ll i = 0; i <= 200000; i++) {
		ans = min(ans,i * c + max(x - i/2,(ll)0)*a + max(y - i/2,(ll)0)*b);
	}
	cout << ans << endl;



}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int n, m;
    cin >> n >> m;
    int L = 1, R = n;
    int l, r;
    while(m--) {
        cin >> l >> r;
        L = max(L, l);
        R = min(R, r);
    }
    cout << max(R-L+1, 0) << endl;
    return 0;
}




Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main ()
{
   long int a; cin >> a;
   const int b = a + 1;
   int c[b]; int d[b] = {0};
   for (int i = 2; i < b; i++) {
     cin >> c[i]; }
     c[1] = 0;
     for (int i = 2; i < b; i++) {
     d[c[i]] += 1; }
     for (int i = 1; i < b; i++) {
       cout << d[i] << '\n'; }
       }
       
       
       


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

#include <iostream>
using namespace std;

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

int main() {
  uint64_t k;
  cin >> k;
  uint64_t total = 0;
  for (size_t a = 1; a <= k; a++) {
    for (size_t b = 1; b <= k; b++) {
      for (size_t c = 1; c <= k; c++) {
        uint64_t temp = gcd(a, b);
        total += gcd(temp, c);
      }
    }
  }
  cout << total << endl;

  return 0;
}


Measured memory_bytes: 3636
#define TEST_MODE true
     
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
     
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= b; --i)
#define range(i, a, b, c) for (int i = a;			\
							   c > 0 ? i < b : i > b;	\
							   i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a), end(a)
#define ifnot(a) if (not(a))
#define int long long
     
#ifdef LOCAL_ENV
     
#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x) << endl
#else
const bool test = false;
#define dump(x) 
#endif
     
#else
const bool test = false;
#define dump(x) 
#endif
     
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }
     
//.....................
const int MAX = (int)2e5 + 5;
     
// vector<string> split(const string &str, char sep)
// {
//   vector<string> v;
//   stringstream ss(str);
//   string buffer;
//   while (getline(ss, buffer, sep))
// 	{
// 	  v.push_back(buffer);
// 	}
//   return v;
// }
     
template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
  return accumulate(begin, end, 0ll);
}
     
void solve();
     
signed main()
{
  cout << fixed << setprecision(20);
  solve();
  while (true)
	{
	  char s[MAX];
	  if (scanf("%s", s) == EOF)
		break;
	  int n = strlen(s);
	  for (int i = n - 1; i > -1; i--)
		{
		  ungetc(s[i], stdin);
		}
	  solve();
	}
  return 0;
}
     
int A, B;
     
void solve() {
  cin >> A >> B;
  if (A + B >= 10) cout << "error" << endl;
  else cout << A + B << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <numeric>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <limits>
#include <cassert>

#define for0(i, N)    for (int i = 0  ; i <  (N); ++i)
#define for1n(i, N)   for (int i = 1  ; i <= (N); ++i)
#define for1(i, N)    for (int i = 1  ; i <  (N); ++i)
#define forn(i, N)    for (int i = 0  ; i <= (N); ++i)
#define forx(i, N, x) for (int i = (x); i <  (N); ++i)
#define forl(i, N, x, a) for (int i = (x), a = 0; a < (N);  \
                              i = (i + 1) % (N), ++a)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef priority_queue<ll> pq;
typedef priority_queue<ll,vector<ll>, greater<ll>> pql;
typedef stack<ll> stk;
typedef queue<ll> qu;


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

    int n;

    cin >> n;

    printf("%.10f", n % 2 == 1 ? (double)(n / 2 + 1) / n : 0.5);

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fo(i,a,b)for(int i=a,_e=b;i<=_e;++i)
#define ll long long
using namespace std;
const int N=1e5+5;
int n,s,x[N];
ll p[N],f[N];
void get(int l,int r){
	if(x[r]<s){
		f[l]=s-x[l];
		f[r]=s-x[r];
		return;
	}
	if(s<x[l]){
		f[l]=x[l]-s;
		f[r]=x[r]-s;
		return;
	}
	if(p[l]>=p[r])p[l]+=p[r],get(l,r-1),f[r]=f[l]+x[r]-x[l];
	else p[r]+=p[l],get(l+1,r),f[l]=f[r]+x[r]-x[l];
}
int main(){
	ios::sync_with_stdio(false);
	cin>>n>>s;
	fo(i,1,n)cin>>x[i]>>p[i];
	get(1,n);
	cout<<max(f[1],f[n]);
}

Measured memory_bytes: 4608
def primefactorize(n) :
    res = []
    if n%2 == 0 :
        t = 0
        while n%2 == 0 :
            n //= 2
            t += 1
        res.append((2,t))
    for i in range(3, int(n**0.5)+1, 2) :
        if n%i != 0 :
            continue
        t = 0
        while n%i == 0 :
            n //= i
            t += 1
        res.append((i,t))
        if n == 1 :
            break
    if n != 1 :
        res.append((n,1))
    return res


N = int(input())
res = 0
for p, e in primefactorize(N) :
    i = 1
    while e >= i :
        res += 1
        e -= i
        i += 1
print(res)

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

#define LLINF (1LL<<60)
typedef long long ll;

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

//C++14 (GCC 5.4.1)
int main() {
    int N,T;
    cin >>N>>T;

    vector<int> c(N),t(N);
    rep(i,N) cin >> c[i]>>t[i];
    
    //-----------------------------------
    int ans=1002;
    rep(i,N){
        if(t[i]<=T) chmin(ans,c[i]);
    }
    if(ans<=1000){
        cout << ans <<endl;
    }else{
        cout << "TLE" << endl;
    }

    return (0);
}

Measured memory_bytes: 256