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

using namespace std;
using ll = long long;

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

const int mod = 1e9 + 7;

ll sum(ll l, ll r) { return (r - l + 1) * (l + r) / 2; }

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

  ll a[n + 2];
  a[0] = 0;
  rep(i, n + 1) a[i + 1] = a[i] + i;

  ll ans = 0;
  for (int i = k; i <= n + 1; ++i) {
    ll mn = a[i], mx = a[n + 1] - a[n + 1 - i];
    // ll mn = sum(0, i - 1);
    // ll mx = sum(n - i + 1, n);
    ans += (mx - mn + 1) % mod;
    // ans %= mod;
  }
  ans %= mod;
  cout << ans << endl;

  return 0;
}


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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  double h, h_max = 0, h_min = 1e7;
  while (cin >> h) {
    h_max = max(h_max, h);
    h_min = min(h_min, h);
  }
  cout << h_max - h_min << endl;

  return 0;
}


Measured memory_bytes: 3228
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define dcml(n) fixed<<setprecision(n)
using namespace std;

ll N;ll ans=0;
vi a;
void exhaustiveSearch(ll i, ll n, ll sm){
    if(i==N){
        sm+=n;
        ans+=sm;
        return;
    }

    exhaustiveSearch(i+1,a[i],sm+n);//+
    exhaustiveSearch(i+1,n*10+a[i],sm);//not +


}
int main(void){
    string S;cin>>S;
    N=S.size();
    a.resize(N);
    REP(i,N){
        a[i]=(S[i]-'0');
    }
    exhaustiveSearch(0,0,0);
    cout<<ans/2<<"\n";
    
}


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

using namespace std;

int main(){
    int T[2];
    cin >> T[0] >> T[1];
    long A[2], B[2];
    cin >> A[0] >> A[1];
    cin >> B[0] >> B[1];

    long g[2];
    for(int i=0; i<2; i++){
        g[i] = (A[i] - B[i]) * T[i];
    }


    if(g[0] + g[1] == 0){
        cout << "infinity" << endl;
        return 0;
    }

    if( (g[0] > 0 && g[0] + g[1] > 0) || (g[0] < 0 && g[0] + g[1] < 0)){
        cout << 0 << endl;
        return 0;
    }

    long d = g[0] + g[1];

    long ans = abs(g[0]) / abs(d) * 2;
    if(abs(g[0]) % abs(d) != 0){
        ans++;
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <utility>
#include <functional>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define rem(i,n,x) for(int i=n;i>x;i--)
#define SORT(x) sort(x.begin(),x.end())
#define REV(x) reverse(x.begin(),x.end())
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define setp(x) setprecision(x)
using LL = long long;
using ULL = unsigned long long;

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

	while (n) {
		vector<int> income(n);
		rep(i, 0, n) cin >> income[i];

		int sum = 0;
		rep(i,0,n) sum += income[i];
		int ave = sum / n, ans = 0;

		rep(i, 0, n) {
			if (income[i] <= ave) ans++;
		}

		cout << ans << endl;

		cin >> n;
	}

	return 0;
}


Measured memory_bytes: 3100
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#import bisect
#import numpy as np
#from copy import deepcopy
#from collections import deque
#from decimal import Decimal

INF = 1 << 50



def run():
    N = int(input())
    lasts = defaultdict(lambda:[])
    lengths = set()
    S = []
    for i in range(N):
        s = input()
        S.append(s)
        lasts[s[1:]].append(i)
        lengths.add(len(s)-1)
    #print(lasts)
    #print(lengths)
    ans = 0
    for s in S:
        for l in lengths:
            if l == 0:
                if '' in lasts.keys():
                    for k in lasts['']:
                        if S[k][0] in s:
                            ans += 1
                            #print(s, l, S[k])
            else:
                if s[-l:] in lasts.keys():
                    for k in lasts[s[-l:]]:
                        if S[k][0] in s[:-l]:
                            ans += 1
                            #print(s, l, S[k])

    print(ans-N)



    

if __name__ == "__main__":
    run()

Measured memory_bytes: 218384
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2242

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

struct Era{

	int from;
	int to;
	string name;

	Era(string era, int w,int g): name(era),from(g - w),to(g){}

	bool isEra(int g){
		return from < g && g <= to;
	}

	void print(int g){
		cout << name << " " << g - from << endl;
	}
};

int main()
{
	int N,Q;
	
	while(cin >> N >> Q && N)
	{
		vector<Era> eras;

		string name;
		int year_w, year_g;
		rep(nth,N)
		{
			cin >> name >> year_w >> year_g;
			eras.push_back(Era(name,year_w, year_g));
		}

		int q;
		rep(nth, Q)
		{
			cin >> q;
			
			bool flag=false;
			rep(i,eras.size())
			{
				if(eras[i].isEra(q))
				{
					eras[i].print(q);
					flag = true;
					break;
				}
			}
			if(!flag){ cout << "Unknown" << endl; }
		}
	}
	return 0;
}

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

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

    int i = 0;

    if(a==0){
        i = 1;
    }

     if(b==0){
        i = 2;
     }
     if(c==0){
        i = 3;
    }
     if(d==0){
        i = 4;
    }
     if(e==0){
        i = 5;
    }


    

    cout << i << endl;    
}

Measured memory_bytes: 3560
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

using Graph = vector<vector<ll>>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

#define MAX_N 2010

const long long INF = 1LL << 60;

//境界値に注意！！！

int main() {
    ll n,d,x;
    cin >> n >> d >> x;
    ll a[n];
    for (ll i=0;i<n;i++)cin >> a[i];
    for (ll i=1;i<=d;i++){
        for (ll j=0;j<n;j++){
            if (i%a[j]==1 || i==1)x++;
            else if (a[j]==1)x++;
        }
    }
    cout << x << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    ll n;
    cin >> n;
    ll odp = 0;
    for (ll a = 1; a <= n; ++a)
    {
        ll d = n / a;
        if (n % a == 0)
            --d;
        odp += d;
    }
    cout << odp;
    return 0;
}


Measured memory_bytes: 3624
import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
v = c.values()
s = 0
for i in v:
    s += (i*(i-1))//2

for i in range(n):
    d = c[a[i]]
    x = (d*(d-1))//2 if d > 1 else 0
    y = ((d-1)*(d-2))//2 if d > 2 else 0
    print(s-x+y)


Measured memory_bytes: 34180
// Author : Chi
// created : Thursday 2020-06-04
// Sawal : Practice

//header files
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

//namespaces
using    namespace __gnu_pbds;
using    namespace std;
typedef tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > ordered_set;

//macros
#define ll 		    long long
#define ss          second
#define ff          first
#define vi          vector<int>
#define vll         vector<long long>
#define pb(x)       push_back(x)
#define TEST  	    int TesT;cin>>TesT;while(TesT--)solve();
#define TEST1       solve();
#define mod         1000000007
#define aLL(x)      x.begin(),x.end()
#define r0n(i,n)    for(ll i = 0; i < n; ++i)
#define r1n(i,n)    for(ll i = 1; i <= n; ++i)
#define pdp(d,i)    fixed<<setprecision(i)<<d
#define CHI         ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define db(...)     __f(#__VA_ARGS__, __VA_ARGS__)                      //for debugging
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
//LOVE ALGO
vector<vector<ll>> mul(vector<vector<ll>>A,vector<vector<ll>>B){
    ll n=A.size();
    ll bich=B.size();
    ll m=B[0].size();
    vector<vector<ll>>res(n,vector<ll>(m,0));
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            for(int k=0;k<bich;k++)
                res[i][j]=(res[i][j]+(A[i][k]*B[k][j])%mod)%mod;
    return res;
}
vector<vector<ll>> pown(vector<vector<ll>>A,ll k){
    if(k==1)
        return A;
    if(k&1){
        return mul(pown(A,k-1),A);
    }
    auto half=pown(A,k/2);
    return mul(half,half);
}
void solve(){
    ll n,k;
    cin>>n>>k;
    vector<vector<ll>>adj(n,vector<ll>(n));
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            cin>>adj[i][j];
    auto adjn=pown(adj,k);
    ll sum=0;
    r0n(i,n)
        r0n(j,n)
            sum=(sum+adjn[i][j])%mod;
    cout<<sum;
    }
// Driver Code
int main(){
    CHI
    TEST1
    return 0;
}


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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0; i<N; i++){
    cin >> A.at(i);
  }
  vector<int> ans(N);
  for(int i=0; i<N; i++){
    ans.at(A.at(i)-1)=i+1;
  }
  for(int i=0; i<N-1; i++){
    cout << ans.at(i) << " ";
  }
  cout << ans.at(N-1) << endl;
}

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

void Main() {
    // input
    u_int64_t N;
    int K;
    cin >> N >> K;


    // translate
    int digit = 0;
    while (N > 0) {
        digit++;
        N /= K;
    }


    // output
    cout << digit << endl;

}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3588
#include<stdio.h>
#define MAX 500000

int n;
void maxHeapify(int *,int);
void buildMaxHeap(int *);

int main(){

  int H[MAX];
  int i;
  
  scanf("%d",&n);
  
  for( i = 1 ; i <= n; i++ )
    scanf("%d",&H[i]);

  buildMaxHeap(H);

  for( i = 1 ; i <= n ; i++ )
    printf(" %d",H[i]);
  
  printf("\n");
  
  return 0;
}
 
void maxHeapify(int H[],int i) 
{
  int l,r;
  int largest;
  int tmp;
  
  l = i * 2;
  r = i * 2 + 1;
  
  if( l <= n && H[l] > H[i] ) 
    largest = l;
  else
    largest = i;
  if( r <= n && H[r] > H[largest] )
    largest = r;
   
  if( largest != i ) {
    tmp = H[i];

    H[i] = H[largest];
    H[largest] = tmp;
    maxHeapify(H,largest);
  }
}
 
void buildMaxHeap(int H[]) 
{
  int i;
  for(i = n/2; i >= 1; i--)
    maxHeapify(H,i);
}

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

using namespace std;

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	int x = 0, y = 0, z = 0;
	for (int i = 0;i < n;i++) {
		int p = 0;
		cin >> p;
		if (p <= a) {
			x++;
		}
		else if (p <= b) {
			y++;
		}
		else {
			z++;
		}
	}
	cout << min(x, min(y, z)) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define getarray(a,n)  for(int i=0;i<n;i++) cin>>a[i]
#define ll long long
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vi vector<int>
using namespace std;
int main()
{
	fast
	int a,b,c,d,e;
	cin>>a>>b>>c>>d;
	if(a==0)
	{
		cout<<1;
	}
	else if(b==0)
	{
		cout<<2;
	}
	else if(c==0)
	{
		cout<<3;
	}
	else if(d==0)
	{
		cout<<4;
	}
	else if(e==0)
	{
		cout<<5;
	}
}


Measured memory_bytes: 3604
#include<iostream>
using namespace std;
int main() {
	int a, b, k;
	cin >> a >> b >> k;
	if (a > b) {
		int tmp;
		tmp = a;
		a = b;
		b = tmp;
	}
	int count = 0;
	
	for (int i = a; i >= 1; i--) {
		if (a % i == 0 && b % i == 0) {
			count++;
			if (count== k) {
				cout << i << endl;
				return 0;
			}
		}
	  }
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

typedef long long i64;
const int MAX_N = 1 << 16, MOD = 998244353;

i64 fac[MAX_N], ifac[MAX_N], inv[MAX_N];

i64 fpm(i64 x, i64 y) {
  i64 res = 1;
  while (y) {
    if (y & 1) res = res * x % MOD;
    x = x * x % MOD;
    y >>= 1;
  }
  return res;
}

inline void rader(i64 *y, int len) {
  for (int i = 1, j = len >> 1; i < len - 1; ++i) {
    if (i < j) swap(y[i], y[j]);
    int k = len >> 1;
    while (j >= k) {
      j -= k;
      k >>= 1;
    }
    if (j < k) j += k;
  }
}

inline void DFT(i64 *y, int len, int op) {
  rader(y, len);
  for (int h = 2; h <= len; h <<= 1) {
    i64 wn = fpm(3, (MOD - 1) + op * (MOD - 1) / h);
    int l = h >> 1;
    for (int j = 0; j < len; j += h) {
      i64 w = 1;
      for (int k = j; k < j + l; ++k) {
	i64 u = y[k], v = y[k + l] * w % MOD;
	y[k] = (u + v) % MOD, y[k + l] = (u - v) % MOD;
	w = w * wn % MOD;
      }
    }
  }
  if (op == -1) {
    i64 INV = fpm(len, MOD - 2);
    for (int i = 0; i < len; ++i)
      y[i] = y[i] * INV % MOD;
  }
}

i64 binom(int n, int m) {
  if (n < m) return 0;
  return fac[n] * ifac[m] % MOD * ifac[n - m] % MOD;
}

char A[MAX_N], B[MAX_N];
int M, E;

i64 G[MAX_N];

void work2(int x) {
  int len = 1;
  while (len <= M * 2) len <<= 1;
  static i64 X[MAX_N], Y[MAX_N];
  for (int i = 0; i <= M; ++i) X[i] = ifac[i + 1];
  while (x) {
    if (x & 1) {
      for (int i = 0; i < len; ++i) Y[i] = X[i];
      DFT(G, len, 1), DFT(Y, len, 1);
      for (int i = 0; i < len; ++i) G[i] = G[i] * Y[i] % MOD;
      DFT(G, len, -1);
      for (int i = M + 1; i < len; ++i) G[i] = 0;
    }
    x >>= 1;
    DFT(X, len, 1);
    for (int i = 0; i < len; ++i) X[i] = X[i] * X[i] % MOD;
    DFT(X, len, -1);
    for (int i = M + 1; i < len; ++i) X[i] = 0;
  }
  for (int i = 0; i <= M; ++i) G[i] = G[i] * fac[i] % MOD;
}
  
int main() {
  int N;
  scanf("%s%s", A, B), N = strlen(A);
  
  for (int i = 0; i < N; ++i)
    if (A[i] == '1' && B[i] == '1') M++;
    else if (A[i] != B[i]) E++;
  fac[0] = ifac[0] = inv[1] = 1;
  for (int i = 1; i < MAX_N; ++i) fac[i] = fac[i - 1] * i % MOD;
  for (int i = 2; i < MAX_N; ++i) inv[i] = -(MOD / i) * inv[MOD % i] % MOD;
  for (int i = 1; i < MAX_N; ++i) ifac[i] = ifac[i - 1] * inv[i] % MOD;

  G[0] = 1, E >>= 1;
  work2(E);
  
  i64 res = 0;
  for (int i = 0; i <= M; ++i) 
    res = (res + fac[M + E] * binom(M, i) % MOD * fac[i] % MOD * G[M - i] % MOD) % MOD;
  res = res * fac[E] % MOD;
  printf("%lld\n", (res + MOD) % MOD);
  return 0;
}


Measured memory_bytes: 2560
from itertools import accumulate
from collections import defaultdict
N, K = map(int, input().split())
A = [0] + [a-1 for a in map(int, input().split())]
A_cum = list(accumulate(A))
A_cum = [a%K for a in A_cum]

ans = 0
dd = defaultdict(int)
q = []
for j in range(N+1):  
  ans += dd[A_cum[j]]
  dd[A_cum[j]] += 1
  q.append(A_cum[j])
  if len(q) == K:
    dd[q[0]] -= 1
    q.pop(0)
print(ans)    
  



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

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

const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const ll Inf = 1LL << 62;

int main() {
        int n;
        cin >> n;
        cout << !n << endl;
        return 0;
}

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

using namespace std;
typedef long long ll;
#define tr(container, it) \
    for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define ill(_x)  ll _x;scanf("%lld",&_x);
#define idb(_x)  double _x;scanf("%lf",&_x);
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define sll set<ll>
#define vs vector<string>
#define in0(x, a, b)((x)>=a && (x)<=b    )
#define in1(x, a, b)((x)>a && (x)<b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define endl '\n'
#define int ll
const double PI = 3.14159265358979323846;
const int INF = 0x3f3f3f3f;
const int MOD = (int) (1e9) + 7;
const int MX = 777777 + 5;
const int mod = 1777777777;
const double EPS = 1e-10;
const ll MXP = 8999251775770639633;


int fac[MX+5];
int power(int x, int y, int p)
{
    int res = 1;

    x = x % p;

    while (y)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

// Returns n^(-1) mod p
int modInverse(int n, int p)
{
    return power(n, p-2, p);
}

int C(int n, int r, int p)
{
    if (r==0)
        return 1;

    return (fac[n]* modInverse(fac[r], p) % p *
            modInverse(fac[n-r], p) % p) % p;
}

void init(int mod){
    fac[0] = 1;
    for (int i=1 ; i<=MX; i++)
        fac[i] = fac[i-1]*i%mod;
}

int CC(int a, int b){
    int res = 1;
    rep(i,a+1,a-b+1)res *= i,res/=a-i+1;
//    rep(i,1,b+1)res /= i;
    return res;
}
void _() {
    init(MXP);
    int n,p,o=0,e=0;
    cin >> n >> p;
    for (int i = 0; i < n; ++i) {
        int t;
        cin >> t;
        if(t&1)o++;
        else e++;
    }
    ll sum = 0;
    for (int i = p; i <= o; i+=2) {
        sum += CC(o,i);
    }
    cout << fixed << sum * (int)pow(2, e) << endl;

};

#undef int
int main() {
#if __MINGW32__
    freopen("C:\\Users\\hiroo\\CLionProjects\\competitive\\Input.txt", "r", stdin);
    freopen("C:\\Users\\hiroo\\CLionProjects\\competitive\\Output.txt", "w", stdout);

#endif

    _();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);


}

Measured memory_bytes: 6528
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef struct pair<int,int> P;
typedef struct pair<int,P> P2;



int main() {
	int n;
	cin>>n;
	string str;
	cin>>str;
	int x=0;
	int res=0;
	for(int i=0;i<n;++i){
		if(str[i]=='I')x++;
		if(str[i]=='D')x--;
		res=max(res,x);
	}

	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);

	int i;
	int sum;
	for (i = 0, sum = 0; sum <= b; i++) {
		sum += a;
	}
	if (i > c) {
		printf("%d\n", c);
	} else {
		printf("%d\n", i - 1);
	}
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    set<int> num = {0,1,2,3,4,5,6,7,8,9};

    for(int i = 0;i< b;i++){
        int c;
        cin >> c;
        num.erase(c);
    }
    while(1){
        if(a/10000 > 0){
            vector<int> A = {a/10000,a%10000/1000, a%1000/100,a%100/10,a%10};
            int key = 0;
            for(int i = 0;i<5;i++){
                if(num.find(A.at(i)) != num.end())
                    key++;
            }
            if(key == 5){
                cout << a << endl;
                break;
            }
            else
                a++;
        }
        if(a/1000 > 0){
            vector<int> A = {a/1000, a%1000/100,a%100/10,a%10};
            int key = 0;
            for(int i = 0;i<4;i++){
                if(num.find(A.at(i)) != num.end())
                    key++;
            }
            if(key == 4){
                cout << a << endl;
                break;
            }
            else
                a++;
        }
        else if(a/100 > 0){
            vector<int> A = {a%1000/100,a%100/10,a%10};
            int key = 0;
            for(int i = 0;i<3;i++){
                if(num.find(A.at(i)) != num.end())
                    key++;
            }
            if(key == 3){
                cout << a << endl;
                break;
            }
            else
                a++;
        }
        else if(a/10 > 0){
            vector<int> A = {a%100/10,a%10};
            int key = 0;
            for(int i = 0;i<2;i++){
                if(num.find(A.at(i)) != num.end())
                    key++;
            }
            if(key == 2){
                cout << a << endl;
                break;
            }
            else
                a++;
        }
        else{
            vector<int> A = {a%10};
            int key = 0;
            for(int i = 0;i<1;i++){
                if(num.find(A.at(i)) != num.end())
                    key++;
            }
            if(key == 1){
                cout << a << endl;
                break;
            }
            else
                a++;
        }
    }
}

Measured memory_bytes: 256
sx, sy, tx, ty = map(int,input().split())
movelist = ['U','D','L','R']
moved = []
countX = tx - sx
countY = ty - sy

for y in range (0, countY):
    moved.append(movelist[0])

for x in range (0, countX):
    moved.append(movelist[3])

for y in range (0, countY):
    moved.append(movelist[1])

for x in range (0, countX):
    moved.append(movelist[2])

moved.append(movelist[2])

for y in range (0, countY+1):
    moved.append(movelist[0])

for x in range (0, countX+1):
    moved.append(movelist[3])

moved.append(movelist[1])

moved.append(movelist[3])

for y in range (0,countY+1):
    moved.append(movelist[1])

for x in range (0, countX+1):
    moved.append(movelist[2])

moved.append(movelist[0])

print("".join(moved))

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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for(ll i = 0 ; i < n; i++)

#ifdef DEBUG
#define DBG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)
#else
#define DBG(fmt, ...)
#endif

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll N, K;
    cin >> N >> K;
    vector<ll> a(N);
    REP(i,N){ cin >> a[i]; }

    ll ans = INF;
    for(int s = 0; s < (1 << (N)); s++){
        if( ! ((s & 1) && (__builtin_popcount(s) == K)) ){
            continue;
        }

        ll height = 0;
        ll cost = 0;
        for(int i = 0; i < N; i++ ){
            if( s & (1<<i) ){
                if( a[i] <= height ){
                    height = height+1;
                    cost += height - a[i];
                }else{
                    height = a[i];
                }
            }else{
                if( a[i] > height ){
                    height = a[i];
                }
            }
        }


        ans = min(ans, cost);
    }

    cout << ans << endl;
}


Measured memory_bytes: 3580
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <numeric>
#include <algorithm>
#include <utility>


using std::cout;
using std::cin;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;


ll gcd(ll a, ll b) {
    while (b != 0) {
        auto tmp = a;
        a = b;
        b = tmp % a;
    }
    return a;
}

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

int isPrime(int a) {
    for (int i = 2; i * i <= a; ++i) {
        if (a % i == 0) {
            return 0;
        }
    }
    return 1;
}





void oneCase () {
    int a, b, c;
    cin >> a >> b >> c;
    if (a <= c && c <= b) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    cout << "\n";
}




int main() {
    int t = 1;
//    cin >> t;
    while (t > 0) {
        oneCase();
        --t;
    }

    return 0;
}

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

int main(){
    std::vector<std::vector<int>> grid(3, std::vector<int>(3));
    int sum = 0;
    for(int i = 0; i < 3; ++i){
        for(int j = 0; j < 3; ++j){
            std::cin >> grid.at(i).at(j);
            sum += grid.at(i).at(j);
        }
    }

    bool flg = true;

    int a, b, c;
    for(int i = 0; i < 2; ++i){
        a = grid.at(0).at(i + 1) - grid.at(0).at(i);
        b = grid.at(1).at(i + 1) - grid.at(1).at(i);
        c = grid.at(2).at(i + 1) - grid.at(2).at(i);
    }

    if(a != b || b != c || c != a){
        flg = false;
    }

    int d, e, f;
    for(int i = 0; i < 2; ++i){
        d = grid.at(i + 1).at(0) - grid.at(i).at(0);
        e = grid.at(i + 1).at(1) - grid.at(i).at(1);
        f = grid.at(i + 1).at(2) - grid.at(i).at(2);
    }

    if(d != e || e != f || f != d){
        flg = false;
    }

    if(0 != sum %3){
        flg = false;
    }

    std::string ans = "Yes";
    if(!flg){
        ans = "No";
    }

    std::cout << ans << std::endl;
}


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

using namespace std;
typedef long long ll;

int main(){
    string s;
    cin >> s;

    if(s == "SUN"){
        cout << 7 << endl;
    }else if(s == "MON"){
       cout << 6 << endl;
    }else if(s == "TUE"){
       cout << 5 << endl;
    }else if(s == "WED"){
       cout << 4 << endl;
    }else if(s == "THU"){
       cout << 3 << endl;
    }else if(s == "FRI"){
       cout << 2 << endl;
    }else{
       cout << 1 << endl;
    }

    return 0;
}

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

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	lli n;
	cin >> n;
	
	if(n==1) {
		cout << 1 ;
		return 0;
	}
	lli sum = 0;
	for(lli x=1; x<=n; x++)
	{
		lli y = (n/x);
		lli tmp = (y*(y+1)*x)/2;
		sum += tmp;
	}
	cout << sum ;
	return 0;
}

Measured memory_bytes: 3652
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace YahooProCon
{
    class A
    {
        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();
            int N = a[0], K = a[1];

            string r = "NO";
            if (K <= (N + 1) / 2) r = "YES";
            Console.WriteLine(r);
        }
    }
}


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

int main(){

  int n;
  int a,b;
  int c;
  int d[1000];
  int ans;

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

  sort(d,d+n);
  reverse(d,d+n);

  ans = c/a;
  for(int i=0;i<n;i++){
    if(ans > (c+d[i])/(a+(i+1)*b)) break;
    c += d[i];
    ans = c/(a+(i+1)*b);
  }

  cout << ans << endl;

}

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

string m,n,o;
int k[10000],l;

int main(){
	cin>>m>>n;
	o=m+n;
	int len=o.length();
	for(int i=0;i<=len;i++){
		k[i]=o[i]-'0';
	}
	int p=pow(10,len-1),yy=0;
	while(len>0){
		p=pow(10,len-1);
		l+=p*k[yy];
		len--;
		yy++;
	}
	int w=sqrt(l);
	if(w*w==l)printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 512
//don't go gentle into
// the goodnight.

#include<bits/stdc++.h>
using namespace std;

#define int       long long
#define ll        long long
#define fr        first
#define sec       second
#define pi        3.141592653589793
#define M         1000000007
#define mod       998244353
#define maxint    2147483647
#define minint    -2147483648
#define maxll     9223372036854775807
#define minll     -9223372036854775808
#define meme0(a)  memset(a,0,sizeof(a));
#define meme1(a)  memset(a,-1,sizeof(a));
#define i_m_speed ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define open      freopen("input.txt","r",stdin);
#define close     freopen("output.txt","w",stdout);
#define v_int     vector<int >
#define v_ll      vector<long long >
#define pb        push_back
#define mk        make_pair
//upper_bound(begin(),end(),key)
//lower_bound(begin(),.end(),key);

ll expo(ll x , ll n , ll m){
    if(n==0)
        return 1;
    else if(n%2==0)
        return expo((x*x)%m , n/2 , m);
    else
        return (x*expo((x*x)%m,(n-1)/2,m))%m;

}
string toBinary(ll n)
{
    std::string r;
    while(n!=0){
        r=(n%2==0 ?"0":"1")+r;
        n/=2;
    }
    return r;
}
void solve(){
    int A, B;
  	cin >> A >> B;
    char C; cin >> C;
    int D; cin >> D;
    B *= 100; B += D;
    ll X = A*B; X /= 100;
    cout << X << endl;

    return;
}
int32_t main(){
    i_m_speed
    int t=1;
    //cin >> t;
    while(t--){
        solve();
    }

    return 0;
}


Measured memory_bytes: 3636
import statistics
n = int(input())
a = list(map(int,input().split()))

bi = []
for i in range(n):
    bi.append(a[i]-i-1)

median = statistics.median(bi)

ans = 0
for i in range(n):
    ans += abs(a[i]-(median+i+1))
print(int(ans))

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

using namespace std;

typedef long long ll;

int n;

string s;

int R, G, B;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    cin >> s;
    s = " " + s;
    for(int i = 1; i <= n; i++)
        if(s[i] == 'R')
            R++;
        else if(s[i] == 'G')
            G++;
        else
            B++;
    ll ans = 1LL * R * G * B;
    for(int i = 1; i <= n; i++)
        for(int j = i + 1; j <= n; j++)
        {
            int k = j + (j - i);
            if(k > n)
                continue;
            if(s[i] != s[j] && s[j] != s[k] && s[i] != s[k])
                ans--;
        }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;


int main(){
  int x1,y1,x2,y2;
  
  cin >> x1 >> y1 >> x2 >> y2;
  
  int a = x2 - y2 + y1;
  int b = y2 + (x2 - x1);
  int c = a - (x2 - x1);
  int d = b - (y2 - y1);
  
  printf("%d %d %d %d",a,b,c,d);

  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define se second
#define fi first
#define ll long long int
#define INF INT_MAX
#define mod
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
bool sortbysec(const pair<ll,ll> &a,const pair<ll,ll> &b){return (a.second < b.second);}
ll gcd(ll a, ll b){if(a==0)return b;return gcd(b % a, a);}
int main()
{
	chutiyaap;
	ll n;cin>>n;
	ll a[n+1];for(ll i=0;i<n;i++)cin>>a[i];
	ll x=a[0];
	for(ll i=1;i<n;i++)x=x^a[i];
	if(x==0)cout<<"Yes";
	else cout<<"No";
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
    int x,y;
    
    while(1){
        cin>>x>>y;
        if((x==0)&&(y==0))break;
        if(x<=y) cout<<x<<" "<<y<<endl;
        else cout<<y<<" "<<x<<endl;
    }
    return 0;
}


Measured memory_bytes: 3016
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
vector<int>v[20];
int p[20];
int main()
{
	int ans=0;
	int n,m;cin>>n>>m;
	rep(i,m)
	{
		int a;
		scanf("%d",&a);
		rep(j,a)
		{
			int b;
			scanf("%d",&b);
			b--;
			v[i].push_back(b);
		}
	}
	rep(i,m)
	{
		scanf("%d",&p[i]);
	}
	rep(i,1<<n)
	{
		bool flag=true;
		rep(j,m)
		{
			int cnt=0;
			for(int m=0;m<v[j].size();m++)
			{
				int temp=v[j][m];
				if(i>>temp&1)
				cnt^=1;
			}
			if(cnt!=p[j])
				flag=false;
		}
		ans+=flag;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const int INF = INT_MAX / 2;

vector<int> hs;

int main(void) {
    int N, K;
    cin >> N >> K;

    hs.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> hs[i];
    }
    sort(hs.begin(), hs.end());

    int ans = INF;
    for (int i = 0; i <= N - K; i++) {
        chmin(ans, hs[i + K - 1] - hs[i]);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;

int main(){
    int n[4];
    cin >> n[0] >> n[1] >> n[2] >> n[3];

    sort(n, n+4);
    if(n[0] == 1 && n[1] == 4 && n[2] == 7 && n[3] == 9){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>//所有库
using namespace std;
long long x,ans;
int main(){
	cin>>x;
	ans=0;
	ans=(x/11)*2;
	x%=11;
	if (x>0) 
		if (x>6) ans+=2;else ans++;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
  int n = sc.nextInt();
  int[] a = new int[n];
  long h = 0;
  long w = 0;
  for(int i = 0; i < n; i++){
    a[i] = sc.nextInt();
  }
  Arrays.sort(a);
  boolean hexist = false;
  for (int i = n-2;i >= 0;i--){
    if (a[i] == a[i+1]){
      if (hexist){
        w = (long)a[i];
        break;
      }
      else{
        hexist = true;
        h = (long)a[i];
        a[i] = 0;
      }
    }
  }
  System.out.println(h*w);
}}

Measured memory_bytes: 51564
#include<bits/stdc++.h>
using namespace std;
const int maxn = 5*1e5+3 ;
typedef long long ll;
int n;
string s;
int a[maxn];
ll kq=0;
void phai( int x )
{
  a[x]=0;
  int dem=0;
  while( s[x] == '<' && (x+1)<=n )
  {
     dem++;
     if( a[x+1] == 1e9 )
     {
         a[x+1] = dem ;
     }
     else a[x+1]=max(a[x+1],dem);
     x++;
  }
}
void trai( int x )
{
  a[x]=0;
  int dem=0;
  x--;
  while( s[x]=='>' && x>=1 )
  {
      dem++;
      if( a[x] == 1e9 )
      {
          a[x] = dem;
      }
      else a[x]=max(a[x],dem);
      x--;
  }
}
void xuli()
{
   for(int i=1;i<=n;i++) a[i]=1e9;
   for(int i=1;i<=n;i++)
   {
       if( i == 1 && s[1] == '<' )
       {
           phai(i);
       }
       else if( i == n && s[n-1] == '>' )
       {
           trai(i);
       }
       else if( s[i] == '<' && s[i-1] == '>' )
       {
           trai(i);
           phai(i);
       }
   }
   for(int i=1;i<=n;i++) {kq+=a[i];}
   cout<<kq;
}
void nhap()
{
   cin>>s;
   n=s.size()+1;
   s=" "+s;
}
int main()
{
    /// freopen("nhap.inp","r",stdin);
    /// freopen("xuat.out","w",stdout);
    nhap();
    xuli();
}


Measured memory_bytes: 2840
s=input()
for i in range(2):
    for j in range(2):
        for k in range(2):
            sum=int(s[0])
            if i==0:
                sum+=int(s[1])
            else:
                sum-=int(s[1])
            if j==0:
                sum+=int(s[2])
            else:
                sum-=int(s[2])
            if k==0:
                sum+=int(s[3])
            else:
                sum-=int(s[3])
            if sum==7:
                a="-"
                b="-"
                c="-"
                if i==0:
                    a="+"
                if j==0:
                    b="+"
                if k==0:
                    c="+"
                print(s[0]+a+s[1]+b+s[2]+c+s[3]+"=7")
                exit()

Measured memory_bytes: 3064
#include <iostream>
#include <string>

int rom2int(const char c){
    switch(c){
        case 'I':
            return 1;
        case 'V':
            return 5;
        case 'X':
            return 10;
        case 'L':
            return 50;
        case 'C':
            return 100;
        case 'D':
            return 500;
        case 'M':
            return 1000;
    }
}

int rom2int(const std::string s){
    int r = 0;
    for(int i = 0; i < s.size() - 1; i++){
        if(rom2int(s[i]) < rom2int(s[i+1])){
            r -= rom2int(s[i]);
        }
        else{
            r += rom2int(s[i]);
        }
    }
    r += rom2int(s[s.size()-1]);
    return r;
}

int main(){
    std::string s;
    while(std::cin >> s){
        std::cout << rom2int(s) << std::endl;
    }
}

Measured memory_bytes: 1184
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
using namespace std;
#define pb        emplace_back
#define fi        first
#define se        second
#define show(...)  fprintf(stderr, __VA_ARGS__ )
#define outl(x)   cout << (x) << '\n'
#define rep(i,n)     for(int i=0; i<(n); ++i)
#define inside(x,y,w,h) ((x)>=0 && (y)>=0 && (x)<(w) && (y)<(h))
template<class A, class B>inline bool chmax(A &a, B b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, B b){return b<a ? a=b,1 : 0;}
typedef long long ll;
constexpr int       INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int dx[] = {1, 0, -1, 0};
constexpr int dy[] = {0, 1, 0, -1};
constexpr int MX = 100010;

typedef pair<ll,int> pii;

int N, E, s;
vector<pii> G[MX];
ll mcos[MX];

void dijkstra(int s)
{
    priority_queue< pii, vector<pii>, greater<pii> > pq;
    pq.emplace(pii(0,s));
    memset(mcos, INF, sizeof(mcos));
    mcos[s] = 0;

    while (pq.size()) {
        const auto now = pq.top(); pq.pop();
        if (mcos[now.se] < now.fi) continue;

        for (const auto &e : G[now.se]) {
            ll nc = e.fi + now.fi;
            const int &nxt = e.se;
            if (chmin(mcos[nxt], nc)) {
                pq.emplace(pii(nc,nxt));
            }
        }
    }
    return;
}

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

   cin >> N >>E >> s;
   rep(i, E) {
       int s, t, c;
       cin >>s >> t >> c;
       G[s].pb(pii(c,t));
   }

   dijkstra(s);

   rep (i, N) {
       if (mcos[i] == LINF)
           outl("INF");
       else
           outl(mcos[i]);
   }
}




Measured memory_bytes: 19460
using System;
using System.Linq;

class A
{
	static void Main()
	{
		Func<int[]> read = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
		var A = read();
		var a = read();
		Console.WriteLine((A[0] - a[0]) * (A[1] - a[1]));
	}
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
using ll = int64_t;
using P = pair<ll,ll>;
ll INF = 1000000007;
// ll INF = 9223372036854775807;
// ll INF = 998244353;

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    ll n,x;
    cin >> n >> x;
    vi a(n);
    rep(i,n) cin >> a.at(i);
    vi b(n-1);
    rep(i,n-1) b.at(i) = a.at(i) + a.at(i+1);
    // 2連続でxを超えていたら後者を下げていく
    // 連続でxを超えていなかったらそのまま下げていく
    ll res = 0;
    rep(i,n-2){
        if(b.at(i)>x){
            ll eat = b.at(i)-x;
            if(a.at(i+1) >= eat){
                res += eat;
                b.at(i+1) -= eat;
            }else{
                res += eat;
                b.at(i+1) -= a.at(i+1);
            }
        }
    }
    // rep(i,n-1) cout << b.at(i) << endl;
    if(b.at(n-2)>x) res += b.at(n-2)-x;
    cout << res << endl;
}

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

int n;
string ans;
vector<string> s(2);
vector<char> a={'m','c','x','i'};
vector<int> cnt(4);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    for (;n--;){
        cin >> s[0] >> s[1];
        fill(cnt.begin(),cnt.end(),0);
        for (int i=0;i<2;++i){
            for (int j=0;j<s[i].size();++j){
                for (int k=0;k<4;++k){
                    if (s[i][j]==a[k]){
                        if (!j||s[i][j-1]-'0'>=10) cnt[k]+=1;
                        else cnt[k]+=s[i][j-1]-'0';
                    }
                }
            }
        }
        for (int i=3;i>=0;--i) if (cnt[i]>=10){
            ++cnt[i-1],cnt[i]-=10;
        }
        ans="";
        for (int i=0;i<4;++i){
            if (!cnt[i]) continue;
            if (cnt[i]>1) ans+=(char)(cnt[i]+'0');
            ans+=a[i];
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3204
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const int N = 60;
const ll INF = 1e17;
int n;
ll c[N];
string snml[N], srev[N];
map<pair<string, bool>, ll> memo;

ll calc(string s, bool rev);

ll calc0(string s, bool rev){
    if (s.empty()) return 0;
    string t(s);
    reverse(ALL(t));
    if (s == t) return 0;
    ll ret = INF;
    REP(i,n){
        string t;
        if (!rev) t = srev[i];
        else t = snml[i];
        if (s == t){
            chmin(ret, c[i]);
            continue;
        }
        bool ok = true;
        REP(j,min(s.length(), t.length())){
            if (s[j] != t[j]){
                ok = false;
                break;
            }
        }
        if (!ok) continue;
        if (s.length() > t.length()) {
            string next = s.substr(t.length());
            ll d = calc(next, rev) + c[i];
            chmin(ret, d);
        }else{
            string next = t.substr(s.length());
            ll d = calc(next, !rev) + c[i];
            chmin(ret, d);
        }

    }
    return ret;
}

ll calc(string s, bool rev){
    auto tmp = make_pair(s, rev);
    if (memo.count(tmp)) return memo[tmp];
    memo[tmp] = INF;
    return memo[tmp] = calc0(s, rev);
}

int main(void){
    cin >> n;
    REP(i,n){
        cin >> snml[i] >> c[i];
        srev[i] = snml[i];
        reverse(ALL(srev[i]));
    }
    ll ans = INF;
    REP(i,n){
        ll x = c[i] + calc(snml[i], false);
        chmin(ans, x);
    }
    if (ans == INF) ans = -1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3672
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map> // STL
#include <string> 
#include <vector>
#include <queue>
#include <stack>
#define mpr make_pair
#define debug() puts("okkkkkkkk")

using namespace std;

typedef long long LL;

const int inf = 1 << 26;

// dp[1][1]=a[1][1]; dp[1][2]=a[1][1]+a[1][2];  dp[i][j]=max(dp[i-1][j],dp[i][j-1])+a[i][j]
int dp[1005][1005];
int a[1005][1005];

int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=2;i++){
		for(int j=1;j<=n;j++)scanf("%d",&a[j][i]);
	}
	dp[1][1]=a[1][1];dp[1][2]=a[1][1]+a[1][2];
	for(int i=2;i<=n;i++)dp[i][1]=dp[i-1][1]+a[i][1];
	for(int i=2;i<=n;i++)dp[i][2]=max(dp[i][1],dp[i-1][2])+a[i][2];
	printf("%d\n",dp[n][2]);

	return 0;
}


Measured memory_bytes: 4736
void main()
{
    int[] tmp = readln.split.to!(int[]);
    int n = tmp[0], h = tmp[1], w = tmp[2];

    int cnt;
    foreach (i; 0 .. n)
    {
        int[] ab = readln.split.to!(int[]);
        int a = ab[0], b = ab[1];
        if (a >= h && b >= w) ++cnt;
    }

    cnt.writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 508
'''
問題：
    英小文字 cが与えられるので、c が母音であるか判定してください。
    ここで、英小文字のうち母音は a、e、i、o、uの 5つです。
'''

'''
制約：
    cは英小文字である。
'''

# 標準入力から c を取得する
c = str(input())

vowel_words = ('a', 'e', 'i', 'o', 'u')

result = 'ret'
if c in vowel_words:
    result = 'vowel'
else:
    result = 'consonant'

print(result)


Measured memory_bytes: 9112
package main

import (
	"fmt"
	"sort"
)

func main () {
	var lx, ly, lz, k int
	fmt.Scan(&lx, &ly, &lz, &k)
	xs := make([]int, lx)
	for i:= 0; i < lx; i++ {
		fmt.Scan(&xs[i])
	}
	ys := make([]int, ly)
	for i:= 0; i < ly; i++ {
		fmt.Scan(&ys[i])
	}
	zs := make([]int, lz)
	for i:= 0; i < lz; i++ {
		fmt.Scan(&zs[i])
	}
	na := make([]int, lx*ly)
	for i:=0; i<lx; i++{
		for j:=0; j< ly; j++ {
			na[i+j*lx] = xs[i]+ys[j]
		}
	}
	sort.Sort(sort.Reverse(sort.IntSlice(na)))
	nb := make([]int, k*lz)
	var K int
	if k < lx*ly{
		K = k
	} else{
		K = lx * ly
	}
	for i:=0; i<K; i++{
		for j:=0; j<lz; j++ {
			nb[i+j*K] = na[i]+zs[j]
		}
	}
	sort.Sort(sort.Reverse(sort.IntSlice(nb)))
	for i:=0; i<k; i++{
		fmt.Println(nb[i])
	} 
}


Measured memory_bytes: 35204
//#include <stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
#define PI 3.14159265359;

class Hoge{
  public:
	long int i0;
	long int isum0;
					int i1,N0,Q;
					string s0;
	int* iarray0;
	int* iarrayb;
	int* iarrayc;
	int* iarrayn;
					Hoge(int);
	void func0();
	~Hoge();
	void array0();
	void array1();
	void printarray0();
	void count0();
	void printarrayn();
	void convert0();
					};


Hoge::Hoge(int itemp){
	
	i0=itemp;
	isum0=0;
	//cout<<"i0="<<i0<<endl;
									}

void Hoge::func0(){
					
	i0+=1;
	//cout<<"i0="<<i0<<endl;
								}


void Hoge::array0(){

	//cout<<"N0?";
	cin>>N0;
	iarray0=new int[N0];
	
	for (int i0=0;i0<N0;i0++){
		//cout<<"i0="<<i0<<endl;
		cin>>iarray0[i0];
		
		
	}
}
	

void Hoge::array1(){
	
	//cout<<"Q?";
	cin>>Q;
	iarrayb=new int[Q];
	iarrayc=new int[Q];
	for (int i0=0;i0<Q;i0++){
		//cout<<"i0="<<i0<<endl;
		cin>>iarrayb[i0];
		cin>>iarrayc[i0];
		
	}
}

void Hoge::count0(){
	int i00=pow(10,5)+1;
	//cout<<"i00="<<i00<<endl;
	
	iarrayn=new int[i00];
	for (int i0=0;i0<N0;i0++){
		iarrayn[iarray0[i0]]++;
		
	
								}
	for (int i0=0;i0<(i00);i0++){
		isum0+=i0*iarrayn[i0];
		
				
			}

}

void Hoge::convert0(){
	
	int inc0;
	//cout<<"isum0="<<isum0<<endl;
	for (int i0=0;i0<Q;i0++){
		inc0=(iarrayc[i0]-iarrayb[i0])*iarrayn[iarrayb[i0]];
		//cout<<"inc0="<<inc0<<endl;
		//cout<<"iarrayn["<<iarrayb[i0]<<"]="<<iarrayn[iarrayb[i0]]<<endl;
		//cout<<"iarrayn["<<iarrayc[i0]<<"]="<<iarrayn[iarrayc[i0]]<<endl;
		isum0+=inc0;
		cout<<isum0<<endl;
		
		iarrayn[iarrayc[i0]]+=iarrayn[iarrayb[i0]];
		iarrayn[iarrayb[i0]]=0;
		//cout<<"iarrayn["<<iarrayb[i0]<<"]="<<iarrayn[iarrayb[i0]]<<endl;
		//cout<<"iarrayn["<<iarrayc[i0]<<"]="<<iarrayn[iarrayc[i0]]<<endl;
	}
	
}

Hoge::~Hoge(){
	delete [] iarray0;
	delete [] iarrayb;
	delete [] iarrayc;
	delete [] iarrayn;
					}
	void Hoge::printarray0(){
							 
							 for (int i0=0;i0<N0;i0++){
			cout<<"iarray0["<<i0<<"]="<<iarray0[i0]<<endl;
			
							 
							 }

	cout<<"---------"<<endl;
}
	void Hoge::printarrayn(){
							 
							 for (int i0=0;i0<20;i0++){
			cout<<"iarrayn["<<i0<<"]="<<iarrayn[i0]<<endl;
			
			
		}
	cout<<"---------"<<endl;
	
}


int main(){
				int N;
			//	cin>>N;
	Hoge* hoge=new Hoge(0);
	//hoge->func0();
	hoge->array0();
	hoge->array1();
	//hoge->printarray0();
	hoge->count0();
	hoge->convert0();
	//hoge->printarrayn();
	
	
	return 0;
	delete hoge;
}//end of main

Measured memory_bytes: 5144