akhauriyash/Code-Regression huggingface dataset:
/**
 * @brief  : c++ code for AtCoder
 * @author : rk222
 * @created: 2019.12.29 19:57:34
 */

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<int, P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i, x) for (int i = 0; i < x; i++)
#define rep1(i, x) for (int i = 1; i <= x; i++)
#define rrep(i, x) for (int i = x - 1; i >= 0; i--)
#define rrep1(i, x) for (int i = x; i > 0; i--)
#define sor(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define lb(vec, a) lower_bound(vec.begin(), vec.end(), a)
#define ub(vec, a) upper_bound(vec.begin(), vec.end(), a)
#define uniq(vec) vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define mp1(a, b, c) P1(a, P(b, c))

#define disp(x) cout << #x << ": " << x << endl
#define disp_vec(v)                                                                           \
    cout << #v << ":";                                                                        \
    rep(i, v.size()) cout << " " << v[i];                                                     \
    cout << endl

const int INF = 100000000;
const int M = 100000000;
const int dir_4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
const int dir_8[8][2] = {{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};

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

int main() {
    ll a, b, k;
    scanf("%lld%lld%lld", &a, &b, &k);
    if (k > a) {
        b -= (k - a);
        a = 0LL;
    } else {
        a -= k;
    }
    a = max(a, 0LL);
    b = max(b, 0LL);
    printf("%lld %lld\n", a, b);

    /* --------------------------------- */
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int n,z=100000,i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		z=z*1.05;
		if(z%1000!=0){
			z+=1000;
		}
		z=(z/1000)*1000;
	}
	printf("%d\n",z);
	return 0;
}


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

using namespace std;

int main(void)
{
    int N;
    int sum = 0;
    int M = 0;
    int result = 0;

    scanf("%d", &N);

    if (N / 10 != 0)
    {
        sum += 9;
        if (N / 100 != 0)
        {
            if (N / 1000 != 0)
            {
                sum += 900;
                if (N / 10000)
                {
                    if (N / 100000 != 0)
                    {
                        sum += 90000;
                    }
                    else
                    {
                        M = N - 9999;
                    }
                }
            }
            else
            {
                M = N - 99;
            }
        }
    }
    else
    {
        M = N;
    }

    result = sum + M;

    cout << result << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

int main() {
  int s; cin >> s;
  int u = s / 100;
  int l = s % 100;
  bool bu = (0 < u && u <= 12);
  bool bl = (0 < l && l <= 12);

  if (bu && bl)  cout << "AMBIGUOUS" << endl;
  else if (bu)   cout << "MMYY" << endl;
  else if (bl)   cout << "YYMM" << endl;
  else           cout << "NA" << endl;
}


Measured memory_bytes: 3556
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
int main() {
    int x,y,z;
    cin >> x >> y >> z;

    int tmp = 0;

    tmp = x;
    x = y;
    y = tmp;

    tmp = 0;

    tmp = x;
    x = z;
    z = tmp;

    cout << x << " " << y << " " << " " << z << endl;
}

Measured memory_bytes: 3628
#abc091 b
n=int(input())
card=dict()
for i in range(n):
    s=input()
    if s not in card:
        card[s]=1
    else:
        card[s]+=1
m=int(input())
for i in range(m):
    t=input()
    if t not in card:
        card[t]=-1
    else:
        card[t]-=1
ans=-m

for i in card.values():
    ans=max(ans,i,0)
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(), a.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define endl "\n"
typedef long long ll;

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

    int n;
    cin >> n;
    vector<int> v(n);
    rep(i, n) {
        cin >> v[i];
    }
    int ans = 0;
    for(int i = 1; i < n - 1; i++) {
        if((v[i - 1] < v[i]) && (v[i] < v[i + 1]))
            ans++;
        else if ((v[i - 1] > v[i] && v[i] > v[i + 1]))
            ans++;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3592
def main():
    all_num, inst_num = map(int, input().split())
    data = list(input())

    data_la = []
    ans_0, ans_1 = 0, 0
    for i in range(all_num):
        if data[i] == '1':
            ans_1 += 1
            if ans_0 > 0:
                data_la.append(ans_0)
                ans_0 = 0
        else:
            ans_0 += 1
            if ans_1 > 0:
                data_la.append(ans_1)
                ans_1 = 0
    if ans_1 > 0:
        data_la.append(ans_1)
    elif ans_0 > 0:
        data_la.append(ans_0)

    ans = 0
    ans_data = 0
    count_0 = 0

    if data[0] == '0':
        data_la.insert(0, 0)

    # print(data_la)

    if len(data_la) <= 2:
        ans_data = sum(data_la)
    else:
        pre_data1_ind, pre_data2_ind = 0, 1
        pre_data1, pre_data2 = data_la[pre_data1_ind], data_la[pre_data2_ind]

        for i in range(len(data_la)):
            if i % 2 == 1:
                count_0 += 1

            if count_0 == inst_num + 1:
                ans = ans - pre_data1 - pre_data2
                pre_data1_ind += 2
                pre_data2_ind += 2
                if pre_data1_ind >= len(data_la):
                    pre_data1 = 0
                else:
                    pre_data1 = data_la[pre_data1_ind]
                if pre_data2_ind >= len(data_la):
                    pre_data2 = 0
                else:
                    pre_data2 = data_la[pre_data2_ind]
                count_0 -= 1

            ans += data_la[i]
            if ans_data < ans:
                ans_data = ans

    print(ans_data)


if __name__ == '__main__':
    main()


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

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

ll K;
vector<ll> A;

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

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

  cin >> K;
  ll ans = 0;
  rep(a, K) {
    rep(b, K) {
      rep(c, K) {
        ll tmp = gcd(b, c);
        ans += gcd(a, tmp);
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <string>

using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)

/*template*/
ll p[5] = {};
char s[5] = {};
ll toI(char c) {
	return c - '0';
}

bool ok = false;
void dfs(int n, int sum) {
	if (ok)return;
	if (n == 3) {
		if (sum == 7) {
			cout << p[0] << ((p[1] < 0) ? '-' : '+')
				<< abs(p[1]) << ((p[2] < 0) ? '-' : '+')
				<< abs(p[2]) << ((p[3] < 0) ? '-' : '+')
				<< abs(p[3]) << "=7" << endl;
			ok = true;
			return;
		}
		return;
	}
	ll next = toI(s[n + 1]);

	p[n + 1] = next;
	dfs(n + 1, sum + next);
	p[n + 1] = -next;
	dfs(n + 1, sum - next);
	p[n + 1] = 0;
}
int main() {
	rep(i, 0, 4)cin >> s[i];

	ll next = toI(s[0]);
	p[0] = next;
	dfs(0, next);
	if (!ok) {
		p[0] = -next;
		dfs(0, -next);
	}

	return 0;
}

Measured memory_bytes: 256
using System;

namespace AizuOnlineJudge {
    class Program {
        static void Main() {
            int min = int.MaxValue, max = int.MinValue;

            for (var i = int.Parse(Console.ReadLine()); i > 0; --i) {
                var c = int.Parse(Console.ReadLine());
                max = Math.Max(max, c - min);
                min = Math.Min(min, c);
            }

            System.Console.WriteLine(max);
        }
    }
}



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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<string> vs(n);
  map<string, int> cnt;
  rep(i, n) {
    cin >> vs[i];
    cnt[vs[i]]++;
  }

  int maxv = 0;
  for (auto it = cnt.begin(); it != cnt.end(); it++) {
    maxv = max(maxv, it->second);
  }

  vector<string> ans;
  for (auto it = cnt.begin(); it != cnt.end(); it++) {
    if (maxv == it->second) ans.eb(it->first);
  }

  sort(all(ans));
  rep(i, ans.size()) cout << ans[i] << endl;
}


Measured memory_bytes: 28788
//
//  main.cpp
//  Hello
//
//  Created by Gasser Mamdouh on 29/10/2019.
//  Copyright © 2019 Gasser Mamdouh. All rights reserved.
//

#include <iostream>
#include <map>
#include <utility>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <stdlib.h>
#include <string.h>
#include <list>
#include <set>
#include <stdio.h>
#include <numeric>
#include <queue>
#include <memory>
#include <limits>
#include <iomanip>

using namespace std;


int main(){
    int n, k;
    cin >> n >> k;
    vector<int> height(n), ans(n);
    for(int i = 0; i < n; i++){
        cin >> height[i];
    }
    
    ans[0] = 0;
    ans[1] = abs(height[0] - height[1]);
    for(int i = 1; i < n; i++){
        ans[i] = ans[i - 1] + abs(height[i] - height[i - 1]);
        for(int j = k; j > 0; j--){
            if(i - j < 0){
                continue;
            }
            ans[i] = min(ans[i], ans[i - j] + abs(height[i] - height[i - j]));
        }
    }
    
    cout << ans[n - 1] << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;

const int maxn = 210000;
const ll Mod = 1e9+7;

ll pw(ll x,int k)
{
	ll re=1ll;
	for(;k;k>>=1,x=x*x%Mod) if(k&1)
		re=re*x%Mod;
	return re;
}
ll s[maxn],inv[maxn];
void pre()
{
	s[0]=1ll;for(ll i=1;i<maxn;i++) s[i]=s[i-1]*i%Mod;
	inv[maxn-1]=pw(s[maxn-1],Mod-2);
	for(ll i=maxn-2;i>=0;i--) inv[i]=inv[i+1]*(i+1ll)%Mod;
}
ll C(const int i,const int j){return s[i]*inv[j]%Mod*inv[i-j]%Mod;}
int n;
int a[maxn],v[maxn],v1,v2;

int main()
{
	pre();
	scanf("%d",&n); n++;
	for(int i=1;i<=n;i++) 
	{
		scanf("%d",&a[i]);
		if(v[a[i]]) v1=v[a[i]],v2=i;
		else v[a[i]]=i;
	}
	int A=v2-v1+1;
	for(int i=0;i<n;i++)
	{
		ll re=C(n,i+1)-(n-A>=i?C(n-A,i):0ll);
		printf("%lld\n",(re+Mod)%Mod);
	}
	
	return 0;
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
   cin >> N;
    vector<int> vec(N-1);
for (int i = 0; i < N-1; i++) {
  cin >> vec.at(i);
}
  int x = vec.at(0);
  for (int i = 1; i < N-1; i++) {
    if (vec.at(i) < vec.at(i-1)) {
      x = x + vec.at(i);
    }
    else {
      x = x + vec.at(i-1);
    }
   //   cout << x << endl;
      }
  x = x + vec.at(N-2);
  cout << x << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

char tar[100][100];
int h,w;
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};

void bfs(int x,int y){
	char tem=tar[x][y];
	tar[x][y]='0';
	for(int i=0;i<4;i++)
		if(0<=x+dx[i]&&x+dx[i]<w&&0<=y+dy[i]&&y+dy[i]<h)
			if(tar[x+dx[i]][y+dy[i]]==tem)
				bfs(x+dx[i],y+dy[i]);
	return ;
}

int main(void){
	while(cin >> h >> w,h|w){
		int cnt=0;
		for(int y=0;y<h;y++)
			for(int x=0;x<w;x++)
				cin >> tar[x][y];
		for(int y=0;y<h;y++){
			for(int x=0;x<w;x++){
				if(tar[x][y]!='0'){
					bfs(x,y);
					cnt++;
				}
			}
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 1636
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define double long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    double a,b,x;
    cin >> a >> b >> x;
    x /= a;
    double ans;
    if(x <= a*b/2){
        ans = atan(b*b/2/x);
    }else{
        x = a*b - x;
        ans = atan(2*x/a/a);
    }
    cout << shosu(10) << ans/M_PI*180 << endl;
}


Measured memory_bytes: 888
# coding: utf-8
# Here your code !
import math
n=int(input())
S=list(map(int,input().split()))

q=int(input())
T=list(map(int,input().split()))
c=0
def biSearch(key):
    left = 0
    right= n
    while left<right:
        mid = math.floor((left+right)/2)
        if S[mid]==key:
            return 1
            
        elif key<S[mid]:
            right=mid
        else:
            left=mid+1
for i in T:
    if biSearch(i):
        c+=1
print(c)

Measured memory_bytes: 18784
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
string c = "CODEFESTIVAL2016";
string s;
int main(void){
  cin >> s;
  int a = 0;
  for(int i = 0; i < s.size(); i++){
    if(s[i] != c[i]) a++;
  }
  cout << a << endl;
}


Measured memory_bytes: 256
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

D = i()
c = l()
C = sorted(c)
C.reverse()
rank = [0]*26
ans = [0]*D
for i in range(D):
    s = l()
    ans[i] = s.index(max(s))+1
for i in range(26):
    rank[i] = C.index(c[i])+1
for i in range(10):
    d = D//rank[i]
    for j in range(i,D,2**d+20):
        ans[j] = i+1
for i in ans:
    print(i)

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


int main() {
 #define int long long
  int X,A;
  
  cin >> X;
  A=0;
  A+=((int)X/500)*1000;
  X=X%500;
  A+=((int)X/5)*5;
  
  
  cout << A<< endl;

}






Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <cmath>
#include <cstring>
using namespace std;

void init();
void solve();
int main(){
try { 

#ifndef CUSTOM_MAIN
#ifdef MULTIPLE_TEST_CASES_WITH_T

int T; scanf("%d",&T); while(T--) {init(); solve();}

#else
#ifdef MULTIPLE_TEST_CASES_WITHOUT_T

while(1) {try{init(); } catch(bool t){return 0;} solve(); }

#else

init(); solve();

#endif
#endif
#endif

} catch (const char* s) { return 0; }
    return 0;
}

#ifdef ENABLE_LL
#define int long long
#endif

#ifdef ENABLE_LL
#define I "%lld"
#define II "%lld%lld"
#define III "%lld%lld%lld"
#define IIII "%lld%lld%lld%lld"
#define IN "%lld\n"
#define IIN "%lld%lld\n"
#define IIIN "%lld%lld%lld\n"
#define IIIIN "%lld%lld%lld%lld\n"
#else
#define I "%d"
#define II "%d%d"
#define III "%d%d%d"
#define IIII "%d%d%d%d"
#define IN "%d\n"
#define IIN "%d%d\n"
#define IIIN "%d%d%d\n"
#define IIIIN "%d%d%d%d\n"
#endif

#ifdef __LOCALE__
#define see(a) std::cout << #a << "=" << a << std::endl
#define ses(a) std::cout << #a << "=" << a << " " 
#else
#define see(a) //std::cout << #a << "=" << a << std::endl
#define ses(a)
#endif
#define repe(a,b) for (int a=0;a<(int)b.size();a++)
#define rep(i,n) for (int i=0;i<n;i++)
#define repa(i,n) for (int i=1;i<=n;i++)
#define repi(i,a,b) for (int i=a;i<=b;i++) 
#define repb(i,a,b) for (int i=a;i>=b;i--)
typedef pair < int , int > pr; typedef pair < pr  , int > prr;
#define L first
#define R second
template <class T> inline bool checkMin(T& a , T b) { return (a > b ? a=b,1 : 0); }
template <class T> inline bool checkMax(T& a , T b) { return (a < b ? a=b,1 : 0); }
class Scanner{ private: istream& ist;public: Scanner(istream& in):ist(in){} string next(){ string r; ist >> r; return r; } string nextLine(){ string r; getline(ist,r); return r; } int nextInt(){ int r; ist >> r; return r; } double nextDouble(){ double r; ist >> r; return r; } char nextChar(){ char r; ist>>r; return r;} }; Scanner sc(cin);
void ALERT(bool judgememt, const char* phrase) { if (judgememt) { puts(phrase); throw "ALERT"; } }
bool alert(bool judgememt, const char* phrase) { if (judgememt) puts(phrase); return judgememt; }


void init() {
     
}

void solve() {
    int l, r, d; scanf(III,&l,&r,&d);
    int ans=0;
    repi (i,l,r) if (i%d==0) ans++;
    printf(IN,ans);
}



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

int main() {
	int n;
	cin >> n;
	vector<long long> a(n);
	vector<long long> b(n);
	for (int i = 0; i < n; i++) {
		scanf("%lld %lld", &a[i], &b[i]);
	}
	long long cnt = 0;
	for (int i = n - 1; i >= 0; i--) {
		a[i] += cnt;
		long long bb = (a[i] + b[i] - 1) / b[i] * b[i];
		cnt += bb - a[i];
	}
	cout << cnt << endl;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000;

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b) {
  if (a + b == a || a + b == b) return a + b;
  if (b > a) return gcd(b, a);
  return gcd(b, a % b);
}

int main(void) {
  int n, a[200010];
  cin >> n;
  rep(i, n) cin >> a[i];

  int k = 1;
  rep(i, n) {
    if (a[i] == k) k++;
  }
  if (k == 1) cout << -1 << endl;
  else cout << n - (k - 1) << endl;

}


Measured memory_bytes: 1024
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
using namespace std;
int a,b,c,ans,A,B,C;
int main(){
    scanf("%d%d%d",&a,&b,&c);
    while(ans<=100000){
        if(a&1) break;
        if(b&1) break;
        if(c&1) break;
        A=a/2,B=b/2,C=c/2;
        a=B+C,b=A+C,c=A+B;
        ++ans;
    }
    if(ans>100000)ans=-1;
    printf("%d\n",ans);
    //system("pause");
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int solve(double p1[2], double p2[2], double p3[2], double pp[2]) {
  double a, b, c;
  a = p2[1] - p1[1]; b = p1[0] - p2[0]; c = p2[0] * p1[1] - p1[0] * p2[1];
  if ((a * p3[0] + b * p3[1] + c) * (a * pp[0] + b * pp[1] + c) < 0) return 0;
  a = p3[1] - p2[1]; b = p2[0] - p3[0]; c = p3[0] * p2[1] - p2[0] * p3[1];
  if ((a * p1[0] + b * p1[1] + c) * (a * pp[0] + b * pp[1] + c) < 0) return 0;
  a = p3[1] - p1[1]; b = p1[0] - p3[0]; c = p3[0] * p1[1] - p1[0] * p3[1];
  if ((a * p2[0] + b * p2[1] + c) * (a * pp[0] + b * pp[1] + c) < 0) return 0;
  return 1;
}
int main() {
  double point[4][2];
  while (scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &point[0][0], &point[0][1], &point[1][0], &point[1][1], &point[2][0], &point[2][1], &point[3][0], &point[3][1]) != EOF) {
    if (solve(point[1], point[2], point[3], point[0]) || solve(point[0], point[2], point[3], point[1]) || solve(point[0], point[1], point[3], point[2]) || solve(point[0], point[1], point[2], point[3])) printf("NO\n");
    else printf("YES\n");
  }
  return 0;
}

Measured memory_bytes: 608
M=1000000007

N = int(input())
A = [-1] + list(map(int,input().split()))

x = [0]*(N+1)
y = [0]*(N+1)
z = [0]*(N+1)
ans=1

for i in range(1,N+1):
    if A[i] == x[i-1] and A[i] == y[i-1] and A[i] == z[i-1]:
        ans = (ans * 3) %M
    elif A[i] == x[i-1] and A[i] == y[i-1]: 
        ans = (ans * 2) %M
    elif A[i] == y[i-1] and A[i] == z[i-1]: 
        ans = (ans * 2) %M
    elif A[i] == z[i-1] and A[i] == x[i-1]: 
        ans = (ans * 2) %M
    if A[i] == x[i-1]:
        x[i]=x[i-1]+1
        y[i]=y[i-1]
        z[i]=z[i-1]
    elif A[i] == y[i-1]:
        x[i]=x[i-1]
        y[i]=y[i-1]+1
        z[i]=z[i-1]
    elif A[i] == z[i-1]:
        x[i]=x[i-1]
        y[i]=y[i-1]
        z[i]=z[i-1]+1
    else:
        ans = 0
        break

print(ans)

Measured memory_bytes: 14088
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n,x=MI()
    aa=LI()
    ans=0
    for i in range(n-1):
        cur=max(aa[i]+aa[i+1]-x,0)
        ans+=cur
        aa[i+1]-=min(cur,aa[i+1])
    print(ans)

main()

Measured memory_bytes: 14172
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>

using namespace std;
typedef long long ll;

int main()
{
    int a, b, c;
    int k;
    cin >> a >> b >> c >> k;
    for (int i = 0; i <= 7; i++)
    {
        for (int j = 0; j <= 7; j++)
        {
            if (i + j > k)
                continue;
            int l = k - i - j;
            for (int m = 0; m <= l; m++)
            {

                if (b * pow(2, j) > a * pow(2, i) & b * pow(2, j) < c * pow(2, m))
                {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 4096
data = []
for i in range(5):
    data.append(int(input()))

total_time = 0
max_wait_time = 10
for i in range(5):
    total_time += int(data[i]/10)*10
    if data[i]%10 != 0:
        total_time += 10
        if data[i]%10 < max_wait_time:
            max_wait_time = data[i]%10
print(total_time - (10-max_wait_time))

Measured memory_bytes: 3060
sd = input()
t = input()

n = len(sd)
m = len(t)
s = []

# sd を後ろから見ていき、 t の入りそうな場所を探す
for i in range(n - m, -1, -1):
    t_kamo = sd[i:i + m]
    for j in range(m + 1):
        # 1文字ずつ順に入りうるか調べ、最後まで入るなら "?" を "a" に置き換えて出力
        if j == m:
            print((sd[:i] + t + sd[i + len(t):]).replace("?", "a"))
            exit()
        if t_kamo[j] == "?":
            continue
        elif t_kamo[j] != t[j]:
            break

print("UNRESTORABLE")


Measured memory_bytes: 3064
[N,M] = list(map(int,input().split()))
G = [[] for i in range(N)]

for i in range(M):
    Atmp,Btmp = list(map(int,input().split()))
    G[Atmp-1].append(Btmp-1)
    G[Btmp-1].append(Atmp-1)

out = [None]*N

from collections import deque

dist = [None]*N
que = deque([0])
out[0] = 0
while que:
    v = que.popleft()
    d = dist[v]
    for w in G[v]:
        if dist[w] is not None:
            continue
        dist[w] = 1
        out[w] = v
        que.append(w)

print("Yes")
for i in range(1,len(out)):
    print(out[i]+1)

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

int main(){
	string s;
	cin >> s;
	
	cout << s.at(0) << s.size()-2 << s.at(s.size()-1) << endl;
}

Measured memory_bytes: 256
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

import Debug.Trace

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = readLn >>= putStrLn . concatMap show . ( \x -> if null x then [0] else x ) . dropWhile ( == 0 ) . solve ( reverse $ take 40 bounds ) ( reverse $ take 40 bases )

bounds = bounds' ( 0, 0 ) 1
	where
		bounds' b@( l, r ) w
			| w > 0 = b : bounds' ( l, r + w ) ( w * (-2) )
			| otherwise = b : bounds' ( l + w, r ) ( w * (-2 ) )

bases = 0 : zipWith (*) ( cycle [ 1, -1 ] ) [ 2 ^ k | k <- [ 0 .. ] ]

solve [ _ ] _ _ = []
solve ( cur : nex : rest ) (b:bs) n
	| inside cur n && not ( inside nex n ) = 1 : solve' ( n - b )
	| otherwise = 0 : solve' n
	where
		inside ( l, r ) n = l <= n && n <= r
		solve' = solve ( nex : rest ) bs

Measured memory_bytes: 508
n = int(input())

if n <= 104:
    print(0)
    exit()


count = 1
for i in range(106, n+1):
    if i % 2 == 0:
        continue
    arr = []
    for j in range(1,i+1):
        if i % j == 0:
            arr.append(j)
    if len(arr) == 8:
        count+=1

print(count)
    

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,a,b) for(ll i=a;i <= b;i++)
#define fast_io ios_base::sync_with_stdio(false)
#define pb push_back
#define fir first
#define sec second
#define tr(it,x) for(it = x.begin();it != x.end();it++)
#define mp make_pair
#define sz(x) (ll)x.size()
#define rep(i,n) for(ll i=0;i<n;i++)
#define double long double
#define accuracy ll precision = numeric_limits<double>::digits10
#define pll pair<ll,ll>
#define M 100005
#define N 105

ll n,w,dp[M][2],we[N],va[N],ans;

int main() {
	// freopen("input.txt", "r", stdin); 
	// freopen("output.txt", "w", stdout);
	fast_io;	 
	accuracy;
	cin >> n >> w;
	fr(i,1,n) cin >> we[i] >> va[i];
	fr(i,0,M-1) {
		fr(j,0,1) dp[i][j] = LLONG_MAX;
	}
	dp[0][0] = 0;
	dp[0][1] = 0;
	fr(i,1,n) {
		fr(j,0,M-1) {
			if(dp[j][0] != LLONG_MAX) {
				dp[j + va[i]][1] = min(dp[j + va[i]][1],dp[j][0] + we[i]);
			}
		}
		fr(j,0,M-1) {
			dp[j][0] = dp[j][1];
		}
	}
	fr(j,0,M-1) {
		if(dp[j][0] <= w) ans = j;
	}
	cout << ans << endl;
}

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

int main(void) {

  std::string s, t, u;
  int a, b;
  std::cin >> s >> t;
  std::cin >> a >> b;
  std::cin >> u;

  if (u == s) {
    a--;
  } else if (u == t) {
    b--;
  }

  std::cout << a << " " << b << std::endl;

  return 0;
}

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

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

#define INF (INT_MAX/2-1)
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

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

int main(){
  /*
  int N;
  cin>>N;
  vector<ll>A(N);
  for(int i=0;i<N;i++)cin>>A[i];
  for(int i=0;i<N-1;i++){
    if(A[i]+A[i+1]<-A[i]-A[i+1]){
      A[i]*=-1;
      A[i+1]*=-1;
    }
  }
  ll sum=0;
  for(int i=0;i<N;i++){
    sum+=A[i];
    cout<<A[i]<<endl;
  }
  cout<<endl;
  cout<<sum<<endl;
  */
  int N;
  cin>>N;
  vector<ll>A(N);
  for(int i=0;i<N;i++)cin>>A[i];
  vector<ll>suml(N),sumr(N);
  for(int i=0;i<N;i++){
    if(i==0)suml[i]=A[i];
    else suml[i]=gcd(suml[i-1],A[i]);
  }
  for(int i=N-1;i>=0;i--){
    if(i==N-1)sumr[i]=A[i];
    else sumr[i]=gcd(sumr[i+1],A[i]);
  }
  ll Max = 1;
  for(int i=0;i<N;i++){
    ll GCD=0;
    if(i-1>=0)GCD=gcd(GCD,suml[i-1]);
    if(i+1<N)GCD=gcd(GCD,sumr[i+1]);
    Max=max(Max,GCD);
  }
  cout<<Max<<endl;
  return 0;
}



Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int n,m;
int main(){
    string s,t;
    cin>>n>>m;
    for(int i=1;i<=n;i++) s+='0'+m;
    for(int i=1;i<=m;i++) t+='0'+n;
    cout<<min(s,t)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(string s;getline(cin,s),s!="END OF INPUT";){
		for(int i=0,j=0;;){
			if(j==s.size()){
				cout<<j-i;
				break;
			}
			if(s[j]==' '){
				cout<<j-i;
				j++;
				i=j;
			}
			else
				j++;
		}
		cout<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T CHMAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T CHMIN(T & a, const T b) { return a = (a > b) ? b : a; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main()
{
    INIT;
    int n, m;
    cin >> n >> m;
    vector<int> h(n);
    
    vector<int> copy(n);
    int sum = 0;
    REP(i,n){
        cin >> h.at(i);
        copy.at(i) = h.at(i);
    }

    int a,b;
    REP(i,m){
        cin >> a >> b;
        if(h.at(a-1) < h.at(b-1)){
            copy.at(a-1) = 0;
        }
        else if(h.at(a-1) > h.at(b-1)){
            copy.at(b-1) = 0;
        }else{
            copy.at(b-1) = 0;
            copy.at(a-1) = 0; 
        }
    }
    int ans = 0;
    REP(i,n){
        if(copy.at(i) != 0) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;

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


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

    int ans = 10 * A + B + C;

    ans = max(ans, 10 * B + C + A);
    ans = max(ans, 10 * C + A + B);

    cout << ans << endl;
}

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

#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif

signed main(){

  int n; cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  multiset<int> st;
  for(int i = 0; i < n; i++){
    auto it = st.lower_bound(a[i]);
    if(it != st.begin()){
      it--;
      st.erase(it);
    }
    st.insert(a[i]);
  }
  cout << st.size() << endl;

  return 0;
}


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

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i = 0; i<n; i++)
        cin>>a[i];
    int d[n];
    d[0] = 0;
    d[1] = abs(a[1]-a[0]);
    for(int i = 2; i<n; i++)
        d[i] = min((d[i-1]+abs(a[i]-a[i-1])),(d[i-2]+abs(a[i]-a[i-2])));
    cout<<d[n-1];
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <functional>
using namespace std;
//#define rep(i,n) for(i=0; i < n; i++)
typedef long long ll;
#define MAX 10000000

vector<int> V(MAX);


int main(){
    string s;
    cin >> s;
    //0の最大距離を求める
    int len = s.length();
    int minl = len;
    for(int i = 0; i < s.length()-1; i++){
        if(s[i]!=s[i+1]) {
            minl = min(minl, max(i+1, len-(i+1)));
        }
    }
    cout << minl << endl;
}


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

int s[501][501];

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

  for(int i = 0; i < m; i++){
    int l, r;
    cin >> l >> r;
    s[l][r]++;
  }

  for(int i = 0; i <= n; i++){
    for(int j = 1; j <= n; j++){
      s[i][j] += s[i][j-1];
    }
  }

  for(int i = 0; i < q; i++){
    int pp, qq;
    cin >> pp >> qq;

    int ans = 0;
    for(int j = pp; j <= qq; j++){
      ans += s[j][qq];
    }

    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 1920
n,m = map(int, input().split())
K = [list(map(int, input().split()))[1:] for _ in range(m)]
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
    bit = [i>>j&1 for j in range(n)]
    for j,k in enumerate(K):
        if p[j] != sum([bit[l-1] for l in k])%2:
            break
    else:
        ans += 1
print(ans)


Measured memory_bytes: 9108
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
sa,sb = sum(A),sum(B)
if sa > sb:
    print('No')
    exit()

x = y = 0
for a,b in zip(A,B):
    if a < b:
        x += (b-a+1)//2
        y += (b-a)%2
    elif a > b:
        y += a-b

if x>sb-sa or y>sb-sa:
    print('No')
else:
    print('Yes' if x>=y else 'No')

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

#define int long long

int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int N, P;
int a[50];

signed main() {
    cin >> N >> P;
    int odd = 1, even = 0;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        if (a[i] % 2 == 0) {
            odd *= 2;
            even *= 2;
        } else {
            odd = odd + even;
            even = odd;
        }
    }
    if (P % 2 == 0) {
        cout << odd << endl;
    } else {
        cout << even << endl;
    }
    return 0;
}


Measured memory_bytes: 256
readlines.each do |input|
  message = input.chomp

  if message.size.odd?
    puts "NA"
    next
  end

  message_int = []
  message.chars.map(&:to_i).map{|x| x-1}.each_slice(2){ |x| message_int << x }
  if message_int.map{ |set| 0 <= set.first && set.first <= 5 && 0 <= set.last && set.last <= 4 }.include?(false)
    puts "NA"
    next
  end

  table = Array.new(6)
  table.map!{Array.new(5)}
  int = 97
  0.upto(5) do |i|
    0.upto(4) do |j|
      if i == 5
        case j
        when 0
          table[i][j] = 'z'
        when 1
          table[i][j] = '.'
        when 2
          table[i][j] = '?'
        when 3
          table[i][j] = '!'
        when 4
          table[i][j] = ' '
        end
      else
        table[i][j] = int.chr
        int += 1
      end
    end
  end

  message_int.each { |set| print table[set.first][set.last] }
  puts ""

end

Measured memory_bytes: 6116
//==========================Head files==========================
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
#include<iostream>
#include<map>
#define LL long long
#define db double
#define mp make_pair
#define pr pair<int, int>
#define fir first
#define sec second
#define pb push_back
#define ms(i, j) memset(i, j, sizeof i)
using namespace std;
//==========================Templates==========================
inline int read() {
    int x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
inline LL readl() {
    LL x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
int power(int a, int b) {
	int ans = 1;
	while (b) {
		if(b & 1) ans = ans * a;
		b >>= 1; a = a * a;
	}
	return ans;
}
int power_mod(int a, int b, int mod) {
	a %= mod;
	int ans = 1;
	while (b) {
		if(b & 1) ans = (ans * a) % mod;
		b >>= 1, a = (a * a) % mod;
	}
	return ans;
}
LL powerl(LL a, LL b) {
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = ans * a;
		b >>= 1ll;a = a * a;
	}
	return ans;
}
LL power_modl(LL a, LL b, LL mod) {
	a %= mod;
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = (ans * a) % mod;
		b >>= 1ll, a = (a * a) % mod;
	}
	return ans;
}
LL gcdl(LL a, LL b) {return b == 0 ? a : gcdl(b, a % b);}
LL abssl(LL a) {return a > 0 ? a : -a;}
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
int abss(int a) {return a > 0 ? a : -a;}
//==========================Main body==========================
#define LD "%I64d"
#define D "%d"
#define pt printf
#define sn scanf
#define pty printf("YES\n")
#define ptn printf("NO\n")
//==========================Code here==========================
LL n, L;
int main() {
	cin >> n >> L;
	LL ans = 0, bs = 1e18;
	for (LL i = 1; i <= n; ++i) {
		LL tmp = L + i - 1;
		ans += tmp;
		if (abssl(tmp) < abssl(bs)) bs = tmp;
	}
	cout << ans - bs;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
  int W[10],K[10],wsum,ksum,a=10,b=10;
  wsum=0,ksum=0;
  for(int i=0;i<10;i++){
    cin>>W[i];
  }for(int i=0;i<10;i++){
    cin>>K[i];
  }
  sort( W , W+a , greater<int>() );
  sort( K , K+b , greater<int>() );
  for(int i=0;i<3;i++){
    wsum+=W[i];
    ksum+=K[i];
  }
  cout<<wsum<<" "<<ksum<<endl;
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i=0 ; i<N ; i++) {
    cin >> vec.at(i);
  }
  double num = 0;
  for (int j=0 ; j<N ; j++) {
    num += 1.0/vec.at(j) ;
  }
  cout << 1.0/num << endl;
    
}



Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

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

    int n = s.size();
    
    
    int cnt1 = 0, cnt2 = 0;
    for(int i=0;i<n;i++){
        if(s[i] == (char)('0' + i % 2)){
            cnt1++;
        }
        else{
            cnt2++;
        }
    }
    cout << min(cnt1, cnt2) << endl;
    return 0;
}
      

Measured memory_bytes: 512
#include<stdio.h>
#include<algorithm>
using namespace std;
int table[10000];
int a;
int solve(int b){
	int search=table[b];
	int left=b;
	int right=b+1;
	int ret=a;
	while(1){
		search=table[left];
		int count=0;
		while(table[left]==search&&left>=0){
			left--;
			count++;
		}
		while(table[right]==search&&right<a){
			right++;
			count++;
		}
		if(count<4)break;
		else ret-=count;
	}
	return ret;
}
int main(){
	while(scanf("%d",&a),a){
		int ret=99999999;
		for(int i=0;i<a;i++)scanf("%d",table+i);
		for(int i=0;i<a;i++){
			int moto=table[i];
			table[i]=1;
			ret=min(solve(i),ret);
			table[i]=2;
			ret=min(solve(i),ret);
			table[i]=3;
			ret=min(solve(i),ret);
			table[i]=moto;
		}
		printf("%d\n",ret);
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

int n;
vector <int> a;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    a.resize(n);
    for(auto &i : a) cin >> i;
    int sum = 0;
    for(auto &i : a) sum += i;
    int ans = 1e9;
    int cur = 0;
    for(auto &i : a){
        sum -= i;
        cur += i;
        ans = min(ans, abs(cur - sum));
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  string S;
  cin>>S;
  if(S=="Sunny"){
    cout<<"Cloudy"<<endl;
  }
  else if(S=="Cloudy"){
    cout<<"Rainy"<<endl;
  }
   else if(S=="Rainy"){
    cout<<"Sunny"<<endl;
  }
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;


public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final int H = sc.nextInt();
			final int A = sc.nextInt();
			
			System.out.println((H + A - 1) / A);
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

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

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

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

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 21076
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <limits.h>

int main(void){
    char s[12],uppercasecmp[27]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    scanf("%s",s);
    if (s[0]!='A'){
        printf("WA\n");
        return 0 ;
    }
    for (int i=0; i<27; i++){
        if (s[1]==uppercasecmp[i]){
            printf("WA\n");
            return 0;
        }
    }
    int count=0;
    for (int i=2; i<strlen(s)-1; i++){
        for (int j=0; j<27; j++){
            if (s[i]==uppercasecmp[j]){
                if (j==2){
                    count++;
                } else {
                    printf("WA\n");
                    return 0 ;
                }
            }
        }
    }
    if (count!=1){
        printf("WA\n");
        return 0 ;
    }
    for (int i=0; i<27; i++){
        if (s[strlen(s)-1]==uppercasecmp[i]){
            printf("WA\n");
            return 0;
        }
    }
    printf("AC\n");
	return 0 ;
}


Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll A, P;
  cin >> A >> P;
  P = P + (3 * A);
  cout << P / 2 << endl;
  return 0;
}

Measured memory_bytes: 3568
#include <iostream>
using namespace std;
int main(void){
    int x;
    cin>>x;
    if(x%7==0){
        cout<<"thu";
    }
    else if(x%7==1){
        cout <<"fri";
    }
    else if(x%7==2){
        cout <<"sat";
    }
    else if(x%7==3){
        cout<<"sun";
    }
    else if(x%7==4){
        cout<<"mon";
        
    }
    else if(x%7==5){
        cout<<"tue";
    }
    else{
        cout<<"wed";
    }
    
cout<<endl;
    }
    



Measured memory_bytes: 3116
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int a = 10 - (n / 100);
        int b = 10 - ((n % 100) / 10);
        int c = 10 - (n % 10);
        int ans = a * 100 + b * 10 + c;

        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s, t;
    cin>>s>>t;
    int ans = 0;
    for(int i=0;i<s.length();i++)
    {
        if(s[i] == t[i]) ans++;
    }
    cout<<ans<<endl;
}


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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define REP(idx, N) for (u64 idx = 0; idx < N; idx++)

int main() {
  u32 K = 0;
  string S;
  cin >> K >> S;

    if (S.length() <= K){
        cout << S;
    }
    else{
        cout << S.substr(0, K) << "...";
    }


  return 0;
}


Measured memory_bytes: 3628