akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll n,m;
Vi a;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    cin>>n>>m;
    a.resize(n);
    ll su = 0;
    rep(i,n){
        cin>>a[i];
        su += a[i];
    }
    ll tmp = 0;
    rep(i,n){
        if(a[i]*4*m >= su){
            tmp++;
        }
    }
    if(tmp >= m)tmp = 1;
    else tmp = 0;
    Yes(tmp);
    return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <map>

using namespace std;

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

  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    int a; cin >> a;
    mp[a]++;
  }
  cout << ( mp.size() == n ? "YES" : "NO") << endl;

  return 0;
}

Measured memory_bytes: 9600
n = int(input())
c = input()

left = 0
right = n - 1
cnt = 0

while left < right:
  while left < right:
    if c[left] == "W":
      break;
    left += 1
  while left < right:
    if c[right] == "R":
      break;
    right -= 1
  if left < right:
    cnt += 1
  left += 1
  right -= 1
#

print(cnt)



Measured memory_bytes: 9388
#include<bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

ll MOD=1000000007;

int main(){
    ll N;cin>>N;
    if(N==1){
        cout<<1<<endl;
    }
    else{
        vector<ll>memo(N-1);
        for(int i=2;i<=N;i++){
            ll K=i;
            for(int j=2;j<=i;j++){
                if(K%j==0){
                    ll count=0;
                    while(K%j==0){
                        K=K/j;
                        count++;
                    }
                    memo[j-2]+=count;
                }
            }
        }
        ll ans=1;
        rep(i,N-1){
            ans=(ans*(memo[i]+1))%MOD;
        }
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i, a, b) for (int i = a; i < b; i++)
typedef pair<ll,ll> pi;
typedef vector<ll> vi;
ll n;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	bool finished = false;
	string output  = "";
	while (finished == false){
		n--;
		output = (char)(97 + (n%26)) + output;
		n /=26;
		if (n == 0){
			finished = true;
		}
	}
	cout << output << endl;
}

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

ll solve() {
    ll A;
    double B;
    cin >> A >> B;
    ll b100 = (ll)(B * 100 + 0.5);
    ll ans = A*b100/100;
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3692
#include <iostream>

using namespace std;

int a,b,c,k;

int main()
{
    scanf("%d%d%d%d",&a,&b,&c,&k);
    int times=0;
    while(b<=a)b*=2,times++;
    while(c<=b)c*=2,times++;
    puts(times<=k?"Yes":"No");
	return 0;
}

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

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)
#define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))

#define SZ(a) (int) a.size()
#define ALL(a) a.begin(),a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const LL INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 100100;

VI g[MAX];

LL A[MAX];

LL dfs(int x, int p)
{
	LL rest = A[x];

	FOR (i, 0, SZ(g[x]))
	{
		int to = g[x][i];
		if (to == p) continue;
		LL v = dfs(to, x);
		if (v < 0) return -1;
		if (SZ(g[x]) != 1)
		{
			if (v * 2 > A[x]) return -1;
		}
		rest -= v;
	}

	if (SZ(g[x]) != 1)
	{
		if (rest * 2 > A[x]) return -1;
	}

	return rest;
}

int main()
{
	//freopen("in.txt", "r", stdin);
	//ios::sync_with_stdio(false); cin.tie(0);

	int n;
	scanf("%d", &n);
	FOR (i, 0, n)
	{
		int x;
		scanf("%d", &x);
		A[i] = x;
	}

	FOR (i, 0, n-1)
	{
		int x, y;
		scanf("%d%d", &x, &y);
		x--;
		y--;
		g[x].PB(y);
		g[y].PB(x);
	}

	FOR (i, 0, n)
	{
		if (SZ(g[i]) > 1) A[i] *= 2;
	}


	if (dfs(0, -1) != 0)
	{
		cout<<"NO"<<endl;
	}
	else
	{
		cout<<"YES"<<endl;
	}


}


Measured memory_bytes: 13184
while True:
  n = int(input())
  if not n:
    break
  
  dic = {}

  for i in range(n):
    e, p, q = map(int, input().split())    
    if e in dic:
      dic[e] = (dic[e][0], dic[e][1] + p * q)
    else:
      dic[e] = (i, p * q)

  lst = []

  for k in dic:
    if dic[k][1] >= 1000000:
      lst.append((dic[k][0], k))
  
  lst.sort()

  if lst:
    for e in lst:
      print(e[1])
  else:
    print("NA")


Measured memory_bytes: 5948
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<map>
#include<list>
#include<queue>
using namespace std;
#define ll long long

int judge753(ll a){
  int flag3,flag5,flag7;
  int tmp;
  flag3=0;
  flag5=0;
  flag7=0;
  while(a>0){
    tmp=a%10;
    if(tmp==3)flag3=1;
    if(tmp==5)flag5=1;
    if(tmp==7)flag7=1;
    a=a/10;
  }
  if(flag3*flag5*flag7==1){
    return 1;
  }else{
    return 0;
  }
}

int main(){
  ll N;
  cin >> N;
  queue<ll> q;
  q.push(3);
  q.push(5);
  q.push(7);
  ll cnt,a;
  cnt=0;
  int flag3,flag5,flag7;
  while(!q.empty()){
     a=q.front();
     if(a*10+3<=N)q.push(a*10+3);
     if(a*10+5<=N)q.push(a*10+5);
     if(a*10+7<=N)q.push(a*10+7);
     cnt+=judge753(a);
     q.pop();
  }
    cout << cnt <<endl;
    return 0;
}


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

int main()
{
    int N;
    cin >> N;
    
    set<int> S;
    
    for(int i=0;i<N;i++)
    {
        int t;
        cin >> t;
        
        if(S.find(t) == S.end())
        {
            S.insert(t);
        }
        else
        {
            S.erase(S.find(t));
        }
    }

    cout << S.size() << endl;
    return 0;
}

Measured memory_bytes: 4864
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;

int main() {
  long long n,m;
  long long num = 0;
  cin >> n >> m;
  if (n > 1 && m > 1) {
    num = (n-2) * (m-2);
  } else if (n == 1 && m > 1){
    num = m -2;
  } else if (m == 1 && n > 1) {
    num = n-2;
  } else if (m == 1 && n == 1) {
    num = 1;
  } else {
  }
  cout << num << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin>>n;
	ll a[n],i;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	ll sum=0;
	for(i=1;i<n;i++)
	{
		if(a[i]<a[i-1])
		{
			sum+=a[i-1]-a[i];
			a[i]=a[i-1];
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 5176
#include <iostream>

using namespace std;
long long x[3],y[3];
int main(){
	long long s,mx = 1000000000;
	cin >> s;
	cout << 0 << " " << 0 << " ";
	if(s<=mx*(mx - 1)){
		x[0] = mx; y[0] = mx - s%mx; x[1] = s/mx + 1; y[1] = 1;
		cout << mx << " " << mx - s%mx << " " << 1 << " " << s/mx + 1 << endl;
	}else{
		cout << mx << " " << mx*mx - s << " " << 1 << " " << mx << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,m,c,s,g;
int dist_corp[128][128][32];
int cost_corp[128][128][32];
vector<int> fare_p;
vector<vector<int> > fare_q,fare_r;
int cost[128][128];
int INF=1048576;
void init(){
	for(int i=0;i<128;++i)
		for(int j=0;j<128;++j){
			for(int k=0;k<32;++k){
				dist_corp[i][j][k]=INF;
				cost_corp[i][j][k]=INF*128;
			}
			cost[i][j]=INF*128;
		}
	fare_p.clear();
	fare_q.clear();
	fare_r.clear();
}
void input(){
	for(int i=0;i<m;++i){
		int x,y,di,co;
		cin >> x >> y >> di >> co;
		dist_corp[x][y][co]=min(dist_corp[x][y][co],di);
		dist_corp[y][x][co]=min(dist_corp[y][x][co],di);
	}
	fare_p.resize(c);
	fare_q.resize(c);
	fare_r.resize(c);
	for(int i=0;i<c;++i) cin >> fare_p[i];
	for(int i=0;i<c;++i){
		fare_q[i].resize(fare_p[i]);
		for(int j=0;j<fare_p[i]-1;++j)
			cin >> fare_q[i][j];
		fare_q[i][fare_p[i]-1]=INF;
		
		fare_r[i].resize(fare_p[i]);
		for(int j=0;j<fare_p[i];++j)
			cin >> fare_r[i][j];
	}
}
void distwf(){
	for(int co=1;co<=c;++co)
		for(int k=1;k<=n;++k)
			for(int i=1;i<=n;++i)
				for(int j=1;j<=i;++j){
					if(i==j) dist_corp[i][j][co]=0;
					dist_corp[i][j][co]=min(dist_corp[i][j][co],dist_corp[i][k][co]+dist_corp[k][j][co]);
					dist_corp[j][i][co]=min(dist_corp[j][i][co],dist_corp[j][k][co]+dist_corp[k][i][co]);
				}
}
void calcost(){
	for(int co=1;co<=c;++co)
		for(int i=1;i<=n;++i)
			for(int j=1;j<=n;++j){
				int div=0,dist=dist_corp[i][j][co],tmpcost=0,prepos=0;
				if(dist>=INF) continue;
				for(div=0;fare_q[co-1][div]<dist;++div){
					tmpcost+=(fare_q[co-1][div]-prepos)*fare_r[co-1][div];
					prepos=fare_q[co-1][div];
				}
				tmpcost+=(dist-prepos)*fare_r[co-1][div];
				//cout << tmpcost << ' ' << dist <<' ' << co << endl;
				cost_corp[i][j][co]=tmpcost;
			}
}
void margecost(){
	for(int co=1;co<=c;++co)
		for(int i=1;i<=n;++i)
			for(int j=1;j<=n;++j){
				cost[i][j]=min(cost[i][j],cost_corp[i][j][co]);
			}
}
void costwf(){
	for(int k=1;k<=n;++k)
		for(int i=1;i<=n;++i)
			for(int j=1;j<=i;++j){
					if(i==j) cost[i][j]=0;
					cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]);
					cost[j][i]=min(cost[j][i],cost[j][k]+cost[k][i]);
			}
}
int main(){
    for(;;){
        cin >> n >> m >> c >> s >> g;
        if(!n&&!m&&!c&&!s&&!g) break;
        init();
        input();
        distwf();
        calcost();
        margecost();
        costwf();
    	int answer=cost[s][g];
    	if(answer>=INF*128) answer=-1;
        cout << answer << endl;
    }
    return 0;
}

Measured memory_bytes: 5368
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
int main() {
  int n;
  vector<int> v;
  while (cin >> n) {
    if (v.size() >= n + 1) {
      cout << accumulate(v.begin(), v.end() - (v.size() - (n + 1)), 0) << endl;
      continue;
    }
    v.resize(n + 1);
    fill(v.begin(), v.end(), 1);
    v[0] = 0;
    v[1] = 0;
    for (int i = 0; i * i < v.size(); ++i) {
      while (v[i] == 0) ++i;
      for (int m = i + 1; m < v.size(); ++m) {
        if (m % i == 0) {
          v[m] = 0;
        }
      }
    }
    cout << accumulate(v.begin(), v.end(), 0) << endl;
  }
  return 0;
}

Measured memory_bytes: 6744
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

typedef pair<long,long> P;

int main() {
  long n,m;
  long ans = 0;
  cin >> n >> m;
  vector<long> a(n);
  priority_queue<P> pq;
  for (long i=0; i<n; i++) cin>>a[i];
  for (long i=0; i<m; i++) {
    long b,c;
    cin >> b >> c;
    pq.push(P(c,b));
  }

  sort(a.begin(),a.end());
  for (long i=0; i<n; i++) {
    long b,c;
    if (pq.empty()) {
      b = c = -1;
    } else {
      tie(c,b) = pq.top();
      pq.pop();
    }
    if (c <= a[i]) {
      pq.push(P(c,b));
      ans += a[i];
      continue;
    } else {
      ans += c;
      if (b-1 > 0) pq.push(P(c,b-1));
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3188
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int
 
#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))
 
typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;
 
typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;
 
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;
 
namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}
 
signed main() {
    int n, m; cin >> n;
    string s;
    set<string> namelist;
    rep(i,0,n) {
        cin >> s;
        namelist.insert(s);
    }
    
    cin >> m;
    bool open = false;
    rep(i,0,m) {
        cin >> s;
        if(namelist.count(s)) {
            open ^= 1;
            if(open) cout << "Opened by " << s << endl;
            else cout << "Closed by " << s << endl;
        }
        else cout << "Unknown " << s << endl;
    }
    return 0;
}

Measured memory_bytes: 3244
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()

using namespace std;


int main(){

    int n,k,q,tmp;
    cin >> n >> k >> q;

    vector<int> a(100001);

    rep(i,q){
        cin >> tmp;
        a[tmp]++;
    }

    rep(i,n){
        if(k - (q - a[i + 1]) <= 0){
            cout << "No" << endl;
        }else cout << "Yes" << endl;
    }


    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

#define MAX(NUM1, NUM2)		(((NUM1)>(NUM2))?NUM1:NUM2)

int main()
{
  int err;
  int a, b;
  int tasu, hiku, kakeru;
  int max;
  
  err = scanf("%d %d", &a, &b);
  
  if(!err)return -1;
  
  tasu = a+b;
  hiku = a-b;
  kakeru = a*b;
  
  max = MAX(kakeru, MAX(tasu, hiku));
  printf("%d\n", max);
  
  return 0;
}


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

int main(){
    string S;
    cin>>S;
    int len=S.size();
    while(len>0){
        if(len>=5){
            if(S.substr(len-5,5)==string("erase")||S.substr(len-5,5)==string("dream")){
                len-=5;
                continue;
            }
        }
        if(len>=6){
            if(S.substr(len-6,6)==string("eraser")){
                len-=6;
                continue;
            }
        }
        if(len>=7){
            if(S.substr(len-7,7)==string("dreamer")){
                len-=7;
                continue;
            }
        }
        cout<<"NO"<<endl;
        return 0;
    }
    cout<<"YES"<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
const int MOD=1000000007;
vector<int>G[200005];
vector<int>ans;
void dfs(int NOW,int BACK){
  for(int NEXT:G[NOW]){
    if(NEXT==BACK){continue;}
    ans[NEXT]+=ans[NOW];
    dfs(NEXT,NOW);
  }
}
int main() {
  int N,Q;
  cin>>N>>Q;
  for(int i=0;i<N-1;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  ans.resize(N);
  for(int i=0;i<Q;i++){
    int p,x;
    cin>>p>>x;
    p--;
    ans[p]+=x;
  }
  dfs(0,-1);
  
  for(int i=0;i<N;i++){
    cout<<ans[i];
    if(i<N-1){cout<<" ";}
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 24292
using System;

class C10{
  public static void Main(){
    int n = int.Parse(Console.ReadLine());
    for(int i = 0;i < n;i++){
      var x = Console.ReadLine();
      var y = Console.ReadLine();
      Console.WriteLine(lc(x,y));
    }
  }

  static int lc(string x,string y){
    int[,] a = new int [1001,1001];
    int s = x.Length;
    int t = y.Length;
    x = " " + x;
    y = " " + y;

    for(int i = 1;i <= s;i++){
      for(int j = 1;j <= t;j++){
        a[i,j] = x[i] == y[j] ?  a[i - 1,j - 1] + 1
        : Math.Max(a[i - 1,j],a[i,j - 1]);
      }
    }
    return a[s,t];
  }
}



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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  if ( a+b > c+d ) {
    cout << "Left" << endl;
  }
  
  if ( a+b == c+d ) {
    cout << "Balanced" << endl;
  }
  
  if ( a+b < c+d ) {
    cout << "Right" << endl;
  }
  
}


Measured memory_bytes: 256
X, N = map(int, input().split())

P = list(map(int, input().split()))

maxP = 0
minP = 0

setP = set(P)

i = 0
while True:
    if X - i not in setP:
        print(X-i)
        break
    elif X + i not in setP:
        print(X+i)
        break
    i += 1


Measured memory_bytes: 61720
#include "bits/stdc++.h"
typedef long long ll;
using namespace std;

int main() {
    int n, m , c;
    cin >> n >> m >> c;
    vector<int> b(m);
    for (int i = 0; i < m; ++i) cin >> b[i];

    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        int sum = 0;
        for (int j = 0; j < m; ++j) {
            int a; cin >> a;
            sum += a * b[j];
        }
        if (0 < sum + c) cnt++;
    }

    cout << cnt << endl;

    return 0;
}


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

int main() {
  int w, h, x, y;
  cin >> w >> h >> x >> y;

  double ans = (double)w*h/2;
  int num = (w==x*2 && h==y*2) ? 1 : 0;
  printf("%.10f %d\n", ans, num);
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    vector<pii> a(n);
    REP(i,n){
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a.rbegin(),a.rend());
    vector<vector<int64>> dp(n+1,vector<int64>(n+1,-LLINF)); //i番目までのうちj-1個を左に振った
    dp[0][0] = 0;
    REP(i,n){
        REP(j,n){
            if(i + j >= n)continue;
            dp[i+1][j] = max(dp[i+1][j], dp[i][j] + a[i+j].first * abs(i - a[i+j].second));
            dp[i][j+1] = max(dp[i][j+1], dp[i][j] + a[i+j].first * abs(n-1-j - a[i+j].second));
        }
    }
    // REP(i,n+1){
    //     REP(j,n+1)cout << dp[i][j] << " ";
    //     cout << endl;
    // }
    int64 ans = 0;
    REP(i,n+1)ans = max(ans, dp[i][n-i]);
    ANS(ans);
    return 0;
}

Measured memory_bytes: 34620
#include<stdio.h>

int main()
{
 int i, j, kosuu, a[101], CGcount = 0, min, minnum, box;

 scanf("%d", &kosuu);
 for(i = 1;i <= kosuu;i++){
   scanf("%d", &a[i]);
 }

 for(i = 1;i <= kosuu;i++){
   min = a[i];
   for(j = i + 1;j <= kosuu;j++){
     if(a[j] < min){
       min = a[j];
       minnum = j;
     }
   }
   if(min < a[i]){
      box  = a[i];
      a[i] = min;
      a[minnum]  = box;
      CGcount++;
   }
 }
 
 for(i = 1;i < kosuu;i++){
   printf("%d ", a[i]);
 }
 printf("%d\n%d\n", a[kosuu], CGcount);

 return 0;
} 

Measured memory_bytes: 1756
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define ALL(a) begin(a), end(a)
#define RALL(a) rbegin(a), rend(a)
#define SORT(a) stable_sort(ALL(a))
#define RSORT(a) stable_sort(RALL(a))
#define REV(a) reverse(ALL(a))
#define UNIQUE(a) a.erase(unique(ALL(a)), end(a))
#define lambda(i) [=](auto i)
#define compare(i, j) [=](auto i, auto j)
#define min_of(a) *min_element(ALL(a))
#define max_of(a) *max_element(ALL(a))
#define sum(a) accumulate(ALL(a), 0)
#define count_of(a, i) count(ALL(a), i)
#define lower(a, i) (int)(lower_bound(ALL(a), i) - begin(a))
#define upper(a, i) (int)(upper_bound(ALL(a), i) - begin(a))
#define binary(a, i) binary_search(ALL(a), i)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define sz(a) (int)(a).size()
#define REP(i, n) for (decltype(+n) i = 0; i < (n); i++)
#define RREP(i, n) for (auto i = n - 1; i != static_cast<decltype(i)>(-1); i--)
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define RFOR(i, a, b) for (auto i = b - 1; i >= a; i--)
#define EACH(i, a) for (auto&& i: (a))
using namespace std;

const int INF = 1e18;
const int MOD = 1e9 + 7;
int mod_add(int A, int B) { return (A + B) % MOD; }
int mod_sub(int A, int B) { return (A + MOD - B) % MOD; }
int mod_mul(int A, int B) { return ((A % MOD) * (B % MOD)) % MOD; }
int mod_bipow(int X, int Y) {
    if (Y == 0) return 1;
    else if (Y == 1) return X % MOD;
    else if (Y % 2 == 0) {
        int Z = mod_bipow(X, (int)(Y / 2));
        return mod_mul(Z, Z);
    } else {
        int Z = mod_bipow(X, (int)(Y / 2));
        return mod_mul(mod_mul(Z, Z), X);
    }
}
int mod_inv(int X) { return mod_bipow(X, MOD - 2); }
int mod_div(int A, int B) { return mod_mul(A, mod_inv(B)); }

int ceil_div(int X, int Y) {
  return (X - 1) / Y + 1;
}

struct vertex {
  vector<int> adj = vi(0);
};

struct union_find {
  vi data;
  union_find(int size) : data(size, -1) { }
  bool union_set(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool find_set(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

vi cum(vi V) {
  vi U(sz(V));
  partial_sum(ALL(V), begin(U));
  return U;
}

void solve() {
  int n, x;
  int ans = 0;

  cin >> n >> x;
  vi m(n);
  REP(i, n) {
    cin >> m[i];
    x -= m[i];
  }

  cout << n + x / min_of(m) << endl;
  // REP(i, n) {
  //   cout << a[i];
  // }
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(15);
  solve();
}


Measured memory_bytes: 256
import math




N=int(input())

anslist=[0]*(N+1)
ma=int(math.sqrt(N))+1
for x in range(1,ma):
    for y in range(x,ma):
        for z in range(y,ma):
            n=x**2+y**2+z**2+x*y+y*z+z*x
            if n <=N:
                if x==y and y==z:
                    anslist[n]+=1
                elif x==y or y==z or z==x:
                    anslist[n]+=3
                else:
                    anslist[n]+=6

            
for i in range(1,N+1):
    print(anslist[i])


Measured memory_bytes: 9348
#include<algorithm>
#include<deque>
#include<iostream>
#include<queue>

int main(void)
{
	unsigned long long numberOfItem = 0;
	unsigned long long numberOfTicket = 0;

	std::cin >> numberOfItem >> numberOfTicket;

	std::priority_queue<unsigned long long, std::deque<unsigned long long>> valueList;

	auto discount = [&valueList](void)
	{
		unsigned long long target = valueList.top();
		valueList.pop();
		valueList.push(target / 2);
	};

	unsigned long long value = 0;
	for (unsigned long long count = 0; numberOfItem > count; ++count)
	{
		std::cin >> value;
		valueList.push(value);
	}

	for (unsigned long long count = 0; numberOfTicket > count; ++count)
	{
		discount();
	}

	unsigned long long sum = 0;
	while(!valueList.empty())
	{
		sum += valueList.top();
		valueList.pop();
	}
	std::cout << sum;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

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

		int odd = 0;
		for (int i=0; i<N; i++) {
			int ai = sc.nextInt();
			if (ai % 2 != 0) odd++;
		}
		if (odd % 2 != 0) {
			System.out.println("NO");
		}
		else {
			System.out.println("YES");
		}

	}

}


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

class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String input ="";
			do{
				input = br.readLine();
				String[] inputs = input.split(" ");
				int num1 = Integer.parseInt(inputs[0]);
				int num2 = Integer.parseInt(inputs[1]);
				System.out.println(getDigit(num1 + num2));
			}while(!input.equals(""));
		}
		catch(Exception e){
			return;
		}
	}
	
	private static int getDigit(int num){
		String numStr = Integer.toString(num);
		return numStr.length();
	}

}

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

#define MAX 12
#define INF 100
int main(){
  
  while(true){
    int d, w, ans = 0;
    int e[MAX][MAX];
    
    cin>>d>>w;

    if(!d &&!w) break;

    for(int i = 0; i < d; i++){
      for(int j = 0; j < w; j++){
	cin>>e[i][j];
      }
    }
    

    for(int i = 1; i < d-1; i++){
      for(int j  = 1; j < w-1; j++){
	for(int k = i; k < d-1; k++){
	  for(int l = j; l < w-1; l++){
	    int min_ = INF, sum = 0;
	    bool flag = false;
	    for(int m = i-1; m <= k+1; m++){
	      //cout<<m<<" ";
	      min_ = min(min_, e[m][j-1]);
	      min_ = min(min_, e[m][l+1]);
	    }//cout<<endl;

	    for(int m = j-1; m <= l+1; m++){
	      // cout<<m<<" ";
	      min_ = min(min_, e[i-1][m]);
	      min_ = min(min_, e[k+1][m]);
	    }//cout<<endl;
	    //cout<<min_<<endl;
	    for(int m = i; m <= k; m++){
	      for(int n = j; n <= l; n++){
		if(min_ <= e[m][n]){
		  flag = true;
		  break;
		} else {
		  sum += min_ - e[m][n];
		}
	      }
	      if(flag) break;
	    }
	    //cout<<sum<<endl;
	    if(!flag) ans = max(ans, sum);
	    
	  }
	}
      }
    }

    cout<<ans<<endl;
    
  }
}



Measured memory_bytes: 3064
package main

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

func main(){
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	arr := strings.Split(sc.Text(), " ")
	N, _ := strconv.Atoi(arr[0])
	M, _ := strconv.Atoi(arr[1])
	X, _ := strconv.Atoi(arr[2])
	Y, _ := strconv.Atoi(arr[3])
	sc.Scan()
	x_list := strings.Split(sc.Text(), " ")
	var x, y, x_max int
	var is_war bool
	x_max = X
	for i:=0; i<N; i++{
		x, _ = strconv.Atoi(x_list[i])
		if x >= Y{
			is_war = true
			break
		}
		if x > x_max{
			x_max = x
		}
	}
	sc.Scan()
	y_list := strings.Split(sc.Text(), " ")
	for i:=0; i<M; i++{
		y, _ = strconv.Atoi(y_list[i])
		if y <= x_max{
			is_war = true
			break
		}
	}
	
	if is_war{
		fmt.Println("War")
	} else {
		fmt.Println("No War")
	}
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for

int main()
{
    int a;
    cin >> a;
    cout << "ABC" << a << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i,a,b) for(int i=a;i<=b;i++)
const int N=1e2+5;
const int mod=1e9+7;
LL a,b,c,d;
LL pow_mod(LL a,LL b) {LL res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int main()
{
	string s;
	cin>>s;
	int sz=s.size();
	d=1;
	rep(i,0,sz-1)
	{
		if(s[i]=='A')a+=d;
		else if(s[i]=='B')b+=a;
		else if(s[i]=='C')c+=b;
		else if(s[i]=='?')c*=3,c+=b,b*=3,b+=a,a*=3,a+=d,d*=3;
		a%=mod,b%=mod,c%=mod,d%=mod;
	}
	cout<<c;

	return 0;
}


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

int main()
{
  int a,b,c,d,e,k;
  cin>>a>>b>>c>>d>>e>>k;
  if(max({a,b,c,d,e})-min({a,b,c,d,e}) > k)
  {
    cout<<":(";
  }
  else
  {
	cout<<"Yay!";
  }
  
  return 0;
} 

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

using namespace std;

int main(void){
    long long a,b,c,d;
    cin >> a >> b >> c >> d;
    long long g = c*d/__gcd(c,d);
    cout << fixed << setprecision(0) << b - b/c - b/d + b/g - (a-1 - (a-1)/c - (a-1)/d + (a-1)/g) << endl;
    return 0;
}

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

int main()
{
	// 入力
	int A;
	int B;
	cin >> A >> B;
	
	int window = A;
	int curtain = B * 2;
	
	int answer = window - curtain;
	if (curtain > window)
	{
		answer = 0;
	}
	
	cout << answer << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int t, n, s, f;
  while(cin >> t, t){
    cin >> n;
    int sum = 0;
    while(n--){
      cin >> s >> f;
      sum += f - s;
    }
    if(sum >= t) cout << "OK" << endl;
    else cout << t - sum << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>



int main(void)
{
	//変数の宣言
	int n;
	
	//データの読み込み
	scanf("%d",&n);
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	//実際の処理
	
	
//	printf("計算部分終了\n");
	
	//出力
	
	if(n<1200){
		printf("ABC");
	}else if(n<2800){
		printf("ARC");
	}else{
		printf("AGC");
	}
	
//	printf("結果の出力終了\n");
	
	return 0;
}


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

const int M = 8000;

string s;
int X, Y;
vector<int> A[2];
int dp[2][16001];
int tmp[16001];

void solve(){
  
  for(int idx=0;idx<2;idx++){
    
    dp[idx][M] = 1;
        
    for(int i=0;i<(int)A[idx].size();i++){
      
      int d = A[idx][i];
      
      memset( tmp, 0, sizeof(tmp) );
      
      for(int j=0;j<=16000;j++){
	
	if( dp[idx][j] ){
	  
	  if( !( idx == 0 && i == 0 ) && j - d >= 0 ) tmp[j-d] = 1;
	  if( j + d <= 16000 ) tmp[j+d] = 1;
	  
	}
	
      }
      
      for(int j=0;j<=16000;j++) dp[idx][j] = tmp[j];
	  
    }
    
  }
  
  if( dp[0][X] && dp[1][Y] ) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  
}

signed main(){
  
  cin>>s;
  cin>>X>>Y;
  
  X += M;
  Y += M;
  
  int cnt = 0, idx = 0;
  
  s += 'T';
  
  for(int i=0;i<(int)s.size();i++){
    
    if( s[i] == 'F' ) cnt++;
    else{
      A[idx].push_back( cnt );
      cnt = 0;
      idx = !idx;
    }
    
  }
  
  solve();
  
  return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >>n;
  vector<int> vec(n);
  for (int i = 0; i < n; i++) {
    cin >>vec.at(i);
    }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  int alice = 0;
  int bob = 0;
  for (int i = 0; i < n; i++) {
    if(i == 0){
    alice+=vec.at(i);
    continue;
    }
    else if (i % 2 == 1)
      bob+=vec.at(i);
    else alice+=vec.at(i);
  }
  cout << alice - bob <<endl;

}

Measured memory_bytes: 256
package main

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

const (
	maxBufSize = 1024 * 1024
)

var (
	scanner = getScanner(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

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

func min(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}

func max(x, y int64) int64 {
	if x < y {
		return y
	}
	return x
}

func main() {
	defer out.Flush()

	n := getNextInt()
	x := getNextInt()
	t := getNextInt()

	round := n / x
	remainder := n % x
	if remainder != 0 {
		round += 1
	}

	fmt.Print(round * t)
}

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString() string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt() int {
	i, _ := strconv.Atoi(getNextString())
	return i
}

func getNextInt64() int64 {
	i, _ := strconv.ParseInt(getNextString(), 10, 64)
	return i
}

func getNextUint64() uint64 {
	i, _ := strconv.ParseUint(getNextString(), 10, 64)
	return i
}

func getNextFloat64() float64 {
	i, _ := strconv.ParseFloat(getNextString(), 64)
	return i
}


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

int main(void)
{
  long long a, b, x;
  cin >> a >> b >> x;
  
  a=(a+x-1)/x * x;
  b=b/x*x;
  
  cout << (b-a)/x+1 << endl;

  return 0;
}


Measured memory_bytes: 256
import numpy as np
N, M = map(int, raw_input().split())
k = np.empty(M, dtype=int)
s = []
for i in xrange(M):
    inp = map(int, raw_input().split())
    k[i] = inp[0]
    s.append(np.array(inp[1:])-1)

is_odd = np.array(map(int, raw_input().split()), dtype=bool)

ans = 0
for i in xrange(2**N):
    all_lighted = True
    on = np.array([int(k) for k in"{:0{}b}".format(i,N)])
    for j in xrange(M):
        if not np.sum(on[s[j]]) % 2 == is_odd[j]:
            all_lighted=False
            break
    if not all_lighted:
        continue
    ans += 1

print ans

Measured memory_bytes: 10420
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define chmin(x,y) x = min(x,y)
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;

int main() {
    int n, m, l;
    cin >> n >> m >> l;
    vector<vector<int>> dist(n, vector<int> (n, INF));
    rep(i, n) dist[i][i] = 0;
    rep(i, m) {
        int a, b, c;
        cin >> a >> b >> c;
        --a; --b;
        dist[a][b] = dist[b][a] = c;
    }
    rep(k,n)rep(i,n)rep(j,n) chmin(dist[i][j], dist[i][k]+dist[k][j]);
    vector<vector<int>> dist2(n, vector<int>(n,INF));
    rep(i,n)rep(j,n) {
        if (dist[i][j] <= l) dist2[i][j] = 1;
    }
    rep(k,n)rep(i,n)rep(j,n) chmin(dist2[i][j], dist2[i][k]+dist2[k][j]);
    int Q;
    cin >> Q;
    rep(i, Q) {
        int s, t;
        cin >> s >> t;
        --s; --t;
        if (dist2[s][t] == INF) puts("-1");
        else cout << dist2[s][t] - 1 << '\n';
    }
    return 0;
}

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

#define all(x) x.begin(),x.end()
#define LB(V,x) lower_bound(all(V),x)-V.begin()

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using pi = pair<int32, int32>;
using pll = pair<int64, int64>;
using vi = vector<int32>;
using vll = vector<int64>;
using ll = int64;

ll gcd(ll A, ll B){
    if(A<B) swap(A, B);
    if(B==0) return A;
    gcd(B,A%B);
}
ll gcd(vll V){
    ll ans=V[0],VSize=V.size();
    for(int i=1;i<VSize;i++){
        ans = gcd(ans,V[i]);
    }
    return ans;
}

void Main(){
    int N;
    vll A(N);
    cin >> N;
    for(auto &a:A) cin >> a;
    cout << gcd(A) << endl;
}

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

Measured memory_bytes: 768
package main

import (
	"fmt"
)

func main(){
	var n int
	fmt.Scan(&n)
	h := make([]int, n)
	dp := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&h[i])
	}
	dp[0] = 0
	dp[1] = abs(h[0] - h[1])
	for i := 2; i < n; i++ {
		dp[i] = min(
			dp[i-2] + abs(h[i] - h[i-2]),
			dp[i-1] + abs(h[i] - h[i-1]))
	}
	fmt.Println(dp[n-1])
}

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

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

Measured memory_bytes: 5504
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <assert.h>
using Int = long long;
constexpr Int inf = 1e17;
void heap_dijkstra(const Int& V,const Int& e,const Int& s){
    std::vector<std::vector<std::pair<Int,Int>>>edge(V,std:: vector<std::pair<Int,Int>>());
    for(int i = 0; i < e; ++i){
        std::pair<Int,Int> a;
        int c;
        std::cin >> a.first >> a.second >> c;
        edge[a.first].emplace_back(a.second,c);
    }
    std::vector<Int>d(V,inf);
    d[s] = 0;
    std:: priority_queue<std::pair<Int,Int>,std::vector<std::pair<Int,Int>>,std::greater<>>que;
    que.emplace(d[s],s);
    std::vector<Int>validate(V,inf);
    while(not que.empty()){
        const auto now = que.top(); que.pop();
        Int cv = now.second; Int cd = now.first;
        if(d[cv] < cd) {/*assert(false); is RE */   continue; }
        assert(validate[cv] == inf);
        validate[cv] = 0;
        for(const auto& next : edge[cv]){
            // No need to update
            if(cd + next.second >= d[next.first])continue;
            //the vertex which is updated will never update
            //assert(d[next.first] != inf);
            d[next.first] = d[cv] + next.second;
            que.emplace(d[next.first],next.first);
        }
    }
    for(int v=0; v<V;v++)
        if(d[v] == inf)std::cout<<"INF"<<std::endl;
        else std::cout << d[v] << std::endl;
}
int main(){
    long long V,e,s;
    std:: cin >> V >> e >> s;
    heap_dijkstra(V,e,s);
}


Measured memory_bytes: 20196
/*
やったぜ。　投稿者：変態糞土方 (8月16日（水）07時14分22秒)

昨日の8月15日にいつもの浮浪者のおっさん（60歳）と先日メールくれた汚れ好きの土方のにいちゃん
（45歳）とわし（53歳）の3人で県北にある川の土手の下で盛りあったぜ。
今日は明日が休みなんでコンビニで酒とつまみを買ってから滅多に人が来ない所なんで、
そこでしこたま酒を飲んでからやりはじめたんや。
3人でちんぽ舐めあいながら地下足袋だけになり持って来たいちぢく浣腸を3本ずつ入れあった。
しばらくしたら、けつの穴がひくひくして来るし、糞が出口を求めて腹の中でぐるぐるしている。
浮浪者のおっさんにけつの穴をなめさせながら、兄ちゃんのけつの穴を舐めてたら、
先に兄ちゃんがわしの口に糞をドバーっと出して来た。
それと同時におっさんもわしも糞を出したんや。もう顔中、糞まみれや、
3人で出した糞を手で掬いながらお互いの体にぬりあったり、
糞まみれのちんぽを舐めあって小便で浣腸したりした。ああ～～たまらねえぜ。
しばらくやりまくってから又浣腸をしあうともう気が狂う程気持ちええんじゃ。
浮浪者のおっさんのけつの穴にわしのちんぽを突うずるっ込んでやると
けつの穴が糞と小便でずるずるして気持ちが良い。
にいちゃんもおっさんの口にちんぽ突っ込んで腰をつかって居る。
糞まみれのおっさんのちんぽを掻きながら、思い切り射精したんや。
それからは、もうめちゃくちゃにおっさんと兄ちゃんの糞ちんぽを舐めあい、
糞を塗りあい、二回も男汁を出した。もう一度やりたいぜ。
やはり大勢で糞まみれになると最高やで。こんな、変態親父と糞あそびしないか。
ああ～～早く糞まみれになろうぜ。
岡山の県北であえる奴なら最高や。わしは163*90*53,おっさんは165*75*60、や
糞まみれでやりたいやつ、至急、メールくれや。
土方姿のまま浣腸して、糞だらけでやろうや。
*/

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Main m = new Main();
    }
    
    public Main(){
        Scanner s = new Scanner(System.in);
        int N = s.nextInt();
        int K = s.nextInt();
        long num = 0;
        for(int b = K+1; b <= N; b++){
            num += (N / b) * (b - K);
            if(N % b >= K)
                num += N % b - K + 1;
            if(K == 0)
                num--;
        }
        System.out.println(num);
    }
    
}


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

using namespace std;
typedef long long ll;

int main(void) {
    ll X, Y;
    scanf("%lld%lld", &X, &Y);
    if(abs(X-Y) > 1) cout << "Alice" << endl;
    else             cout << "Brown" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
 
#define sl(x) scanf("%ld", &x)
#define ss(x) scanf("%s", x)
#define pl(x) printf("%ld\n", x)
#define ps(x) printf("%s\n", x)
 
#define INF 1000000000000000000
#define MOD 1000000007
 
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))

int compare_long(const void *a, const void *b) {
	return *(long*)b - *(long*)a;
}

int main() {
	long N, M;
	long A[100001];
	long i, j;
	long ans = 0;
	long idx = 0;
	long odd = 0, even = 0;
	
	sl(N);
	for(i=1;i<=N;i++) {
		sl(A[i]);
		if(A[i] % 2) odd++;
		else even++;
	}
	
	if(odd%2) ps("NO");
	else ps("YES");
	
	return 0;
}

Measured memory_bytes: 896
import sys

def chmin(a,i,b):
  if a[i] > b:
    a[i] = b
    #print(a)
    return True
  else:
    return False

n = int(input())
h = list( map(int,input().split()))
dp = [sys.maxsize for i in range(n)]

dp[0] = 0
#print(n,h)
#print(dp)

for i in range(len(dp)):
  if i - 1 >= 0:
    chmin(dp,i, abs(h[i]-h[i-1])+dp[i-1])

  if i - 2 >= 0:
    chmin(dp,i, abs(h[i]-h[i-2])+dp[i-2])
    
#print(dp)   
print(dp[-1])


Measured memory_bytes: 13924
#include <stdio.h>

int main() {
    int N, A, B;
    scanf("%d %d %d", &N, &A, &B);
    
    int ans=0;

    for (int i=1; i<=N; i++) {
        int c=0, t=i;
        for (int j=0; j<5; j++) c+=t%10, t/=10;
        if (A<=c && c<=B) ans+=i;
    }
    printf("%d\n", ans); 
}


Measured memory_bytes: 128
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<vector>
#define rep(index,num) for(int index=0;index<num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
typedef long long ll;
using namespace std;
int main(){
	vector<int> moji;
	char str[100];
	while(scanf("%s", str) != EOF){
		if(str[0]=='+'||str[0]=='-'||str[0]=='*'){
			int kazu2=moji.back();
			moji.pop_back();
			int kazu1=moji.back();
			moji.pop_back();
			int kazukekka;
			if(str[0]=='+'){
				kazukekka=kazu1+kazu2;
			}
			if(str[0]=='-'){
				kazukekka=kazu1-kazu2;
			}
			if(str[0]=='*'){
				kazukekka=kazu1*kazu2;
			}
			moji.push_back(kazukekka);
		}
		else{
			moji.push_back(atoi(str));
		}
	}
	prin(moji[0]);
	return 0;
}



Measured memory_bytes: 3260
#include<bits/stdc++.h>
using namespace std;
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL); \
    cout.tie(NULL)
#define inc(x, y, i) for (int i = x; i <= y; i++)
#define dec(x, y, i) for (int i = x; i >= y; i--)
#define repeat(n) for (int i = 0; i<n;i++)

#define ll long long
#define ld long double
#define ull unsigned long long
#define infl LONG_MAX
#define infi INT_MAX
#define nl cout<<'\n'

#define all(v) v.begin(),v.end()
#define vi vector<int>
#define pb push_back
#define pii pair<int,int>
#define mkpr make_pair
#define pq priority_queue
/*void show(auto v){
    for(auto t : v)cout << t <<" ";cout <<endl;
}

void printAr(int a[],int n)  // print the array
{
    for(int *i = a; i!=a+n; ++i)cout << *i << " ";
    cout << endl;
}*/
const int N = 3000+6;
const int mod = pow(10,9)+7;
int a[N];
vector<int> v[N];
int dp[N];
int main()
{
    fastio;

    ll n;
    cin >> n;
    ll ans = 1LL;
    ll ans2 = 1LL;
    ll ans1 = 1LL;
    ll ans3 = 1LL;
    repeat(n){
        ans = (ans * 10)%mod;
        ans1 = (ans1*9)%mod;
        ans3 = (ans3*9)%mod;
    }
    repeat(n){ans2 = (ans2*8)%mod;}
    ans = (ans-ans1+mod-ans3+mod+ans2)%mod;
    cout << ans <<endl;

}


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

int main(){
	int i,j,k,n,m,l,f,x,y,z; string s;
	cin >> n >> x;
	int mm[105];
	rep(i, n) cin >> mm[i];

	sort(mm, mm+n);

	f = 0;
	rep(i, n){
		f += mm[i];
	}

	cout << n + (x-f)/mm[0] << endl;
}

Measured memory_bytes: 256
def can_load?(k, bags, p)
  cnt = 1
  sum = 0
  bags.each do |b|
    if b > p
      return false
    elsif sum + b > p
      sum = b
      cnt += 1
    else
      sum += b
    end
    return false if cnt > k
  end
  true
end

def search(k, bags)
  left = 0
  right = bags.inject(0) {|sum, b| sum + b}
  while left < right
    mid = (left + right) / 2
    #puts "#{mid} : #{can_load?(k, bags, mid)}"
    if can_load?(k, bags, mid)
      right = mid
    else
      left = mid + 1
    end
  end
  right
end

lines = STDIN.read.split(/\n/)
k = lines[0].split(/\s/)[1].to_i
bags = lines[1..-1].map {|l| l.to_i}
puts search(k, bags)
#p can_load?(k, bags, 16)

Measured memory_bytes: 14280
#include<bits/stdc++.h>
using namespace std;
string s;
int l;
int main(){
    cin>>s;
    l=s.size();
    for(register int i=0;i<l;i++)
    {
        if(s[i]=='C')
        {
            for(register int j=i+1;j<l;j++)
            {
                if(s[j]=='F')
                {
                    cout<<"Yes";
                    return 0;
                }
            }
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
import itertools

n = int(input())

p = tuple(int(i) for i in input().split())
q = tuple(int(i) for i in input().split())

idx = 1
for i in itertools.permutations(range(1, n + 1)):
    if i == p:
        pi = idx
    if i == q:
        qi = idx
    idx += 1

print(abs(pi - qi))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define MOD 1000000007
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;

main()
{
	IO;
	int n;
	cin>>n;
	
	int a[n][3],ans[n][3];
	
	memset(ans,0,sizeof(ans));
	
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<3;j++)
		cin>>a[i][j];
	}
	
	ans[0][0]=a[0][0];
	ans[0][1]=a[0][1];
	ans[0][2]=a[0][2];
	
	for(int i=1;i<n;i++)
	{
		ans[i][0]=max(ans[i-1][1],ans[i-1][2])+a[i][0];
		ans[i][1]=max(ans[i-1][0],ans[i-1][2])+a[i][1];
		ans[i][2]=max(ans[i-1][1],ans[i-1][0])+a[i][2];
	}
	
	int tmp=0;
	
	for(int i=0;i<3;i++)
	{
		tmp=max(tmp,ans[n-1][i]);
	}
	
	cout<<tmp;
}

Measured memory_bytes: 2560
def plus(l1, l2):
    return [x + y for (x, y) in zip(l1, l2)]


# 整数の入力
N, M = list(map(int, input().split(" ")))

cake_list = []
for n in range(N):
    cake_list.append(list(map(int, input().split(" "))))


# 正の値、負の値で8パターン考えれば良い。
plus_minus_list = [[1, 1, 1], [1, 1, -1], [1, -1, 1], [-1, 1, 1],
                   [1, -1, -1], [-1, 1, -1], [-1, -1, 1], [-1, -1, -1]]


pattern_sum_list = []
for pattern in plus_minus_list:
    pattern_sum = 0
    cake_num_list = []
    for cake in cake_list:
        cake_num = cake[0]*pattern[0]+cake[1]*pattern[1]+cake[2]*pattern[2]
        cake_num_list.append(cake_num)

    cake_num_list = sorted(cake_num_list)[::-1]
    pattern_sum_list.append(sum(cake_num_list[:M]))

print(max(pattern_sum_list))

Measured memory_bytes: 3316
#include<iostream>
#include<vector>
#include<queue>
#include <string>
#include <sstream>
using namespace std;

int main()
{
    int x, y, z;
    string s, t;

    cin >> x >> y >> z ;
    
    int count=0;
    for(int i=1;i<x;i++){
        if (i*(y+z) + z <= x)count++;
        if (i*(y+z) + z > x)break;
    }


    cout <<  count;

    return 0;
}






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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<long int> a(3 * N);
  for (int i = 0; i < 3 * N; i++) {
    cin >> a[i];
  }

  sort(a.begin(), a.end(), greater<long int>());

  long int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += a[2 * i + 1];
  }
  cout << ans << endl;
}

Measured memory_bytes: 2560
#include <stdio.h>

int main(void) {
    int n, ans = 0;
    scanf("%d", &n);

    if ( n < 10 ) {
        ans += n;
        goto END_;
    }
    else {
        ans += 9;
    }
    if ( n < 100 ) {
        goto END_;
    }
    if ( n < 1000 ) {
        ans += (n - 100 + 1);
        goto END_;
    }
    else  {
        ans += 900;
    }
    if ( n < 10000 ) {
        goto END_;
    }
    if ( n < 100000 ) {
        ans += (n - 10000 + 1);
    }
    else {
        ans += 90000;
    }

END_:
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int a, b;
	cin >> a >> b;
	int tim[1000 + 1];
	fill(tim, tim + 1001, 0);
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		int s, f;
		cin >> s >> f;
		tim[s]++; tim[f]--;
	}
	int p = 0;
	int l[1001];
	fill(l, l + 1001, 0);
	for(int i = 0; i <= 1000; i++){
		p += tim[i];
		l[i] = p;
	}
	int flg = 0;
	for(int i = a; i < b; i++) if(l[i] > 0) flg = 1;
	cout << flg << endl;
	return 0;
}


Measured memory_bytes: 3144