akhauriyash/Code-Regression huggingface dataset:
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

# nの逆元のリスト
def inv_mod(n:int, mod:int) -> list:
    inv = [0,1]
    for i in range(2,n+1):
        inv.append(mod - ((mod//i)*inv[mod%i]) % mod)
    return inv
       
# nの階乗のリスト
def fact(n:int, mod:int) -> list:
    fac = [1,1]
    res = 1
    for i in range(2,n+1):
        res = res*i%mod
        fac.append(res)
    return fac

# nの階乗の逆元のリスト
def fact_inv(n:int, inv:list, mod:int) -> list:
    facInv = [1,1]
    for i in range(2,n+1):
        facInv.append(facInv[i-1]*inv[i] % mod)
    return facInv
        
# 二項係数
def nCr(n:int, r:int, mod:int, fac:list, facInv:list) -> int:
    if not (0<=r and r<=n):
        return 0
    
    return ((fac[n]*facInv[r]) % mod) * facInv[n-r] % mod

MOD = 998244353

k,n = li()

inv = inv_mod(n+k,MOD)
fac = fact(n+k,MOD)
facInv = fact_inv(n+k,inv,MOD)

answers = []
if k == 1:
    print(0)

else:
    for t in range(2,k+2):
        p = t//2
        ans = 0
        if t%2 == 0:
            temp = 0
            for q in range(p):
                temp = temp + nCr(p-1,q,MOD,fac,facInv) \
                              * (2**q) \
                              * nCr(n+k-2*p,n-q,MOD,fac,facInv)
                temp %= MOD
                
                temp = temp + nCr(p-1,q,MOD,fac,facInv) \
                              * (2**q) \
                              * nCr(n+k-2*p-1,n-q-1,MOD,fac,facInv)
                temp %= MOD
                
            ans = temp%MOD
        
        else:
            temp = 0
            for q in range(p+1):
                temp = temp + nCr(p,q,MOD,fac,facInv) \
                              * (2**q) \
                              * nCr(n+k-2*p-1,n-q,MOD,fac,facInv)
                temp %= MOD
            
            ans = temp%MOD
            
        answers.append(ans)
        print(ans)
        
for ans in answers[-2::-1]:
    print(ans)
    

Measured memory_bytes: 58584
from sys import stdin
#from collections import deque
from math import ceil


def ii(): return int(stdin.readline())


def fi(): return float(stdin.readline())


def mi(): return map(int, stdin.readline().split())


def fmi(): return map(float, stdin.readline().split())


def li(): return list(mi())


def lsi():
    x=list(stdin.readline())
    x.pop()
    return x


def si(): return stdin.readline()


def sieve(x):
    a=[True]*(x+1)
    sq=floor(sqrt(x))
    for i in range(3, sq+1, 2):
        if a[i]:
            for j in range(i*i, x+1, i):
                a[j]=False
    if x>1:
        p=[2]
    else:
        p=[]
    for i in range(3, x+1, 2):
        if a[i]:
            p.append(i)
    return p
#vowel={'a', 'e', 'i', 'o', 'u', 'y', 'A', 'E', 'I', 'O', 'U', 'Y'}
#pow=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 4294967296, 8589934592, 17179869184, 34359738368, 68719476736, 137438953472, 274877906944, 549755813888, 1099511627776, 2199023255552, 4398046511104, 8796093022208, 17592186044416, 35184372088832, 70368744177664, 140737488355328, 281474976710656, 562949953421312, 1125899906842624, 2251799813685248, 4503599627370496, 9007199254740992, 18014398509481984, 36028797018963968, 72057594037927936, 144115188075855872, 288230376151711744, 576460752303423488, 1152921504606846976, 2305843009213693952, 4611686018427387904, 9223372036854775808]
############# CODE STARTS HERE #############
n, m=mi()
print(ceil(n/m))

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

int main(void)
{
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; i++)
    {
        int a, b, c;
        scanf("%d", &a);
        scanf("%d", &b);
        scanf("%d", &c);
        
        if(a * a == b * b + c * c)
        {
            printf("YES\n");
            continue;
        }
        if(b * b == a * a + c * c)
        {
            printf("YES\n");
            continue;
        }
        if(c * c == b * b + a * a)
        {
            printf("YES\n");
            continue;
        }
        printf("NO\n");
    }
}



Measured memory_bytes: 2048
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <cmath>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;

template <typename T>
struct Graph_ {
		int n;
		vector<vector<pair<int, T> > > edge;
		vector<T> dis;
		Graph_(int ns) {
				n = ns;
				edge.resize(n);
				dis.resize(n);
		}
		void dijkstra(int s){
				dijkstra(s, 0);
		}
		T dijkstra(int s, int t){
				// initialize
				fill(dis.begin(), dis.end(), -1);
				vector<bool> used;
				used.resize(n);
				fill(used.begin(), used.end(), false);
				dis[s] = 0;
				// dijkstra
				priority_queue<pair<T, int>, vector<pair<T, int> >, greater<pair<T, int> > > q;
				q.push(make_pair(0, s));
				while(!q.empty()){
						pair<T, int> p = q.top(); q.pop();
						int at = p.second;
						T distance = p.first;
						used[at] = true;
						if(distance > dis[at])continue;
						for(auto itr = edge[at].begin(); itr != edge[at].end(); ++itr){
								int to = (*itr).first;
								T cost = (*itr).second;
								if(used[to])continue;
								if(dis[to] == -1 || dis[to] > distance + cost){
										q.push(make_pair(distance + cost, to));
										dis[to] = distance + cost;
								}
						}
				}
				return dis[t];
		}
		void adde(int at, int to, T cost){
				edge[to].push_back(make_pair(at, cost));
		}
};

typedef struct Graph_<int> GraphI;
typedef struct Graph_<ll> GraphL;

int n;

int main(int argc, char const* argv[])
{
	cin >> n;
	GraphL graphi(n);
	for(int i = 0; i < n - 1; i++){
			int a, b, c;
			cin >> a >> b >> c;
			a--; b--;
			graphi.adde(a, b, c);
			graphi.adde(b, a, c);
	}
	int q;
	int k;
	cin >> q >> k;
	graphi.dijkstra(k-1);
	for(int i = 0; i < q; i++){
			int x, y;
			cin >> x >> y;
			x--; y--;
			cout << graphi.dis[x] + graphi.dis[y] << endl;
	}
	return 0;
}


Measured memory_bytes: 11120
#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 0; i < n; i++ ){
    if ( i > 0 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(){
  int n, i, j;
  int key, temp;
  int A[N];
  scanf("%d", &n);

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

  trace(A, n);

  for(i=1; i<n; i++){
    key = A[i];
    j=i-1;
    while(j>=0){
      if(A[j]>key){
        A[j+1]=A[j];
      }
      else{
        break;
      }
      j--;
    }      
    A[j+1]=key;
    trace(A,n);
  }

  return 0;
}



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

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

void solve(long long N, long long K, std::vector<long long> l)
{
    sort(l.begin(), l.end());
    reverse(l.begin(), l.end());
    int ans = 0;
    for(int i = 0; i < K; i++)
    {
        ans += l[i];
    }

    cout << ans << endl;
    
}

int main()
{
    long long N;
    scanf("%lld", &N);
    long long K;
    scanf("%lld", &K);
    std::vector<long long> l(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &l[i]);
    }
    solve(N, K, std::move(l));
    return 0;
}


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

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

    vector<long long int> vec;

    long long int input;

    for(int i=0; i < n; i++)
    {
        cin>> input;
        vec.push_back(input);
    }

    sort(vec.begin(),vec.end());

    reverse(vec.begin(),vec.end());

    long long int high = 0,temp;
    bool x = true;
    bool ans = false;


    for(int i = 0; i < n; i++)
    {
        if(!x)
        {
            if(vec[i] ==vec[i+1])
            {
                cout<< temp*vec[i] << "\n";
                ans = true;
                break;
            }


        }
        else
        {

            if(vec[i] == vec[i+1])
                high++;
            else
            {

                if(high >=3)
                {
                    cout<< vec[i]*vec[i] << "\n";
                    ans = true;
                    break;
                }

                else if(high >= 1)
                {
                    x = false;
                    temp = vec[i];


                }

            }


        }

    }

    if(!ans)
        cout<< 0;


    return 0;



}






Measured memory_bytes: 4220
n,m=map(int,input().split())
n=int(n)
m=int(m)
a=list(map(int,input().split()))
sum=0
for i in a:
  sum+=i
ave=sum/(4*m)
product=0
for i in a:
  if i>=ave:
    product+=1
if product>=m:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
N, M = map(int,input().split())
favorite_lists = []
merged = []
count = 0
for _ in range(0, N):
    favorite_lists.append(input().split()[1:])
for l in favorite_lists:
    merged.extend(l)
for key in range(0, M+1):
    if merged.count(str(key))==N:
        count+=1
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  string s, t;
  cin >> s >> t;

  vector<char> S;
  rep(i,s.size()) S.push_back(s[i]);
  sort(S.begin(), S.end());

  string ss = "";
  rep(i,S.size()) ss += S[i];

  vector<char> T;
  rep(i,t.size()) T.push_back(t[i]);
  sort(T.begin(), T.end());
  reverse(T.begin(), T.end());

  string tt = "";
  rep(i,T.size()) tt += T[i];

  if (ss < tt) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3636
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int x = Integer.parseInt(sc.next());
        int n = Integer.parseInt(sc.next());
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(Integer.parseInt(sc.next()));
        }
        sc.close();

        // 主処理
        int min = 1;
        for (int i = x; 0 <= i; i--) {
            if (!list.contains(i)) {
                min = i;
                break;
            }
        }
        int max = 100;
        for (int i = x; i <= 101; i++) {
            if (!list.contains(i)) {
                max = i;
                break;
            }
        }
        int minDiff = x - min;
        int maxDiff = max - x;
        boolean judge = minDiff <= maxDiff;
        int result = judge ? min : max;

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 35760
#include <iostream>
#define lli long long int
using namespace std;

int main()
{
    lli n,k = 1;
    cin >> n;
    lli a[n], b[n];
    for(lli i = 0; i < n; i++)
    {
        cin >> a[i];
        b[a[i] - 1] = k++;
    }
    for(lli i = 0; i < n; i++)
    {
        cout << b[i] << " ";    
    }
    
    return 0;
}


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

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

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

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	int n;
	cin>>n;
	vector<int> v(n),c(n);
	for(int i = 0; i < n; i++){
		cin>>v[i];
	}
	for(int i = 0; i < n; i++){
		cin>>c[i];
		v[i] -= c[i];
	}
	int ans = 0;
	for(int i = 0; i < n; i++){
		if (v[i]>=0)
		{
			ans += v[i];
		}
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int n;
	int c[21], v[21];
	int ans = 0;

	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", v + i);
	}
	for (int i = 0; i < n; i++) {
		scanf("%d", c + i);
	}

	for (int i = 0; i < n; i++) {
		if (v[i] - c[i] > 0) {
			ans += v[i] - c[i];
		}
	}

	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
ll modpow(ll a, ll n, int mod) {
	ll r = 1; a %= mod;
	while (n) r = r * ((n % 2) ? a : 1) % mod, a = a * a % mod, n >>= 1;
	return r;
}
vector<ll> LagrangePolynomialGetCoefficient(vector<pair<int, int>> points, int mod) {
	int N = points.size();
	vector<ll> polynomial(N + 1);
	polynomial[0] = 1;
	fore(p, points) {
		vector<ll> tmp(N + 1);
		rep(i, 0, N) tmp[i + 1] = polynomial[i];
		rep(i, 0, N) tmp[i] = (tmp[i] - ((polynomial[i] * p.first) % mod) + mod) % mod;
		swap(polynomial, tmp);
	}

	vector<ll> res(N);

	rep(i, 0, N) if (points[i].second) {
		ll Q = 1;
		rep(j, 0, N) if (j != i) Q = Q * (points[i].first - points[j].first) % mod;
		Q = modpow((Q % mod + mod) % mod, mod - 2, mod);

		vector<ll> tmp(N + 1);
		rep(j, 0, N + 1) tmp[j] = polynomial[j];
		rrep(j, N, 1) {
			Q %= mod;
			res[j - 1] = (res[j - 1] + ((tmp[j] * Q) % mod) * points[i].second) % mod;
			tmp[j - 1] = (tmp[j - 1] + tmp[j] * points[i].first) % mod;
		}
	}

	rep(i, 0, N) res[i] %= mod;
	return res;
}
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/













int P, A[3030];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> P;
	rep(i, 0, P) cin >> A[i];

	vector<pair<int, int>> ps;
	rep(i, 0, P) ps.push_back({ i, A[i] });

	auto ans = LagrangePolynomialGetCoefficient(ps, P);

	rep(i, 0, P) {
		if (i) printf(" ");
		printf("%lld", ans[i]);
	}
	printf("\n");
}









Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
#include <string>
#include <queue>
using namespace std;

int n,x,l[505],now=1,d[505];

int main(void){
	scanf("%d %d",&n,&x);
	for(int i=1;i<=n;i++)
	scanf("%d",&l[i]);
	d[1]=0;
	while(now<=n){
		d[++now]=d[now-1]+l[now-1];
		if(d[now]>x){
			now--;
			break;
		}
	}
	printf("%d",now);
}


Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#define MOD 1000000007
#define MAX(a,b) (a>b?a:b)
#define MAX3(a,b,c) MAX(a,MAX(b,c))
#define MIN(a,b) (a<b?a:b)
#define MIN3(a,b,c) MIN(a, MIN(b,c))
typedef long long lli;

int main()
{
    int i;
    char s[4];
    scanf("%s",s);
    for(i=0; i<3; i++) {
        if(s[i]==s[i+1]) {
            printf("Bad");
            return 0;
        }
    }
    printf("Good");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
using namespace std;
const int MAX = 10000001;
bool p[MAX];

int main(){
	p[0] = p[1] = 1;
	for(int i = 2; i*i < MAX; ++i) {
		if(!p[i]) {
			for(int j = i*i; j < MAX; j+=i) {
				p[j] = 1;
			}
		}
	}
	int n;
	while(cin >> n, n) {
		for(int i = n; i >= 13; i--) {
			if(!p[i] && !p[i-2] && !p[i-6] && !p[i-8]) {
				cout << i << endl;
				break;
			}
		}
	}
}

Measured memory_bytes: 10924
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    int n;
    cin >> n;
    int ans = 0;

    for(int i = 1; i < n+1; i+=2){
        int cnt = 0;
        reps(j,1,n+1){
            if(i % j == 0) cnt++;
        }
        if(cnt == 8){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=410;
bitset <N> g[N];
struct node{int u,v;}e[100010];
int n,m,f[N];

int main()
{
//	freopen("D:\\3.txt","r",stdin);
//	freopen("c.in","r",stdin);
//	freopen("c.out","w",stdout);
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++) scanf("%d%d",&e[i].u,&e[i].v);
    for(int i=1;i<=n;i++)
    {
        g[i][i]=1;
        for(int j=m;j;j--)
        {
            int u=e[j].u,v=e[j].v;
            if(g[i][u]&&g[i][v]) {f[i]=1;break;}
            if(g[i][u]||g[i][v]) g[i][u]=g[i][v]=1;
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++)
        if(!f[i])
            for(int j=i+1;j<=n;j++)
                if(!f[j]&&(g[i]&g[j]).none())
                    ++ans;
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;
#define LL long long

int N,P[200002];

int main(){
	cin>>N;
	for(int i=0;i<N;i++)cin>>P[i];
	int mini=200002,ans=0;
	for(int i=0;i<N;i++){
		if(mini>=P[i]){
			mini=P[i];
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

/*
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;
#define LL long long

int N,M;
string S;

int main(){
	cin>>N>>M;
	for(int i=0;i<max(N,M);i++)S+=to_string(min(N,M));
	cout<<S<<endl;
	return 0;
}


*/

/*
#include<iostream>
#include<algorithm>

using namespace std;
#define LL long long

int N,M;

int main(){
	cin>>N>>M;
	cout<<(N==M?"Yes":"No")<<endl;
	return 0;
}


*/

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

int main() {
    int A,B,C;
    cin >> A >> B >> C;
    int res;
    if(C <= B) res = C + B;
    else if(C <= A + B) res = C + B;
    else res = A + B + 1 + B;

    cout << res << endl; 
}

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

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(){

  string a,b,c;cin>>a>>b>>c;
  char dif='A'-'a';


  cout<<char(a[0]+dif)<<char(b[0]+dif)<<char(c[0]+dif)<<endl;

  return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (in i = 0; i < (in)(n); i++)
#define REP(i,a,b) for(in i=(in)(a);i<(in)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const in inf=1e9+7;
using P=pair<in,in>;
vector<in> dx={0,1,-1,0};
vector<in> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    in n;
    cin>>n;
    vector<in> a(n);
    rep(i,n) cin>>a[i];
    sort(all(a));
    reverse(all(a));
    in ans=0ll;
    in now=0;
    in cnt=1;
    rep(i,n){
        if(i==0) continue;
        ans +=a[now];
        if(cnt==0) cnt ++;
        else {now ++;cnt=0;}
    }
    cout<<ans<<endl;
}/*
./problem.exe
*/

Measured memory_bytes: 4772
n, t = map(int, input().split())
lc = []
lt = []
for i in range(n):
    c, tt = map(int, input().split())
    lc.append(c)
    lt.append(tt)

cost = 1001
for i in range(n):
    if lt[i] <= t:
        if lc[i] < cost:
            cost = lc[i]
if cost == 1001:
    print('TLE')
else:
    print(cost)

Measured memory_bytes: 3064
#include"bits/stdc++.h"
#define ll long long
#define inf 100005
#define mod 1000000007
using namespace  std;

vector<vector<ll>>g(inf);
vector<ll>indgree(inf);
vector<ll>dist(inf);
bool visted[inf];



int main(){
	float n,x,t;
	cin>>n>>x>>t;
	ll res=ceil(n/x)*t;
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 7044
import java.util.*;
import java.lang.*;
class Main{
	static long findProSum(long a[], int n) {
		 long sum = 0 ;
		 long mod=(long)Math.pow(10, 9)+7; 
	        
	        long dp[]=new long[n];
	        for(int i=n-1;i>=0;i--)
	        {
	            dp[i] = sum;
	            sum=(sum%mod+a[i]%mod)%mod;
	        }
	        
	        sum = 0 ;
	        
	        for(int i=0;i<n;i++)
	        {
	            sum =(sum%mod+ a[i]%mod*dp[i]%mod)%mod;
	        }
	        return sum;
	}

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		long a[]=new long[n];
		for(int i=0;i<n;i++) a[i]=sc.nextLong();
		long sum= findProSum(a,a.length);
		System.out.println(sum);

	}

}


Measured memory_bytes: 60928
import static java.lang.System.out;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();

        int counter = 0;

        while (a <= b) {
            if(c % a == 0) {                                           
                counter += 1;
            }
            a += 1;
        }

        out.println(counter);
    }   
}

Measured memory_bytes: 26284
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ar array
 
int main() {
    ll n;
    cin>>n;
   ll a[n];
    ll cnt=0;
    for(ll i=1;i<=n;i++)
    {
        cin>>a[i];
        if(i%2==1 && a[i]%2==1)
        {
            cnt++;
        }
    }
    cout<<cnt;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16000000")
using namespace std;

typedef long long ll;
typedef pair <int, int> ii;

const int Maxn = 100005;

int n;
ll D[Maxn];
map <ll, ll> M;
map <ll, int> ind;
vector <ii> res;
vector <int> neigh[Maxn];
ll cor;

ll Solve(int v, int p, int cur)
{
    ll res = cur;
    for (int i = 0; i < neigh[v].size(); i++) {
        int u = neigh[v][i];
        if (p == u) continue;
        res += Solve(u, v, cur + 1);
    }
    return res;
}

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%lld", &D[i]);
        ind[D[i]] = i;
        M[D[i]] = 0;
    }
    sort(D, D + n);
    for (int i = n - 1; i > 0; i--) {
        ll my = M[D[i]] + 1;
        if (my >= n - my) { printf("-1\n"); return 0; }
        ll need = D[i] + 2ll * ll(my) - ll(n);
        map <ll, ll>::iterator it = M.find(need);
        if (it == M.end()) { printf("-1\n"); return 0; }
        it->second += my;
        int A = ind[D[i]], B = ind[need];
        neigh[A].push_back(B);
        neigh[B].push_back(A);
        res.push_back(ii(A, B));
    }
    if (M[D[0]] != n - 1) { printf("-1\n"); return 0; }
    if (Solve(ind[D[0]], -1, 0) != D[0]) { printf("-1\n"); return 0; }
    for (int i = 0; i < n - 1; i++)
        printf("%d %d\n", res[i].first + 1, res[i].second + 1);
    return 0;
}


Measured memory_bytes: 24820
N,M = map(int,input().split())
sum1 = 1
if N > 1:
    for i in range(2):
        sum1 = sum1 * N
        N -= 1
    sum1 /= 2
else:
    sum1=0
sum2 = 1
if M > 1:
    for i in range(2):
        sum2 *= M
        M -= 1
    sum2 /= 2
else:
    sum2 = 0
print(int(sum1+sum2))


Measured memory_bytes: 3316
x,y=map(int,input().split())

if x==2 or y==2:
    print('No')
elif x==4:
    if y==6 or y==9 or y==11:
        print('Yes')
    else :
        print('No')
elif x==6:
    if y==9 or y==11:
        print('Yes')
    else :
        print('No')
elif x==9:
    if y==11:
        print('Yes')
    else :
        print('No')
elif x==11:
    print('No')
else :
    print('Yes')

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

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

Measured memory_bytes: 256
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def No(): print('No')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

H,W = imn()
A = [input() for _ in range(H)]

cnt = 0
for i in range(H):
    for j in range(W):
        if A[i][j] == '#': cnt += 1

print('Possible' if cnt == (H+W-1) else ('Impossible'))
        

Measured memory_bytes: 5292
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

#ifdef MY_DEBUG_FLAG
template<typename T> void debug(T a) { cerr << a << ' '; }
template<typename T, typename U> void debug(pair<T, U> a) { cerr << a.first << ' ' << a.second << ' '; }
template<typename T> void debug(vector<T> a) { for(auto it : a) debug(it);}
template<typename T> void debug(set<T> a) { for(auto it : a) debug(it);}
#define db(a) cerr << "DEBUG ( " << #a << " == "; debug(a); cerr << ")\n"
#else
#define db(...)
#endif

#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false), cout.tie(nullptr), cin.tie(nullptr)
#define sz(a) ((int)(a).size())
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define dec(i,n,a) for(int i=(n); i>=(a); i--)
#define clr(a,v) memset(a, v, sizeof(a))
#define all(a) (a).begin(),(a).end()

constexpr int inf = 0x3f3f3f3f;
constexpr int MAXN = 1e5 + 10;
constexpr int mod = 1000000007;

int main() {
	int n; scanf("%d", &n);
	vi a(n);
	rep(i,0,n) scanf("%d", &a[i]);
	vector<vector<ll>> dp(n+1, vector<ll>(n+1));
	for(int i = n-1; i >= 0; i--) {
		dp[i][i] = a[i];
		for(int j = i+1; j < n; j++) {
			dp[i][j] = max(a[i] - dp[i+1][j], a[j] - dp[i][j-1]);
		}
	}
	printf("%lld\n", dp[0][n-1]);
}


Measured memory_bytes: 73768
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstdlib>
#include <stack>
#include <vector>
#define INF 0x3f3f3f3f
#define MOD 1000000009
# define FOR(i,a,n) for(register int i=a; i<=n; ++i)
# define FDR(i,a,n) for(register int i=a; i>=n; --i)
typedef long long ll;
typedef unsigned long long ull;

inline int scan() {
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}
inline void Out(int a) {
    if(a<0) {putchar('-'); a=-a;}
    if(a>=10) Out(a/10);
    putchar(a%10+'0');
}
using namespace std;
const int maxn = 100005;
struct A
{
    int l, r;
};
A node[maxn];
bool cmp(A a, A b)
{
    if(a.l != b.l)return a.l < b.l;
    else return a.r < b.r;
}
int main()
{
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    FOR(i,1,m)cin >> node[i].l >> node[i].r;
    sort(node+1, node+1+m, cmp);
    int ans = 1;
    int lr = node[1].r;
    FOR(i,1,m)
    {
        if(node[i].l >= lr){
            ans++;
            lr = node[i].r;
        }
        else lr = min(node[i].r, lr);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  cin >> A >> B;
  int N = 0;
  
  for (A; A <= B; A++) {
    if (A / 10000 == A - (A / 10) * 10 && A / 1000 - (A / 10000) * 10 == A / 10 - (A / 100) * 10) {
      N += 1;
    }
  }
  cout << N << endl;
}

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

typedef long long ll;

int main() {
  int P, Q, R;
  std::cin >> P >> Q >> R;
  int ans = P + Q;
  ans = std::min(ans, P + R);
  ans = std::min(ans, Q + R);
  std::cout << ans << std::endl;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from itertools import combinations
def main():
    X = int(readline())
    p = [int(i) for i in range(-1000, 1001)]
    for b, a in combinations(p, 2):
        if a**5 - b**5 == X:
            A = a
            B = b
            break
    print(A, B)
if __name__ == '__main__':
    main()

Measured memory_bytes: 9324
import java.util.*;

class Main {

    static int gcd(int a, int b) {
        return b > 0 ? gcd(b, a % b) : a;
    }

    static int lcm(int a, int b) {
        return a * b / gcd(a, b);
    }

    public static void main(String[] args) {

        long a = 0;
        long b = 0;
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();

        for (int i = -256; i < 255; i++) {
            for (int j = -256; j < 255; j++) {
                if (i != j && x % (i - j) == 0) {
                    long tmpx = x / ((long) i - (long) j);
                    if ((long) (i * i * i * i) + (long) (i * i * i * j) + (long) (i * i * j * j)
                            + (long) (i * j * j * j) + (long) (j * j * j * j) == tmpx) {
                        a = i;
                        b = j;
                    }
                }
            }
        }

        System.out.println(a + " " + b);
        sc.close();
    }
}


Measured memory_bytes: 38848
#include <iostream>
#include <vector>

using namespace std;

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

    vector<int> m(n);
    for (int i = 0; i < n; ++i)
        cin >> m[i];

    int count = 0;
    int min_index = 0;
    for (int i = 0; i < n; ++i) {
        if (x - m[i] >= 0) {
            x -= m[i];
            ++count;
        }

        if (m[i] < m[min_index])
            min_index = i;
    }

    while (x - m[min_index] >= 0) {
        x -= m[min_index];
        ++count;
    }

    cout << count << '\n';
}


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

const int MOD = 1e9 + 7;
inline int add(int a, int b) {
  return a + b >= MOD ? a + b - MOD : a + b;
}
inline int mul(int a, int b) {
  return (a * 1ll * b) % MOD;
}
int modpow(int a, int n) {
  int res = 1;
  for (; n > 0; n >>= 1) {
    if (n & 1) res = mul(res, a);
    a = mul(a, a);
  }
  return res;
}
inline int modinv(int a) {
  return modpow(a, MOD - 2);
}

const int MAX = 1e6 + 1;
int f[MAX];

int main() {
  int n; cin >> n;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int x; cin >> x;
    ans = add(ans, modinv(x));
    for (int p = 2; p * p <= x && x > 1; p++) {
      int cur = 0;
      while (x % p == 0) {
        cur++;
        x /= p;
      }
      f[p] = max(f[p], cur);
    }
    f[x] = max(f[x], 1);
  }
  
  for (int p = 2; p < MAX; p++) {
    ans = mul(ans, modpow(p, f[p]));
  }
  cout << ans << endl;
  
  return 0;
}


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

long long N, K, H[100009], dp[100009];

int main() {
	cin >> N; K = 2;
	for (int i = 1; i <= N; i++) cin >> H[i];
	for (int i = 1; i <= N; i++) dp[i] = (1LL << 60);
	dp[1] = 0;
	for (int i = 2; i <= N; i++) {
		for (int j = i - K; j <= i - 1; j++) {
			if (j <= 0) continue;
			dp[i] = min(dp[i], dp[j] + abs(H[j] - H[i]));
		}
	}
	cout << dp[N] << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define REP(i, m, n) for (int i = m; i < n; i++)
#define rep(i, n) REP(i, 0, n)
using ld = long double;
constexpr ld EPS = 1e-12;

// Ax^2 + Bx + C = 0 (0 < x < R)
ld solve(ld A, ld B, ld C, ld R)
{
  if (fabs(A) < EPS)
  {
    if(fabs(B) < EPS)
    return 1e18;
    ld ans = -C / B;
    if (ans > 0 and ans < R + EPS)
      return ans;
    else
      return 1e18;
  }

  ld D = B * B - 4.0 * A * C;
  if (D < 0)
    return 1e18;

  ld ans1;
  if (B > 0)
    ans1 = (-B - sqrtl(D)) / 2.0 / A;
  else
    ans1 = (-B + sqrtl(D)) / 2.0 / A;
  ld ans2 = C / (A * ans1);
  if (ans1 > ans2)
    swap(ans1, ans2);
  if (ans1 > 0 and ans1 < R + EPS)
    return ans1;
  else if (ans2 > 0 and ans2 < R + EPS)
    return ans2;
  else
    return 1e18;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);

  while (1)
  {
    int n;
    cin >> n;
    if (n == 0)
      break;
    vector<ld> px(n), py(n), pz(n), vx(n), vy(n), vz(n), r(n), vr(n);
    rep(i, n) cin >> px[i] >> py[i] >> pz[i] >> vx[i] >> vy[i] >> vz[i] >> r[i] >> vr[i];
    vector<ld> disapp(n), ans(n);
    vector<pair<ld, pair<int, int>>> v;
    rep(i, n)
    {
      ans[i] = disapp[i] = r[i] / vr[i];
    }
    rep(i, n) REP(j, i + 1, n)
    {
      ld A = 0.0, B = 0.0, C = 0.0; // 距離の2乗が At^2 + Bt + C
      C += (px[i] - px[j]) * (px[i] - px[j]);
      C += (py[i] - py[j]) * (py[i] - py[j]);
      C += (pz[i] - pz[j]) * (pz[i] - pz[j]);
      B += 2.0 * (px[i] - px[j]) * (vx[i] - vx[j]);
      B += 2.0 * (py[i] - py[j]) * (vy[i] - vy[j]);
      B += 2.0 * (pz[i] - pz[j]) * (vz[i] - vz[j]);
      A += (vx[i] - vx[j]) * (vx[i] - vx[j]);
      A += (vy[i] - vy[j]) * (vy[i] - vy[j]);
      A += (vz[i] - vz[j]) * (vz[i] - vz[j]);
      ld P, Q;
      ld D, E, F; // 半径の和の2乗が Dt^2 + Et + F
      P = r[i] + r[j];
      Q = -(vr[i] + vr[j]);
      F = P * P, E = 2.0 * P * Q, D = Q * Q;
      ld t = solve(A - D, B - E, C - F, min(disapp[i], disapp[j]));
      v.push_back({t, {i, j}});
    }
    sort(begin(v), end(v));
    vector<bool> used(n, false);
    for (auto pp : v)
    {
      ld t = pp.first;
      int i = pp.second.first;
      int j = pp.second.second;
      if (used[i] || used[j])
        continue;
      ans[i] = min(ans[i], t);
      ans[j] = min(ans[j], t);
      used[i] = used[j] = true;
    }
    rep(i, n) cout << ans[i] << "\n";
  }

  return 0;
}


Measured memory_bytes: 4660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i))
#define mat(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define each(x,y) for(auto &(x):(y))
#define var(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { cin >> first; Scan(rest...); }
#define vec(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
#define em emplace
#define pb pop_back
#define fi first
#define se second
#define get(a, i) get<i>(a)
#define bit_count __builtin_popcount
#define mt make_tuple
inline string zero(int a,string s,char c='0'){return string(a-len(s),c)+s;}
inline string zero(int a,int t,char c='0'){return zero(a, to_string(t), c);}
inline string zero(int a,ll t,char c='0'){return zero(a, to_string(t), c);}
#define mini min_element
#define maxi max_element
#define sum accumulate
#define chmax(a,b) if(a<b)a=b
#define chmin(a,b) if(a>b)a=b
template <class T> inline void print(T t){cout << t << '\n';}
template <class H, class... T> inline void print(H h, T... t){cout << h << " ";print(t...);}
ll A[1010];
ll solve() {
	var(int, n, k);
	int a;
	rep(i, 0, n) {
		cin >> a;
		A[i + 1] = A[i] + a;
	}
	vll B, T;
	B.reserve(n * (n + 1));
	T.reserve(n * (n + 1));
	rep(i, 0, n) {
		rep(j, i + 1, n + 1) {
			B.eb(A[j] - A[i]);
		}
	}
	ll ans = 0;
	rrep(i, 40, -1) {
		T.clear();
		each(b, B) {
			if (b >> i & 1) {
				T.eb(b);
			}
		}
		if (len(T) >= k) {
			ans |= 1LL << i;
			B.clear();
			B = T;
		}
	}
	return ans;
}
int main() {
	print(solve());
	return 0;
}


Measured memory_bytes: 7936
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    char a, b;
    cin >> a >> b;
    if(a > b){
        cout << ">";
    }
    else if(a < b)
    {
        cout << "<";
    }
    else
    {
        cout << "=";
    }
    
    cout << endl;    
}


Measured memory_bytes: 256
// Problem : B - Mix Juice
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define int long long
#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define db1(x) cout<<#x<<"="<<x<<endl
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<endl
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define rep2(i,a,b) for(int i = a; i >= b; i--)
#define die return 0;

using namespace std;

typedef long long ll;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > pii;

int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

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

while(testcases--)
{
int n,k;	
cin>>n>>k;
vector<int> vec(n);
rep(i,0,n-1)
	cin>>vec[i];
sort(vec.begin(),vec.end());
 int s=0;
rep(i,0,k-1)
	s+=vec[i]; 
cout<<s<<'\n';
}

return 0;
}


Measured memory_bytes: 3624
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        char x = a.charAt(0);
        char y = b.charAt(0);
        if(x > y) System.out.println(">");
        else if(x < y) System.out.println("<");
        else System.out.println("=");
    }
}

Measured memory_bytes: 23764
# -*- coding: utf-8 -*-
n = int(input())
v = [int(i) for i in input().split()]

v.sort()
while len(v) > 1:
    tmp1 = v.pop(0)
    tmp2 = v.pop(0)
    v.append((tmp1 + tmp2) / 2)
    v.sort()
print(v[0])

Measured memory_bytes: 3060
#include <iostream>
 
using namespace std;
 
int A[100001];
 
int main() {
  int n, m;
  cin >> n >> m;
  for(int i=0;i<m;i++) {
    int l, r;
    cin >> l >> r;
    A[l-1]++;
    A[r]--;
  }
  int hgt = 0;
  int cnt = 0;
  for(int i=0;i<n;i++) {
   	hgt += A[i];
    if(hgt==m) cnt++;
  }
  cout << cnt << "\n";
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
using namespace std;
string str;

int main(void)
{
	cin >> str;
	if (str[5] == '1')
	{
		cout << "TBD" << endl;
	}
	else
	{
		if (str[6] == '1' || str[6] == '2' || str[6] == '3')
		{
			cout << "Heisei" << endl;
		}
		else if (str[6] == '4')
		{
			if (str[8] == '3')
			{
				if (str[9] == '1')
				{
					cout << "TBD" << endl;
				}
				else
				{
					cout << "Heisei" << endl;
				}
			}
			else
			{
				cout << "Heisei" << endl;
			}
		}
		else
		{
			cout << "TBD" << endl;
		}
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
int n,r;
int main(){
	cin>>n>>r;
	if(n>=10){
		cout<<r<<endl;
	}
	else{
		cout<<r+(10-n)*100<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 #define int long long
#define all(X) (X).begin(), (X).end()
#define reset(X) memset(X, 0, sizeof(X))
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define endl '\n'
#define fi first
#define se second

 
 
using namespace __gnu_pbds;
using namespace std;
 const int mod=1e9+7;
 // const int mod=998244353;
const int INF=4e18+10;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
#define read(n) int n; cin>>n;
#define readv(x, n) vector<int> x(n); for(auto &i:x) cin>>i; 
int multiply(int a, int b, int in_mod){return (a*b)%in_mod;} 
int mult_identity(int a){return 1;}


auto power(auto a, int b, int in_mod)
{
    auto prod=mult_identity(a);
    auto mult=a%in_mod;
    while(b!=0)
    {
        if(b%2)
        {
            prod=multiply(prod,mult, in_mod);
        }
        mult=multiply(mult, mult,in_mod);
        b/=2;
    }
    return prod;
}
int mod_inv(int q, int in_mod)
{

    return power(q, in_mod-2,in_mod);
}


 
void solve()
{     
    int a, b, c, d;
    cin>>a>>b>>c>>d;
    while(true)
    {
        c-=b;
        if(c<=0)
        {
            cout<<"Yes"<<endl;
            return ;
        } 
        a-=d;
        if(a<=0)
        {
            cout<<"No"<<endl;
            return ;
        }

    }
}

 
 
signed main()
 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);  
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        if(fopen("INPUT.txt","r"))
        {
            freopen ("INPUT.txt" , "r" , stdin);
            freopen ("OUTPUT.txt" , "w" , stdout);
        }
    #endif
    auto clk=clock(); 
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    // -------------------------------------Code starts here---------------------------------------------------------------------     
 
    int t=1;
    // cin>>t;
    for(int test=1;test<=t;test++)
    {
        // cout<<"Case #"<<test<<": ";
        solve();
        // cout<<endl;
 
    }
 
    // -------------------------------------Code ends here------------------------------------------------------------------
 
 
    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
    return 0;
 }


Measured memory_bytes: 3808
#include<stdio.h>
#include<stdbool.h>
int main(void)
{
    int n,i,num1,num2,num4;
    bool objective;

    scanf("%d",&n);

    int a[n];

    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    num1=num2=num4=0;
    for(i=0;i<n;i++)
        if(a[i]%4)
            if(a[i]%2) num1++;
            else num2++;
        else
            num4++;
    if(!num2&&num4>=num1-1)
        objective=true;
    else if(num4>=num1)
        objective=true;
    else
        objective=false;
    if(objective)
        printf("Yes");
    else
        printf("No");
    return 0;
}


Measured memory_bytes: 512
S = input() [::-1]
ans = 0
mod = 0
ten = 1
count = [0]* 2019
count[0] = 1
for i in range(len(S)):
    mod = (mod + int(S[i]) * ten) % 2019
    ten = ten*10 % 2019
    count[mod] += 1
for c in count:
    ans += c*(c-1)//2
print(ans)


Measured memory_bytes: 9328
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);       
		int n = Integer.parseInt(sc.next());
		long[] a = new long[n];
		Map<Long, Integer> map = new HashMap<>();
        for(int i=0; i<n; i++) {
            a[i] = Long.parseLong(sc.next());
            if(map.containsKey(a[i])) map.put(a[i], map.get(a[i])+1);
            else map.put(a[i], 1);
        }
        long ans = 0;
        for(Long key : map.keySet()) {
            if(map.get(key) >= key) ans += map.get(key)-key;
            else ans += map.get(key);
        }
        System.out.println(ans);
	}
}

Measured memory_bytes: 52436
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int n,k,l;
  cin>>n>>k>>l;
  
  UnionFind auni(n),buni(n); 
  int p,q;
  REP(i,k){
    cin>>p>>q;
    p--;q--;
    auni.connect(p,q);
  }
  int r,s;
  REP(i,l){
    cin>>r>>s;
    r--;s--;
    buni.connect(r,s);
  }
  
  map<pair<int,int>,int> mp;
  REP(i,n){
    mp[make_pair(auni.root(i),buni.root(i))] += 1;
  }
  REP(i,n){
    cout<<mp[make_pair(auni.root(i),buni.root(i))]<<endl;
  } 
  return 0;
}


Measured memory_bytes: 13568