akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main() {
    int N;
    cin >> N;
    int a[N];
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }
    int c[9]={};
    for (int i = 0; i < N; i++)
    {
        if (1<=a[i] && a[i] <=399)
        {
            c[0]=c[0]+1;
        }
        if (400<=a[i] && a[i] <=799)
        {
            c[1]=c[1]+1;
        }
        if (800<=a[i] && a[i] <=1199)
        {
            c[2]=c[2]+1;
        }
        if (1200<=a[i] && a[i] <=1599)
        {
            c[3]=c[3]+1;
        }
        if (1600<=a[i] && a[i] <=1999)
        {
            c[4]=c[4]+1;
        }
        if (2000<=a[i] && a[i] <=2399)
        {
            c[5]=c[5]+1;
        }
        if (2400<=a[i] && a[i] <=2799)
        {
            c[6]=c[6]+1;
        }
        if (2800<=a[i] && a[i] <=3199)
        {
            c[7]=c[7]+1;
        }
        if (3200<=a[i])
        {
            c[8]=c[8]+1;
        }
        
    }
    int cc =0;
    for (int i = 0; i < 8; i++)
    {
        if (c[i]>=1)
        {
            cc++;
        }
        
    }
    int bk;
    bk =8-cc;
    int maxc,minc;
    maxc = cc+c[8];
    minc = max(1,cc);
    cout << minc <<" "<< maxc<<endl;
    
}

Measured memory_bytes: 256
sub nCk{my($n,$k)=@_;
	my$r=1;
	$r*=$n+1-$_,$r/=$_ for 1..$k;
	$r
}
($N,$A,$B)=glob<>;
@v=sort{$b<=>$a}glob<>;
$s+=$_ for@v[0..$A-1];
$l=$r=$A-1;
$l--while$l-1>=0&&$v[$l-1]==$v[$A-1];
$r++while$r+1<$N&&$v[$r+1]==$v[$A-1];
$p+=nCk($r-$l+1,$_-$l)for$A..($l?$A:$B);
printf"%f\n%d",$s/$A,$p


Measured memory_bytes: 768
import queue
MAXIMUM = 10 ** 10
q = queue.PriorityQueue()
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
for a in A:
  q.put((-a, a))

while M > 0:
  item = q.get()
  if item[1] == 0:
    break
  q.put((-int(item[1]/2), int(item[1]/2)))
  M -= 1

result = 0
while not q.empty():
  result += q.get()[1]
print(result)

Measured memory_bytes: 21564
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <bitset>
#include <time.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
int k,s;
int ans;
int main()
{
    scanf("%d%d",&k,&s);
    for(int i=0;i<=k;++i)
    {
        for(int j=0;j<=k;++j)
        {
            if(s>=i+j&&s-i-j<=k)++ans;
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

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

using namespace std;
double solve(int k,double r,double l,double p,double e,double t)
{
  if(t+e<r || l<t-e) return 0.0;
  else if(t-e<=r && l<=t+e) return 1.0;
  if(k==0)
    if(abs(t-(r+l)/2)<e) return 1.0;
    else return 0.0;
  if((r+l)/2<t) return (1-p)*solve(k-1,(r+l)/2,l,p,e,t)+p*solve(k-1,r,(r+l)/2,p,e,t);
  else return p*solve(k-1,(r+l)/2,l,p,e,t)+(1-p)*solve(k-1,r,(r+l)/2,p,e,t);
}  
int main(void)
{
  int k;
  double r,l,p,e,t;
  cin >> k >> r >> l >> p >> e >> t;
  cout << fixed << setprecision(10) << solve(k,r,l,p,e,t) << endl;
}

Measured memory_bytes: 3284
//by Top
#include <bits/stdc++.h>
     
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
 
const int inf = (1e9) + 1;
const int mod = 1e9 + 7;
const int maxn = 4e6 + 111;
     
using namespace std;

int n, q, dp[maxn], a[25][25];

void solve(){  
	cin >> n;

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

	dp[0] = 1;

	for (int mask = 0; mask < (1 << n); mask++){
		int k = __builtin_popcount(mask);
		//cout << k << endl;
		for (int i = 0; i < n; i++)
			if (a[k][i] == 1 && (mask & (1 << i)) == 0){
				dp[mask | (1 << i)] += dp[mask];
				dp[mask | (1 << i)] %= mod;
			}
	}

	cout << dp[(1 << n) - 1];
}

main(){
    boost;
	    
	q = 1;

	while (q--){
		solve();
	}
}

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

int main(){
  int N;
  cin >> N;
  vector<int> p(N);
  int64_t sum=0;
  for(int i=0;i<N;i++){
    cin >> p.at(i);
    sum+=p.at(i);
  }
  sort(p.begin(),p.end());
  sum=sum-p.back()/2;
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define N 110000
int n,K,ans;
int a[N];
vector<int>vec[N];
int dfs(int x)
{
	int ret=0;
	for(int i=0;i<vec[x].size();i++)
	{
		int t=dfs(vec[x][i]);
		if(t==K)ans++;
		else ret=max(ret,t);
	}
	return ret+1;
}
int main()
{
	//freopen("tt.in","r",stdin);
	scanf("%d%d",&n,&K);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if(i!=1)vec[a[i]].push_back(i);
	}
	ans=(a[1]!=1);
	for(int i=0;i<vec[1].size();i++)
		dfs(vec[1][i]);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 11008
from math import cos, radians

def main():
    a, b, h, m = map(int, input().split())
    h_angle = (h * 60 + m) / 2 # 時針の角度
    m_angle = m * 6 # 分針の角度
    theta = abs(h_angle - m_angle)
        
    x_2 = a**2  + b**2 - 2*a*b*cos(radians(theta))
    print(x_2 ** 0.5)
    
main()

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

int main() {
	int n;
	cin >> n;
	vector<vector<int>> val(n+1, vector<int>(3)), dp(n+1, vector<int>(3, 0));
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> val[i][j];
		}
	}
	
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 3; k++) {
				if (j == k) continue;
				dp[i][j] = max(dp[i][j], dp[i-1][k]+val[i][j]);
			}
		}
	}
	
	cout << max(dp[n][0], max(dp[n][1], dp[n][2]));
}

Measured memory_bytes: 11136
#include <iostream>
#include <string>
#include <vector>
using namespace std;
 
int main() {
	int h;
	cin >> h;
	int w;
	cin >> w;
	vector<string> a(h);
	for (int i = 0; i < h; i++) {
		cin >> a[i];
	}
 
	vector<bool> row(h, false);
	vector<bool> col(w, false);
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				row[i] = true;
				col[j] = true;
			}
		}
	}
 
	for (int i = 0; i < h; i++) {
		if (row[i]) {
			for (int j = 0; j < w; j++) {
				if (col[j]) {
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
}


Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B: Addition and Multiplication
 */

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

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

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

  int a = 1;
  for (int i = 0; i < n; i++)
    a = min(a * 2, a + k);

  printf("%d\n", a);
  return 0;
}


Measured memory_bytes: 256
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))


S=list(ns())
T=list(ns())

INF=10**9
ans=INF
for i in range(len(S)-len(T)+1):
    tmp=0
    for j in range(len(T)):
        if(S[i+j]!=T[j]):
            tmp+=1
    ans=min(ans,tmp)

print(ans)
            




Measured memory_bytes: 10320
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
using namespace std;

int main() {
    long long n, A, B, ans = 0;
    long long a, b;
    
    cin >> n >> A >> B;
    if ( A == B ) {
        cout << 1 << endl;
        return 0;
    }
    
    if ( A > B || n == 1 ) {
        cout << 0 << endl;
        return 0;
    }
    
    a = A * (n - 1) + B;
    b = B * (n - 1) + A;
    ans = b - a + 1;
    cout << ans << endl;
        
    return 0;
}


Measured memory_bytes: 256
import math

a, b = map(int, input().split())


def comb(n, r):
    try:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    except:
        return 0

c = comb(a, 2)
d = comb(b, 2)

print(c+d)

Measured memory_bytes: 3060
"""
                            pppppppppppppppppppp
                         ppppp  ppppppppppppppppppp
                      ppppppp    ppppppppppppppppppppp
                      pppppppp  pppppppppppppppppppppp
                      pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
       ppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppp
      pppppppppppppppppppppppppppppppppppppppppppppppp  ppppppppppppppppppppp
     ppppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppppp
    ppppppppppppppppppppppppppppppppppppppppppppppp    pppppppppppppppppppppppp
   pppppppppppppppppppppppppppppppppppppppppppppp     pppppppppppppppppppppppppp
  ppppppppppppppppppppppppppppppppppppppppppppp      pppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppppppp               pppppppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppp     pppppppppppppppppppppppppppppppppppppppppppppp
  ppppppppppppppppppppppppppp    pppppppppppppppppppppppppppppppppppppppppppppppp
    pppppppppppppppppppppppp  pppppppppppppppppppppppppppppppppppppppppppppppppp
     ppppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppppp
      pppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppp
       ppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
                              pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppp  pppppppp
                              ppppppppppppppppppppp    ppppppp
                                 ppppppppppppppppppp  ppppp
                                    pppppppppppppppppppp
"""


import sys
from functools import lru_cache, cmp_to_key
from collections import defaultdict as dd, deque, Counter as C
from bisect import bisect_left as bl, bisect_right as br, bisect
from heapq import heapify, heappop, heappush
from math import ceil, log, floor, sqrt
mod = pow(10, 9) + 7
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(var, end="\n"): sys.stdout.write(str(var)+end)
def outa(*var, end="\n"): sys.stdout.write(' '.join(map(str, var)) + end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]


n, x, t = sp()
temp = n // x
if n % x:
    temp += 1
out(t * temp)


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

using namespace std;

/*  テンプレここから */
typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; ++i)
#define repi(i, start, end) for(int i = start; i < end; ++i)
#define all(x) (x).begin(), (x).end()
#define INF (1e9)
#define INFL (1e18)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)
#define out(x) cout << (x) << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outYes(bool_val) cout << (bool_val ? "Yes" : "No") << endl;
#define outYES(bool_val) cout << (bool_val ? "YES" : "NO") << endl;
#define outPossible(bool_val) cout << (bool_val ? "Possible" : "Impossible") << endl;
#define outPOSSIBLE(bool_val) cout << (bool_val ? "POSSIBLE" : "IMPOSSIBLE") << endl;

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
/*  テンプレここまで */

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

    int n, m, c;
    cin >> n >> m >> c;

    vector<int> b_nums(m);
    rep(i, m) cin >> b_nums[i];

    int cnt = 0;
    rep(i, n){
        int sum = 0;
        rep(j, m){
            int a;
            cin >> a;
            sum += a * b_nums[j];
        }
        sum += c;
        if(sum > 0) cnt ++;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
n=int(input())
s=input()

alle = 0
allw = 0
for i in range(n):
  if s[i] == 'E':
    alle += 1
  else:
    allw += 1

sum_left_w = 0
sum_right_e = alle
result = n
for i in range(n):
  if s[i] == 'E':
    sum_right_e -= 1
  result = min(result, sum_left_w+sum_right_e)
  
  if s[i] == 'W':
    sum_left_w += 1
print(result)

Measured memory_bytes: 9600
N = int(input())
a = int(N//1.08 - 1)
if int(a*1.08//1) == N:
  print(a)
  exit(0)
b = int(N//1.08)
if int(b*1.08//1) == N:
  print(b)
  exit(0)
c = int(N//1.08 + 1)
if int(c*1.08//1) == N:
  print(c)
  exit(0)
print(":(")

Measured memory_bytes: 38256
#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 x, n;
  cin >> x >> n;
  vector<int> vec(102);
  
  rep(i,n) {
    int a;
    cin >> a;
    vec.at(a) = 1;
  }
  
  P ans(99999,0);
  for (int i = 0; i < 102; i++) {
    if (vec.at(i) == 1) continue;
    int dif = abs(x - i);
    ans = min(ans, P(dif,i));
  }
  cout << ans.second;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int c=0;
  for(int i=0;i<m;i++){
    c+=a[i];
  }
  cout<<c;
}

Measured memory_bytes: 256
#include <iostream>
using ll = long long;
int main()
{
  std::string S;std::cin >> S;
  ll ans = 0;
  for(int i = 0, d =0; i < S.size(); i++){
  	if(S[i]=='W'){ans += i-d,d++;}
  }
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include <stdio.h>
#include <algorithm>

#define all(x) x.begin(),x.end()
#define sc(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define pr(x) printf("%d",x)
#define prl(x) printf("%lld",x)
#define LL long long
#define pb push_back
#define PB pop_back
#define PF pop_front
#define F first
#define S second
#define inrow(vec)    for(int i=0;i<vec.size();i++)cout<<vec[i]<<" ";
#define incoloum(vec) for(int i=0;i<vec.size();i++)cout<<vec[i]<<endl;

const double PI=3.1415926;
const int KL=1e6;

using namespace std;

LL q,x,y,z,n,m,k,p[KL],mn=1e9,mx=-1e9,ans;
string t;
vector <int> vec;
set <int> s;
map <int,int> M;

int main()
{
    cin>>k>>x;
    if(k*500>=x)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
class WarshallFloyd():
    def __init__(self, N):
        self.N = N
        self.d = [[float("inf") for i in range(N)]
                  for i in range(N)]  # d[u][v] : 辺uvのコスト(存在しないときはinf)

    def add(self, u, v, c, directed=False):
        """
        0-indexedであることに注意
        u = from, v = to, c = cost
        directed = Trueなら、有向グラフである
        """
        if directed is False:
            self.d[u][v] = c
            self.d[v][u] = c
        else:
            self.d[u][v] = c

    def WarshallFloyd_search(self):
        # これを d[i][j]: iからjへの最短距離 にする
        # TODO: verify in directed 本来無向グラフでのみ、全域木を考える
        for k in range(self.N):
            for i in range(self.N):
                for j in range(self.N):
                    self.d[i][j] = min(
                        self.d[i][j], self.d[i][k] + self.d[k][j])
        for i in range(self.N):
            self.d[i][i] = 0
        return self.d


H, W = map(int, input().split())
C = [list(map(int, input().split())) for i in range(10)]
A = [list(map(int, input().split())) for i in range(H)]

graph = WarshallFloyd(10)
for i in range(10):
    for j in range(10):
        graph.add(i, j, C[i][j], directed=True)

d = graph.WarshallFloyd_search()

ans = 0
for h in range(H):
    for w in range(W):
        if A[h][w] != -1:
            ans += d[A[h][w]][1]

print(ans)

Measured memory_bytes: 40284
#include <iostream>
using namespace std;
using lint = long long;

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

    int N, Q;
    static lint A[100005] = {}, SUM[2][100005] = {}, diff[100005];

    cin >> N >> Q;

    for (int i = 0; i < N; i++) {
        cin >> A[i];
        SUM[i % 2][i] = A[i];
    }
    A[N] = 1e16;

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

    for (int i = 0; i < Q; i++) {
        lint X;
        cin >> X;

        lint le = 0, ri = N;
        lint len = 0;
        while (le <= ri) {
            lint mid = (le + ri) / 2;
            if (abs(A[N - mid] - X) > abs(A[N - (mid + 1) / 2] - X)) {
                ri = mid - 1;
            } else {
                len = mid;
                le = mid + 1;
            }
        }

        lint ans = SUM[0][N - 1] + SUM[1][N - 1];
        if (N - (len + 1) / 2 > 0) {
            ans -= SUM[0][N - (len + 1) / 2 - 1] + SUM[1][N - (len + 1) / 2 - 1];
        }
        lint take = (N - (len + 1) / 2) - (N - len);
        if (take < (N - (N - (len + 1) / 2))) {
            if (N - len - 1 >= 0) {
                ans += SUM[(N - len) % 2][N - len - 1];
            }
        } else {
            if (N - len - 1 >= 0) {
                ans += SUM[(N - len + 1) % 2][N - len - 1];
            }
        }
        cout << ans << "\n";
    }

    return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
int main() {
  int tmp,i;
  long N,ans=0;cin>>N;
  int sizN=to_string(N).size();
  for(tmp=0;tmp<(1<<(sizN-1));tmp++){
    bitset<9> s(tmp);
    long L=0,copyN=N;
    int w=1;
    for(i=0;i<sizN-1;i++){
      w*=10;
      if(s[i]){L+=copyN%w;copyN/=w;w=1;}
    }
    ans+=L+copyN;
  }
  if(ans==0)ans+=N;
  cout<<ans<<endl;
}

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

int main(){
	int N, K, p, i;
	scanf("%d%d", &N, &K);
	vector<double> s(N + 1, 0);
	for(i = 1; i <= N; i++){
		scanf("%d", &p);
		s[i] = s[i - 1] + (double)((p * (p + 1)) / 2) / p;
	}
	double ans = 0;
	for(i = 0; i + K <= N; i++){
		ans = max(ans, s[i + K] - s[i]);
	}
	printf("%.15lf\n", ans);
	return 0;
}

Measured memory_bytes: 1792
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] v = new int[n];
        int[] c = new int[n];
        int sum = 0;
        
        for (int i = 0; i < n; i++) {
            v[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            c[i] = sc.nextInt();
        }
        
        for (int i = 0; i < n; i++) {
            int p = v[i] - c[i];
            if (p > 0) {
                sum += p;
            }
        }
        
        System.out.println(sum);
        
    }
}

Measured memory_bytes: 23636
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <numeric>
#include <string>
#include <bitset>
#include <functional>

using ld = long double;
using vld = std::vector<ld>;
using vvld = std::vector<vld>;
using vvvld = std::vector<vvld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using pll = std::pair<ll, ll>;
using vpll = std::vector<pll>;
using str = std::string;
using vstr = std::vector<str>;

template<typename T> bool chmin(T a, T &b) { return a < b ? b = a, true : false; }
template<typename T> bool chmax(T a, T &b) { return a > b ? b = a, true : false; }

constexpr ld PI = 3.141592653589793L;
constexpr ld EPS = std::numeric_limits<ld>::epsilon();

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
bool is_prime(ll n) {
    if (n == 1) return false;
    for (ll i = 2; i * i <= n; i++)
        if (n % i == 0) return false;
    return true;
}
ll rpow(ll x, ll n) {
    if (n == 0) return 1;
    ll k = 1;
    for (; n > 1; n /= 2) {
        if (n & 1) k *= x;
        x *= x;
    }
    return k * x;
}
ll modpow(ll x, ll n, ll mod) {
    if (n == 0) return 1;
    ll k = 1;
    for (; n > 1; n /= 2) {
        if (n & 1) (k *= x) %= mod;
        (x *= x) %= mod;
    }
    return k * x % mod;
}
ll modcomb(ll n, ll r, ll mod) {
    if (r < 0 || n < r) return 0;
    chmin(n - r, r);
    ll mul = 1, div = 1;
    for (ll i = 0; i < r; i++) {
        (mul *= n - i) %= mod;
        (div *= i + 1) %= mod;
    }
    return mul * modpow(div, mod - 2, mod) % mod;
}

/*------------------------------------------------------------------------*/

void solve();

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15);

    solve();
}
void solve() {
    ll x;
    std::cin >> x;

    std::cout << (5 * (x / 100) >= x % 100) << '\n';
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#define sz(x) (int)(x).size()

const int N = 110;
const int M = 100010;
ll w[N], v[N], f[N][M], n, max_w;

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

  cin >> n >> max_w;
  for (int i = 0; i < n; i++) cin >> w[i] >> v[i];

  for (int i = 0; i <= max_w; i++) {
    f[n - 1][i] = (w[n - 1] <= i) * v[n - 1];
  }

  for (int i = n - 2; i >= 0; i--) {
    for (int j = 0; j <= max_w; j++) {
      f[i][j] = f[i + 1][j];
      if (j >= w[i]) {
        ll t = v[i] + f[i + 1][j - w[i]];
        f[i][j] = max(f[i][j], t);
      }
    }
  }

  cout << f[0][max_w] << "\n";
}



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

using namespace std;

int main() {
    string s;
    cin >> s;
    int N = s.length();
    vector<long long> x(N + 1);
    x[0] = 0;

    // x[0] op(s[0]) x[1]
    for (int i = 0; i < N; ++i) {
        if (s[i] == '<')
            x[i + 1] = x[i] + 1;
        else
            x[i + 1] = 0;
    }

    // x[N - 1] op(s[N - 1]) x[N]
    for (int i = N - 1; i >= 0; --i) {
        if (s[i] == '>')
            x[i] = max(x[i], x[i + 1] + 1);
    }

    long long ans = 0;
    for (int i = 0; i <= N; ++i)
        ans += x[i];
    cout << ans << endl;
}


Measured memory_bytes: 4740
#include <bits/stdc++.h>
using namespace std;
map <int,bool> mymap;
int main ()
{
	int n, i=0;
	cin>>n;
	int a[n+1];
	for(i=1; i<=n; i++){
		cin>>a[i];
		if(mymap[a[i]]!=1)
		mymap[a[i]]=1;
		else{
		cout<<"NO";
		return 0;
		}
	}
	cout<<"YES";
}

Measured memory_bytes: 10368
MOD = 1000000007
def power(a, b):
	if b == 0:
		return 1
	elif b == 1:
		return a % MOD
	elif b % 2 == 0:
		return (power(a, b//2) ** 2) % MOD
	else:
		return (power(a, b//2) ** 2 * a) % MOD
 
L = input()
N = len(L)
ans = 0
cou = 0
for i in range(N):
    if L[i] == "1":
        if i == 0:
            ans += (power(3, N-1-i) + 2) * (power(2, cou))
            ans %= MOD
            cou += 1
        else:
            ans += (power(3, N-1-i) + 1) * (power(2, cou))
            ans %= MOD
            cou += 1
print(ans)

Measured memory_bytes: 3188
checkList s moji = fmap (\a -> if a == moji then 1 else 0) s

listW s = scanl (+) 0 (checkList s 'W')
listE s = scanr (+) 0 (checkList s 'E')

solve s = minimum $ zipWith (+) (listW s) (listE s)

main = do
    n <- getLine
    s <- getLine
    putStrLn $ show $ solve s

Measured memory_bytes: 58748
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
//
#define int long long
#define ALL(x) (x).begin(), (x).end()
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))
// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) ((a) >> (b)) & 1
#define bitcount(a) __builtin_popcountll((a))
//
typedef long long lint;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;
//
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
//
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

int N, M;
int d[110][110];

bool C(TP e) {
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (i == j) {
        continue;
      }
      int tmp = d[i][get<0>(e)] + get<2>(e) + d[get<1>(e)][j];
      if (tmp == d[i][j]) {
        return true;
      }
    }
  }
  return false;
}

signed main() {
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      d[i][j] = INF;
      if (i == j) {
        d[i][j] = 0;
      }
    }
  }

  vector<TP> t;
  for (int i = 0; i < M; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--, b--;
    d[a][b] = d[b][a] = c;
    t.push_back(tie(a, b, c));
  }

  for (int k = 0; k < N; k++) {
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        chmin(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }

  int cont = M;
  for (auto e : t) {
    if (C(e)) {
      cont--;
    }
  }

  cout << cont << endl;
  return 0;
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main ()
{
    int x1,x2,x3,x4,x5;
    cin>>x1>>x2>>x3>>x4>>x5;
    if (x1==0)
        cout<<"1"<<endl;
    else if (x2==0)
        cout<<"2"<<endl;
    else if (x3==0)
        cout<<"3"<<endl;
    else if (x4==0)
        cout<<"4"<<endl;
    else
        cout<<"5"<<endl;
    return 0;
}


Measured memory_bytes: 3068
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	int N, L; cin >> N >> L;
	vi a(N);
	REP(i,N) cin >> a[i];

	int lastIdx = -1;
	REP(i, N - 1) {
		if (a[i] + a[i + 1] >= L) {
			lastIdx = i;
			break;
		}
	}
	if (lastIdx == -1) {
		cout << "Impossible" << endl;
		return;
	}
	cout << "Possible" << endl;
	
	for (int i = 0; i < lastIdx; ++i) {
		cout << i + 1 << endl;
	}
	for (int i = N - 1; i > lastIdx + 1; --i) {
		cout << i << endl;
	}
	cout << lastIdx + 1 << endl;
}

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


Measured memory_bytes: 1280
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <sstream>
#include <algorithm>
using namespace std;
int dp[10002];
int calcL(string s){
  sort(s.begin(), s.end(),greater<int>());
  //cout << __FUNCTION__ << ":" << s << endl;
  return atoi(s.c_str());
}
int calcS(string s){
  sort(s.begin(), s.end());
  //cout << __FUNCTION__ << ":" << s << endl;
  return atoi(s.c_str());
}
string toString(int n){stringstream ss; ss << n; return ss.str();}
int rec(string s){
  int idx = atoi(s.c_str());
  if(dp[idx] != -1){
    return dp[idx];
  }
  if(s == "6174"){
    return 0;
  }
  if(s[0] == s[1] && s[1] == s[2] && s[2] == s[3]){
    return -1;
  }
  int diff = calcL(s) - calcS(s);
  
  s = toString(diff);
  if(s.size() < 4){
    string _s = "";
    for(int i = s.size(); i < 4; i++){
      _s += "0";
    }
    _s += s;
    s = _s;
  }
  int res = rec(s);
  return (dp[diff] = (res < 0?-2:res + 1));
}
void solve(string s){
  fill(dp, dp+ 10002, -1);
  dp[6174] = 0;
  int cnt = 0;
  int input = atoi(s.c_str());
  dp[input] = rec(s);
  if(dp[input] == -1)cout << "NA" << endl;
  else cout << dp[input] << endl;
}
int main(){
  string s;
  while(cin >> s){

    if(s == "0000")break;
    solve(s);
  }
  return 0;
}

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

const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x=0):x(x%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 {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

int main() {
  int n, k;
  cin >> n >> k;
  vector<ll> a(n);
  int negAll = 0;
  rep(i, n) {
    cin >> a[i];
    if (a[i] < 0) negAll++;
  }
  mint ans = 1;

  if (n == k) {
    rep(i, n) {
      ans *= (a[i] + 1000000007);
    }
    cout << ans.x << endl;
    return 0;
  }

  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());

  if (negAll == n && k % 2) {
    rep(i, k) {
      ans *= (a[i] + 1000000007);
    }
    cout << ans.x << endl;
    return 0;
  }

  int head = 0, tail = n - 1;
  if (k % 2) { ans *= a[0]; head++; k--; }

  while (k > 0) {
    ll pos = a[head] * a[head + 1], neg = a[tail] * a[tail - 1];
    if (pos > neg) {
      ans *= pos;
      head += 2;
    } else {
      ans *= neg;
      tail -= 2;
    }
    k -= 2;
  }

  cout << ans.x << endl;

  return 0;
}
/*
*/


Measured memory_bytes: 4860
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(a, b):
	return a * b // gcd (a, b)

N = int(input())
a = list(map(int,input().split()))

m = 1
for i in range(N):
	m = lcm(a[i], m)
m -= 1

ans = 0
for i in range(N):
	ans += m % a[i]

print(ans)

Measured memory_bytes: 3316
import java.io.IOException;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class Main{

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] st = br.readLine().split(" ");
        int a = Integer.parseInt(st[0]);
        int b = Integer.parseInt(st[1]);
        int c = Integer.parseInt(st[2]);
        int counting = 0;
        for (; a <= b; a++) {
            if (c % a == 0) {
                counting++;
            }
        }
        bw.append(counting + "\n");
        bw.flush();
    }


}


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

using namespace std;
using ll = long long;

int f(int x, int y, int z) {
  return x*x + y*y + z*z + x*y + y*z + z*x;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int max = 100;
  int ans[70001] = {0};
  for(int x = 1; x <= max; x ++) {
    for(int y = 1; y <= max; y ++) {
      for(int z = 1; z <= max; z ++) {
        ans[f(x, y, z)] ++;
      }
    }
  }
  int n;
  cin >> n;
  for(int i = 1; i <= n; i++) {
    cout << ans[i] << '\n';
  }
  return 0;
}


Measured memory_bytes: 3880
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

// graph //
int V,E,r,from,to,weight;

struct Edge{
    int from,to,cost;
    Edge(int from,int to,int cost) : from(from),to(to),cost(cost){}
};

vector<Edge> edges;

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> V >> E >> r;
    REP(i,E){
        cin >> from >> to >> weight;
        edges.emplace_back(from,to,weight);
    }

    vector<ll> dist(V,INF);
    dist[r] = 0;
    REP(i,V){
        bool update = false;
        for(auto e : edges){
            if(dist[e.to] > dist[e.from] + e.cost && dist[e.from] != INF){
                update = true;
                dist[e.to] = dist[e.from] + e.cost;
                if(i == V-1){
                    cout << "NEGATIVE CYCLE" << '\n';
                    return 0;
                }
            }
        }
        if(!update) break;
    }

    REP(i,V){
        if(dist[i]==INF) cout << "INF" << '\n';
        else cout << dist[i] << '\n';
    }
    return 0;
}


Measured memory_bytes: 3200
nums = input().split()
a = int(nums[0])
b = int(nums[1])
c = int(nums[2])

if a <= b <= c:
    print(a, b, c)

elif a <= c <= b:
    print(a, c, b)

elif b <= a <= c:
    print(b, a, c)

elif b <= c <= a:
    print(b, c, a)

elif c <= a <= b:
    print(c, a, b)

else:
    print(c, b, a)

Measured memory_bytes: 6724
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

int main()
{
    ll n=in(),m=in();
    cout<<n*(n-1)/2+m*(m-1)/2<<endl;
}


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

int arr[100003] , N;

int main(){
	cin >> N; for(int i = 1 ; i <= N ; ++i) cin >> arr[i];
	bool flag = 0;
	while(1){
		flag ^= 1; int cnt = 0; for(int i = 1 ; i <= N ; ++i) cnt ^= arr[i] - 1;
		if(cnt & 1){puts(!flag ? "Second" : "First"); return 0;}
		int id = 0;
		for(int i = 1 ; i <= N ; ++i)
			if(arr[i] & 1) if(arr[i] == 1 || id){puts(flag ? "Second" : "First"); return 0;} else id = i;
		--arr[id]; int Gcd = 0; for(int i = 1 ; i <= N ; ++i) Gcd = __gcd(arr[i] , Gcd);
		for(int i = 1 ; i <= N ; ++i) arr[i] /= Gcd;
	}
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include<algorithm>
#include <vector>
#include<string>
#include<cmath>
#include<cstdio>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define max(x,y) (((x)>(y)) ? x:y)
#define min(x,y) (((x)<(y)) ? x:y)
#define FOR(a) for(int i=0;i<a;i++)
#define ender {return 0;}
#define tosasuretu(a) (a*(a+1)/2)
inline ll kaizyo(ll);
ll gcd(ll, ll);
ll combination(ll, ll);
int main() {
	int n, k;
	cin >> n >> k;
	if (((n+1) / 2) < k) {
		cout << "NO";
	}
	else {
		cout << "YES";
	}
	return 0;
}


inline ll kaizyo(ll x) {
	long ans = 1;
	for (int z = 0; z < x; z++) {
		ans *= (x - z);
	}
	return ans;
}
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}

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

int main() {
  int a, b;
  int route[20][20];
  while(cin >> a >> b, a+b) {
    for(int i = 0; i < 20; i++) {
      for(int j = 0; j < 20; j++) {
        route[i][j] = 0;
      }
    }

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

    route[0][0] = 1;
    for(int i = 0; i < b; i++) {
      for(int j = 0; j < a; j++) {
        if(route[i][j] == -1) continue;
        if(i > 0 && route[i-1][j] != -1) route[i][j] += route[i-1][j];
        if(j > 0 && route[i][j-1] != -1) route[i][j] += route[i][j-1];
      }
    }
    cout << route[b-1][a-1] << endl;
 }
}

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

int main(){
  double n, m;
  cin >> n >> m;

  vector<int> a(n);
  double sum = 0;
  // 総得票数を数える
  for(int i = 0; i < n; i++){
    cin >> a[i];
    sum += a[i];
  }
  int count = 0;
  for(int i = 0; i < n; i++) {
    if(a[i] >= sum/(4.0*m)) count++;
  }

  if(count >= m) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
long long eu(long long C, long long D)
{
	long long a,b,r,x,tmp;
	a = C;
	b = D;
	x = a * b;

	/* 自然数 a > b を確認・入替 */
	if (a<b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	/* ユークリッドの互除法 */
	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return x / b;
}
int main()
{
	long long A, B, C, D;
	long long i, j;
	
	long long ans = 0;
	long long seki = 0;
	scanf("%lld%lld%lld%lld", &A, &B, &C, &D);
	ans = B - A + 1;
	seki = eu(C,D);

	if (C > B || D > B)
	{
		printf("0\n");
		return 0;
	}
	if (C < A)
	{
		if (D < A)
		{
			if (seki < A)
			{
				printf("%lld\n", ans - (B / C - (A-1) / C) - (B / D - (A-1) / D)
					+ (B / seki - (A-1) / seki));
			}
			else 
			{
				printf("%lld\n", ans - (B / C - (A-1) / C) - (B / D - (A-1)/ D)
					+ (B/seki));
			}
		}
		else
		{
			if (seki < A)
			{
				printf("%lld\n", ans - (B / C - (A-1) / C) - B/D
					+ (B / seki - (A-1) / seki));
			}
			else
			{
				printf("%lld\n", ans - (B / C - (A-1) / C) - B / D
					+ (B/seki));
			}
		}
	}
	else
	{
		if (D < A)
		{
			if (seki < A)
			{
				printf("%lld\n", ans - B/C - (B / D - (A-1) / D)
					+ (B / seki - (A-1) / seki));
			}
			else
			{
				printf("%lld\n", ans - B / C - (B / D - (A-1) / D)
					+ (B/seki));
			}
		}
		else
		{
			if (seki < A)
			{
				printf("%lld\n", ans - B / C - B/D
					+ (B / seki - (A-1) / seki));
			}
			else
			{
				printf("%lld\n", ans - B / C - B / D
					+ B/seki);
			}
		}

	}

	return 0;
}

Measured memory_bytes: 128
import javax.swing.plaf.IconUIResource;
import java.io.*;
import java.util.*;

class MyScanner {
    BufferedReader br;
    StringTokenizer st;

    public MyScanner() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine(){
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }

}



public class Main {

    public static PrintWriter out;
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = sc.nextInt();
        int lastDigit = n%10;
        if (lastDigit==2||lastDigit==4||lastDigit==5||lastDigit==7||lastDigit==9){
            out.println("hon");
        }else if (lastDigit==0||lastDigit==1||lastDigit==6||lastDigit==8){
            out.println("pon");
        }else {
            out.println("bon");
        }
        out.close();
    }

}


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

int main(int argc, char *argv[]) {
	int a = 0;
	int b = 0;
	std::cin >> a >> b;

	int sub = b - a;
	int tower1 = 0;
	int tower2 = 0;
	for (int i = 1; i <= sub; i++) {
		if (i <= sub - 1) {
			tower1 += i;
		}
		tower2 += i;
	}

	std::cout << (tower1 - a) << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int k,l,i;
	cin>>k;
	string str;
	cin>>str;
	l=str.length();
	if(k>=l) cout<<str;
	else
	{
		for(i=0; i<k; i++)
		{
			cout<<str[i];
		}
		cout<<"...";
	}

	return 0;
}

Measured memory_bytes: 3568
#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
    int h, w;
    cin >> h >> w;
    while(!(h == 0 && w == 0)){
        for (int i = 0; i < h; i++){
            for (int j =0; j < w; j++){
                cout << "#";
            }
            cout << endl;
        }
        cout << "" << endl;
        cin >> h >> w;
    }
}



Measured memory_bytes: 3116
n = int(input())
a = list(map(int,input().split()))
dp = [[0]*2 for _ in range(n+1)]
dp[0][0] = 0
dp[0][1] = -10**10

for i in range(n):
  dp[i+1][0] = max(dp[i][0]+a[i],dp[i][1]-a[i])
  dp[i+1][1] = max(dp[i][0]-a[i],dp[i][1]+a[i])

print(dp[n][0])
  



Measured memory_bytes: 25572
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int N, X, m[100],min_m = 10000,ans = 0;

	cin >> N >> X;

	for (int i = 0; i < N; i++) {
		cin >> m[i];
		min_m = min(min_m, m[i]);
	}

	for (int i = 0; i < N; i++) {
		if (X - m[i] >= 0) {
			ans++;
			X -= m[i];
		}
	}

	for (;;) {
		if (X - min_m >= 0) {
			X -= min_m;
			ans++;
		}
		else break;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

num = int(input())
val = factorization(num)
ans = 0
for x in val:
    if x[0] == 1: break
    val = 0
    for i in range(40):
        val += i + 1
        if x[1] < val:
            ans += i
            break
print(ans)

Measured memory_bytes: 9492
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ACurtain solver = new ACurtain();
        solver.solve(1, in, out);
        out.close();
    }

    static class ACurtain {
        public void solve(int testNumber, FastReader s, PrintWriter out) {
            int a = s.nextInt();
            int b = s.nextInt();
            out.println(Math.max(0, a - 2 * b));
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	int a,b,h;
	cin >> a >>b >> h;
	cout << (a+b)*h/2 << endl;

	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define mod 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
int main() {
	string S;
	cin>>S;
	int a[26]={};
	for(int i=0;i<4;i++)
		a[S[i]-'A']++;
	for(int i=0;i<26;i++)
		if(a[i]!=2 && a[i]!=0){
			cout<<"No"<<endl;
			return 0;
		}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
fn get_line() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn get_divisor_count(num: u64) -> u64 {
    let mut count = 0;
    for i in 1..num + 1 {
        if num % i == 0 { count += 1; }
    }
    count
}

fn main() {
    let num = get_line().parse::<u64>().unwrap();
    let mut result = 0;
    for n in (1..num + 1).filter(|&x| x % 2 != 0) {
        if get_divisor_count(n) == 8 {
            result += 1;
        }
    }
    println!("{}", result);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstring>
#include <fstream>
#include <string>
#include <cmath>
#include <algorithm>
#include <time.h>
#include <stack>
#include <vector>
using namespace std;

int main()
{
	string S, T;
	cin >> S >> T;
	int ss = S.length();
	int ts = T.length();

	int cnt = ts;
	for (int i = 0; i + ts <=ss; i++) {
		int tmp = 0;
		for (int j = 0; j < ts; j++) {
			if (T[j] != S[i + j])
				tmp++;
		}
		if (tmp < cnt)
			cnt=tmp;
	}
	cout << cnt << endl;
}

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

int main(){
    int H1, H2, M1, M2, K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    cout << (H2 * 60 + M2) - (H1 * 60 + M1) - K << endl;
}



Measured memory_bytes: 3600