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

typedef long long ll;

int main() {
  string s; cin >> s;
  int n = s.size();

  ll ans = 0;
  for (int set = 0; set < (1 << (n-1)); set++) {
    ll p = 0, q = 0;
    for (int i = 0; i < n; i++) {
      p = p * 10 + (s[i]-'0');
      if (set >> i & 1) {
        q += p;
        p = 0;
      }
    }
    q += p;
    ans += q;
  }
  cout << ans << endl;
}


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

using namespace std;

static const long long N = 100001;
long long c[N];


int main() {
    
    c[0] = 0;
    c[1] = 1;
    long long n;
    cin >> n;
    for (long long i=2;i<=n;i++){
        long long f6,f9;
        long long minv = c[i-1];
        f6 = 6;
        f9 = 9;
        while (i >= f6){
            if(minv > c[i-f6]){
                minv = c[i-f6];
            }
            f6 *= 6;
        }
        while (i >= f9){
            if(minv > c[i-f9]){
                minv = c[i-f9];
            }
            f9 *= 9;
        }
        c[i] = minv + 1;
    }
    cout << c[n] << endl;


}

Measured memory_bytes: 1024
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,0,-1}, dy[4]={1,0,-1,0};
long double eps = 1e-9;
long double pi = acos(-1);

//firstに素因数、secondに素因数が何個あるか
vector<pair<ll, ll> > prime_factorize(ll n) {
    vector<pair<ll, ll> > res;
    for (ll p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    ll n;
    cin>>n;
    vector<pair<ll,ll>> v = prime_factorize(n);
    ll ans = 0;
    for(int i=0;i<v.size();i++){
        ll now = v[i].first;
        for(int j=1;j<=v[i].second;j++){
            if(v[i].second >= j){
                v[i].second -= j;
                n /= now;
                now *= v[i].first;
                ans++;
            }
        }
    }
    cout << ans << endl;
    

}

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

typedef long long ll;

const int Maxn = 2505;
const int Maxm = 5005;
const ll Inf = 1000000000000000000ll;

int n, m, p;
int A[Maxm], B[Maxm], C[Maxm];
vector <int> neigh[Maxn], rneigh[Maxn];
bool reach1[Maxn], reachn[Maxn];
ll mx[Maxn];

void Fill(int v, vector <int> neigh[], bool reach[])
{
    if (reach[v]) return;
    reach[v] = true;
    for (int i = 0; i < neigh[v].size(); i++)
        Fill(neigh[v][i], neigh, reach);
}

int main()
{
    scanf("%d %d %d", &n, &m, &p);
    for (int i = 0; i < m; i++) {
        scanf("%d %d %d", &A[i], &B[i], &C[i]);
        neigh[A[i]].push_back(B[i]);
        rneigh[B[i]].push_back(A[i]);
        C[i] -= p;
    }
    Fill(1, neigh, reach1);
    Fill(n, rneigh, reachn);
    mx[1] = 0;
    for (int i = 2; i <= n; i++)
        mx[i] = -Inf;
    for (int i = 1; i <= m; i++) {
        for (int j = 0; j < m; j++) {
            mx[B[j]] = max(mx[B[j]], mx[A[j]] + C[j]);
            mx[B[j]] = min(mx[B[j]], Inf);
        }
        if (mx[n] >= Inf) { printf("-1\n"); return 0; }
    }
    for (int j = 0; j < m; j++) if (reach1[A[j]] && reachn[B[j]]) {
        ll cand = mx[A[j]] + C[j];
        if (cand > mx[B[j]]) { printf("-1\n"); return 0; }
    }
    cout << max(0ll, mx[n]) << endl;
    return 0;
}


Measured memory_bytes: 640
(defun solve (h w a)
  (loop for j from 0 below (1- h)
    do (loop for i from 0 below (1- w)
         if (and (eq (char (aref a j) (1+ i)) #\#)
                 (eq (char (aref a (1+ j)) i) #\#))
         do (return-from solve "Impossible")))
  "Possible")

(let* ((h (read)) (w (read))
       (a (make-array h)))
  (loop for i below h do (setf (aref a i) (read-line)))
  (princ (solve h w a)))

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

int main() {
	int n,k;
	cin>>n>>k;
	
	ll ans=0;
	for(ll i=k;i<=n+1;i++){
		ll max,min;
		max=(2*n+1-i)*i/2;
		min=(i-1)*i/2;
		ans+=max-min+1;
	}
	
	ll waru=1000000007;
	cout<<ans%waru<<endl;
}


Measured memory_bytes: 3636
s = list(input())
alpha = 'abcdefghijklmnopqrstuvwxyz'
alpha_list = list(alpha)
check = [0] * 26
for i in range(len(s)):
  if check[alpha_list.index(s[i])] == 0 :
    check[alpha_list.index(s[i])] = 1
if 0 in check :
  ans = alpha_list[check.index(0)]
  print(ans)
else:
  print('None')

Measured memory_bytes: 3956
void main()
{
    string s = readln.chomp;

    auto g = s.group.array;

    writeln(g.length - 1);
}

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: 2712
# 解き直し

n, m = map(int, input().split())

arr = [0 for _ in range(n+2)]
for _ in range(m):
  l, r = map(int, input().split())
  arr[l] += 1
  arr[r+1] -= 1

for i in range(n):
  arr[i+1] += arr[i]

count = 0
for ai in arr:
  if ai == m:
    count += 1

print(count)

Measured memory_bytes: 7080
#include <algorithm>
#include <functional>
#include <iostream>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

using vll = vector<ll>;

void solve();

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

  solve();

  return 0;
}

#define ini(...)   \
  int __VA_ARGS__; \
  in(__VA_ARGS__)

#define ins(...)      \
  string __VA_ARGS__; \
  in(__VA_ARGS__);

void in() {}
template <typename T, class... U>
void in(T& t, U&... u) {
  cin >> t;
  in(u...);
}

void out() {
  cout << endl;
}
template <typename T, class... U>
void out(const T& t, const U&... u) {
  cout << t;
  if (sizeof...(u))
    cout << " ";
  out(u...);
}

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

void solve() {
  ini(A, B);

  if (A + B >= 10)
    out("error");
  else
    out(A + B);
}


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

int main(){
    int ans = 700;
    char c1, c2, c3;
    cin >> c1 >> c2 >> c3;
    
    if(c1 == 'o')ans += 100;
    if(c2 == 'o')ans += 100;
    if(c3 == 'o')ans += 100;

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


Measured memory_bytes: 256
#include <iostream>
#include <string.h>

using namespace std;
# define COL 3
# define ROW 50

int main()
{

  int a[ROW][COL];

  for(int i = 0; i < ROW ; i++)
  {
    for(int j = 0; j < COL ; j++)
    {
      cin >> a[i][j];
    }
    if(a[i][0] == -1 && a[i][1] == -1 && a[i][2] == -1) break;
    else
    {
      if(a[i][0] < 0 || a[i][1] < 0)cout << 'F' << endl;
      else if((a[i][0] +  a[i][1]) >= 80 )cout << 'A' << endl;
      else if((a[i][0] +  a[i][1]) >= 65 && (a[i][0] +  a[i][1])< 80) cout << 'B' << endl;
      else if((a[i][0] +  a[i][1]) >= 50 && (a[i][0] +  a[i][1])< 65) cout << 'C' << endl;
      else if((a[i][0] +  a[i][1]) >= 30 && (a[i][0] +  a[i][1])< 50)
      {
        if(a[i][2] >= 50)cout << 'C' << endl;
        else cout << 'D' << endl;
      }
      else if((a[i][0] +  a[i][1])< 30)cout << 'F' << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 3092
#include <iostream>
using namespace std;
 
int main() {
 
	int x, a, b;
    
    cin >> x;
    cin >> a >> b;
    
   	int i;
    for(i = a; i <= b; ++i)
    	if(i % x == 0)
        	break;
	
    if(i == b + 1)
    	cout << "NG" << endl;
    else
    	cout << "OK" << endl;
        
    return 0;
}

Measured memory_bytes: 3596
// https://atcoder.jp/contests/abc048/tasks/abc048_a
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    vector<string> s(3);
    REP(i, 3) cin >> s[i];
    cout << "A" << s[1][0] << "C\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define in freopen("input.txt", "r" ,stdin)
#define out freopen("output.txt", "w" , stdout)
#define ll long long
#define inf 200005
#define fr first
#define  sc second
#define pb push_back
#define p_b pop_back
#define p_f pop_front
#define mp make_pair
#define N 100100
#define mod 1000000007
#define pi 3.1415926535
using namespace std;
int n;
ll a[3035];
ll dp[3035][3035];
ll brute (ll l , ll r , ll t) {
    if (l == r){
            return 0;
    }
    if (dp[l][r] != -1) return dp[l][r];
    ll res = 0;
    if (t == 1) {
        res = max (brute (l+1,r,2) + a[l] , brute (l ,r-1,2) + a[r-1]);
    }
    else res = min (brute(l+1,r,1) - a[l] , brute (l,r-1,1) - a[r-1]);

    return dp[l][r]=res;
}
int main (){
//in;out;
ios_base::sync_with_stdio(0);
cin >> n;
for (int i = 1; i <= 3030; i++){
    cin >> a[i];
}
for (int i = 0; i <=3030; i++){
    for (int j = 0; j <= 3030; j++){
        dp[i][j] = -1;
    }
}
cout << brute (1, n+1 ,1);
}


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

using namespace std;

int main(){
	long long l[87];

	l[0] = 2;
	l[1] = 1;

	int n;
	cin >> n;

	for(int i = 2; i <= n; i++){
		l[i] = l[i - 1] + l[i - 2];
	}

	cout << l[n];

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod=1e9+7;

int main(){
	int N;
	cin >> N;
	vi B(N-1);
	for(int i=0; i<N-1; i++){
		cin >> B[i];
	}

	int ans=B[0]+B[N-2];
	for(int i=1; i<N-1; i++){
		ans+=min(B[i-1],B[i]);
	}

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

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int i, l[10], v[2], comp;
	float dis;
	
	while (scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &l[0], &l[1], &l[2], &l[3], &l[4], &l[5], &l[6], &l[7], &l[8], &l[9], &v[0], &v[1]) != EOF){
		dis = 0;
		comp = 0;
		
		for (i = 0; i < 10; i++){
			dis += l[i];
		}
		
		dis = dis * 1.0 * v[0] / (v[0] + v[1]);
		
		for (i = 0; i < 10; i++){
			comp += l[i];
			
			if (dis <= comp){
				printf("%d\n", i + 1);
				break;
			}
		}
	}
	
	return (0);
}

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

using namespace std;

int main(void)
{
  int height;
  vector<int> mountain;

  for(int i=0;i<10;i++)
    {
      cin >> height;
      mountain.push_back(height);
    }

  sort(mountain.begin(),mountain.end(),greater<int> ());

  for(int i=0;i<3;i++)
    cout << mountain[i] <<endl;

  return 0;

}


Measured memory_bytes: 3084
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
 
int main(void) {
 string a, b;
 cin >> a >> b;
  
  	reverse(a.begin(), a.end());
 	if (a == b) cout << "YES" << endl;
  	else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, x; cin >> n >> m >> x;
    int a = 0;//n - x;
    int b = 0;//x;
    rep(i, m) {
        int c; cin >> c;
        if (c > x) a++;
        else b++;
    }
    cout << min(a, b) << endl;
}


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

const int mxhw = 101;
int fld[mxhw][mxhw];

int main() {
    int H, W;
    cin >> H >> W;
    int N;
    cin >> N;
    vector<int> a(N);
    for(int i = 0; i < N; i++) cin >> a[i];

    int car = 0;
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            if(a[car] <= 0) car++;
            if(i%2 == 0) fld[i][j] = car + 1;
            else fld[i][W-1-j] = car + 1;
            a[car]--;
        }
    }

    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            cout << fld[i][j] << " ";
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll mod = 1e9+7;
#define rep(i,n) for(int i = 0;i<n;i++)

int main(){
	int n;
	cin >> n;
	std::vector<ll> a(n);
	rep(i,n)cin >> a[i];

	sort(a.begin(), a.end(),greater<ll>());
	int times = 1;
	int head = 0;
	ll ans = 0;
	rep(i,n-1){
		if(times == 1){
			ans += a[head];
			head++;
			times = 0;
		}
		else{
			ans += a[head];
			times++;
		}
		//cout << ans << endl;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4760
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using LP = pair<int, int>;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

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

const double PI=3.14159265358979323846;

int mod = 1e9+7;

int INF = 1e9+7;

int main(){
  int A, B, C;
  cin >> A >> B >> C;
  if(B-A==C-B){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }



  return 0;
}


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

using namespace std;

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

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

template<typename A, size_t N, typename T>
void array_fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

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

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

    int antena[5];
    rep(i, 5) cin >> antena[i];
    int k;
    cin >> k;

    bool ans = true;
    rep(i, 5){
        rep(j, 5){
            if(i == j) continue;
            ans &= (abs(antena[i] - antena[j]) <= k);
        }
    }

    cout << (ans ? "Yay!" : ":(" )<< endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
  int N;
  vector<int>X(10);
  vector<int>Y(10);
 
double func(int i,int j){
  double dX=X.at(j)-X.at(i);
  double dY=Y.at(j)-Y.at(i);
  double K= pow(dX*dX+dY*dY,0.5);
  return K;}
 
int main() {
  cin>>N;
  for(int i=0;i<N;i++){
   cin>>X.at(i)>>Y.at(i);}
  vector<int>bangou(N);
  for(int i=0;i<N;i++){
    bangou.at(i)=i;}
  double sum=0;
  do{
    for(int i=0;i<N-1;i++){sum+=func(bangou.at(i),bangou.at(i+1));}}
     while(next_permutation(bangou.begin(),bangou.end()));
  int kaijou=1;
  for(int i=2;i<=N;i++){kaijou*=i;}
  cout << fixed << setprecision(10);
  cout<<sum/kaijou<<endl;
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <math.h>
#define rep(i,n) for(int i=0;i<=(n);i++)
using namespace std;


int to_num(char c){
  return c - 48;
}

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

  int mini = 999999999;
  for(int i=0;i<s.length()-2;i++){
    int s1 = to_num(s.at(i))*100 + to_num(s.at(i+1))*10 + to_num(s.at(i+2)) ;

    mini = min(mini, abs(s1 - 753));
  }
  cout << mini << endl;
}


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

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long LL;
#define PB push_back
#define ST first
#define ND second

const int nax = 200*1000+2;
int n;
string s;
int pref[nax],suf[nax];
int ans=1000*1000*1000;


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>s;
    for(int i=0; i<n;i++) {
        pref[i+1]=pref[i]+(s[i]=='#');
    }
    for(int i=n-1; i>=0; i--) {
        suf[i+1] = suf[i+2]+(s[i]=='.');
    }
    for(int i=0; i<=n;i++) {
        ans = min(ans,pref[i]+suf[i+1]);
    }
    cout<<ans;
}


Measured memory_bytes: 2196
#include<cstdio>
using namespace std;
int main()
{
	int a,b,c,x,i,j,k,cnt;
	cnt=0;
	scanf("%d %d %d %d",&a,&b,&c,&x);
	for(i=0;i<=a;i++){
		for(j=0;j<=b;j++){
			for(k=0;k<=c;k++){
				if(i*500+j*100+k*50==x){
					cnt++;
				}
			}
		}
	}
	printf("%d\n",cnt);
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int a,b;
  while(cin>>a>>b,a+b){
    int S[b];
    for(int i=0;i<b;i++)
      cin>>S[i];
    int flag=1;
    for(int i=0;i<a;i++){
      for(int j=0;j<b;j++){
	int B;
	cin>>B;
	S[j]-=B;
	if(S[j]<0){
	  flag=0;
	}
      }
    }
    if(flag)
      cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3076
fun main(args: Array<String>?): Unit {
    while (true) {
        val (width, q) = readLine()!!.trim().split(' ').map(String::toInt)
        if (width == 0) break;
        val state = Array(width){-1}
        repeat(q) {
            val arg = readLine()!!.trim().split(' ')
            if (arg.first() == "s") {
                var pos = -1
                val id = arg[1].toInt()
                val w = arg[2].toInt()
                for (left in 0 .. width - w) {
                    if ((0 until w).all{state[left + it] == -1}) {
                        pos = left
                        break
                    }
                }
                when(pos) {
                    -1 -> println("impossible")
                    else -> {
                        (0 until w).forEach { state[pos + it] = id }
                        println(pos)
                    }
                }
            }else {
                val id = arg[1].toInt()
                state.indices.forEach{if (state[it] == id) state[it] = -1}
            }
        }
        println("END")
    }
}


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

void solve(void){
  int N;
  cin >> N;
  int a[10000];
  for(int i=0; i<N; ++i) cin >> a[i];
  int ret = 0;
  for(int i=0; i<N; ++i){
    int cur = a[i];
    int count = 0;
    while(cur%2 == 0){
      count++;
      cur /= 2;
    }
    ret += count;
  }
  cout << ret << endl;
}

int main(void){
  solve();
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var num = ToInt32(ReadLine());
        var price = new int[num];
        for (var i = 0; i < num; i++)
            price[i] = ToInt32(ReadLine());
        Array.Sort(price);
        var result = 0;
        for (var i = 0; i < num; i++)
            if (i == price.Length - 1) result += price[i] / 2;
            else result += price[i];
        WriteLine(result);
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


Measured memory_bytes: 11220
#include<iostream>
using namespace std;
int main () {
  int N;
  cin >> N;
  char s[11];
  for (int i = 0; i < N; i ++) cin >> s[i];
  int K;
  cin >> K;
  K --;
  for (int i = 0; i < N; i ++) {
    if (s[i] == s[K]) cout << s[i];
    else cout << '*';
  }
  cout << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
int b[510][510];
int c[510];
int tmp[510][510];
int A[510][510];
int main(){
	int a;
	scanf("%d",&a);
	for(int i=0;i<a;i++)for(int j=0;j<a;j++)scanf("%d",&b[i][j]);
	for(int i=0;i<a;i++)scanf("%d",c+i);
	int T;scanf("%d",&T);
	for(int i=0;i<a;i++)A[i][i]=1;
	while(T){
		if(T%2){
			for(int i=0;i<a;i++)for(int j=0;j<a;j++)tmp[i][j]=0;
			for(int i=0;i<a;i++)for(int j=0;j<a;j++)for(int k=0;k<a;k++)
				tmp[i][j]^=(A[i][k]&b[k][j]);
			for(int i=0;i<a;i++)for(int j=0;j<a;j++)A[i][j]=tmp[i][j];
		}
		T/=2;
		for(int i=0;i<a;i++)for(int j=0;j<a;j++)tmp[i][j]=0;
		for(int i=0;i<a;i++)for(int j=0;j<a;j++)for(int k=0;k<a;k++)
			tmp[i][j]^=(b[i][k]&b[k][j]);
		for(int i=0;i<a;i++)for(int j=0;j<a;j++)b[i][j]=tmp[i][j];
	}
	for(int i=0;i<a;i++)for(int j=0;j<a;j++)b[i][j]=A[i][j];
	for(int i=0;i<a;i++)b[i][a]=c[i];
	/*for(int i=0;i<a;i++){
		for(int j=0;j<=a;j++)printf("%d ",b[i][j]);
		printf("\n");
	}*/
	int now=0;
	for(int i=0;i<a;i++){
		int at=-1;
		for(int j=now;j<a;j++){
			if(b[j][i]){
				at=j;break;
			}
		}
		if(!~at){
			continue;
		}
		for(int j=0;j<=a;j++)swap(b[now][j],b[at][j]);
		for(int j=0;j<a;j++){
			if(now==j)continue;
			if(b[j][i]){
				for(int k=0;k<=a;k++){
					b[j][k]^=b[now][k];
				}
			}
		}
		now++;
	}
	if(now<a){
		bool ok=true;
		for(int j=now;j<a;j++)if(b[j][a])ok=false;
		if(ok)printf("ambiguous\n");
		else printf("none\n");
	}else{
		for(int i=0;i<a;i++){
			if(i)printf(" ");
			printf("%d",b[i][a]);
		}
		printf("\n");
	}
}

Measured memory_bytes: 2828
N = int(input())
T,A = map(int, input().split())
H = list(map(int, input().split()))
judge = abs(A - (T - 0.006*H[0]))
k = 0

for i in range(N):
  a = abs(A - (T - 0.006*H[i]))
  if judge > a:
    judge = a
    k = i
    
print(k+1)


Measured memory_bytes: 3060
#include <bits/stdc++.h> 
using namespace std; 
#define lli long long int 
#define uli unsigned long long int 
#define INF 999999999999999999 
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n) 
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end()); 
#define Sort(n) sort(n.begin(), n.end()) 
#define Rev(n) reverse(n.begin(),n.end()) 
#define Out(S) cout << S << endl 
#define NeOut(S) cout << S 
#define HpOut(S) cout << setprecision(25) << S << endl 
#define Vec(K,L,N,S) vector<L> K(N,S) 
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S)) 
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S))) 
#define pint pair<lli,lli> 
#define paf(L,R) pair<L,R> 
#define mod 1000000007 
#define MAX 5100000 
#define ALL(a) a.begin(),a.end() 
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a)) 
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a)) 
int main(){
ios::sync_with_stdio(false); 
cin.tie(0); 
lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T; 
cin >> A >> B >> C >> K;
if(K%2)Out(B-A);
else Out(A-B);
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    solve(java.util.Scanner(System.`in`))
}

fun solve(sc: java.util.Scanner) {
    val X = sc.nextInt()

    var x = X
    var ans = (X / 500) * 1000
    x %= 500
    ans += (x / 5) * 5

    println(ans)
}


Measured memory_bytes: 31388
#include<iostream>
#include<vector>
#define INT_MAX 999999999
using namespace std;
int main()
{
  long long int n, k;
  cin>>n>>k;
  vector<long long int> h(n);
  for(int i =0;i <n; i++)
    cin>>h[i];
  vector<long long int> dp(n, 0);
  if(n==2)
    {cout<<abs(h[1] - h[0])<<endl;return 0;}
  dp[1]  = abs(h[1] - h[0]);
  for(int i = 2; i< n; i++)
  {
    dp[i] = INT_MAX;
    for(int j = i-1, l = k; j>=0 && l>0; j--, l--)
    {
        dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]));
    }
  }
  cout<<dp[n-1]<<endl;
  return 0;
}

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

int main()
{
  string s;
  string ans = "AC";
  cin >> s;

  int cnt = 0;

  if(s[0] != 'A') ans = "WA";

  for(int i = 1; i < s.size(); i++){
    if(isupper(s[i])){
      if(i == 1 || i == s.size()-1 || s[i] != 'C'){
        ans = "WA";
      }
      cnt++;
    }
  }

  if(cnt != 1) ans = "WA";

  cout << ans << endl;

  return 0;

}


Measured memory_bytes: 256
import sys

n,m=map(int,input().split())
c=set(map(int,sys.stdin))

d=[0]*(n+1)
d[0]=1
d[1]=1 if 1 not in c else 0
for j in range(2,n+1):
    if j in c:
        pass
    else:
        d[j]=(d[j-1]+d[j-2])%1000000007

print(d[n])

Measured memory_bytes: 11884
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type block struct {
	lr rune
	n  int
}

func main() {
	n, k := getInt(), getInt()
	s := []rune(getString())

	bs := make([]block, 0, n)
	now := s[0]
	cnt := 1
	for i := 1; i < n; i++ {
		if s[i] == now {
			cnt++
		} else {
			bs = append(bs, block{now, cnt})
			now = s[i]
			cnt = 1
		}
	}
	bs = append(bs, block{now, cnt})

	for i, c := 1, 1; (i < len(bs)) && (c <= k); i, c = i+2, c+1 {
		bs[i].lr = bs[i-1].lr
	}

	ans := 0
	now = bs[0].lr
	sum := bs[0].n
	for i := 1; i < len(bs); i++ {
		b := bs[i]
		if b.lr == now {
			sum += b.n
		} else {
			ans += sum - 1
			now = b.lr
			sum = b.n
		}
	}
	ans += sum - 1

	fmt.Println(ans)
}

// -----------------------------------------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	buf := 200001
	sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
}

func getInt() int {
	i, err := strconv.Atoi(getString())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 2816
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main()
{
	long long n,a[100010],i,k=1,flag=0;
	scanf("%lld",&n);
	for(i=0;i<n;i++)
		scanf("%lld",&a[i]);
	for(i=1;i<n;i++)
	{
		if(flag==0)
		{
			if(a[i]==a[i-1])
				continue;
			else if(a[i]>a[i-1])
				flag=1;
			else
				flag=2;
		}
		else if(a[i]==a[i-1]||flag==1&&a[i]>a[i-1]||flag==2&&a[i]<a[i-1])
			continue;
		else
		{
			flag=0;
			k++;
		}
	}
	printf("%lld",k);
return 0;
}

Measured memory_bytes: 896
import sys
import copy
from collections import deque
import collections
import itertools
stdin = sys.stdin
import math

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, x, t = na()

tim = 0
if n%x==0:
    tim = t*(n//x)
else:
    tim = int(t*(n//x) + t)

print(tim)

Measured memory_bytes: 68296
S=list(input())
abc=list("abcdefghijklmnopqrstuvwxyz")
idx={}
for i in range(26):
    idx[abc[i]]=i
D=[0]*26
for s in S:
    D[idx[s]]+=1

if len(S)!=26:
    for i in range(26):
        if D[idx[abc[i]]]==0:
            ans="".join(S)+abc[i]
            break
        
else:
    ans=-1
    now=S[-1]
    for i in range(len(S)-1, 0,-1):
        if idx[S[i]]> idx[S[i-1]]:
            now=sorted(list(now))

            for j,n in enumerate(now):
                if idx[n]>idx[S[i-1]]:
                    pre=n
                    ans="".join(S[:i-1])+pre
                    print(ans)
                    exit()



        else:
            now=str(now)
            now+=S[i-1]

print(ans)


Measured memory_bytes: 61856
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ul unsigned long int
#define ld long double
#define f(t) for(ll i =0;i<t;i++)
#define vi vector<int>
#define vl vector<ll>
#define pri pair<int,int>
#define mpi map<int,int>
#define prl pair<ll,ll>
#define mp make_pair
#define mpl map<ll,ll>
#define umpl unordered_map<ll,ll>
#define pb push_back
#define ff first
#define ss second
#define MOD 1000000007
#define inf 2e18
#define EPS 1e-3
#define PI 3.1415926535897932385
const double h = 1e-6;
const int MAX_  = 100005;
#define display(v) f(v.size())cout << v[i] << " "
#define all(v) v.begin(),v.end()

inline ll mul(ll a, ll b){ return (a * 1ll * b) % MOD; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += MOD; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > MOD) c -= MOD; return c; }
 //////////////////////*********CODE***********/////////////////////
 //////////////////////////////////////////////////////////////////

int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
   ll k,n;  cin>>k>>n;
   ll arr[n]; f(n)cin>>arr[i];
   ll sum = 0,mx = INT_MIN;
   for(int i =1;i<n;i++)
   {
      sum += arr[i]-arr[i-1];
      mx = max(mx,arr[i]-arr[i-1]);
   }
   sum += (k-arr[n-1]+arr[0]);   // left segment.
   mx = max(mx,k-arr[n-1]+arr[0]); cout << sum - mx;
   return 0;
}     

Measured memory_bytes: 1792
#include<stdio.h>
 
int main(){
  int i,j,n,u,k,v;
  int data[101][101];
  scanf("%d",&n);
  for( i = 1; i <= n; i++){
    for( j = 1; j <= n; j++){
      data[i][j]=0;
      }
  }
  for(i = 0; i < n; i++){
    scanf("%d",&u);
    scanf("%d",&k);
    for(j = 0; j < k; j++){
      scanf("%d",&v);
      data[u][v]=1;
    }
  }
 
  for(i = 1;i <=n;i++ ){
    for(j = 1; j <=n;j++){
      if(j==n){
    printf("%d",data[i][j]);
      }else{
    printf("%d ",data[i][j]);
      }
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 2760
#include<cmath>
#include<cstdio>
#include<cassert>
#include<algorithm>

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

using namespace std;

const double EPS=1e-8;

const int N_MAX=3;
bool Gauss_Jordan(int n,const double A[N_MAX][N_MAX],const double *b,double *x){
	static double B[N_MAX][N_MAX+1];
	rep(i,n){
		rep(j,n) B[i][j]=A[i][j];
		B[i][n]=b[i];
	}

	rep(i,n){
		int piv=i;
		for(int j=i;j<n;j++) if(abs(B[j][i])>abs(B[piv][i])) piv=j;
		rep(j,n+1) swap(B[i][j],B[piv][j]);

		if(abs(B[i][i])<EPS) return false;

		for(int j=i+1;j<=n;j++) B[i][j]/=B[i][i];
		rep(j,n) if(i!=j) for(int k=i+1;k<=n;k++) B[j][k]-=B[j][i]*B[i][k];
	}

	rep(i,n) x[i]=B[i][n];
	return true;
}

int main(){
	int n; scanf("%d",&n);
	double sx=0,sy=0,sxx=0,sxy=0,syy=0,sxxx=0,sxxy=0,sxyy=0,syyy=0;
	rep(i,n){
		int x,y; scanf("%d%d",&x,&y);
		sx+=x;
		sy+=y;
		sxx+=x*x;
		sxy+=x*y;
		syy+=y*y;
		sxxx+=x*x*x;
		sxxy+=x*x*y;
		sxyy+=x*y*y;
		syyy+=y*y*y;
	}

	double A[3][3]={
		{sxx,sxy,sx},
		{sxy,syy,sy},
		{sx,sy,n}
	};
	double b[3]={-sxxx-sxyy,-sxxy-syyy,-sxx-syy},x[3];

	assert(Gauss_Jordan(3,A,b,x));

	printf("%.9f %.9f %.9f\n",x[0],x[1],x[2]);

	return 0;
}

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

const int N = 6e3 + 5;

#define st first
#define nd second

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

bool dp[N][N];

int main() {
	int a, b, c, d, e, f;
	scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);
	dp[0][0] = 1;
	for (int water = 0; water <= f; water ++) {
		for (int sugar = 0; sugar <= water; sugar ++) {
			if (dp[water][sugar] == 0) continue;
			dp[water + 100 * a][sugar] = true;
			dp[water + 100 * b][sugar] = true;
			dp[water + c][sugar + c] = true;
			dp[water + d][sugar + d] = true;
		}
	}
	pair<int,int> best = make_pair(0, 0);
	for (int water = 0; water <= f; water ++) {
		for (int sugar = 0; sugar <= water; sugar ++) {
			if (dp[water][sugar] == 0) continue;
			if (e * water < sugar * (e + 100)) continue;
			if (best.first == 0 || best.second * water < best.first * sugar) {
				best = make_pair(water, sugar);
			} 
		}
	}
	printf("%d %d\n", best.first, best.second);
}


Measured memory_bytes: 34304
fun main(args: Array<String>) {
  val (H, A) = readInts()
  println(H / A + if (H % A == 0) 0 else 1)
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readInts() = readStrings().map { it.toInt() }
fun readLong() = readString().toLong()
fun readLongs() = readStrings().map { it.toLong() }


Measured memory_bytes: 36140
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class t>
using table = vector<vector<t>>;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"
  
void getnum(const int l, const int r, const vector<pair<ld, ld>>&armonds, const vector<pair<ld, ld>>&lines,vector<pair<int,ld>>&areas) {
	if (l + 1 == r) {
		areas[l].first = armonds.size();
	}
	else {
		int m = (l + r) / 2;
		pair<ld, ld>line(lines[m]);
		vector<pair<ld, ld>>larmonds, rarmonds;
		for (auto armond : armonds) {
			ld ay = line.first + line.second*armond.first;
			if (ay > armond.second) {
				larmonds.emplace_back(armond);
			}
			else {
				rarmonds.emplace_back(armond);
			}
		}
		getnum(l, m, larmonds, lines, areas);
		getnum(m, r, rarmonds, lines, areas);
	}
}

int main() {
	while (1) {
		int N, M, W, H, S; cin >> N >> M >> W >> H >> S;
		if (!N)break;
		vector<pair<ld, ld>>lines;
		lines.emplace_back(0, 0);
		for (int i = 0; i < M; ++i) {
			ld l, r; cin >> l >> r;
			lines.emplace_back(l, (r - l) / W);
		}
		vector<pair<ld, ld>>armonds;
		for (int i = 0; i < N; ++i) {
			ld x, y; cin >> x >> y;
			armonds.emplace_back(x, y);
		}
		vector<pair<int, ld>>areas(M);
		{
			ld asum = 0;
			for (int i = 0; i < M; ++i) {
				ld sum= (2 * lines[i + 1].first + W*lines[i + 1].second)*W / 2;
				areas[i].second = sum - asum;
				asum = sum;
			
			}
		}
		getnum(0, M, armonds, lines, areas);
		int l = 0;
		int r = 0;
		ld needarea = W*H - S + eps;
		ld sum = 0;
		int num = 0;
		int ans = 0;
		bool flag = true;
		while (1) {
			while (sum < needarea) {
				ans = max(ans, num);
				if (r == M) {
					flag = false;
					break;
				}
				else {
					sum += areas[r].second;
					num += areas[r].first;
				}
				r++;
			}
			if (!flag)break;
			while (sum > needarea) {
				sum -= areas[l].second;
				num -= areas[l].first;
				l++;
			}
		}
		cout << N-ans << endl;

	}
	return 0;
}

Measured memory_bytes: 7848
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
  int n;
  cin>>n;
  for(int i=1; i<=10000; i++){
    int sum=i*(i+1)/2;
    int x=i;
    if(sum>=n){
      for(int j=1; j<=x; j++){
        if(j==sum-n)continue;
        cout<<j<<endl;
      }
      return 0;
    }
  }
}
  

Measured memory_bytes: 256
import sys
import math
import collections
import decimal
import itertools
from collections import deque
from functools import reduce
import heapq
import copy
#n = int(input())
l, r, d = map(int, sys.stdin.readline().split())
#s = input()
#a = list(map(int, sys.stdin.readline().split()))

ans = 0
for i in range(l, r+1):
    if i % d == 0:
        ans += 1

print(ans)


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

int main() {
  string s;
  cin >> s;
  int n=s.size();
  int r=0;
  int m=0;
  for(int i=0;i<n-1;i++){
        if(s[i+1] == s[i]){
		   r++;
           if(s[i+1]- '0' == 0 ) s[i+1] ++;
           else s[i+1] --;   
		}
  }
  
   if(s[0]- '0' == 0 ) s[0] ++;
           else s[0] --; 
  m=1;		   
		   
   for(int i=0;i<n-1;i++){
        if(s[i+1] == s[i]){
		   m++;
           if(s[i+1]- '0' == 0 ) s[i+1] ++;
           else s[i+1] --;   
		}
  }
  
  cout <<  min (r,m) << endl;
}


Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

template <int64_t MOD>
class Modint {
  using Self = Modint<MOD>;

  int64_t m_value;

 public:
  explicit Modint(int64_t value) : m_value((value % MOD + MOD) % MOD) {}
  Self pow(int64_t e) const {
    if (e == 0) {
      return (Self)1;
    } else if (e % 2 == 0) {
      return ((*this) * (*this)).pow(e / 2);
    } else {
      return (*this).pow(e - 1) * (*this);
    }
  }
  Self inv() const { return pow(MOD - 2); }
  Self& operator=(const Self& rh) {
    m_value = rh.m_value;
    return *this;
  }
  Self operator-() const { return Self(-m_value); }
  Self operator+(const Self& other) const {
    return Self(m_value + other.m_value);
  }
  Self operator-(const Self& other) const {
    return Self(m_value - other.m_value);
  }
  Self operator*(const Self& other) const {
    return Self(m_value * other.m_value);
  }
  Self operator/(const Self& other) const { return (*this) * other.inv(); }
  Self& operator+=(const Self& rh) { return (*this) = (*this) + rh; }
  Self& operator-=(const Self& rh) { return (*this) = (*this) - rh; }
  Self& operator*=(const Self& rh) { return (*this) = (*this) * rh; }
  int64_t value() const { return m_value; }
};

int main() {
  using Mint = Modint<998244353L>;

  int N, S;
  cin >> N >> S;

  vector<vector<Mint>> dp(N + 1, vector<Mint>(S + 1, (Mint)0));
  const Mint u = Mint(2).pow(N);
  const Mint i2 = Mint(2).inv();
  dp[0][0] = u;

  rep(i, N) {
    int a;
    cin >> a;
    irep(j, S) {
      if (j == 0) {
        dp[i + 1][j] = u;
      } else {
        dp[i + 1][j] = dp[i][j];
        if (j - a >= 0) {
          dp[i + 1][j] += dp[i][j - a] * i2;
        }
      }
    }
  }

  cout << dp[N][S].value() << endl;

  return 0;
}

Measured memory_bytes: 73752
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


int const INF = 1001001001;


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

int n;
cin >> n;
vi a(n);
rep(i,n) cin >> a[i];
vector<bool> color(8);

int tourist = 0;

rep(i,n){
    if(a[i] <= 399) color[0] = true;
    else if(a[i] <= 799) color[1] = true;
    else if(a[i] <= 1199) color[2] = true;
    else if(a[i] <= 1599) color[3] = true;
    else if(a[i] <= 1999) color[4] = true;
    else if(a[i] <= 2399) color[5] = true;
    else if(a[i] <= 2799) color[6] = true;
    else if(a[i] <= 3199) color[7] = true;
    else tourist++;
}

int cnt = 0;
rep(i,8) if(color[i] == true) cnt++;

int M = cnt + tourist;
int m;
if(cnt == 0) m = 1;
else m = cnt;

cout << m << ' ' << M << endl;

return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <math.h>
#include <stdlib.h>
#include <numeric>

int main(){
	unsigned long long a, b, t = 0, tmp = 0;
	std::cin >> a >> b;
	if((b - a + 1) % 2 == 0){
		t = ((b - a + 1) / 2) % 2;
	}else if(a % 2 == 0){
		t = ((b - a) / 2) % 2;
	}else{
		t = ((b - a + 2) / 2) % 2;
	}
	for(unsigned long long i = 0; i < 65; i++){
		tmp = 0;
		if(a & (1ull<<i)){
			tmp += ((1ull<<i) - a) % 2;
		}
		if(b & (1ull<<i)){
			tmp += (b - (1ull<<(i+1)) + 1) % 2;
		}
		tmp %= 2;
		t += tmp<<i;
		//std::cout << tmp << std::endl;
	}
	std::cout << t << std::endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  rep2(i, 1, n-1){
    string fr = s.substr(0, i);
    string re = s.substr(i);
    map<char, int> mp;
    for(char c : fr) mp[c] = 1;
    int add = 0;
    for(char c : re){
      if(mp[c] == 1){
        add++;
        mp[c]--;
      }
    }
    ans = max(ans, add);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a[55],ma=0,mi;
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>a[i];
    if(abs(ma)<=abs(a[i])){
      mi=i;
      ma=a[i];
    }
  }
  cout<<2*n-2<<endl;
  for(int i=1;i<=n;i++){
    if(i!=mi)cout<<mi<<" "<<i<<endl;
  }
  for(int i=1;i<n;i++){
    if(ma>0)cout<<i<<" "<<i+1<<endl;
    else cout<<n-i+1<<" "<<n-i<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
n,m,k=map(int,input().split())
#par[i]:iの親　deep[i]:iの深さ　size[i]:iの大きさ
par=[i for i in range(n)]
deep=[1]*n
size=[1]*n

#親を見つける
def find(x):
  if par[x]==x:
    return x
  else:
    return find(par[x])

#二つのグループを統合する
def unite(x,y):
  x=find(x)
  y=find(y)
  if x==y:
    return
  if deep[x]<deep[y]:
    par[x]=y
    size[y]+=size[x]
  else:
    par[y]=x
    size[x]+=size[y]
    if deep[x]==deep[y]:
      deep[x]+=1

#xとyが同じグループに属するかどうか
def same(x,y):
  return find(x)==find(y)

#xが属するグループの要素数を返す
def group_count(x):
  return size[find(x)]





es=[[] for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  es[a-1].append(b)
  es[b-1].append(a)
  unite(a-1,b-1)

cnt=[1]*n
for i in range(n):
  cnt[i]=group_count(i)
  
check=[0]*n
for j in range(k):
  c,d=map(int,input().split())
  if same(c-1,d-1):
    check[c-1]+=1
    check[d-1]+=1
for i in range(n):
  print(cnt[i]-1-len(es[i])-check[i],end=" ")
  
  
  
  


Measured memory_bytes: 110216
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <deque>
#include <numeric>
using namespace std;

string YorN(bool P) { if (P)return "Yes"; else return "No"; }

int main() {

    int A,B;
    cin >> A >> B;

    cout << A + B - ((A + B > 23) ? 24 : 0) << endl;

    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <utility>
#include <queue>
#include <stdio.h>
#include <string>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000007
using namespace std;
typedef long long int ll;

vector<int> used(10,0);
int n, s, ans;

void solve(int m, int sum){
    if (m==0) {
        if (sum == s) {
            ans++;
        }
        //cout << "|"<<ans<<"|"<<endl;
        return;
    }
    for (int i=0; i<10; i++) {
        if (used[i]==0) {
            //cout << i <<" "<<m<< endl;
            used[i]=1;
            solve(m-1, sum+i);
            used[i]=0;
        }
    }
}

int fac(int n){
    if (n==0) return 1;
    return n*fac(n-1);
}

int main(){
    while (1) {
        cin >> n >> s;
        if(n==0 and s == 0) break;
        ans = 0;
        solve(n, 0);
        cout << ans/fac(n) <<endl;
    }
}

Measured memory_bytes: 1192
using System;
using static AtCoderTemplate.MyLibrary;

namespace AtCoderTemplate
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = ToIntArray(Console.ReadLine().Split(' '));
            int a = input[0],b = input[1];
            double h = input[2],m = input[3];
            double[] degree = new double[2];
            degree[0] = m * 360 / 60;
            degree[1] = (h * 360 + degree[0]) / 12;
            double radian = (degree[0] - degree[1]) * Math.PI/180;
            double len = Math.Sqrt(Math.Pow(a,2) + Math.Pow(b, 2) - 2 * a * b * Math.Cos(radian));
            Console.WriteLine(len);

            //Console.WriteLine("Hello World!");
        }
    }
    //2回位使ったら追加する
    class MyLibrary
    {
        public static int[] ToIntArray(string[] stringArray)
        {
            int length = stringArray.Length;
            int[] intArray = new int[length];
            for (int i = 0; i < length; i++)
            {
                intArray[i] = int.Parse(stringArray[i]);
            }
            return intArray;
        }
    }
}


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

int main() {
  unsigned long long a;
  string b;
  cin >> a >> b;
  
  unsigned long long d = 0;
  d += a * (b[0] - '0') * 100;
  d += a * (b[2] - '0') * 10;
  d += a * (b[3] - '0');
  cout << (d / 100);
}

Measured memory_bytes: 3192
#include <stdio.h>

int main(void)
{
	int n, a, i;
	double revans = 0, ans = 0;

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%d", &a);
		revans = revans + 1 / (double)a;
	}

	ans = 1 / revans;

	printf("%f", ans);

	return 0;
}

Measured memory_bytes: 256
//***Little by little one travels far***
 
#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main(){
    ll a,b;
    cin>>a>>b;
    cout<<((a*b)/__gcd(a,b));
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int n,m,c;
    int b[21];
    int a[21][21];
    int ans = 0;
    cin>>n>>m>>c;
    for(int i = 0; i < m; i++){
        cin>>b[i]; 
    }
    int get;
    int tmp;
    for(int i = 0; i < n; i++){
        tmp = c;
        for(int k = 0; k < m; k++){
            cin >> get;
            tmp += b[k]*get;
        }
        if(tmp>0){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	ans := 1

	for i := 0; i < n; i++ {
		if ans > k {
			ans += k
		} else {
			ans *= 2
		}
	}
	fmt.Println(ans)
}


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

int main() {
	string s; cin >> s;
	string sl = s.substr(0, s.size() / 2), sr = s.substr(s.size()/2 + 1);
	if(sl != sr) cout << "No" << endl;
	else {
		bool ok = true;
		for (int i = 0; i < sl.size() / 2; i++)
		{
			if(sl[i] != sl[sl.size()-1-i]) ok = false;
		}
		if(ok) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define dbg(x) cout << #x << ": " << (x) << '\n'
#define ff first
#define ss second
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;

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

   int n;
   cin >> n;
   int ans = 0;
   for (int i = 1; i <= n; i++) {
      int x;
      cin >> x;
      if ((i & 1) && x & 1)
         ans++;
   }
   cout << ans << '\n';

   return 0;
}

Measured memory_bytes: 3608