akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

bool is_ok(int64 x) {
  return x % 7 == 1 || x % 7 == 6;
}

int main(void) {
  int64 n;
  while (cin >> n && n != 1) {
    vector<int64> res;
    bool ok[312345] = {};
    FOR(i, 2, n+1) {
      if (!is_ok(i) || n % i != 0 || ok[i]) continue;
      if (is_ok(n/i)) {
        res.push_back(i);
        for (int64 j = i*2; j <= n; j += i) {
          ok[j] = 1;
        }
      }
    }
    cout << n << ":";
    REP(i, res.size()) {
      cout << " " << res[i];
    }
    cout << endl;
  }
}


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

int	main()
{
	int	X, Y, A, B, C;
	cin >> X >> Y >> A >> B >> C;
	vector<int64_t>	p_vec(A), q_vec(B), r_vec(C);
	for (int i = 0; i < A; ++i)
		cin >> p_vec.at(i);
	for (int i = 0; i < B; ++i)
		cin >> q_vec.at(i);
	for (int i = 0; i < C; ++i)
		cin >> r_vec.at(i);
	sort(p_vec.begin(), p_vec.end(), greater<int64_t>());
	sort(q_vec.begin(), q_vec.end(), greater<int64_t>());
	sort(r_vec.begin(), r_vec.end(), greater<int64_t>());
	int64_t	sum_X = 0, sum_Y = 0;
	for (int i = 0; i < X; ++i)
		sum_X += p_vec.at(i);
	for (int i = 0; i < Y; ++i)
		sum_Y += q_vec.at(i);
	int i = X - 1, j = Y - 1, k = 0;
	bool	X_filled = false, Y_filled = false;
	while (k < C) {
		if (i < 0 || p_vec.at(i) >= r_vec.at(k))
			X_filled = true;
		if (j < 0 || q_vec.at(j) >= r_vec.at(k))
			Y_filled = true;
		if (X_filled && Y_filled) break;
		if (!X_filled && !Y_filled) {
			if (p_vec.at(i) < q_vec.at(j)) {
				sum_X += r_vec.at(k) - p_vec.at(i);
				++k;
				--i;
			} else {
				sum_X += r_vec.at(k) - q_vec.at(j);
				++k;
				--j;
			}
		} else if (!Y_filled) {
			sum_Y += r_vec.at(k) - q_vec.at(j);
			++k;
			--j;
		} else {
			sum_X += r_vec.at(k) - p_vec.at(i);
			++k;
			--i;
		}
	}
	cout << sum_X + sum_Y << endl;
}


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

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

    int n,k,i=0,sum=0;;
    cin>>n>>k;
    int a[n];

    for(i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);

    for(i=0;i<k;i++)
    {
        sum+=a[i];
    }
   cout<<sum;
}


Measured memory_bytes: 3612
// author - saiku_ni_naro
// TO THE TOP

#include<bits/stdc++.h>
using namespace std;
#define F_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define endl '\n'
#define For(i,a,n) for(int i=(a);i<=(n);i++)
#define RFor(i,a,n) for(int i=(n);i>=(a);i--)
#define SET(a,val) memset((a),(val),sizeof((a)))
#define X first
#define Y second
#define pb push_back
#define over(v) v.begin(),v.end()
#define sz(x) (int)x.size()
#define inp(x) cin>>x;
#define oup(x) cout<<x<<endl;

void solving_problem(){
    int n; cin>>n;
    int AC = 0,WA = 0,TLE = 0,RE = 0;

    For(i,1,n){
        string s; cin>>s;

        if(s == "AC") AC++;
        else if(s == "WA") WA++;
        else if(s == "TLE") TLE++;
        else if(s == "RE") RE++;
    }

    cout<<"AC x "<<AC<<endl;
    cout<<"WA x "<<WA<<endl;
    cout<<"TLE x "<<TLE<<endl;
    cout<<"RE x "<<RE<<endl;
    
}

signed main(){
    F_IO;


    int testcases = 1; 
    // cin>>testcases;

    For(i,1,testcases){
        // cout<<"Cases #"<<i<<": ";
        solving_problem();
    }
}

Measured memory_bytes: 3656
A,B,C,D=map(int,input().split())

from math import*
upto_B=B-(B//C+B//D-B//(C*D//gcd(C,D)))
upto_A=A-1-((A-1)//C+(A-1)//D-(A-1)//(C*D//gcd(C,D)))

print(upto_B-upto_A*(A>2))

Measured memory_bytes: 9136
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define PB push_back
#define MP make_pair
#define pri 1000000007
#define all(x) x.begin(),x.end()
#define mnx 1000001
#define f(a,b) MP(min(a,b),max(a,b))
#define pr pair<ll,ll>
#define nonod 100005
using namespace std;
ll d[nonod]={0};
ll vis[nonod]={0};
map <pr,ll> done;
ll p=0;
vector <pr> ans;
void dfs(ll c,vector <ll> adj[],ll old){
	vis[c]=1;

	for(auto j:adj[c]){
		if(j==old)continue;
	
		if(vis[j]==0)dfs(j,adj,c);
		
		if(done[f(j,c)])continue;
		done[f(j,c)]=1;
    
		if(d[c]%2==1){ ans.PB(MP(c,j)); d[c]++;  }
		else         { d[j]++;    ans.PB(MP(j,c));}
		
	
	}
	if(c!=1){
		if(done[f(old,c)]==0){
		done[f(old,c)]=1;
       
		if(d[c]%2==1){ ans.PB(MP(c,old)); d[c]++;  }
		else         { d[old]++;    ans.PB(MP(old,c));}}
	}

}
void masterstroke(){
	ll n,m;
	cin>>n>>m;
	vector <ll> adj[n+1];
	for(ll i=0;i<m;i++){
		ll u,v;cin>>u>>v;
		adj[u].PB(v);
		adj[v].PB(u);
	}
	dfs(1,adj,0);
	
	for(ll i=1;i<=n;i++){
		//cout<<i<<" "<<d[i];
		if(d[i]%2){cout<<-1;return;}
    }
	
		for(auto j:ans){
			cout<<j.ff<<" "<<j.ss<<endl;
		
		
	}
	
}

int main(){
ll t=1;//cin>>t;
for(ll i=0;i<t;i++)masterstroke();
}

Measured memory_bytes: 28784
# cook your dish here
n,m = map(int,input().split())
c = [1]
#c[i]:i!
for i in range(1,10**5+10):
    w = (c[-1]*i)%(10**9+7)
    c.append(w)
#print(c)
if m ==n-1:
    print((c[m]*c[n])%(10**9+7))
elif m == n:
    print((c[m]*c[n]*2)%(10**9+7))
elif m == n+1:
    print((c[m]*c[n])%(10**9+7))
else:
    print(0)

Measured memory_bytes: 7060
n, m = map(int, input().split())
prob = {}
for i in range(m):
  pi, si = input().split()
  prob.setdefault(int(pi), [])
  prob[int(pi)].append(si)

ac_cnt = 0
pen_cnt = 0
for key, val in prob.items():
  if 'AC' not in val:
    continue
  ac_idx = val.index('AC')
  ac_cnt += 1
  pen_cnt += ac_idx
print(ac_cnt, pen_cnt)

Measured memory_bytes: 29616
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A: Diagonal String
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int N = 3;

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    putchar(s[i]);
  }
  putchar('\n');
  return 0;
}


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

using namespace std;

int main(int argc, char *argv[]) {
    int N, M, C;
    cin >> N >> M >> C;

    vector<int> barr;
    int cur;
    for (int i = 0; i < M; i++) {
        cin >> cur;
        barr.push_back(cur);
    }

    int ans = 0;
    for (int k = 0; k < N; k++) {
        int cur1;
        int sum = 0;
        for (int j = 0; j < M; j++) {
            cin >> cur1;
            sum += (cur1 * barr[j]);
        }
        if (sum + C > 0) {
            ans++;
        }
    } 

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


Measured memory_bytes: 256
//https://atcoder.jp/contests/agc044/tasks/agc044_a
#include<bits/stdc++.h>
typedef long long ll;
const ll mod=1e9+7;
const ll inf=0x3f3f3f3f;
using namespace std;
map <ll,ll> mp;
ll n,a,b,c,d;
ll dfs(ll n)
{
    if(n==0) return 0;
    if(n==1) return d;
    if(mp[n]) return mp[n];
    ll ans=1e18;
    if(n<ans/d) ans=n*d;
    ans=min(ans,a+(n%2)*d+dfs(n/2));
    ans=min(ans,a+(2-n%2)*d+dfs((n+1)/2));
    ans=min(ans,b+(3-n%3)*d+dfs((n+2)/3));
    ans=min(ans,b+(n%3)*d+dfs(n/3));
    ans=min(ans,c+(n%5)*d+dfs(n/5));
    ans=min(ans,c+(5-n%5)*d+dfs((n+4)/5));
    mp[n]=ans;
    return ans;
}
int main()
{
    ll T;cin>>T;
    while(T--)
    {
        mp.clear();
        cin>>n>>a>>b>>c>>d;
        cout<<dfs(n)<<endl;
    }
    return 0;
}


Measured memory_bytes: 4316
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;
typedef tree<
        pair<int, int>, // change type
        null_type,
        less<pair<int, int> >, // change type
        rb_tree_tag,
        tree_order_statistics_node_update>
        ordered_set;

typedef long long ll;
#define rep(i, start, end) for(int i = start; i < end; ++i)
#define sz(x) (int)(x).size()
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(d, v) memset(d, v, sizeof(d))
#define pii pair<int, int>
const double PI = 3.14159265358979323846;
const double eps = (1e-8);


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
 //   freopen("input.txt", "r", stdin);
//    freopen("facebook.txt", "w", stdout);
#endif
    int n, mx = INT_MIN, sum = 0;
    cin >> n;
    rep(i,0,n)
    {
        int x;
        cin >> x;
        sum += x;
        mx = max(mx, x);
    }
    if (mx < sum - mx)
        cout << "Yes";
    else
        cout << "No";
    return  0;

}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  int N,R;
  cin>>N>>R;

  if(N>=10)cout<<R<<endl;
  else cout<<100*(10-N)+R<<endl;
  return 0;
}


Measured memory_bytes: 256
class Dice
  attr_accessor :face

  def rotate(dir)
    case dir
    when "N"
      @face[0],@face[1],@face[5],@face[4] = @face[1],@face[5],@face[4],@face[0]
    when "E"
      @face[0],@face[2],@face[5],@face[3] = @face[3],@face[0],@face[2],@face[5]
    when "S"
      @face[0],@face[1],@face[5],@face[4] = @face[4],@face[0],@face[1],@face[5]
    when "W"
      @face[0],@face[2],@face[5],@face[3] = @face[2],@face[5],@face[3],@face[0]
    when "cw" #ClockWise rotation
      self.rotate("E").rotate("N").rotate("W")
      #@face[1],@face[2],@face[4],@face[3] = @face[2],@face[4],@face[3],@face[1]
    when "acw" #Anti ClockWise rotation
      self.rotate("W").rotate("N").rotate("E")
      #@face[1],@face[2],@face[4],@face[3] = @face[3],@face[1],@face[2],@face[4]
    end
    return self
  end

  def query(top, front)
    @face.each_with_index do |item, index|
      if item == top
        case index
        when 1
          self.rotate("N")
        when 2
          self.rotate("W")
        when 3
          self.rotate("E")
        when 4
          self.rotate("S")
        when 5
          self.rotate("N").rotate("N")
        end
        (1..4).each do |index|
          if @face[index] == front
            case index
            when 2
              self.rotate("cw")
            when 3
              self.rotate("acw")
            when 4
              self.rotate("cw").rotate("cw")
            end
            right = @face[2]
            return right
          end
        end
      end
    end
  end
end

dice = Dice.new
dice.face = gets.chomp.split.map(&:to_i)

gets.chomp.to_i.times do
  top,front = gets.chomp.split.map(&:to_i)
  puts dice.query(top, front)
end

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

struct edge{
    int to;
    int cost;
    edge(int a, int b){
        to=a;
        cost=b;
    }
};
typedef pair<long long, int> P;
struct D{
    vector<edge> G[100008];
    long long d[100008],INF=1e18;
    void AddEdge(int from, int to, int cost){
        G[from].push_back(edge(to, cost));
    }
    void dijkstra(int n, int s){
        priority_queue<P, vector<P>, greater<P>> q;
        fill(d,d+n,INF);
        d[s]=0;
        q.push(P(0,s));
        while(!q.empty()){
            P p=q.top();
            q.pop();
            int v=p.second;
            if(d[v]<p.first)continue;
            for(int i=0;i<G[v].size();i++){
                edge e=G[v][i];
                if(d[e.to]>d[v]+e.cost){
                    d[e.to]=d[v]+e.cost;
                    q.push(P(d[e.to],e.to));
                }
            }
        }
    }
};

int main(void){
    int n,f=0;
    D d,e;
    cin>>n;
    for(int i=0;i<n-1;i++){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        d.AddEdge(a,b,1);
        d.AddEdge(b,a,1);
        e.AddEdge(a,b,1);
        e.AddEdge(b,a,1);
    }
    d.dijkstra(n,0);
    e.dijkstra(n,n-1);
    for(int i=1;i<n-1;i++){
        if(d.d[i]<=e.d[i]){
            f++;
        }
    }
    if(f>n-2-f){
        cout<<"Fennec"<<endl;
    }else{
        cout<<"Snuke"<<endl;
    }
}



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

#define int long long

#define F first
#define S second
#define all(x) (x).begin(), (x).end()

using namespace std;

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

//  freopen("input.txt", "r", stdin);
//  freopen("output.txt", "w", stdout);

    int n;
    cin >> n;
    int d[n+1][3];
    d[0][0] = d[0][1] = d[0][2] = 0;
    for(int i = 1; i <= n; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        d[i][0] = max(d[i-1][1], d[i-1][2]) + a;
        d[i][1] = max(d[i-1][0], d[i-1][2]) + b;
        d[i][2] = max(d[i-1][0], d[i-1][1]) + c;
    }
    cout << max(d[n][0], max(d[n][1], d[n][2]));

    return 0;
}


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

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)

const double INF = 1e+09;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


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

  ll k;
  cin >> k;
  vector<ll> a;

  FOR(i, 1, 10) a.push_back(i);

  while(true){
    if  (k <= a.size()){
      cout << a[k-1] << endl;
      return 0;
    }
    k -= a.size();
    vector<ll> old;
    swap(old, a);
    for (ll x : old){
      FOR(i, -1, 2){
        int matubi = x % 10 + i;
        if (matubi < 0 || matubi > 9) continue;
        ll nx = x * 10 + matubi;
        a.push_back(nx);
      }
    }
  }
  return 0;
}



Measured memory_bytes: 1712
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <algorithm>
#include <cmath>
#include <climits>
#define REP(i, n) for(int i=0; i<(n); i++)
#define FOR(i, a, n) for(int i=(a); i<(n); i++)
using namespace std;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

int func(int x){
    int cnt=0;
   while(1){
    if(x%2==0){
        x/=2;
        cnt++;
    }
    else{
        break;
    }
   }
    return cnt;
}
int main(){
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if(a[0]==a[1] && a[1]==a[2] &&a[0]%2==0){
        cout<<-1<<endl;
        return 0;
    }
    else if(a[0]==a[1] && a[1]==a[2]){
        cout<<0<<endl;
        return 0;
    }
    int x=a[1]-a[0];
    int y=a[2]-a[1];
    int z=a[2]-a[0];
    int cnt1=func(x),cnt2=func(y),cnt3=func(z);
    cout<<min({cnt1,cnt2,cnt3})<<endl;
   


    return 0;
}

Measured memory_bytes: 256
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)
    del divisors[0]
    return divisors

def check_mod(n, k):
    if k == 1:
        return False
    while n != 0:
        mod = n % k
        if mod == 0:
            n = n/k
        elif mod == 1:
            return True
        else:
            return False

def main():
    n = int(input())
    #あまりが1のやつ
    res = len(make_divisors(n-1))

    for dv in make_divisors(n):
        if check_mod(n, dv):
            res += 1
    print(res)

if __name__ == '__main__':
    main()



Measured memory_bytes: 39792
#include <bits/stdc++.h>
#define endl '\n'
// using namespace std;

int main() {
    int N;
    std::cin >> N;
    long long int  sum = 0;
    for(int i =1 ; i <= N ; i++) {
       if(i%3 !=0 && i%5!= 0 ) 
           sum += i;
    }    
    std::cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3588
n,m=map(int,input().split())
A=set(int(input()) for i in range(m))
dp=[0]*(n+1)
dp[0]=1
for i in range(1,n+1):
    dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)
    if i in A:dp[i]=0
print(dp[n])

Measured memory_bytes: 58200
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
bool used[100001];
int p[1000];
int main(){
	string s,t;
	cin>>s>>t;
	if(s[2]==t[0]&&s[1]==t[1]&&t[2]==s[0])cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
from bisect import *
N = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(N):
    for j in range(i+1, N):
        s = a[i] + a[j]
        ans += bisect_left(a, s) - j - 1

print(ans)


Measured memory_bytes: 3316
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    n = int(input())
    aa = list(map(int, input().split()))
    dp = [[0] * n for _ in range(n)]
    coff = 1 if n % 2 else -1
    for i, a in enumerate(aa):
        dp[i][i] = coff * a
    # p2D(dp)
    for d in range(1, n):
        coff *= -1
        for l in range(n - 1):
            r = l + d
            if r >= n: break
            if coff == 1:
                dp[l][r] = max(dp[l + 1][r] + aa[l], dp[l][r - 1] + aa[r])
            else:
                dp[l][r] = min(dp[l + 1][r] - aa[l], dp[l][r - 1] - aa[r])
    # p2D(dp)
    print(dp[0][-1])

main()


Measured memory_bytes: 112604
n = int(input())
x = []
x = list(map(int, input().split()))

def E_sum(p):
    e_sum = 0
    for i in range(n):
        y = (x[i] - p)**2
        e_sum += y
    return e_sum

m = float("inf")
for j in range(1, 101):
    tmp = E_sum(j)
    if tmp < m:
       m = tmp

print(m) 


Measured memory_bytes: 3060
#include <bits/stdc++.h>
typedef long long int ll;
#define FOR(i, a, b) for (ll i = (signed)(a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define MOD 1000000007
#define pb push_back
#define INF 93193111451418101
#define MIN -93193111451418101
#define EPS 1e-11
#define tp(a, b, c) make_tuple(a, b, c)
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
#define bitcnt(a) (ll) __builtin_popcount((a))
using namespace std;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef pair<ll, P> TP;
template <typename T> void fill_all(T &arr, const T &v) { arr = v; }
template <typename T, typename ARR> void fill_all(ARR &arr, const T &v) {
  for (auto &i : arr) {
    fill_all(i, v);
  }
}
//------------------変数-----------------------//

ll n, a, b;
//-------------------関数----------------------//
int main() {
  ll y;
  cin >> n >> y;
  if (y % 1000) {
    cout << "-1 -1 -1" << endl;
    return 0;
  }
  y /= 1000;
  REP(i, n + 1) {
    FOR(j, i, n + 1) {
      if (i * 10 + (j - i) * 5 + (n - j) == y) {
        cout << i << " " << j - i << " " << n - j << endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
string s;
int main(void){
    cin>>s;
    if(s[0]==s[2]){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    
}


Measured memory_bytes: 3636
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdio>
using namespace std;
struct point {
	int x, y;
} pp[10001];
int n, m;
int par[10001], ran[10001];
struct edge {
	int from, to;
	double cost;
	bool operator < (const edge &a) const {
		return cost > a.cost;
	}
};
vector <edge> gg;

int find(int x)
{
	if(x == par[x])
		return x;
	return par[x] = find(par[x]);
}

void init()
{
	for(int i = 0; i <= n; i++)
		par[i] = i;
}
bool unite(int x, int y)
{
	x = find(x); y = find(y);
	if(x == y)	return false;
	if(ran[x] < ran[y])
		par[x] = y;
	else {
		if(ran[x] == ran[y])
			ran[x]++;
		par[y] = x;
	}
	return true;
}

void kruls()
{
	init();
	double res = 0;
	sort(gg.begin(), gg.end() );
	for(int i = 0; i < gg.size(); i++)
	{
		if(!unite(gg[i].from, gg[i].to) )
			res += gg[i].cost;
	}
	printf("%.3f\n", res);
}
int main()
{
	scanf("%d %d", &n, &m);
	int a, b;
	double d;
	for(int i = 1; i <= n; i++)
		scanf("%d %d", &pp[i].x, &pp[i].y);
	for(int i = 1; i <= m; i++)
	{
		scanf("%d %d", &a, &b);
		d = sqrt( (double)(pp[a].x - pp[b].x) * (pp[a].x - pp[b].x) + (pp[a].y - pp[b].y) * (pp[a].y - pp[b].y) );
		gg.push_back(edge {a, b, d});
	}
	kruls();
}


Measured memory_bytes: 3684
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

struct Node {
	int location;
	int p, l, r;
	Node() {}
};

struct Point {
	int x;
	int y;
	int index;
	Point() {}
	Point(int x, int y, int index) :x(x), y(y), index(index) {}
	bool operator < (const Point& o) const {
		return index < o.index;
	}
};
static const int MAX = 1000000;
static const int NIL = -1;
Point P[MAX];
Node T[MAX];
int N;
int np;

bool lessX(const Point &p1, const Point &p2) {
	return p1.x < p2.x;
}

bool lessY(const Point &p1, const Point &p2) {
	return p1.y < p2.y;
}

int makekDTree(int l, int r, int depth) {
	if (!(l < r))return NIL;
	int mid = (l + r) / 2;
	int t = np++;
	if (depth % 2 == 0) {
		sort(P + l, P + r, lessX);
	}
	else {
		sort(P + l, P + r, lessY);
	}
	T[t].location = mid;
	T[t].l = makekDTree(l, mid, depth + 1);
	T[t].r = makekDTree(mid + 1, r, depth + 1);

	return t;
}

void find(int v, int sx, int tx, int sy, int ty, int depth, vector<Point> &ans) {
	int x = P[T[v].location].x;
	int y = P[T[v].location].y;

	if (sx <= x && x <= tx && sy <= y && y <= ty) {
		ans.push_back(P[T[v].location]);
	}

	if (depth % 2 == 0) {
		if (T[v].l != NIL) {
			if (sx <= x) find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
		}
		if (T[v].r != NIL) {
			if (x <= tx) find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
		}
	}
	else {
		if (T[v].l != NIL) {
			if (sy <= y) find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
		}
		if (T[v].r != NIL) {
			if (y <= ty) find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
		}
	}
}

int main() {
	scanf("%d", &N);
	for (int i = 0; i < N;i++) {
		int x, y; scanf("%d %d", &x, &y);
		P[i] = Point(x, y, i);
		T[i].l = T[i].r = T[i].p = NIL;
	}
	np = 0;
	int root = makekDTree(0, N, 0);
	int q; scanf("%d", &q);
	vector<Point> ans;
	for (int i = 0; i < q; i++) {
		int sx, tx, sy, ty; scanf("%d %d %d %d", &sx, &tx, &sy, &ty);
		ans.clear();
		find(root, sx, tx, sy, ty, 0, ans);
		sort(ans.begin(), ans.end());
		for (auto& p : ans) {
			printf("%d\n", p.index);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 15896
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
	int n,i,r,last,time,day;
	for(;cin>>n,n;){
		vector<pair<int,string> >program;
		set<string>fav;
		{
			string s;
			map<string,int>m;
			for(;n--;){
				cin>>s>>day>>time;
				program.push_back(make_pair(day*1440+time/100*60+time%100,s));
				m[s]=day*1440+time/100*60+time%100;
			}
			vector<int>v;
			for(cin>>n;n--;v.push_back(m[s]),fav.insert(s))cin>>s;
			sort(v.begin(),v.end());
			for(i=0;i<v.size()-1;i++)if(v[i+1]-v[i]<30){puts("-1");goto next;}
		}
		sort(program.begin(),program.end());
		for(last=r=i=0;i<program.size();i++){
			if(program[i].first>=last){
				last=program[i].first+30;
				r++;
			}else if(fav.find(program[i].second)!=fav.end()){
				last=program[i].first+30;
			}
		}
		printf("%d\n",r);
		next:;
	}
}

Measured memory_bytes: 1340
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    k = I()
    a = [int(c) for c in str(n)]
    l = len(a)
    dp = [[[0]*(k+1) for j in range(2)] for i in range(l+1)]
    dp[0][0][0] = 1
    for i in range(l):
        cp = dp[i]
        np = dp[i+1]
        c = a[i]
        if c == 0:
            for j in range(2):
                for ck in range(k+1):
                    np[j][ck] += cp[j][ck]
        else:
            for j in range(2):
                for ck in range(k+1):
                    np[1][ck] += cp[j][ck]

        for v in range(1,10):
            if v == c:
                for ck in range(k):
                    np[0][ck+1] += cp[0][ck]
                    np[1][ck+1] += cp[1][ck]
            elif v < c:
                for ck in range(k):
                    np[1][ck+1] += cp[0][ck]
                    np[1][ck+1] += cp[1][ck]
            else:
                for ck in range(k):
                    np[1][ck+1] += cp[1][ck]

    r = dp[l][0][k] + dp[l][1][k]
    return r


print(main())





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

int main() {
  //1以上N以下の整数のうち、10進法での各桁の和がA以上B以下であるものの総和を求めてください。
  
  int N,A,B;
  cin >> N >> A >> B;
  
  int SUM = 0;       //総和
  int digitSUM;      //各桁の和
  
  for(int i = 1; i <= N; i++){
    
    digitSUM = 0;
    
    //各桁の和を算出
    digitSUM = (i / 10000) + ((i % 10000) / 1000) + ((i % 1000) / 100) + ((i % 100) / 10) + (i % 10);

    if (digitSUM >= A && digitSUM <= B){
      SUM = SUM + i;
    }
  }
  
  cout << SUM << endl;
  
}
  
 

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

#define ll long long
int pre[200001], post[200001];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n, k, c; string s;
	cin >> n >> k >> c >> s;
	for(int i=0,id=0;i<n;i++) {
		if(s[i] == 'o') {
			pre[id++] = i;
			i += c;
		}
	}

	for(int i=n-1,id=k-1;i>-1 && id > -1;i--) {
		if(s[i] == 'o') {
			post[id--] = i;
			i -= c;
		}
	}

	for(int i=0;i<k;i++) {
		if(pre[i]==post[i]) {
			cout << pre[i]+1 << '\n';
		}
	}
}

Measured memory_bytes: 3348
#define _CRT_SECURE_NO_WARNINGS
//#pragma GCC optimize("O3")
#include <vector>
#include <algorithm>
#include <vector>
//#include <random>
#include <fstream>
#include <map>
#include <string>
#include <deque>
#include <set>
#include <ctime>
#include <exception>
#include <iostream>
#include <queue>
using namespace std;

//const int size2 = 6e5;
const int size1 = 1e6 + 500;
const long long INF = 1e9 + 10;
const long long mod = 1e9 + 7;
const long double eps = 1e-7;
const long double pi = 3.1415926535;
const int erat = 1e6 + 500;

long long pow1(long long a, long long deg)
{
	if (deg == 0)
	{
		return 1;
	}
	if (deg == 1)
	{
		return a % mod;
	}
	long long res = pow1(a, deg / 2);
	res = (res * res) % mod;
	if (deg % 2 == 1)
	{
		res = (res * a) % mod;
	}
	return res;
}

long long obr(long long a)
{
	return pow1(a, mod - 2);
}

static long long fact[size1];

long long c_n_k(long long n, long long k)
{
	return ((fact[n] * obr(fact[k])) % mod * obr(fact[n - k])) % mod;
}


int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	n--;
	fact[0] = 1;
	for (int i = 1; i <= n; i++)
	{
		fact[i] = (fact[i - 1] * i) % mod;
	}
	int pok = n / 2 + 1;
	long long ans = 0;
	long long prev_kol = 0;
	//long long ans = (fact[n] * (pok - 1)) % mod;
	for (int i = pok; i <= n; i++)
	{
		int kol_pov = 2 * (i - 1) - (n - 1);
		long long kol = ((c_n_k(i - 1, kol_pov) * fact[n - i]) % mod * fact[i]) % mod;

		//cout << kol << endl;
		//cout << kol << endl;
		ans = (ans + (i * (((kol - prev_kol) % mod + mod) % mod) % mod)) % mod;
		//cout << ans << endl;
		prev_kol = kol;
		//ans = (fact[n] - c_n_k(i, kol_pov)) % mod;
		//с_i_kol_pov
	}
	cout << ans;
	//cout << (ans + fact[n]) % mod;
	return 0;
}

Measured memory_bytes: 8064
import numpy as np
from sys import stdin
from copy import deepcopy
from functools import reduce
from fractions import gcd
import math
import itertools
from collections import Counter
from itertools import chain  ##list(chain.from_iterable(l)) ##flatten
from heapq import heappush, heappop

"""
N = int(input())
A, B = map(int,input().split())
A = list(map(int,input().split())) ## 横一列
A = [int(input()) for _ in range(N)] ## 縦一列
lst = [list(map(int,input().split())) for i in range(M)] ## 二次元
"""

H, A = map(int,input().split())

ans = (H + A - 1) // A
print(ans)

Measured memory_bytes: 13540
#include <iostream>
using namespace std;
int a[10005], b[505];
int n, q;

int search(int *a, int c)
{
	int idx = 0;
	a[n] = c;
	while(a[idx] != a[n])	idx ++;
	
	return idx != n;
}

int main()
{
	int sum = 0;
	cin >> n;
	for(int i = 0; i < n; ++ i)
		cin >> a[i];
	
	cin >> q;
	for(int i = 0; i < q; ++ i)
	{
		cin >> b[i];
		if(search(a, b[i]))	sum ++;
	}
	
	cout << sum << endl;
	
	return 0;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define F .first
#define S .second 
#define endl "\n"
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;
ll a[220000],b[220000];
main(){
  ll n,ans=1e16,tmp=0;
  cin>>n;
  rep(i,0,n){cin>>a[i];b[i]=a[i]-i;}
  sort(b,b+n);
  if(n%2==1){
    rep(i,0,n)tmp+=labs(a[i]-i-b[n/2]);
    cout<<tmp;
  }
  else{
    ll l=b[n/2],r=b[n/2+1];
    rep(i,l,r+1){
      tmp=0;
      rep(j,0,n)tmp+=labs(a[j]-i-j);
      ans=min(ans,tmp);
    }
  cout<<ans<<endl;
  }
}


Measured memory_bytes: 3328
import math

n = int(input())
res = float("inf")
for i in range(1, int(math.sqrt(n))+1):
    if n % i == 0 and res > max(len(str(int(n/i))), len(str(i))):
        res = max(len(str(int(n/i))), len(str(i)))

print(res)



Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;
namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
using ll = long long;

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

    int n;
    cin >> n;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];
    sort(a.begin(), a.end());

    Bint sum = 1;
    REP(i, n) {
        sum *= a[i];
        if (sum > ll(1e18)) {
            sum = -1;
            break ;
        }
    }

    cout << sum << '\n';
    return 0;
}


Measured memory_bytes: 4056
#include<stdio.h>
#include<math.h>
/*
Divide a given segment (p1, p2) into three equal segments.
Replace the middle segment by the two sides of an equilateral triangle (s, u, t) of the same length as the segment.
Repeat this procedure recursively for new segments (p1, s), (s, u), (u, t), (t, p2).
*/
void divide(int n,double x1, double y1,double x2, double y2){
	if(n==0){
		if((x1==0&&y1==0)||(x1==100&&y1==0))
			printf("%.8lf %.8lf\n",x1,y1);
		printf("%.8lf %.8lf\n",x2,y2);
		return;
	}
	//
	double th=M_PI*60.0/180.0;
	double sx=(2.0*x1+1.0*x2)/3.0;
    double sy=(2.0*y1+1.0*y2)/3.0;
    double tx=(1.0*x1+2.0*x2)/3.0;
    double ty=(1.0*y1+2.0*y2)/3.0;
    double ux=(tx-sx)*cos(th)-(ty-sy)*sin(th)+sx;
    double uy=(tx-sx)*sin(th)+(ty-sy)*cos(th)+sy;
	divide(n-1,x1,y1,sx,sy);
	//double mid_x = ;//(((x1+x2)/3)+(2*(x1+x2)/3))/2;
	//double mid_y = 
	divide(n-1,sx,sy,ux,uy);
	//divide(n-1,(2*(x1+x2)/3),((y1+y2)/2),x2,y2);
	divide(n-1,ux,uy,tx,ty);
	divide(n-1,tx,ty, x2,y2);
}

int main(){
	int n;
	scanf("%d",&n);
	double x1 = 0,y1 = 0;
	double x2 = 100, y2= 0;
	divide(n,x1,y1,x2,y2);
	return 0;
} 


Measured memory_bytes: 2728
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
prev = a[0]
ans = 0
l = 1
(n - 1).times do |i|
  if a[i + 1] == prev
    l += 1
  else
    ans += (l / 2)
    l = 1
  end
  prev = a[i + 1]
end
ans += (l / 2)
puts ans

Measured memory_bytes: 1788
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
#define V vector<ll>
#define Q int tt,qq; cin>>tt ;for(qq=1;qq<=tt;qq++)
#define I ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int main()
{
    ll n,ans=0,j,x,k,i,mn;
    cin>>n;
    V a(n);
    for(auto &x:a)cin>>x;
    while(1)
    {
        j=0;
        x=0;
        for(i=0;i<n;i++)
        {
            if(a[i]!=0)j++;
            if(j==0)x=i+1;
            if(j!=0&&a[i]==0)break;
        }
      //  cout<<x<<" "<<j<<endl;
        if(j==0)break;
        mn=100;
        for(i=x;i<n;i++)
        {
            if(a[i]==0)break;
            mn=min(mn,a[i]);
        }
        for(i=x;i<n;i++)
        {
            if(a[i]==0)break;
            a[i]-=mn;
        }
        ans+=mn;
    }
    cout<<ans;
}



Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
typedef long long ll;

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

  vector <int> A(N), B(N), C(N - 1);
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < N; i++) cin >> B[i];
  for (int i = 0; i < N - 1; i++) cin >> C[i];

  int ans = 0;
  for (int i = 0; i < N; i++){
    ans += B[i];
    if (i >= 1 && A[i] - A[i - 1] == 1){
      ans += C[A[i] - 2];
    }
  }
  cout << ans << endl;
  

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(i,n)for(int i=0;i<n;i++)
using namespace std;
int n,m,a[23],pp=0;
int main(){
  while(cin>>n>>m,n){
    cout<<"Case "<<++pp<<": ";
    int cnt=0;
    memset(a,0,sizeof(a));
    a[0]=n;
    while(1){
      cnt++;
      int p=0;
      for(int i=20;i>=0;i--){
	p+=a[i]/2;
	a[i+1]+=a[i]/2;
	a[i]=a[i]%2;
      }
      a[0]+=p;
      if(a[m]){
	cout<<cnt<<endl;
	break;
      }
    }
  }
}

Measured memory_bytes: 3072
#pragma comment(linker, "/STACK:102400000,102400000")
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <cassert>
//#include <unordered_map>
//#include <unordered_set>
using namespace std;

typedef long long ll;
#define eps 1e-8
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define DE(val) cout<<#val<<": "<<val<<endl;

const int dx4[5] = { 0,-1,0,1,0 };
const int dy4[5] = { 0,0,1,0,-1 };
const int dx8[9] = { 0,-1,0,1,0,1,1,-1,-1 };
const int dy8[9] = { 0,0,1,0,-1,1,-1,1,-1 };
const int maxn = 2e5 + 5;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
ll po(ll a, ll b, ll mod) { ll res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
ll gcd(ll a, ll b) { if (a == 0) { return b; } else { return gcd(b%a, a); } }
void YES() { puts("YES"); exit(0); }
void Yes() { puts("Yes"); exit(0); }
void NO() { puts("NO"); exit(0); }
void No() { puts("No"); exit(0); }
void one() { puts("-1"); exit(0); }

int n,t;
int val[maxn];

void solve()
{
	ll res = 0;
	sa(n),sa(t);
	sa(val[1]);

	repp(i,2,n)
	{
		sa(val[i]);
		if(val[i]>=val[i-1]+t)res+=t;
		else
		{
			res+=val[i]-val[i-1];
		}
	}
	res+=t;
	printf("%lld\n", res);
}

int main()
{
	solve();
	//system("pause");
	return 0;
}

Measured memory_bytes: 1024
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
using ull=unsigned long long;
constexpr auto inf=static_cast<ll>(1e18);
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}
template<typename T=ll>inline auto vec2(size_t h,size_t w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}
inline void setp(int n){cout<<fixed<<setprecision(n);}
inline void delnl(){cin.ignore(numeric_limits<streamsize>::max(),'\n');}

class mod_int{
    private:
        ull num;
        static ull pow_mod(ull x,ull y){x%=mod;return y==0?1:y%2==0?pow_mod(x*x,y/2):x*pow_mod(x,y-1)%mod;}
    public:
        static ull mod;
        mod_int()=default;
        mod_int(ull num):num(num%mod){}
        explicit operator ull()             const{return num;}
        bool    operator==(const mod_int&mi)const{return num==mi.num;}
        bool    operator!=(const mod_int&mi)const{return !operator==(mi);}
        mod_int operator~ ()                const{return pow_mod(num,mod-2);}
        mod_int operator+ (const mod_int&mi)const{return num+mi.num;}
        mod_int operator- (const mod_int&mi)const{return num-mi.num+mod;}
        mod_int operator* (const mod_int&mi)const{return num*mi.num;}
        mod_int operator/ (const mod_int&mi)const{return num*(~mi).num;}
        mod_int&operator+=(const mod_int&mi)     {return*this=operator+(mi);}
        mod_int&operator-=(const mod_int&mi)     {return*this=operator-(mi);}
        mod_int&operator*=(const mod_int&mi)     {return*this=operator*(mi);}
        mod_int&operator/=(const mod_int&mi)     {return*this=operator/(mi);}
};
class combination_modulo:mod_int{
    private:
        vector<mod_int>factorial_mod;
    public:
        combination_modulo(ull max_n):factorial_mod(max_n+1)
        {
            factorial_mod[0]=1;
            for(ll i=1;i<=max_n;++i)factorial_mod[i]=factorial_mod[i-1]*i;
        }
        mod_int operator()(ull n,ull r)
        {
            return n<r?0:factorial_mod[n]/(factorial_mod[r]*factorial_mod[n-r]);
        }
};
ull mod_int::mod=1000000007;
int main()
{
    ll x=in(),y=in();
    if((2*y-x)%3!=0||(2*x-y)%3!=0){
        cout<<0<<endl;
    }else{
        ll a=(2*y-x)/3,b=(2*x-y)/3;
        if(a<0||b<0){
            cout<<0<<endl;
            return 0;
        }
        combination_modulo cm(a+b);
        cout<<(ull)cm(a+b,a)<<endl;
    }
}


Measured memory_bytes: 5504
#include <stdio.h>

int main()
{
	int n,x,i,j,k,t;
	
	while (1) {
		scanf("%d %d", &n, &x);
		t = 0;
		if (n == 0 && x == 0) break;
	
		for(i=1;i<=n;i++){
			for(j=i+1;j<=n;j++) {
				for(k=j+1;k<=n;k++) {
					if(i+j+k == x)		t++;
				}
			}
		}
		printf("%d\n",t);
	}
	
	return 0;
}
	


Measured memory_bytes: 2052
#include<cstdio>
#include<algorithm>
#include<functional>
#include<iostream>
#include<string>
using namespace std;
int main(void)
{
	int i,j,k,h,w,cnt;
	char mp[101][101];
	while(1) {
		cin>>h>>w;
		if(h==0&&w==0)break;
		for(i=0;i<h;i++) 
			for(j=0;j<w;j++) cin>>mp[i][j];
		cnt=0;
		i=0,j=0;
		while(1) {
			if('>'==mp[i][j]) j++,cnt++;
			if('v'==mp[i][j]) i++,cnt++;
			if('^'==mp[i][j]) i--;cnt++;
			if('<'==mp[i][j]) j--,cnt++;
			if('.'==mp[i][j]) {
				cout<<j<<" "<<i<<endl;
				break;
			}
			if(cnt>10000) {
				cout<<"LOOP"<<endl;
				break;
			}
		}
	}
}

Measured memory_bytes: 3100
#include<iostream>
#include<algorithm>
using namespace std;
string d[105];
int a,b,c,l,n;
bool cmp(string m,string n)
{
    for(int i=0;i<l;i++)
    {
        if(m[i]<n[i])
            return true;
        else if(m[i]>n[i])
        return false;
    }

    return false;
}
int main()
{
	cin>>n>>l;
	for(int i=1;i<=n;i++)
        cin>>d[i];
    sort(d+1,d+n+1,cmp);
    for(int i=1;i<=n;i++)
        cout<<d[i];
    cout<<endl;
	return 0;
}


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

int main()
{
	string a;
	cin>>a;
    int cnt=0;
    if(a[0]=='1')cnt++;
    if(a[1]=='1')cnt++;
	if(a[2]=='1')cnt++;
	cout<<cnt;
	 
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define p(s) cout<<(s)<<endl
#define REP(i,n,N) for(int i=n;i<N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=n;i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const ll mod = 1e9+7;

ll X,Y;
int main(){
    cin>>X>>Y;
    ll now=X;
    ll ans=0;
    while(X<=Y){
        X*=2;
        ans++;
    }
    p(ans);
    return 0;
}

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

int main(void){
    int n;
    cin >> n;
    int64_t ans;
    if(n == 0){
        cout << 2 << endl;
    }
    if(n == 1){
        cout << 1 << endl;
    }
    int64_t i0, i1 = 1, i2 = 2;
    int i;
    for(i = 2; i <= n; i++){
        i0 = i1 + i2;
        ans = i0;
        i2 = i1;
        i1 = i0;
    }
    if(n != 0 && n != 1){
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>

class input
{
    std::istream& cin;

public:
    input() : cin(std::cin)
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var)
    {
        cin >> var;
        return *this;
    }
    template <class T>
    inline input& operator,(T& var)
    {
        cin >> var;
        return *this;
    }

    template <class T>
    inline T read()
    {
        T var;
        cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            cin >> *head;
            ++head;
        }
    }

    template <class T>
    inline std::vector<T> read(std::size_t n)
    {
        std::vector<T> res;
        res.reserve(n);

        for (std::size_t i = 0; i < n; ++i) {
            T tmp;
            cin >> tmp;
            res.emplace_back(tmp);
        }
        return res;
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

    template <class T, class... Args>
    void impl(T&& v, Args&&... args)
    {
        cout << std::forward<T>(v) << ' ';
        impl(std::forward<Args>(args)...);
    }
    template <class T>
    void impl(T&& v)
    {
        cout << std::forward<T>(v);
    }

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class... Args>
    void operator()(Args&&... args)
    {
        impl(std::forward<Args>(args)...);
        cout << '\n';
    }
    template <class... Args>
    void noreturn(Args&&... args)
    {
        impl(std::forward<Args>(args)...);
    }

    template <class T>
    void print(const T& container)
    {
        bool first = true;
        for (auto&& x : container) {
            if (!first) {
                cout << ' ';
            }
            cout << x;
            first = false;
        }
        cout << '\n';
    }
};

void prog()
{
    input in;
    output out;

    std::uint64_t n, a, b;
    in >> n, a, b;
    auto res = n / (a + b) * a;
    n %= a + b;
    res += std::min(n, a);
    out(res);
}

int main()
{
    prog();
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
#define all(x) x.begin(), x.end()
#define trav(i,a) for(auto &i:a) 
inline int in(){int x;scanf("%lld",&x);return x;}
int32_t main()
{
	int n=in();int x=in();int t=in();
	int ans=0;
	int made=0;
	while(made<n)
	{
		ans+=t;
		made+=x;
	}
	cout<<ans;
	
	
}

Measured memory_bytes: 3756