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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int N = 100100;
int n;
ll m, v, p;
ll a[N];
ll pref[N];
 
int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
 
	scanf("%d%lld%lld%lld", &n, &m, &v, &p);
	int ans = 0;
	for (int i = 0; i < n; i++)
		scanf("%lld", &a[i]);
	sort(a, a + n);
	reverse(a, a + n); // 将初始分数排序
	for (int i = 0; i < n; i++)
		pref[i + 1] = pref[i] + a[i]; // 前缀和计算区间分数和
	ans = p;
	for (int i = p; i < n; i++) {
		if (a[i] + m < a[p - 1]) break;
		ll cur = v - (n - (i - p + 1)); // 每个评委必须投的票数
		if (cur <= 0) { // 无票可投，第i票有机会被投
			ans++;
			continue;
		}
		if (cur * m <= (i - p + 1) * (a[i] + m) - (pref[i] - pref[p - 1]))
			// cur*m=必须投出的票数
			// (i-p+1)*(a[i]+m)=这(i-p+1)道题目最终的最高分数和
			// pref[i]-pref[p-1]=在[p-1,i)区间内的初始分数和
			// 二者相减=[p-1,i)这些题目所能投的最多票数（？？？？？？？？）
			ans++;
	}
	printf("%d\n", ans);
 
	return 0;
}












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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define vi vector<int>
typedef long long ll;

using namespace std;


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(0); 

	int n , a , b;
	cin >> n >> a >> b;
	if(n == 2)dier("Borys");

	if(abs(a - b) % 2 == 0){
		dier("Alice");
	}else{
		dier("Borys");
	}

	return 0;
}

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

int main(){
  int a, b;
  cin >> a >> b;
  if((a + b) % 2 == 0){
    cout << (a + b) / 2 << endl;
  } else{
    cout << (a + b + 1) / 2 << endl;
  }
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	int x = ri() - 1;
	int y = ri() - 1;
	int r0 = x;
	int r1 = n - 1 - y;
	
	int64_t sum[n + 2];
	memset(sum, 0, sizeof(sum));
	// line - line
	for (int i = 1; i <= r0; i++) {
		sum[i + 1 + 1]++;
		sum[i + 1 + r1 + 1]--;
	}
	for (int i = 0; i < r0; i++) {
		sum[1]++;
		sum[r0 - i]--;
	}
	for (int i = 0; i < r1; i++) {
		sum[1]++;
		sum[r1 - i]--;
	}
	// line - circle
	for (int i = 1; i <= r0; i++) {
		sum[i]++;
		sum[i + 1]++;
		sum[i + (y - x + 2) / 2]--;
		sum[i + (y - x + 3) / 2]--;
	}
	for (int i = 1; i <= r1; i++) {
		sum[i]++;
		sum[i + 1]++;
		sum[i + (y - x + 2) / 2]--;
		sum[i + (y - x + 3) / 2]--;
	}
	// circle - circle
	sum[1] += (y - x + 1);
	sum[(y - x + 2) / 2] -= (y - x + 1) / 2;
	sum[(y - x + 3) / 2] -= (y - x + 2) / 2;
	for (int i = 0; i + 1 < n; i++) sum[i + 1] += sum[i];
	for (int i = 1; i < n; i++) std::cout << sum[i] << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int abs(int a) {
  return a > 0 ? a : -a;
}

int main(void) {
  int i, j, a, b, c, d, n, ans = 10000;
  scanf("%d%d%d%d%d", &n, &a, &b, &c, &d);
  a--, b--, c--, d--;
  for(i = 1; i <= n; ++i) {
    int xa, ya, xb, yb, xc, yc, xd, yd;
    xa = a / i;
    ya = a % i;
    xb = b / i;
    yb = b % i;
    xc = c / i;
    yc = c % i;
    xd = d / i;
    yd = d % i;
    int now = abs(xa - xb) + abs(xc - xd) + abs(ya - yb) + abs(yc - yd);
    if(now < ans) ans = now;
  }
  printf("%d\n", ans);
  return 0;
}


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

#ifdef DEBUG
    #include "debug.h"
    #define DEB
    #define dump(...)                                                              \
        DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
                << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
                << endl                                                            \
                << "    ",                                                         \
            dump_func(__VA_ARGS__)
#else
    #define DEB if (false)
    #define dump(...)
#endif


// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

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

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//////////////////

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

#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

/*
#define mod 1000000007 /*/
#define mod 998244353 //*/

typedef pair<int, int> P;
#define INF (1LL<<60)



void solve(){
    int N;
    cin >> N;
    N--;
    vector<char> ans;
    while(N>=0){
        ans.push_back( N % 26 +'a');
        N/=26;
        N--;
    }
    reverse(ALL(ans));
    for(auto c : ans) cout << c;
    cout << endl;

}



signed main(){
    cout << fixed << setprecision(18);
    cerr << fixed << setprecision(18);
    solve();
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> vec(m, 0);
  for(int i=0; i<n; i++){
    int k; cin >> k;
    for(int j=0; j<k; j++){
      int l; cin >> l;
      vec[l-1]++;
    }
  }
  int ans=0;
  for(int i=0; i<m; i++){
    if(vec[i] == n){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
double EPS=1e-8;
int cnt[100001];
int main(){
	int n,m,p[100000],a[100000],b[100000],c[100000];
	cin>>n>>m;
	REP(i,m){
		cin>>p[i];p[i]--;
		if(i==0)continue;
		if(p[i-1]<p[i]){
			cnt[p[i-1]]++;cnt[p[i]]--;
		}else{
			cnt[p[i]]++;cnt[p[i-1]]--;
		}
	}
	REP(i,100000)cnt[i+1]+=cnt[i];
	ll ans=0;
	REP(i,n-1){
		cin>>a[i]>>b[i]>>c[i];
		ll vl=(ll)a[i]*(ll)cnt[i];
		ll vr=(ll)b[i]*(ll)cnt[i]+(ll)c[i];
		ans+=vl>vr?vr:vl;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3108
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong(), R = sc.nextLong();
		if(R - L > 2019) System.out.println(0);
		else {
			long ans = Long.MAX_VALUE;
			for(long i = L; i <= R; i++) {
				for(long j = i + 1; j <= R; j++) {
					ans = Math.min(ans, (i * j) % (long)2019);
				}
			}
			System.out.println(ans);
		}
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define sz(x) int(x.size())
using ll = long long;
const ll LLINF = numeric_limits<long long>::max();
const int mod = 1000000007;
const int INF = 1001001001;

int main()
{
    int x,y,z,t;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

// フェルマーの小定理
ll mod_pow(ll n, ll p, ll mod=MOD) {
    if(p==0) return 1;
    ll res = mod_pow(n*n%mod, p/2, mod);
    if(p%2==1) res = res * n % mod;
    return res;
}
ll nCr(ll n, ll r, ll mod=MOD) {
    r = min(r, n-r);
    ll numer = 1, denom = 1;
    rep(i,r) {
        numer *= n-i;
        numer %= mod;
        denom *= i+1;
        denom %= mod;
    }
    return numer * mod_pow(denom, mod-2, mod) % mod;
}

int main() {
	ll n, a, b;
	cin >> n >> a >> b;
    ll ans = mod_pow(2, n) - 1 -nCr(n,a) - nCr(n,b) + MOD * 2;
    ans %= MOD;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
digit, num_of_querys = map(int, input().split())

querys = []
for _ in range(num_of_querys):
    querys.append(list(map(int, input().split())))

guess_num = ['*'] * digit

for query in querys:
    # すでに数値が決まっていて、かつ別の数値が設定される場合
    if guess_num[query[0] - 1] != '*' and guess_num[query[0] - 1] != str(query[1]):
        print('-1')
        exit()
    # 2桁以上で左から1桁目に0が設定される場合
    elif digit >= 2 and query[0] == 1 and query[1] == 0:
        print('-1')
        exit()
    else:
        guess_num[query[0] - 1] = str(query[1])

for i, _ in enumerate(guess_num):
    if _ == '*':
        # 1桁かつクエリが0の場合は除外する
        if i == 0 and len(guess_num) > 1:
            guess_num[i] = '1'
        else:
            guess_num[i] = '0'

print(''.join(guess_num))

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

int main(){
 int N,K;
 cin >> N >> K;
  
 char chr[N];
 cin >> chr;

 chr[K-1] = tolower(chr[K-1]); 
  
 for(int i = 0; i < N; i++){
  
  cout << chr[i];
   
 } 
  
 return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#define pb push_back 
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ll long long
#define sc(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
const ll mod=1e9+7;
ll ad(ll a,ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll jc[720005];
ll ap(ll a,ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
ll ksm(ll a,ll b){
	ll res=1;
	while(b)
	{
		if(b%2==1)res=ap(res,a);
		a=ap(a,a);
		b/=2;
	}
	return res;
}
ll C(ll a,ll b)
{
	return ap(jc[a],ap(ksm(jc[b],mod-2),ksm(jc[a-b],mod-2)));
}
ll f[720005];
ll g[720005];
int main(int argc, char** argv) {
	ll n,m;
	sl(n);
	sl(m);
	jc[0]=1;
	rep(i,1,m)
	{
		jc[i]=ap(jc[i-1],i);
	}
	ll ans=0;
	rep(i,0,n)//最少有i个相等 
	{
		g[i]=ap(ap(ap(C(n,i),C(m,i)),ap(C(m-i,(n-i)),C(m-i,n-i))),ap(jc[i],ap(jc[n-i],jc[n-i])));
	//	cout<<g[i]<<" "<<ap(C(m,2*(n-i)),(jc[2*(n-i)]))<<endl;
		ans=ad(ans,((i)%2==0)?g[i]:mod-g[i]);
	}
	
	cout<<ans;
	return 0;
}

Measured memory_bytes: 11428
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
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;}
ll mod(ll n){return n%=MOD1;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{ ll a , b;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->a - ((fr*)q)->a;}
int cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}
void strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}
void strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}

int main(void){
    // char ;
    ll n,ans=0;
    scanf("%lld",&n);
    ll a[n+1],b[n];
    rep(i,0,n+1){
        scanf("%lld",&a[i]);
    }
    rep(i,0,n){
        scanf("%lld",&b[i]);
    }
    ll rest=0;
    rep(i,0,n){
        ans+=min2(rest,a[i]);
        a[i]-=min2(a[i],rest);
        rest=0;
        // if(rest>a[i]){
        //     ans+=a[i];
        //     rest=0;
        //     a[i]=0;
        // }else{
        //     ans+=rest;
        //     rest=0;
        //     a[i]-=rest;
        // }
        ans+=min2(a[i],b[i]);
        rest=max2(0,b[i]-a[i]);

        // if(a[i]>b[i]){
        //     ans+=b[i];
        // }else{
        //     ans+=a[i];
        //     rest=b[i]-a[i];
        //     // a[i]=0;
        // }
        // // rest+=b[i+1];
        // // printf("%lld ",ans);
    }
    ans+=min2(a[n],rest);

    
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1664
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int result[100001] = {};

int solve(int n)
{
	if(result[n] > 0) return result[n];
	int ans = n;
	for(int i = 9; i <= n; i *= 9){
		ans = min(ans, solve(n - i) + 1);
	}
	for(int i = 6; i <= n; i *= 6){
		ans = min(ans, solve(n - i) + 1);
	}
	return result[n] = ans;
}

int main()
{
	int n;
	cin >> n;
	cout << solve(n) << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
using namespace std;
char s[3003],t[3003];
int n,m,i,j,a[3003][3003];
int main()
{
    cin >>s>>t;
    n=strlen(s);
    m=strlen(t);
    for (i=n;i>0;i--)
    {
        for (j=m;j>0;j--)
        {
            if (s[i-1]==t[j-1]){
                a[i][j]=a[i+1][j+1]+1;
            }
            else a[i][j]=max(a[i][j+1],a[i+1][j]);
        }
    }
    i=1,j=1;
    while (i<=n && j<=m){
        if (s[i-1]==t[j-1]){
            cout <<s[i-1];
            i++,j++;

        }
        else
        {
            if (a[i+1][j]>a[i][j+1]){
                i++;
            }
            else j++;
        }
    }
    return 0;
}


Measured memory_bytes: 35456
#define NDEBUG
NDEBUG


#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <queue>
#include <random>


using namespace std;


// TC_REMOVE_BEGIN
/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);
// TC_REMOVE_END


// Section with adoption of array and vector algorithms.


//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//
//template <class T> using StdTree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;


namespace template_util {
    

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    template<int N>
    struct bytetype {
        
    };

    
    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}


template<class T>
T next(istream& in) {
    T ret;
    in >> ret;
    return ret;
}


void solve(istream& in, ostream& out) {
  auto s = next<string>(in);
  out << s.substr(0, 4) << " " << s.substr(4) << "\n";
}

//#include <fstream>


int main() {
//  ifstream fin("bridges.in");
//  ofstream fout("bridges.out");
    solve(cin, cout);
//  solve(fin, fout);
    return 0;
}



Measured memory_bytes: 3628
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <numeric>
#include <tuple>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
#define ALL(x)   (x).begin(),(x).end()
#define mp       make_pair
#define eb       emplace_back

int n, t, s;
int a[3030], b[3030];
int dp[3030][3030];

int main() {
	cin >> n >> t >> s;
	for (int i = 0; i < n; i++)cin >> a[i] >> b[i];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= t; j++) {
			if (j < b[i])dp[i + 1][j] = dp[i][j];
			else if (j > s&&j - b[i] < s)dp[i + 1][j] = dp[i][j];
			else dp[i + 1][j] = max(dp[i][j], dp[i][j - b[i]] + a[i]);
		}
	}
	int ans = 0;
	for (int i = 0; i <= t; i++)ans = max(ans, dp[n][i]);
	cout << ans << endl;
}

Measured memory_bytes: 38620
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+100;
int h[maxn];
int dp[maxn];
int n,k;
int main(){
    scanf("%d%d",&n,&k);
    for (int i=0;i<n;i++){
        scanf("%d",h+i);
    }
    for (int i=1;i<n;i++){
        dp[i] = dp[i-1] + abs(h[i] - h[i-1]);
        for (int j=max(0,i-k);j<i-1;j++){
            dp[i] = min(dp[i],dp[j] + abs(h[i] - h[j]));
        }
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int n;
int ans = 0;

int32_t main()
{
        cin >> n;
        for (int i=1; i<=n; i++)
        {
                int x; cin >> x;
                if (x%2==0)
                {
                        while (x%2==0)
                        {
                                ans++;
                                x/=2;
                        }
                }
        }
        cout << ans;
        return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void)
{
  char a[101];
  char b[101];
  int i, n;
  int score_a = 0;
  int score_b = 0;
  int count = 0;
 
  scanf("%d", &n);
 
  for (i = 0 ; i < n; i++){
    scanf("%s %s", a, b);
    count = strcmp(a, b);
    if (count == 0){
      score_a++;
      score_b++;
    }
    else if(count > 0){
      score_a += 3;
    }
    else {
      score_b += 3;
    }
  }
  printf("%d %d\n", score_a, score_b);
  return (0);
}


Measured memory_bytes: 1988
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
ll N;
  cin>>N;
  if(N>999) {
cout<<"ABD"<<endl;
  }
  else {
cout<<"ABC"<<endl;
  }
}

Measured memory_bytes: 3640
#include<iostream>
#include<cmath>

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

long long lcm(long long a, long long b)
{
   return a * b / gcd(a, b);
}
int main(void){
    long long a, b, c, d;
    std::cin >> a >> b >> c >> d;
    long long s, e;
    auto seekStart = [&](long long i){
        long long tmp = a / i;
        if(a % i != 0) tmp++;
        return i * tmp;
    };
    auto seekEnd = [&](long long i){
        return b / i * i;
    };
    // auto lcm = [&](long long n, long long m){
    //     long long lcm = 1;
    //     long long adiv = std::sqrt(c);
    //     for(int i = 2; i <= adiv; i++){
    //         while(c % i == 0 && d % i == 0){
    //          n /= i;
    //          m /= i;
    //          lcm *= i;
    //         }
    //     }
    //     lcm *= n * m;
    //     return lcm;
    // };
    long long cok = (seekEnd(c) - seekStart(c)) / c + 1;
    long long dok = (seekEnd(d) - seekStart(d)) / d + 1;
    long long cd = lcm(c, d);
    long long cdok = (seekEnd(cd) - seekStart(cd)) / cd + 1;
    long long all = b - a + 1;
    std::cout << all - cok - dok + cdok << std::endl;
    return 0;
}

Measured memory_bytes: 3544
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }


void dfs(LL y, LL x, set<LL>& y_set, set<LL>& x_set, set<pair<LL,LL>>& memo, map<LL, vector<LL>>& h, map<LL, vector<LL>>& v){
    pair<LL,LL> k(y, x);
    if(memo.count(k) > 0) return;
    memo.insert(k);
    if(y_set.count(y) <= 0){
        y_set.insert(y);
        for(LL x2: h[y]){
            dfs(y, x2, y_set, x_set, memo, h, v);
        }
    }
    if(x_set.count(x) <= 0){
        x_set.insert(x);
        for(LL y2: v[x]){
            dfs(y2, x, y_set, x_set, memo, h, v);
        }
    }
}

int main(){
    LL n;
    cin >> n;
    map<LL, vector<LL>> v, h;
    for(LL i = 0; i < n; ++i){
        LL x, y;
        cin >> x >> y;
        v[x].push_back(y);
        h[y].push_back(x);
    }
    set<pair<LL,LL>> memo;
    LL ans = -n;
    for(auto p: h){
        LL y = p.first;
        LL x = p.second[0];
        set<LL> y_set;
        set<LL> x_set;
        dfs(y, x, y_set, x_set, memo, h, v);
        ans += y_set.size() * x_set.size();
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 34432
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
using ll = long long;

string s;
int count_par = 0;

void solve(){
    int len = (int)s.size();
    for(int i = 0; i < len; i++){
        if(s[i] == 'p') count_par++;
    }
    cout << floor(len / 2) - count_par << endl;
}

int main(){
    cin >> s;
    solve();
}

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

#define int long long
//typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


signed main(){
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    
    int ans=0;
    rep(bit,60){
        int cnt=0;
        rep(i,N){
            if(A[i]&(1LL<<bit)) cnt++;
        }
        int t = cnt * (N-cnt);
        t %= mod;
        ans += (t*((1LL<<bit)%mod))%mod;
        ans%=mod;
        
    }
    cout << ans << endl;
    
}



Measured memory_bytes: 2560
object Main {
  def main(args: Array[String]) {
    def compare(a: => Long, b: => Long): Boolean = a <= b
    val sc = new java.util.Scanner(System.in)
    val A = sc.nextInt
    val B = sc.nextInt
    val C = sc.nextInt
    val X = sc.nextInt
    val Y = sc.nextInt
    val result = if (2 * C > A + B) {
      A * X + B * Y
    } else if (X < Y) {
      if (2 * C < B) {
        2 * C * Y
      } else {
        2 * C * X + B * (Y - X)
      }
    } else {
      if (2 * C < A) {
        2 * C * X
      } else {
        2 * C * Y + A * (X - Y)
      }
    }
    println(result)
  }
}

Measured memory_bytes: 25804
TakahashiAndAoki=list(map(int,input().split())) 
while 1:
    if(TakahashiAndAoki[1]>=TakahashiAndAoki[2]):
        print("Yes")
        break
    else:
        TakahashiAndAoki[2]=TakahashiAndAoki[2]-TakahashiAndAoki[1]
    if (TakahashiAndAoki[3]>= TakahashiAndAoki[0]):
        print("No")
        break
    else:
        TakahashiAndAoki[0]=TakahashiAndAoki[0]-TakahashiAndAoki[3]

Measured memory_bytes: 9164
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()

const int mod = 1e9 + 7;
const int N = 1e5 + 5;

string s;
int dp[N][2];

int solve(int i, int lt)
{
  if(i >= sz(s))
    return 1;
  int& r = dp[i][lt];
  if(r != -1) return r;
  r = 0;
  if(s[i] == '1'){
    r = (r + 2LL * solve(i + 1, lt)) % mod;
    r = (r + solve(i + 1, 1)) % mod;
  }else{
    if(lt)
      r = (r + 2LL * solve(i + 1, lt)) % mod;
    r = (r + solve(i + 1, lt)) % mod;
  }
  return r;
}

int main()
{
  cin >> s;
  memset(dp, -1, sizeof dp);
  cout << solve(0, 0) << endl;
  return 0;
}


Measured memory_bytes: 7552
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

void print(double x, double y) {
    if (x == -0.0) x = 0;
    if (y == -0.0) y = 0;
    printf("%.3f %.3f\n", x, y);
}

int main() {
    double a, b, c, d, e, f;
    while (scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f) != EOF) {
        if (d == 0) {
            const double y = f / e;
            const double x = (c-b*y) / a;
            print(x, y);
        }
        else {
            const double y = (c-a*f/d) / (b-a*e/d);
            const double x = (f-e*y)/d;
            print(x, y);
        }
    }
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cmath>
using namespace std;
int main(void){
    
    int n,a,b,answer = 0;
    cin >> n >> a >> b;
    
    for(int i = 1; i <= n; i++){
        int t = 0;
        
        for(int j = 0; j < 5; j++){
            t += (i / (int)pow(10,j))%10;
        }
        
        if(a <= t && t <= b){
            answer += i;
        }
    }
    
    cout << answer << endl;
}


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

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ll long long
#define inf 1000000007 //10^9+7
#define sort(vec) sort((vec).begin(),(vec).end());
#define rever(vec) reverse((vec).begin(),(vec).end());
#define unsort(vec) sort((vec)); rever((vec));
using namespace std;

int main() {
	ll n;
	cin>>n;
	vector<ll>vec(n);
	for(ll i=0;i<n;i++) cin>>vec[i];
	sort(vec);
	cout<<vec[n-1]-vec[0]<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define db(x) cout<<#x<<" ---> "<<x<<"\n";
void print(vector<int> v);
void fastio();

void solve()
{
	int x;
	cin>>x;
	if(x==0)
		cout<<"1";
	else
		cout<<"0";
}

int32_t main()
{
	fastio();
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}
void print(vector<int>v)
{
	for (auto x : v)
	{
		cout << x << " ";
	}
	cout << "\n";
}
void fastio()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout .tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define _ ios::sync_with_stdio(false);cin.tie(0);
#define __ cout<<fixed;cout<<setprecision(10);
#define int long long
#define fori(a,b) for(int i = a ; i < b ; i++)
#define forj(a,b) for(int j = a ; j < b ; j++)

void solve() {
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	int ki = 0;
	while (b <= a) {
		ki++;
		b *= 2;
	}
	while (c <= b) {
		c *= 2;
		ki++;
	}
	//cout << ki << "\n";
	if (ki <= k) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
}

int32_t main() {
	_ __
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int t = 1;
	//cin >> t;
	while (t--) {
		solve();
	}

#ifndef ONLINE_JUDGE
	cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
#endif

	return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
int n,k;
ll dp[66666][111];
vector<int>v;
int main()
{
    scanf("%d%d",&n,&k);
    int l=1,r=1;
    while(r+1<=n)
    {
        v.push_back(r);
        l=r+1;r=n/(n/l);
    }
    v.push_back(r);
    sort(v.begin(),v.end());
    dp[0][1]=v[0];
    for(int i=1;i<v.size();i++)
        dp[i][1]=v[i]-v[i-1];
    ll ans=0;
    for(int i=2;i<=k;i++)
    {
        int r=v.size()-1;
        ll now=0;
        for(int j=0;j<v.size();j++)
        {
           now=(now+dp[j][i-1])%mod;
           while(v[r]>=n/v[j]&&r>=0)
           {
               dp[r][i]=now*(r==0?v[r]:v[r]-v[r-1])%mod;
               r--;
           }
        }
    }
    for(int i=0;i<v.size();i++)
        ans+=dp[i][k];
    printf("%lld\n",ans%mod);
}


Measured memory_bytes: 55932
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a),i##_end=(b);i<=i##_end;++i)
#define per(i,a,b) for(int i=(b),i##_end=(a);i>=i##_end;--i)
#define For(i,a,b) for(int i=(a),i##_end=(b);i<i##_end;++i)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)(x).size())
#define Es(x,i) for(Edge *i=G[x];i;i=i->nxt)
#define heap(...) priority_queue<__VA_ARGS__,vector<__VA_ARGS__ >,greater<__VA_ARGS__ > > 
#ifdef flukehn
#define debug(...) fprintf(stderr, __VA_ARGS__);
#else
#define debug(...)
#endif
typedef double db;
typedef long long L;
typedef long double lf;
typedef unsigned int uint;
typedef unsigned long long uL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f,mo=998244353;
template<typename T>inline void admo(int&a,const T&b){a=(a+b>=mo?a+b-mo:a+b);}
template<typename T>inline void sumo(int&a,const T&b){a=(a-b<0?a-b+mo:a-b);}
template<typename T,typename S>inline bool upmx(T&a,const S&b){return a<b?a=b,1:0;}
template<typename T,typename S>inline bool upmn(T&a,const S&b){return a>b?a=b,1:0;}
template<typename T>inline T gcd(T a,T b){while(b)a%=b,swap(a,b);return a;}
inline int Pow(int a,int b,int p=mo){int r=1;for(;b;b>>=1,a=1ll*a*a%p)if(b&1)r=1ll*r*a%p;return r;}
const int N=2e5+11;
int a[N],n,b[N];
int c[N<<1];
int main(){
#ifdef flukehn
	freopen("g.in","r",stdin);
#endif
	ios::sync_with_stdio(0);
	cin>>n;
	rep(i,1,n)cin>>a[i];
	b[n]=1;
	per(i,1,n-1){
		b[i]=max(b[i+1]-1,a[i+1]-1);
	}
	if(a[1]){
		puts("-1");
		return 0;
	}
	For(i,1,n)if(a[i]<b[i]){
		debug("%d %d\n",i,b[i]);
		puts("-1");
		return 0;
	}
	int j=-1,w=0;
	L r=0;
	per(i,1,n)if(a[i]){
		++j;int x=j+a[i];
		if(!c[x]){
			++w;
			c[x]=1;
		}
		if(c[j])c[j]=0,--w;
		r+=w;
		debug("%d %d\n",i,w);
	}
	cout<<r;
}


Measured memory_bytes: 2560
#include <iostream>
#include <stdlib.h>
using namespace std;
long long h[100005];
long long dp[100005];
int main() {
	int N; cin >> N;
	for (int i = 1; i <= N; i++) cin >> h[i];
	for (int i = 1; i <= N; i++) {
		if (i == 1) dp[i] = 0;
		else if (i == 2) dp[i] = llabs(h[2] - h[1]);
		else dp[i] = min(llabs(h[i] - h[i - 1]) + dp[i - 1], llabs(h[i] - h[i - 2]) + dp[i - 2]);
	}
	cout << dp[N] << endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);

	int i,A,B,C;
	string result="NO";
	cin >> A;
	cin >> B;
	cin >> C;
	for(i=0;i<B;i++){
    	if((A*i)%B==C) result="YES";
	}
	cout << result << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
inline int add(int a,int b)
{a+=b;return a>=MOD?a-MOD:a;}
inline int sub(int a,int b)
{a-=b;return a<0?a+MOD:a;}
inline int mul(int a,int b)
{return 1LL*a*b%MOD;}
int f[1<<20],inv[1<<20];
int main()
{
	int n,x,als=0,fac=1;
	scanf("%d",&n);
	inv[1]=1;
	int si=0;
	for(int i=2;i<=n;i++)inv[i]=mul(inv[MOD%i],MOD-MOD/i);
	for(int i=1;i<=n;i++)
		f[i]=add(mul(inv[i],inv[i+1]),f[i-1]),fac=i==n?fac:mul(fac,i);
	for(int i=1;i<n;i++)
		scanf("%d",&x),als=add(als,mul(x,sub(f[i-1],add(f[n-i-1],inv[n-i])))),si=add(si,inv[i]);
	scanf("%d",&x);
	printf("%d\n",mul(add(als,mul(x,si)),fac));
	return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
#include <numeric>
#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

ll n,a,b,c,d,e;

int main() {
cin >> n;cin >> a >> b >> c >> d >> e;
ll x=min(min(a,b),min(min(c,d),e));
cout << 4+(n+x-1)/x;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vr vector
#define pb push_back
#define watch(x) cout << (#x) << " is " << (x) << endl

bool isvowel(char a)
{
    if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u')
     return true;
     else
        return false;
}

  int main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     //ll t;
     //cin>>t;
     //while(t--)
     {
      ll n,k,i,a[200001],diff=0,d=0;
      cin>>k>>n;
       for(i=0;i<n;i++)
        cin>>a[i];
       for(i=0;i<n-1;i++)
       {
           d=a[i+1]-a[i];
           diff=max(diff,d);

       }
      d=a[n-1]-a[0];

      cout<<min(k-diff,d);




        cout<<endl;

     }

 return 0;
  }



Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <stack>
#include <cmath>
#include <queue>
#include <numeric>


int main()
{
	std::string s;

	std::cin >> s;

	for (size_t i = 0; i < s.length() - 1; i++)
	{
		if (s[i] == 'A' && s[i + 1] == 'C') {
			std::cout << "Yes" << std::endl;
			return 0;
		}
	}

	std::cout << "No" << std::endl;

	return 0;

}


Measured memory_bytes: 256
#import math

def cheak(x):
    if x[0] == "0" and len(x) > 1:
        return True
    return False

def find(ss):
    for i in range(0,10):
        s = ss.replace("X",str(i))
        ab, c = list(s.split("=="))
        a, b = list(ab.split("+"))
        if i == 0 and (cheak(a) or cheak(b) or cheak(c)):
            continue
        if eval(s):
            print(i)
            return
    print("NA")

while True:
    try:
        s = input().replace("=","==")
        find(s)
    except:
        break


Measured memory_bytes: 5604
#include <stdio.h>
#include <stdlib.h>

int main(){
int n = 0;
int *a = NULL;
int i = 0;
	scanf("%d",&n);
	a = (int *)malloc(sizeof(int)*(n+1));

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

	for(i = n-1 ;i > 0 ; i --){
		printf("%d ",a[i]);
	}
	printf("%d\n",a[0]);
	return 0;

}

Measured memory_bytes: 596
#include<stdio.h>
int a[200010];
int ans[200010];
int main(void){
  int n;
  scanf("%d",&n);
  for(int i=2;i<=n;i++){
    scanf("%d",&a[i]);
  }
  for(int i=2;i<=n;i++){
    ans[a[i]]++;
  }
  for(int i=1;i<=n;i++){
    printf("%d\n",ans[i]);
  }
  return 0;
}

Measured memory_bytes: 3240
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int main() {
	int n;
	cin >> n;
	double a = n / 3.0;
	cout << setprecision(12) << a * a * a << endl;
}

Measured memory_bytes: 3744
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
	ll n;
	cin>>n;
	long double arr[n],ans=0;
	
	for(ll i=0;i<n;i++)
	{
		cin>>arr[i];
		ans=ans+1/arr[i];
	}
	cout<<1/ans;
	return 0;
}

Measured memory_bytes: 256
def main():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())

    count = 0
    for ia in range(0, a+1):
        for jb in range(0, b+1):
            for kc in range(0, c+1):
                total = 500 * ia + 100 * jb + 50 * kc
                if total == x:
                    count += 1

    print(count)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;

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

int main() {
        int n;
        cin >> n;
        vector<long long> a(n);
        for (int i = 0; i < n; i ++) {
                cin >> a[i];
        }
        long long ans = 0;
        while (true) {
                bool end = true;
                for (int i = 0; i < n; i ++) {
                        if (a[i] < n) continue;
                        end = false;
                        long long div = a[i] / n;
                        long long mod = a[i] % n;
                        a[i] = mod;
                        for (int j = 0; j < n; j ++) if (i != j) {
                                a[j] += div;
                        }
                        ans += div;
                }
                if (end) break;
        }
        cout << ans << endl;
        return 0;
}



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

int main()
{
  char ch;
  int count[26] = {};
  while (cin >> ch) {
    if (!isalpha(ch)) continue;
    int num = tolower(ch) - 'a';
    count[num]++;
  }
  for (char c='a'; c<='z'; c++) {
    int num = c - 'a';
    cout << c << " : " << count[num] << endl;
  }
  return 0;
}



Measured memory_bytes: 3092
#include<bits/stdc++.h>
#define INF (1e9)
#define M 105
#define N 55
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;

vector<int> G[N];
int n,m,declare[3];
int used[3][N][M],used2[N];
queue<P1> q;

void bfs(){
  while(!q.empty()){
    P1 t=q.front(); q.pop();
    int idx=t.first;
    int node=t.second.first;
    int cnt=t.second.second;
    if(used[idx][node][cnt])continue;
    used[idx][node][cnt]=1;
    if(!cnt)continue;
    
    for(int i=0;i<G[node].size();i++)
      q.push(P1(idx,P(G[node][i],cnt-1)));
  }
}

int main(){
  cin>>n>>m;
  for(int i=0;i<3;i++)cin>>declare[i];

  int u,v;
  for(int i=0;i<m;i++){
    cin>>u>>v;
    u--,v--;
    G[v].push_back(u);
  }
  
  for(int i=0;i<3;i++)used[i][n-1][0]=1;
  
  int turn=1,ans=INF;
  while(1){
    for(int i=0;i<n;i++){
      if(used2[i])continue;
      int f=0;
      for(int j=0;j<3;j++)
	if(!used[j][i][0])f=1;
      if(!f){
	used2[i]=1;
	for(int j=0;j<3;j++)
	  q.push(P1(j,P(i,declare[j])));
      }
    }
    if(q.empty())break;
    bfs();
    int f=0;
    for(int i=0;i<3;i++)
      if(!used[i][0][0])f=1;
    if(!f){
      ans=turn;
      break;
    }
    turn++;
  }
  
  if(ans==INF)cout<<"IMPOSSIBLE"<<endl;
  else cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 3324
#include<stdio.h>

int main(){
  int n;
  scanf("%d",&n);
  int amin=1000,amax=0,a;
  for(int i=0;i<n;i++){
    scanf("%d",&a);
    if(a>amax) amax=a;
    if(a<amin) amin=a;
  }
  printf("%d",amax - amin);
}

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

signed main()
{
    int N,A,B; cin>>N>>A>>B;
    vector<int> x(N);
    for(int i=0;i<N;i++){
        cin>>x[i];
    }

    int ans=0;
    for(int i=0;i<N-1;i++){
        ans+=min(A*(x[i+1]-x[i]),B);
    }
    cout<<ans<<endl;
}


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

int main() {
  int N,i,k;
  cin>>N;
  k=0;
  vector<int> vec(N);
  for(i=0;i<N;i++) cin >> vec[i];
  for(i=0;i<N;i++){
    if(vec[i]!=i+1){
      k++;
    }
  }
  if(k<=2){
    cout<<"YES"<<endl;
  }else{cout<<"NO"<<endl;}
}


Measured memory_bytes: 256
n, m = map(int, input().split())
s = [0] * (n+1)
for i in range(m):
    l,r = map(int, input().split())
    s[l-1] += 1
    s[r] -= 1
for i in range(n):
    s[i+1] += s[i]

ans = 0
for i in range(n):
    if s[i] == m:
        ans += 1
print(ans)

Measured memory_bytes: 6900
// ABC153C.cpp
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <numeric> //accumulateに必要
#include <iomanip> //setprecision(桁数指定)に必要
using namespace std;

int main(){
	int N,K;
	cin>>N>>K;
	long long sum = 0;
	vector<long long> H;
	for(int i=0;i<N;i++){
		long long a;
		cin>>a;
		H.push_back(a);
	}
	sort(H.begin(),H.end());
	if(N<=K){
		sum = 0;
	}else{
		sum = accumulate(H.begin(),H.end()-K,0LL);
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 2420
//103A
#include <bits/stdc++.h>
using namespace std;
int main(void){
   vector<int> L(3, 0);
   int ans=0;
   for(int i=0; i<3; i++){
       cin >> L[i];
   }
   sort(L.begin(), L.end());
   for(int i=0; i<2; i++){
       ans +=(L[i+1]-L[i]);
       //cout << L[i+1] << L[i] << endl;
   }
   cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n; int c0 = 0; int c1= 0;int c2= 0; int c3=0;
  while(n--)
  {
    string str="";
      cin>>str;
   
    if(str=="AC")
    {
      c0++;
    }
    else if(str=="WA")
      c1++;
    else if(str=="TLE")
      c2++;
    else if(str=="RE")
      c3++;
    else
      continue;
  }
  cout<<"AC"<<' '<<"x"<<' '<<c0<<endl;
  cout<<"WA"<<' '<<"x"<<' '<<c1<<endl;
  cout<<"TLE"<<' '<<"x"<<' '<<c2<<endl;
  cout<<"RE"<<' '<<"x"<<' '<<c3<<endl;
  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <vector>
using namespace std;
int main()
{
	int n,c=0,d=0;
	cin>>n;
	int s[n],a[n];
	for (int i=0;i<n;i++) 
	{
	    cin>>s[i];
	    a[i]=s[i];
	    c=c+s[i];
    }
    if (c%10!=0)
    {
    	cout<<c<<endl;
    	return 0;
	}
	else
	{
		for (int i=0;i<n;i++)
		{
			for (int j=i;j<n;j++)
			{
				if (s[i]>s[j])
				{
					s[i]=a[j];
					s[j]=a[i];
					a[i]=s[i];
					a[j]=s[j];
				}
			}
	    }
		for (int i=0;i<n;i++) if (s[i]%10==0) d++;
		if (d==n) 
		{
			cout<<0<<endl;
			return 0;
		}
		else 
		{
			for (int i=0;i<n;i++)
			{
				if (s[i]%10!=0)
				{
					cout<<c-s[i]<<endl;
					return 0;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    #define F first
    #define S second
    using namespace std;
    typedef pair<int,int *> P;
    typedef pair<long long,int>PP;
    int main(){
    int n,k;
    cin>>n;
    int l,sum=0,mx=0;
    for(int i=0;i<n;i++){
    cin>>l;
    if(l>mx){
    mx=l;
    }
    sum+=l;
    }
    sum-=mx;
    if(sum>mx){
    cout<<"Yes"<<endl;
    }else{
    cout<<"No"<<endl;
    }
    return(0);
    }

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <random>
#include <ctime>
#include <bitset>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <cstring>
#include <queue>
#include <deque>
#include <list>
#include <stack>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define ld long double
#define ull unsigned long long
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(x) x.begin(), x.end()
#define fast_io cout.tie(0), cin.tie(0), ios_base::sync_with_stdio(0)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
using namespace std;
ld eps = (ld)1 / 1e15;
ll inf = 1e18, mod1 = 998244353, mod2 = 1e9 + 7;
ll sqr(ll a) { return a * a; }
ll qb(ll a) { return a * a * a; }
ll gcd(ll a, ll b) { return !a ? b : gcd(b % a, a); }
ll binpow(ll a, ll b, ll mod) { return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod : sqr(binpow(a, b / 2, mod)) % mod) : 1; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ll a[101];

int main()
{
    //freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
    fast_io;
    ll n, i;
    cin >> n;
    for (i = 1; i <= n; i++) cin >> a[i];
    for (i = 1; i <= n; i++)
        if (a[i] % 2 == 0 && a[i] % 3 && a[i] % 5) break;
    cout << (i > n ? "APPROVED" : "DENIED");
    return 0;
}

Measured memory_bytes: 256
import core.stdc.stdio;
import std.container;
import std.algorithm;
import std.typecons;
import std.stdio;

void main(){
	int n,m,k;
	scanf("%d%d%d",&n,&m,&k);
	alias Tuple!(int,"cost",int,"to") ct;
	ct[][] graph = new ct[][n];
	alias Tuple!(int,"a",int,"b",int,"l") edge;
	edge[] es = new edge[m];
	foreach(ref e;es){
		scanf("%d%d%d",&e.a,&e.b,&e.l);
		graph[--e.a]~=ct(e.l,--e.b);
		graph[e.b]~=ct(e.l,e.a);
	}
	auto pq = BinaryHeap!(ct[],"a>b")(new ct[n+m],0);
	int[] nc = new int[n];
	nc[] = 1145141919;
	foreach(i;0..k){
		int a;
		scanf("%d",&a);
		nc[--a]=0;
		pq.insert(ct(0,a));
	}
	while(!pq.empty){
		auto t=pq.front;
		pq.popFront;
		with(t){
			if(cost>nc[to])
				continue;
			foreach(c;graph[to]){
				if(nc[c.to]>cost+c.cost){
					nc[c.to]=cost+c.cost;
					pq.insert(ct(cost+c.cost,c.to));
				}
			}
		}
	}
	int ans;
	foreach(e;es)
		ans = max(ans,e.l+nc[e.a]+nc[e.b]);
	printf("%d\n",(ans+1)/2);
}

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

double x[100], y[100];
int main() {
	int n; cin >> n;
	rep(i, n)cin >> x[i];
	rep(i, n)cin >> y[i];
	double a = 0, b = 0, c = 0, d = 0;
	rep(i, n)a += abs(x[i] - y[i]);
	rep(i, n)b += abs(x[i] - y[i])*abs(x[i] - y[i]);
	b = sqrt(b);
	rep(i, n)d += abs(x[i] - y[i])*abs(x[i] - y[i])*abs(x[i] - y[i]);
	d = cbrt(d);
	rep(i, n)c = max(c, abs(x[i] - y[i]));
	printf("%.7lf\n%.7lf\n%.7lf\n%.7lf\n", a, b, d, c);
}

Measured memory_bytes: 3392