akhauriyash/Code-Regression huggingface dataset:
from collections import defaultdict


N = int(input())
input_list = list(map(int, input().split()))
a_list = sorted(input_list)

a_sum = sum(a_list)
a_dict = defaultdict(int)
for a in a_list:
    a_dict[a] += 1

Q = int(input())
b_list, c_list = [], []
for _ in range(Q):
    input_list = list(map(int, input().split()))
    b, c = input_list
    
    replace_time = a_dict[b]
    a_dict[c] += a_dict[b]
    a_dict[b] = 0
    
    a_sum += c * replace_time - b * replace_time    
    print(a_sum)   


Measured memory_bytes: 24180
#include <bits/stdc++.h>
#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 REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(rng(x))
#define RSORT(x) sort(rrng(x))
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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; }

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main () {
  int x, y, z;
  int K;
  cin >> x >> y >> z;
  cin >> K;
  vll a(x), b(y), c(z);

  rep(i,x) cin >> a[i];
  rep(i,y) cin >> b[i];
  rep(i,z) cin >> c[i];

  vll ab;
  rep(i,x) {
    rep(j,y) {
      ab.pb(a[i]+b[j]);
    }
  }
  RSORT(ab);

  vll abc;
  rep(i,min(K, sz(ab))) {
    rep(j,z) {
      abc.pb(ab[i]+c[j]);
    }
  }
  RSORT(abc);

  rep(i,K) {
    printf("%lld\n", abc[i]);
  }
  
  return 0;
}


Measured memory_bytes: 43240
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; } /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; } /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b)
{
  return *(char *)a - *(char *)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b)
{
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define rep(i, n) for (int i = 0; i < n; i++)

long long int gcd(int p, int q) {
  long long int big, sml;
  big = max(p, q);
  sml = min(p, q);
  if (big % sml == 0) {
    return sml;
  } else {
    return gcd(big % sml, sml);
  }
}

int main(void)
{
  long long int a, b, c, d;
  scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
  int g = gcd(c, d);
  long long int c_mul, d_mul, cd_mul;
  c_mul = b / c - (a - 1) / c;
  d_mul = b / d - (a - 1) / d;
  cd_mul = b / (c * d / g) - (a - 1) / (c * d / g);
  long long int ans = (b - a + 1) - (c_mul + d_mul - cd_mul);
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h> //ABC 154_c
using namespace std;
int N,A[200005];
int main(){
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>A[i];

	}		
	sort(A,A+N);
	for(int i=1;i<=N;i++) {
		if(A[i]==A[i-1]){
			cout<<"NO";
		return 0;
		}	
	}
	cout<<"YES"; 
	return 0;
}

Measured memory_bytes: 1024
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n = 24;
  vector<pair<double, int>> v(n);
  rep(i, n) cin >> v[i].se >> v[i].fi;
  vector<pair<double, int>>
    a(v.begin(), v.begin() + 8),
    b(v.begin() + 8, v.begin() + 16),
    c(v.begin() + 16, v.begin() + 24);
  sort(all(a)), sort(all(b)), sort(all(c)), sort(all(v));
  set<int> s;
  rep(i, 2) cout << a[i].se << ' ' << prec(2) << a[i].fi << endl, s.insert(a[i].se);
  rep(i, 2) cout << b[i].se << ' ' << prec(2) << b[i].fi << endl, s.insert(b[i].se);
  rep(i, 2) cout << c[i].se << ' ' << prec(2) << c[i].fi << endl, s.insert(c[i].se);
  for (int i = 0, t = 0; t < 2; i++) {
    if (s.count(v[i].se)) continue;
    cout << v[i].se << ' ' << prec(2) << v[i].fi << endl;
    t++;
  }
}

Measured memory_bytes: 3264
def main():
    N, *M = (int(input()) for _ in range(6))

    t = 10 ** 15 + 1
    ind = -1
    for i, x in enumerate(M):
        if x < t:
            t = x
            ind = i

    ans = 5 + (N - 1) // t + 1 - 1
    print(ans)


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())


Measured memory_bytes: 3060
n, m = map(int, input().split())
lp, ls = [0] * m, [0] * m
for i in range(m):
    lp[i], ls[i] = input().split()

lac = [0] * n
lwa = [0] * n

for j in range(m):
    p = int(lp[j]) - 1
    if lac[p] == 0:
        if ls[j] == 'AC':
            lac[p] = 1
        else:
            lwa[p] += 1

print(sum(lac), sum(x * y for x, y in zip(lac, lwa)))

Measured memory_bytes: 17268
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int N;
int A[1005];
bool Special[1005];
vector <pair <int, int> > V[2];
vector <int> Pos;
void Read()
{
    cin >> N;
    for(int i = 1; i <= N; i++)
    {
        int x;
        cin >> x;
        V[i % 2].push_back(make_pair(x, i));
    }
    sort(V[0].begin(), V[0].end());
    sort(V[1].begin(), V[1].end());
}

void findPos()
{
    long long s[] = {0, 0}, point[] = {0, 0};
    for(int ind = 0; ind <= 1; ind++)
    {
        s[ind] = V[ind].back().first, point[ind] = V[ind].size() - 1;
        for(int i = point[ind] - 1; i >= 0; i--)
        {
            if(s[ind] + V[ind][i].first > s[ind])
            {
                s[ind] += V[ind][i].first;
                point[ind] = i;
            }
        }
    }
    if(s[0] > s[1])
    {
        for(int i = V[0].size() - 1; i >= point[0]; i--)
            Pos.push_back(V[0][i].second);
        cout << s[0] << "\n";
    }

    else
    {
        for(int i = V[1].size() - 1; i >= point[1]; i--)
            Pos.push_back(V[1][i].second);
        cout << s[1] << "\n";
    }
}

void Solve()
{
    for(int i = 0; i < Pos.size(); i++)
        Special[Pos[i]] = 1;
    vector <int> Aux, Sol;
    for(int i = 1; i <= N; i++)
        Aux.push_back(i);
    while(Special[Aux[0]] == 0)
    {
        Aux.erase(Aux.begin());
        Sol.push_back(1);
    }
    while(Special[Aux.back()] == 0)
    {
        Sol.push_back(Aux.size());
        Aux.erase(prev(Aux.end()));
    }
    while(Aux.size() > 1)
    {
        auto it = next(Aux.begin());
        for(int i = 1; i < Aux.size() - 1; i++, it = next(it))
        {
            if(Special[Aux[i - 1]] == Special[Aux[i + 1]])
            {
                Sol.push_back(i + 1);
                Special[Aux[i]] = Special[Aux[i - 1]];
                Aux.erase(next(it));
                Aux.erase(prev(it));
                break;
            }
        }
    }

    cout << Sol.size() << "\n";
    for(int i = 0; i < Sol.size(); i++)
        cout << Sol[i] << "\n";
}
int main()
{
    Read();
    findPos();
    Solve();
    return 0;
}


Measured memory_bytes: 256
/// >>In The Name Of God
/// >>ALIREZANA

#include <bits/stdc++.h>
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)(x).size()
#define smin(x,y) (x) = min(x,y)
#define smax(x,y) (x) = max(x,y)
#define all(x) (x).begin(),(x).end()
#define _ ios_base::sync_with_stdio(0)\
                ,cin.tie(0),cout.tie(0);

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

const int M = 60;
vi adj[M];
int p[M], t[M], l[M], ans, a[M];
int dp[M][M][M*2];

int main()
{_
    int n, K, s = 0;   cin >> n >> K;
    for(int i = 1; i <= n; i++)
        cin >> a[i], s += a[i];

    for(int k = 1; k <= K; k++)
        for(int i = 1; i <= n; i++)
            for(int j = i; j <= n; j++)
        {
            if(j == i){
                dp[i][j][k] = max(0, a[i]);
                continue;
            }
            dp[i][j][k] = max({dp[i][j][k-1], (k<2?0:dp[i][j-1][k-2]), dp[i][j-1][k-1]+a[j]});
        }

    for(int k = 1; k <= K; k++)
        for(int i = n; i; i--)
            for(int j = i; j <= n; j++)
        {
            if(j == i){
                //dp[i][j][k] = max(0, a[i]);
                continue;
            }
            dp[i][j][k] = max({dp[i][j][k-1], dp[i][j][k], (k<2?0:dp[i+1][j][k-2]), dp[i+1][j][k-1]+a[i]});
        }
    cout << max(0, dp[1][n][K]);
    return 0;
}


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

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

using namespace std;

int64_t solve(int64_t n, int64_t k) {
  int64_t ret = k;
  for (int i = 1; i < n; i++) {
    ret *= (k - 1);
  }
  return ret;
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  int64_t n;
  std::cin >> n;
  int64_t k;
  std::cin >> k;
  auto const res = solve(n, k);
  std::cout << res << std::endl;
  return 0;
}


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

int main()
{
  string s;
  cin>>s;
  int l=s.length();
  int sum=1;
  int a=l/2;
  for(int i=0;i<l;i++)
  {
    if(s[i]=='o')
      ++sum;
  }
if(a>sum)
    cout<<"NO";
  else
    cout<<"YES";
}
    

Measured memory_bytes: 256
def read():
    N = int(input())
    A = list( map(int, input().split(" ")) )
    B = list( map(int, input().split(" ")) )

    return (N, A, B)

def kill(A, B):
    if B < A:
        A = A - B
        B = 0
    else:
        B = B - A
        A = 0
    
    return (A, B)

def main(N, A, B):

    for i in range(N):
        A[i], B[i] = kill(A[i], B[i])
        if 0 < B[i]:
            A[i+1], B[i] = kill(A[i+1], B[i])
    
    return (A, B)

N, A, B = read()
print(sum(A) - sum(main(N, A, B)[0]))

Measured memory_bytes: 18476
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
f=list(map(int,input().split()))
a=sorted(a)
f=sorted(f,reverse=True)
l=-1
r=2*10**12+1
while l+1<r:
  c=(l+r)//2
  s=0
  for i in range(n):
    m=max(0,math.ceil((a[i]*f[i]-c)/f[i]))
    s=s+m
  if s>k:
  	l=c
  else:
    r=c
print(r)

Measured memory_bytes: 121036
#include <stdio.h>

int main(int argc, char const *argv[]) {
  int N,count,i,j;
  scanf("%d",&N);

  long int a[N];

for(i=0; i<N; i++){
    scanf("%ld",&a[i] );
}
j=0;
count=0;
while (j<N) {

  if (a[j]%2==0) {
    count++;
    a[j]=a[j]/2;
  }

  else j++;
}

printf("%d",count );
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll max_n=1e5+100;
const ll inf=0x3f3f3f3f;
int t,n,a[max_n][5],dp[max_n][5];
int main(){
    //freopen("in.txt","r",stdin);
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin>>n;
    for(int i=0;i<n;i++)
        for(int j=0;j<3;j++)
            cin>>a[i][j];
    for(int i=0;i<3;i++){
        dp[0][i]=a[0][i];
    }
    for(int i=1;i<n;i++){
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i][0];
        dp[i][1]=max(dp[i-1][0],dp[i-1][2])+a[i][1];
        dp[i][2]=max(dp[i-1][1],dp[i-1][0])+a[i][2];
    }cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<endl;
    return 0;
}


Measured memory_bytes: 7568
#include <bits/stdc++.h>
using namespace std;
int n,a[100000],num;
long long ans=1;
int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a,a+n);
  for(int i=n-1;i;i--){
    if(a[i]==a[i-1]){
      ans*=a[i];
      i--;
      num++;
    }
    if(num==2){
      cout<<ans;
      return 0;
    }
  }
  cout<<0;
  return 0;
}

Measured memory_bytes: 640
//pragma
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define YOU using
#define DONT namespace
#define SAY std

YOU DONT SAY;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define REPP(i,a,b,d) for(int i=a;i<=b;i+=d)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,d) for(int i=a;i>=b;i-=d)
#define REV(i,a,b) REVV(i,a,b,1)

#define FOR(i,a) for(int i=0; i<a; i++)
#define FORD(i,a) for(int i=(int)a-1; i>=0; i--)

#define mp make_pair

#define pb push_back
#define F first
#define S second

const int OO = 1e9;
const ll INF = 1e18;

const int irand(int lo,int hi){
    return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

const ll lrand(ll lo,ll hi){
    return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

#define getc getchar
template<typename T>
T getnum(){
    int sign = 1;
    T ret = 0;
    char c;

    do{
        c = getc();
    }while(c == ' ' || c == '\n');
    if(c == '-')sign = -1;
    else ret = c-'0';
    while(1){
        c = getc();
        if(c < '0' || c > '9')break;
        ret = 10*ret + c-'0';
    }
    return sign * ret;
}

inline void ini(int& x){
    x = getnum<int>();
}

inline void scani(int& x){
    scanf("%d",&x);
}

//end of macro

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #define endl '\n'
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(10);
    
    int n;
    cin>>n;
    int odd=0, even=0;
    REP(i,1,n){
        int x;
        cin>>x;
        if(x&1)odd++;
        else even++;
    }

    while(odd+even > 1){
        bool fail = true;
        if(odd > 1){
            even++;
            odd -= 2;
            fail = false;
        }
        if(even > 1){
            even--;
            fail = false;
        }
        if(fail)break;
    }

    if(odd+even == 1)cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int C[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };

	int K;
	cin >> K;

	cout << C[K-1] << endl;


	
}




Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<queue>
#include<list>
#include<stack>
#include<algorithm>
#include<cmath>
#include<memory>
#include<array>

using namespace std;

int main()
{
  array<int,5> a;

  for ( auto i = 0; i < 5; ++i )
    cin >> a[i];

  sort( a.begin(), a.end(), []( int x, int y ){ return x > y; } );
  
  for ( auto i = 0; i < 5; ++i )
    {
      if ( i ) cout << " ";
      cout << a[i];
    }

  cout << endl;
  
  return 0;
}

Measured memory_bytes: 1176
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,i;
    string str,ans;
    cin>>str;
    for(i=0;str[i];i++)
    {
        if(str[i]=='B' && ans.empty()==0)
            ans.pop_back();
        else if(str[i]=='B')
            continue;
        else
            ans.push_back(str[i]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<complex>
#include<set>
#include<map>
#include<queue>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

int w,h;
int ans;

typedef pair<int,int> pii;

int enx,eny;
const int W = 22;
int masu[W][W];

void getans(int x, int y,int count){
	int dx[]={1,0,-1,0};
	int dy[]={0,1,0,-1};
	
	if(count>10)return;
	/*
	printf("%d %d %d\n",x,y,count);
	rep(i,h){rep(j,w)printf("%d ",masu[i][j]);puts("");}
	*/
	rep(p,4){
		rep(i,11111){
			int nx = x+dx[p]*i;
			int ny = y+dy[p]*i;
			
			if(nx>=w || ny>=h || nx<0 || ny<0)break;
			if(nx==enx && ny==eny){
				ans = min(ans, count);
				break;
			}
			
			if(masu[ny][nx]==1){
				masu[ny][nx]=0;
				if(i!=1)getans(nx-dx[p], ny-dy[p], count+1);
				masu[ny][nx]=1;
				break;
			}
		}
	}
}

int main(){
	A:;
	int stx,sty;
	cin>>w>>h;
	if(w==0 || h==0)return 0;
	
	rep(i,h)rep(j,w){
		cin>>masu[i][j];
		if(masu[i][j]==3){
			enx = j;
			eny = i;
		}
		if(masu[i][j]==2){
			stx = j;
			sty = i;
		}
		if(masu[i][j]!=1)masu[i][j]=0;
	}
	
	ans = 111;
	getans(stx,sty,1);
	
	if(ans==111)puts("-1");
	else printf("%d\n",ans);
	
	goto A;
}

Measured memory_bytes: 1148
#include<iostream>
#include<string.h>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> pii;

int main()
{
  int a,b,c;
  int i,j;

  cin>>a>>b>>c;
  int max=(a+b)*c;
  int x=a+b;
  for(i=c;i<=max;i=i+60){
    // cout<<i<<endl;
    if(i%x<=a){
      cout<<i<<endl;
      return 0;
    }
  } 

  cout<<"-1"<<endl;
}

Measured memory_bytes: 3092
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
map<string, int> mp = {{"Vacant", 0}, {"Male", 1}, {"Female", 2}};
bool check(int l, int r, int mid, vector<int> &vec){
    if(l % 2 == mid % 2){
        if(vec[l] == vec[mid]){
            return true;
        } else {
            return false;
        }
    } else {
        if(vec[l] == vec[mid]){
            return false;
        } else {
            return true;
        }
    }
}
int main(void){
    int n;
    cin >> n;
    vector<int> vec(n, -1);

    int l = 0;
    int r = n - 1;
    while(abs(l - r) > 1){
        if(vec[l] == -1){
            string in;
            cout << l << endl;
            cin >> in;
            if(mp[in] == 0){
                return 0;
            }
            vec[l] = mp[in];
        }
        if(vec[r] == -1){
            string in;
            cout << r << endl;
            cin >> in;
            if(mp[in] == 0){
                return 0;
            }
            vec[r] = mp[in];
        }
        int mid = (l + r) / 2;
        if(vec[mid] == -1){
            string in;
            cout << mid << endl;
            cin >> in;
            if(mp[in] == 0){
                return 0;
            }
            vec[mid] = mp[in];
        }
        if(check(l, r, mid, vec)){
            l = mid;
        } else {
            r = mid;
        }
    }
}

Measured memory_bytes: 1236
#include <stdio.h>
int main(int argc ,const char *argv[])
{
    int x,y,z,s;
    scanf("%d",&x);
    scanf("%d",&y);
    scanf("%d",&z);
    if(x>y){
        s=x;x=y;y=s;
    }
    if(y>z){
        s=y;y=z;z=s;
        if(x>y){
            s=x;x=y;y=s;
        }
        
    }
    printf("%d %d %d\n",x,y,z);
    return 0;
}



Measured memory_bytes: 2104
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;

int main(){
    int N, K;
    cin >> N >> K;
    double ans = 0;
    for(int i=1; i<=N; i++){
        if(i>=K) ans += 1.0/N;
        else{
            int k = ceil(log2((double)K/i));
            // cout << i << " " << k << endl;
            ans += 1.0/N/(1<<k);
        }
    }
    cout << setprecision(20) << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <unordered_map>

using namespace std;


int main() {
    
    long n;
    deque <long> a;
    cin >> n;
    for (long i=0;i<n;i++){
        long p;
        cin >> p;
        a.push_back(p);
    }

    sort(a.begin(),a.end());
    deque <long> a2(a);
    deque <long> b;
    b.push_back(*(a.end()-1));
    a.pop_back();
    while(!a.empty()){
        if(a.size() == 1) {
            if(abs(*(b.end()-1) - *a.begin()) > abs(*b.begin() - *a.begin())) {
                b.push_back(*a.begin());
                a.pop_front();
            }else{
                b.push_front(*a.begin());
                a.pop_front();
            }
        }else{
            b.push_back(*a.begin());
            a.pop_front();
            b.push_front(*a.begin());
            a.pop_front();
        }
        if(a.empty()){
            break;
        }else if(a.size()==1){
            if(abs(*(b.end()-1) - *(a.end()-1)) > abs(*b.begin() - *(a.end()-1))){
                b.push_back(*(a.end()-1));
                a.pop_back();
            }else{
                b.push_front(*(a.end()-1));
                a.pop_back();
            }
        }else{
            b.push_back(*(a.end()-1));
            a.pop_back();
            b.push_front(*(a.end()-1));
            a.pop_back();
        }
    }
    deque <long>::iterator p;
    long long ans1=0;
    for (p=b.begin();p!=b.end()-1;p++){
        ans1 += abs(*(p+1) - *p);
//        cout << ans1 << endl;
    }


    reverse(a2.begin(),a2.end());
    b.clear();
    b.push_back(*(a2.end()-1));
    a2.pop_back();
    while(!a2.empty()){
        if(a2.size() == 1) {
            if(abs(*(b.end()-1) - *a2.begin()) > abs(*b.begin() - *a2.begin())) {
                b.push_back(*a2.begin());
                a2.pop_front();
            }else{
                b.push_front(*a2.begin());
                a2.pop_front();
            }
        }else{
            b.push_back(*a2.begin());
            a2.pop_front();
            b.push_front(*a2.begin());
            a2.pop_front();
        }
        if(a2.empty()){
            break;
        }else if(a2.size()==1){
            if(abs(*(b.end()-1) - *(a2.end()-1)) > abs(*b.begin() - *(a2.end()-1))){
                b.push_back(*(a2.end()-1));
                a2.pop_back();
            }else{
                b.push_front(*(a2.end()-1));
                a2.pop_back();
            }
        }else{
            b.push_back(*(a2.end()-1));
            a2.pop_back();
            b.push_front(*(a2.end()-1));
            a2.pop_back();
        }
    }
//    for (p=b.begin();p!=b.end();p++){
//        cout << *p << endl;
//    }
    long long ans2=0;
    for (p=b.begin();p!=b.end()-1;p++){
        ans2 += abs(*(p+1) - *p);
//        cout << ans2 << endl;
    }
    cout << max(ans1,ans2);

}

Measured memory_bytes: 2048
#include<stdio.h>

int count=0;
void margesort(int *,int,int);
void marge(int *,int,int,int);

int S[5000000],L[2500001],R[2500001];

int main(){
  int n,i;
  scanf("%d",&n);
   for(i=0;i<n;i++) scanf("%d",&S[i]);

   margesort(S,0,n);

   for(i=0;i<n-1;i++) printf("%d ",S[i]);
   printf("%d\n",S[i]);
   
   printf("%d\n",count); 
   
   return 0;
}

void margesort(int *S,int left,int right){
  int mid;
  if(left+1 < right){ 
    mid = (left + right)/2;
    margesort(S,left,mid);
    margesort(S,mid,right);
    marge(S,left,mid,right);
  }
}

void marge(int *S,int left,int mid,int right){
  int n1,n2;
  int i,j=0,k;

  n1 = mid - left;
  n2 = right - mid;

  for(i=0;i<n1;i++) L[i] = S[left+i];
  L[n1]=1000000001;
  for(i=0;i<n2;i++) R[i] = S[mid+i];
  R[n2]=1000000001;

  i=0;
  for(k=left;k<right;k++){
  if(L[i] <= R[j]){  
    S[k] = L[i];
    i++;
  }
  else{
    S[k] = R[j];
    j++;
  }
  count++;
  }
}

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

int main() {
	int A, B, ans;
	cin >> A >> B;
	if (A >= 13)
		ans = B;
	else if (A >= 6)
		ans = B / 2;
	else ans = 0;
	cout << ans << endl;
}

Measured memory_bytes: 256
let ck cx cy (x1,y1,h1) = abs(cx-x1)+abs(cy-y1)+h1 in
Scanf.scanf "%d\n" (fun n->
  let rec loop i =
    if i=n then [] else
    let m = Scanf.scanf "%d %d %d\n" (fun x1 y1 h1->(x1,y1,h1)) in
    m::loop (i+1)
  in
  let ls = loop 0 in
  let (ls1,ls2) = List.partition(fun(x1, y1, h1)->h1>0) ls in
  let (nx,ny,mx,my) = List.fold_left(fun (nx,ny,mx,my) (x1,y1,h1) ->
       (min (x1-h1) nx,min (y1-h1) ny,max(x1+h1) mx, max(y1+h1) my)
  ) (0,0,100,100) ls1 in
  for x=max 0 nx to min 100 mx do
   for y=max 0 ny to min 100 my do
     match ls1 with
     | [] -> assert false
     | [(x1,y1,h1)] -> Printf.printf "%d %d %d\n" x1 y1 h1; exit 0
     | l::ls ->
     if (List.exists (fun (x1,y1,h1)->x=x1&&y=y1) ls2) then () else
     let h = ck x y l in
     if (List.for_all (fun (x1,y1,h1) -> ck x y (x1,y1,h1) = h) ls) then (
             Printf.printf "%d %d %d\n" x y h;
             exit 0
     )
   done
  done
)


Measured memory_bytes: 1920
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;


class Program {
    internal static void Main(string[] args)
    {
        var N = long.Parse(ReadLine());
        var A = ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();

        var lst = new List<long>();
        for (int i = 0; i < N; i++) {
            lst.Add(i + 1);
        }

        for (int i = 0; i < N; i++) {
            lst[i] = A[i] - lst[i];
        }

        long b = 0;
        lst = lst.OrderBy(i => i).ToList();
        if (lst.Count % 2 == 0) {
            b = (lst[lst.Count / 2] + lst[lst.Count / 2 - 1]) / 2;
        } else {
            b = lst[lst.Count / 2];
        }

        long ans = 0;
        for (int i = 0; i < N; i++) {
            ans += Math.Abs(A[i] - (b + i + 1));
        }

        WriteLine(ans);
    } 
}

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

int main() {
  int l;
  cin >> l;
  printf("%.10f\n", (double)l*l*l/27);
  return 0;
}


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

int n, q;
long a[300000], b[300000];
int x[300000], y[300000];
set<int> d;

int main()
{
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a[i];
		b[i] = a[i];
	}

	sort(b, b + n);

	for (int j = 0; j < n; j++)
		if (a[j] != b[j])
			d.insert(j);

	cin >> q;

	for (int i = 0; i < q; i++) {
		int xa, ya;
		cin >> xa >> ya;
		x[i] = xa - 1;
		y[i] = ya - 1;
	}

	if (d.size() == 0)
		cout << 0 << endl;
	else {
		bool g = 1;
		for (int i = 0; i < q; i++) {
			if (a[x[i]] == b[y[i]]) {
				if(find(d.begin(), d.end(), y[i]) != d.end())
					d.erase(find(d.begin(), d.end(), y[i]));
			}
			else if (a[x[i]] == b[x[i]])
				d.insert(x[i]);

			if (a[y[i]] == b[x[i]]) {
				if(find(d.begin(), d.end(), x[i]) != d.end())
					d.erase(find(d.begin(), d.end(), x[i]));
			}
			else if (a[y[i]] == b[y[i]])
				d.insert(y[i]);

			if (d.size() == 0) {
				cout << i + 1 << endl;
				g = 0;
				break;
			}
			swap(a[x[i]], a[y[i]]);
		}
		if (g)
			cout << -1 << endl;
	}

	return 0;
}


Measured memory_bytes: 24272
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pf push_front
#define mod 1000000007
#define endl '\n'
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


int main()
{
    string s;
    cin>>s;
    ll i,n=s.length();
    for(i=0;i<n;i++)
    {

        s[i]='x';
    }
    cout<<s<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;


int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    long long A[3];
    rep(i,3) cin >> A[i];

    long long ans=0;
    sort(A,A+3);
    if(A[0]%2==1 && A[1]%2==1 && A[2]%2==1){
        ans=A[0]*A[1];
    }
    cout << ans << endl;


}


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

int main(){
  int a, b;
  cin >> a >> b;
  
  int ans = 0;
  ans += max(a, b);
  if(a < b) b--;
  else a--;
  ans += max(a, b);
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
		
	public static void main(String[] args) {		
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		sc.close();
		
		int dif = A - B;
		
		int res = 0;
		
		if(C > dif) {
			res = C - dif;
		}
		else {
			res = 0;
		}
		
		System.out.println(res);
		
	}
	
}

Measured memory_bytes: 21972
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define INF 1000000000000
#define MOD 1000000007
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3)                                                 \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << endl
#define debug_4(x1, x2, x3, x4)                                             \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5)                                         \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

using namespace std;
using ll = long long;

int main() {
    string s;
    cin >> s;
    int n = s.size() - 1;
    ll ans = 0;
    rep(i, 1 << n) {
        string s_plus;
        rep(j, n + 1) {
            s_plus += s[j];
            if (i >> j & 1) {
                ans += stoll(s_plus);
                s_plus = "";
            }
        }
        ans += stoll(s_plus);
    }

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

Measured memory_bytes: 3140
/**   Created by: Marcos Portales
          Codeforces User: marcosportales
          Country: Cuba
          ABC092-C
                         **/
#include<bits/stdc++.h>
using namespace std;
/// Macros:
#define int long long
#define f first
#define s second
#define db(x) cerr << #x << ": " << (x) << '\n';
#define pb push_back
#define lb lower_bound
#define up upper_bound
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define enl '\n'
#define vi vector<int>
#define sz size
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,x,n) for(int i=x;i<(n);i++)
typedef pair<int,int> ii;
#define vii vector<ii>
typedef long double ld;
typedef unsigned long long ull;
/// Constraints:
const int maxn = 2*1e5+1;
const int mod = 1000000009;
const ld eps = 1e-9;
const int inf = ((1ll<<31ll)-1ll);
const int INF = 10000000000000000ll;
const ld pi = acos(-1);
/// Prime Numbers:
// 2, 173, 179, 181, 197, 311, 331, 737, 1009, 2011, 2027, 3079, 4001, 10037, 10079, 20011, 20089;
// 100003, 100019, 100043, 200003, 200017, 1000003, 1000033, 1000037, 1000081;
// 2000003, 2000029, 2000039, 1000000007, 1000000021, 2000000099;
/// Functions:
#define lg2(x) 31 - __builtin_clz(x)
#define lgx(x,b) ( log(x) / log(b) )
/// Red-Black Tree Template ---------------------------------
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree < long long ,  null_type ,  less<long long> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
/// Quick Pow------------------------------------------------
int qpow(int b,int e){
    if( !e ) return 1;
    if( e & 1 ) return qpow(b,e-1) * b;
    int pwur = qpow(b,e>>1);
    return pwur * pwur;
}
int modinv(int x){
    return qpow(x,mod-2);
}
/// Criba de Eratostenes ------------------------------------
const int pr=10000;
map<int,int>isp;
void criba(){
    for(int i=0;i<=pr;i++)isp[i]=i;
    isp[0]=isp[1]=-1;
    for(int i=2;i*i<=pr;i++){
        if(isp[i]==i){
        for(int j=2*i;j<=pr;j+=i)
            isp[j]=i;
        }
    }
}
/// My Code ------------------------------------------------

int a[100005];

int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout.setf(ios::fixed); cout.precision(0);
    srand(time(NULL));

    ///freopen("a.in","r",stdin);
    ///freopen("a.out","w",stdout);
    ///criba();
    int n;
    cin>>n;
    int s=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        s+=abs(a[i]-a[i-1]);
    }
    s+=abs(a[n]);
    for(int i=1;i<=n;i++){
        cout<<s-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i+1]-a[i-1])<<enl;
    }
    return 0;
}


Measured memory_bytes: 4404
#include<iostream>
#include<string>
#define rep(i, n) for(int i = 0; i < n; i++)
#define INF 1<<30

using namespace std;
typedef long long ll;

const int MAX_N = 100000;
const int MAX_M = 100000;
ll N, M;
string S, T;

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

int main(){
	cin >> N >> M;
	char c;
	rep(i, N){
		cin >> c;
		S += c;
	}
	rep(i, M){
		cin >> c;
		T += c;
	}

	ll g = gcd(N, M);  //最大公約数
	ll l = N * M / g;  //最小公倍数
	ll n = l / N;
	ll m = l / M;
	ll s = n * m / gcd(n, m);

	bool x = true;
	int j = 0;
	for(ll i = 0; i < l; i += s){
		if(S[j * (s / n)] != T[j * (s / m)]){ x = false;}
		j++;
	}
	if(x){
		cout << l << endl;
	}else{
		cout << -1 << endl;
	}


	return 0;
}



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

int main()
{
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i += 2) {
        int cnt = 0;
        for (int j = 1; j <= i; j++) {
            if (i % j == 0) cnt++;
        }
        if (cnt == 8) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3568
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let s = read::<String>().chars().collect::<Vec<_>>();
    let mut a_pos = 0;
    for i in 0..s.len() {
        if s[i] == 'A' {
            a_pos = i;
            break;
        }
    }
    let mut z_pos = 0;
    for i in (0..s.len()).rev() {
        if s[i] == 'Z' {
            z_pos = i;
            break;
        }
    }
    println!("{}", z_pos - a_pos + 1);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include <string>
#include <iostream>
#include <set>
#include <algorithm>
 
using namespace std;
 
// 文字列一つ受け取る場合
// string s;
// 整数(max 2^31-1 or 10^9)一つ受け取る場合
// int x;
// int k;
// int n;
set<int> a;
int n;
int m;
int total;

int main(){
    cin >> n;
    cin >> m;
    total = 0;

    for(int i = 0; i < n; i++){
        int j;
        cin >> j;
        a.insert(j);
        total = total + j;
    }

    int thresholdEx;
    thresholdEx = total/(4*m);
    if(total%(4*m)!=0){
        thresholdEx++;
    }

    int count;
    count = count_if(a.begin(), a.end(), [thresholdEx](int v){return v>=thresholdEx;});
 
    if(count>=m){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    
}

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef vector< long long > vi;
typedef pair<long long, long long> ii;
typedef priority_queue <ll> pq;
#define o_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define graph vector<vi>

const ll mod = 1000000007;
const ll INF = (ll)1e18;
const ll MAXN = 1000006;

ll po(ll x, ll n ){ 
    ll ans=1;
     while(n>0){
         if(n&1) ans=(ans*x)%mod;
         x=(x*x)%mod;
         n/=2;
     }
     return ans;
}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r" , stdin);
    // freopen("output.txt", "w" , stdout);
    // #endif
    int T=1;
    //cin >> T;
    while(T--){
        int l,r,d;
        cin>>l>>r>>d;
        cout<<(r/d - (l-1)/d)<<el;
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 3788
const main = stdin => {
  const input = stdin.trim().split('\n')
  const [A, B, C] = input[0].split(' ').map(x => parseInt(x))

  console.log(A + B >= C ? 'Yes' : 'No')
}


// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))


Measured memory_bytes: 30468
N, K = map(int, input().split())
A = [int(i) for i in input().split()]
    
def ev(n):
    return (n+1)/2
    
from collections import deque
    
if K == N:
    print(sum(ev(a) for a in A))
else:
    deq = deque()
    
    while len(deq) < K:
        deq.append(ev(A.pop()))
    
    total = sum(i for i in deq)
    mx = total
    
    while A:
        out = deq.popleft()
        in_ = ev(A.pop())
        deq.append(in_)
        
        total -= out
        total += in_
        mx = max(mx, total)
    
    print(mx)

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

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

typedef long long ll;
const ll MOD = 1e9 + 7;
const int MAX_N = 1e5;

int main() {
  int N;
  static std::string s[MAX_N];
  std::cin >> N;

  ll ans = 0;
  std::unordered_map<std::string, int> hist;
  rep(i, N) {
    std::cin >> s[i];
    std::sort(s[i].begin(), s[i].end());
    ans += hist[s[i]];
    ++hist[s[i]];
  }
  std::cout << ans << '\n';
}


Measured memory_bytes: 17572
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;


bool is_prime(ll n) {
    if (n==1) return false; 
    repr(i,2,int(sqrt(n)+1)) {
        if (n%i==0) return false;
    }
    return true;
}

int main() {
    ios_base::sync_with_stdio(false); 

    int n;
    cin >> n;
    ll s=2;
    vector<int> ans;
    int cnt=n;
    while (cnt>0) {
        if (is_prime(s) && s%5==1) {
            ans.push_back(s);
            --cnt;
        }
        ++s;
    }
    rep(i,n) cout << ans[i] << ' ';
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
import Foundation

func readInt() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let line = readInt()
    let N = line[0]
    let M = line[1]
    let X = line[2]

    let books = (1...N).map { _ in readInt() }
    var ans = Int.max
    for bit in 0..<(1<<N) {
        var comb = [Int](repeating: 0, count:M+1)
        for i in 0..<N {
            if bit & (1 << i) > 0 {
                let book = books[i]
                for j in 0...M {
                    comb[j] += book[j]
                }
            }
        }
        if comb[1...].allSatisfy({ $0 >= X }) {
            ans = min(ans, comb[0])
        }
    }

    if ans == Int.max {
        print(-1)
    } else {
        print(ans)
    }
}


main()

Measured memory_bytes: 13636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

const int mod = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if(!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if(t & 1) a *= *this;
    return a;
  }
  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
mint fact(int n) {
  if(n == 1 || n == 0) return 1;
  mint res = n;
  return res * fact(n - 1);
}

int main() {
  ll n;
  cin >> n;
  vl x(n);
  rep(i, n) cin >> x[i];
  x[0] = 1;
  mint ans = 1;
  ll cnt = 0;
  rep2(i, 1, n) {
    x[i] = min(x[i], x[i - 1] + 2);
    if(x[i] - x[i - 1] > 1) continue;
    ans *= i + 1 - cnt;
    cnt++;
    x[i] = x[i - 1];
  }
  rep2(i, 2, n - cnt + 1) ans *= i;
  cout << ans << endl;
}

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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N;
  IN(N);
  map<string, ll> mp;
  REP(i,N){
    string S;
    IN(S);
    mp[S]++;
  }

  printf("AC x %lld\n", mp["AC"]);
  printf("WA x %lld\n", mp["WA"]);
  printf("TLE x %lld\n", mp["TLE"]);
  printf("RE x %lld\n", mp["RE"]);



  return 0;
}

Measured memory_bytes: 3760
#include<iostream>
#include<vector>
#define MAX 10000000
using namespace std;
int main(){
	int n;
	vector<char> a;
	vector<int> box;
	for(int i=0;i<=MAX;i++)
		a.push_back('1');
	a[0]='0';
	a[1]='0';
	for(int i=2;i<=MAX;i++)
	if(a[i]=='1'){
		if(i>=13&&(a[i]=='1'&&a[i-2]=='1'&&a[i-6]=='1'&&a[i-8]=='1')){
		box.push_back(i);
		}
		for(int j=i*2;j<=MAX;j+=i)
		a[j]='0';
	}
	while(cin>>n,n){
		int i;
		for(i=0;i<(int)box.size()&&box[i]<=n;i++);
		cout<<box[i-1]<<endl;
	}
	return 0;
}

Measured memory_bytes: 10000
#include <bits/stdc++.h>
using namespace std;
int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
main () {
	int k;
	cin>>k;
	--k;
	cout<<a[k]<<endl;	
}

Measured memory_bytes: 256