akhauriyash/Code-Regression huggingface dataset:
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <algorithm>

struct P {
    float x, y;
    P operator-(const P& p) {
        return P{x - p.x, y - p.y};
    }
};

float dot(const P& p1, const P& p2) {
    return p1.x * p2.x + p1.y * p2.y;
}

float cross(const P& p1, const P& p2) {
    return p1.x * p2.y - p1.y * p2.x;
}

float abs(const P& p) {
    return std::sqrt(p.x * p.x + p.y * p.y);
}

float distance_ls_p(P a, P b, P c) {
  if ( dot(c-b, a-b) < 1e-6 ) return abs(b-a);
  if ( dot(a-c, b-c) < 1e-6 ) return abs(c-a);
  return std::abs(cross(b-c, a-b)) / abs(b-c);
}

int main()
{
    struct UFO {
        float x, y;
        float v;
        float r;
        float sita;
        float d;
    };
    
    while (true) {
        int count = 0;
        int R, N;
        std::cin >> R >> N;
        
        if (R == 0 && N == 0) {
            break;
        }
        
        std::vector<UFO> ufos(N);
        
        for (int i = 0; i < N; i++) {
            std::cin >> ufos[i].x >> ufos[i].y >> ufos[i].r >> ufos[i].v;
            ufos[i].sita = std::atan2(ufos[i].y, ufos[i].x);
            ufos[i].d = std::sqrt(ufos[i].x * ufos[i].x + ufos[i].y * ufos[i].y);
        }
        
        while (!ufos.empty()) {
            for (std::size_t i = 0; i < ufos.size(); i++) {
                ufos[i].d = std::max(ufos[i].d - ufos[i].v, 0.0f);
                ufos[i].x = std::cos(ufos[i].sita) * ufos[i].d;
                ufos[i].y = std::sin(ufos[i].sita) * ufos[i].d;
            }
            
            count += std::count_if(ufos.begin(), ufos.end(), [R](auto& elem){
                return elem.d <= R;
            });
            
            {
                auto rm_it = std::remove_if(ufos.begin(), ufos.end(), [R](auto& elem){
                    return elem.d <= R;
                });
                ufos.erase(rm_it, ufos.end());
            }
            
            std::sort(ufos.begin(), ufos.end(), [](auto& lhs, auto& rhs){
                return lhs.d < rhs.d;
            });
            
            if (ufos.empty()) {
                break;
            }
            
            float a = ufos[0].y / ufos[0].x;
            {
                float shot_angle = std::atan2(ufos[0].y, ufos[0].x);
                auto rm_it = std::remove_if(ufos.begin(), ufos.end(), [shot_angle, R, a, &ufos](auto& elem){
                    return distance_ls_p(P{elem.x, elem.y}, 
                                         P{R * std::cos(shot_angle), R * std::sin(shot_angle)},
                                         P{1e6f * std::cos(shot_angle), 1e6f * std::sin(shot_angle)}) < elem.r;
                });
                ufos.erase(rm_it, ufos.end());
            }
        }
        printf("%d\n", count);
    }
}



Measured memory_bytes: 3384
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>

#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n;i++)
#define repf(i, a, b) for (int i = (int)a; i < (int)b;i++)
#define repv(x, arr) for (auto& x:arr)
#define all(v) (v).begin(), (v).end()
#define vec(name, num) vector<ll> name((num), 0);
#define mp(a,b) make_pair(a,b)
#define op(i) cout << (i) << endl;
#define F first
#define S second

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;

const ll mod = 1e9 + 7;
const ll infl = 1e17;

typedef unsigned long long ull;

struct tur{
    ll num;
    ll A;
    ll B;
    tur(ll inp_num,ll inp_A,ll inp_B){
        num = inp_num;
        A = inp_A;
        B = inp_B;
    }
    bool operator < (const tur &another) const{
        return A + B < another.A + another.B;
    };
};

int main(){
    ll N;
    cin >> N;
    vector<tur> turget;
    ll A, B;
    rep(i,N){
        cin >> A >> B;
        turget.push_back(tur(i, A, B));
    }
    sort(turget.begin(), turget.end());
    ll ans = 0;
    rep(i,N){
        if (i&1){
            ans -= turget[N - 1 - i].B;
        }
        else {
            ans += turget[N - 1 - i].A;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4852
/*
 * author :Sadik Hassan
 *
*/
#include "bits/stdc++.h"
using namespace std;
#define ll            long long
#define nl            "\n"
#define PB            push_back
#define fi            first
#define se            second
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define rep(i,n)      for(int i=0;i<n;i++)
#define repn(i,n)     for(int i=1;i<=n;i++)
#define rrep(i,n)     for(int i=n-1;i>=0;i--)
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
/*---------------------------------------------------------------------*/
const int N = 2e5+10;

int main()
{
    _SAD()
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=200000;i++)
    {
        if((k-1)*i+1>=n)
        {
            cout<<i<<nl;
            return 0;
        }
    }
    return 0;
}


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

int N;
lint arr[200010], ans;
int zjmp[200010];

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

    cin>>N;
    for(int n = 0; n < N; n++) cin>>arr[n];
    for(int n = N-1, last = N; n >= 0; n--) {
        if(!arr[n]) zjmp[n] = last;
        else last = n;
    }
    for(int b = 0; b < N; b++) {
        lint v = 0;
        for(int e = b; e <= N; e++) {
            if(e == N) {
                ans += e - b;
                break;
            }
            if(!arr[e]) e = zjmp[e];
            if(e == N) {
                ans += e - b;
                break;
            }
            if((arr[e] ^ v) != arr[e] + v) {
                ans += e - b;
//                cout<<b<<' '<<e<<'\n';
                break;
            }
            v ^= arr[e];
        }
    }
    cout<<ans<<'\n';

    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
// #include <numeric>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
typedef long long int ll;
#define iceil(a,b) (x+y-1)/y
#define min(x,y)(x<y?x:y)
 
using namespace std;
typedef pair<int, int> P;


int main() {
	FAST;

	int n;
	cin >> n;

	long a[n+1];
	a[0]=0;
	rep(i,1,n+1) {cin >> a[i]; a[i] = a[i-1] + a[i];}

	long ans=LONG_MAX;

	long s[4];

	int l=1, r=3;
	for(int i=2; i<n; i++) {
		while (l<i && abs(a[l] - abs(a[i]-a[l])) >= abs(a[l+1] - abs(a[i]-a[l+1]))) l++;
		while (r<n && abs(a[n]-a[r] - abs(a[r]-a[i])) >= abs(a[n]-a[r+1] - abs(a[r+1]-a[i]))) r++;
		// cout << "i="<<i <<",l="<<l<<",r="<<r<<"\n";
		s[0] = a[l]; s[1] = a[i] - a[l]; s[2] = a[r] - a[i]; s[3] = a[n] - a[r];
		// cout << "s = " << s[0] << " " << s[1] << " " << s[2] << " " << s[3] << "(before sort)\n";
		sort(s, s+4);
		// cout << "s = " << s[0] << " " << s[1] << " " << s[2] << " " << s[3] << "(after sort)\n";
		// cout << "ans = " << ans << "\n";
		// cout << "s   = " << abs(s[]3]-s[0]) << "\n";
		ans = min(ans, abs(s[3]-s[0]));
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 1792
/*
ID: espr1t
TASK: 
KEYWORDS: 
*/

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;
FILE* in = stdin; FILE* out = stdout;

const int MAX = 128;

vector <int> divs;
int dyn[MAX][MAX];

int recurse(int idx, int rem) {
    if (rem == 1)
        return 1;
    if (idx >= (int)divs.size())
        return 0;
    if (dyn[idx][rem] != -1)
        return dyn[idx][rem];
    
    int ans = 0;
    for (int use = 0; use <= divs[idx]; use++) {
        if (rem % (use + 1) == 0) {
            ans += recurse(idx + 1, rem / (use + 1));
        }
    }
    
    return dyn[idx][rem] = ans;
}

int main(void) {
	// in = fopen("D.in", "rt");
	
	int rem[MAX];
	for (int i = 0; i < MAX; i++)
	    rem[i] = i;
	
	int n;
	fscanf(in, "%d", &n);
	for (int i = 2; i <= n; i++) {
	    if (rem[i] != 1) {
	        int cur = 0;
	        for (int c = i; c <= n; c += i) {
	            while (rem[c] % i == 0) {
	                cur++;
	                rem[c] /= i;
                }
            }
            divs.push_back(cur);
        }
    }
    
    memset(dyn, -1, sizeof(dyn));
    int ans = recurse(0, 75);
    fprintf(out, "%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
        int n; cin >> n;
        int arr[n];
        for (int x = 0; x < n; ++x){
            cin >> arr[x];
        }
        sort(arr, arr+n);
        for (int x = 0; x < n-1; ++x){
            if (arr[x] == arr[x+1]){
                cout << "NO";
                return 0;
            }
        }
        cout << "YES" << endl;
    return 0;
}



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

const int INF = 100100;

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

    vector<int> dp(n + 1, INF);
    dp[0] = 0;
    for (int i = 1; i <= n; i++)
    {
        for (int pow = 6; pow <= i; pow *= 6)
            if (i - pow >= 0)
                dp[i] = min(min(dp[i - pow] + 1, dp[i - 1] + 1), dp[i]);
        for (int pow = 9; pow <= i; pow *= 9)
            if (i - pow >= 0)
                dp[i] = min(min(dp[i - pow] + 1, dp[i - 1] + 1), dp[i]);
        if (dp[i] == INF)
            dp[i] = dp[i - 1] + 1;
    }

    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 3712
#include <stdio.h>
#include <queue>
using namespace std;
int main(){
    int n,temp,now,cnt;
    long long int ans=0;
    priority_queue<int> pq;
    scanf("%d",&n);
    while(n--){
        scanf("%d",&temp);
        pq.push(temp);
    }
    cnt=now=0;
    while(!pq.empty()&&pq.top()>now){
        ans+=pq.top()-now;
        pq.pop();
        cnt++;
        if(cnt==4){
            cnt=0;
            now++;
        }
    }
    printf("%lld\n",ans+1);
}


Measured memory_bytes: 2784
def line(i,j):
    retval=[]
    if i<=5 and j<=5:
        if i<j:
            for k in range(i,j+1):
                retval.append(k)
        else:
            for k in range(i,j-1,-1):
                retval.append(k)

    elif i<=5 and j>5:
        for k in range(i,j+1):
            retval.append(k)

    elif i>5 and j>5:
        if i<j:
            for k in range(i,j+1):
                retval.append(k)
        else:
            for k in range(i,10):
                retval.append(k)
            retval+=[5,4,3,2,1,0,1,2,3,4,5]
            for k in range(6,j+1):
                retval.append(k)
    else:
        for k in range(i,10):
            retval.append(k)
        for k in range(5,j-1,-1):
            retval.append(k)


    return " ".join([str(i) for i in retval])

N=int(input())
for i in range(N):
    print(line(*[int(j) for j in input().split(" ")]))



Measured memory_bytes: 5612
n = int(input())
A = [list(map(int,input().split())) for i in range(n-1)]

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

for i in range(len(A)):
    B[A[i][0]].append([A[i][1],A[i][2]])
    B[A[i][1]].append([A[i][0],A[i][2]])

root = 0
for i in range(len(B)):
    root = max(root, len(B[i]))

ANS = [-1 for i in range(n+1)]
ANS[root]=0
#print(B)
nurulist = [root]
t = 0
while t < len(nurulist):
    k = nurulist[t]
    col = ANS[k]
    for j in range(len(B[k])):
        if ANS[B[k][j][0]] == -1:
            ANS[B[k][j][0]] = (col + B[k][j][1])%2
            nurulist.append(B[k][j][0])
    t += 1


#print(ANS)

for i in range(n):
    print(ANS[i+1])


Measured memory_bytes: 60068
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long LL;
const int INF=0x3f3f3f3f;
const int MAXN=1e5+5;
int a[MAXN];
int G[105][105];

int main()
{
    int h,w;
    while(scanf("%d%d",&h,&w)!=EOF)
    {
        int n;
        scanf("%d",&n);
        for(int i=1;i<=n;++i)
            scanf("%d",&a[i]);
        int cnt=1;
        for(int i=1;i<=h;++i)
        {
            if(i%2==1)
            {
                for(int j=1;j<=w;++j)
                {
                   if(a[cnt]>0) {G[i][j]=cnt;--a[cnt];}
                   else if(a[cnt]==0) {++cnt;G[i][j]=cnt;--a[cnt];}
                }
            }else
            {
                for(int j=w;j>=1;--j)
                {
                    if(a[cnt]>0) {G[i][j]=cnt;--a[cnt];}
                    else if(a[cnt]==0) {++cnt;G[i][j]=cnt;--a[cnt];}
                }
            }
        }
        for(int i=1;i<=h;++i)
        {
            for(int j=1;j<=w;++j)
            {
                if(j!=w) printf("%d ",G[i][j]);
                else printf("%d\n",G[i][j]);
            }
        }
    }
    return 0;
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;


public class Main {
	private	static	BufferedReader	br = null;
	private	static	MyConv			cv = null;

	static {
		br = new BufferedReader(new InputStreamReader(System.in));
		cv = new MyConv();
	}
 
    /**
     * @param args
     */
	public static void main(String[] args) {
	// TODO Auto-generated method stub
		String	stdin = null;

		while ((stdin = parseStdin()) != null) {
			boolean	lp  = true;
			int		len = stdin.length();
			String	cnv = "";
			String	out = "";

			for(int l = 0; l < len; l++) {
				cnv += cv.enc.get(stdin.substring(l, l+1));
			}

			while (lp) {
				boolean	bs = false;
				for (String key : cv.dec.keySet()) {
					if (cnv.startsWith(key)) {
						out += cv.dec.get(key);
						cnv  = cnv.substring(key.length(), cnv.length());
						bs   = true;
						break;
					}
				}
				lp = bs;
			}

			System.out.println(out);
		}
	}

	private static String parseStdin() {
        String  stdin = null;
        
        try {
       		stdin = br.readLine();
        }
        catch (IOException e) {}
 
        return stdin;
	}
}

class MyConv {
	public	HashMap<String, String>	enc = null;
	public	HashMap<String, String>	dec = null;

	public MyConv() {
		enc = new HashMap<String, String>();
		if (enc != null) {
			enc.put("A", "00000");
			enc.put("B", "00001");
			enc.put("C", "00010");
			enc.put("D", "00011");
			enc.put("E", "00100");
			enc.put("F", "00101");
			enc.put("G", "00110");
			enc.put("H", "00111");
			enc.put("I", "01000");
			enc.put("J", "01001");
			enc.put("K", "01010");
			enc.put("L", "01011");
			enc.put("M", "01100");
			enc.put("N", "01101");
			enc.put("O", "01110");
			enc.put("P", "01111");
			enc.put("Q", "10000");
			enc.put("R", "10001");
			enc.put("S", "10010");
			enc.put("T", "10011");
			enc.put("U", "10100");
			enc.put("V", "10101");
			enc.put("W", "10110");
			enc.put("X", "10111");
			enc.put("Y", "11000");
			enc.put("Z", "11001");
			enc.put(" ", "11010");
			enc.put(".", "11011");
			enc.put(",", "11100");
			enc.put("-", "11101");
			enc.put("'", "11110");
			enc.put("?", "11111");
		}

		dec = new HashMap<String, String>();
		if (dec != null) {
			dec.put("101", " ");
			dec.put("000000", "'");
			dec.put("000011", ",");
			dec.put("10010001", "-");
			dec.put("010001", ".");
			dec.put("000001", "?");
			dec.put("100101", "A");
			dec.put("10011010", "B");
			dec.put("0101", "C");
			dec.put("0001", "D");
			dec.put("110", "E");
			dec.put("01001", "F");
			dec.put("10011011", "G");
			dec.put("010000", "H");
			dec.put("0111", "I");
			dec.put("10011000", "J");
			dec.put("0110", "K");
			dec.put("00100", "L");
			dec.put("10011001", "M");
			dec.put("10011110", "N");
			dec.put("00101", "O");
			dec.put("111", "P");
			dec.put("10011111", "Q");
			dec.put("1000", "R");
			dec.put("00110", "S");
			dec.put("00111", "T");
			dec.put("10011100", "U");
			dec.put("10011101", "V");
			dec.put("000010", "W");
			dec.put("10010010", "X");
			dec.put("10010011", "Y");
			dec.put("10010000", "Z");
		}
	}
}

Measured memory_bytes: 48664
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>
#include <bits/stdc++.h>

using namespace std;

typedef pair<long long,bool> Pair;
const long long INF = 1LL<<60;

int main(){

double L;
double ans;

cin >> L;

ans = (L/3.0)*(L/3.0)*(L/3.0);

cout.setf(ios::fixed);
 
cout << ans << endl;

return 0;

}   


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n,m;
    cin>>n>>m;
    ll days=0;
    for(ll i=0;i<m;i++){
        ll k;
        cin>>k;
        days+=k;
    }
    if(days>n){
        cout<<-1<<endl;
    }
    else{
        ll ans=n-days;
        cout<<ans;
    }
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using namespace std;
typedef long long ll;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
using Real = mp::number<mp::cpp_dec_float<1024>>;

#define INCANT cin.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define out(a) cout << a << endl
#define PRINT(V) for (auto v : (V)) cout << v << " "

const int MOD = 1000000007;
const double PI = acos(-1.0);

void solve() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    ll s=0;
    rep(i, N){
        ll a;
        cin >> a;
        s = s^a;
        A.at(i)=a;
    }
    for(ll a : A){
        ll ans = a^s;
        out(ans);
    }
}
int main() {
    INCANT;
    solve();
    return 0;
}




Measured memory_bytes: 4764
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define int int64_t
#define double long double
#define rep(i, N) for(int i=0; i<N; i++)
#define repr(i, N) for(int i=N-1; i>=0; --i)
#define all(v) v.begin(),v.end() 
using namespace std;
//using pr = pair<int, int>;
using tup  = tuple<int, int, int>;
using vec  = vector<int>;
using vvec = vector<vec>;

//プロトタイプ宣言

//グローバル変数
const int INF = 105;
const int MAX_N = 20;
vec a(MAX_N);
vvec x(MAX_N, vec(MAX_N, INF));
vvec y(MAX_N, vec(MAX_N, INF));
//const int MAX_M = ;
//vvec dp(MAX_N, vec(MAX_M));

//関数：
/* 使用せず。 */
bool logical(vec a, vec b) {
	bool frag = true;
	rep(i, MAX_N) {
		if(a[i] != INF && b[i] != INF) {
			if(a[i] != b[i]) frag = false;
			break;
		}
	}
	return frag;
}

/* 二進表記の1の数をカウント */
int count(int bits) {
	if(bits == 0) return 0;
	return count(bits >> 1) + (bits & 1);
}

/* メイン・プログラム */
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n; cin >> n;
	for(int i=1; i<=n; i++) {
		cin >> a[i];
		for(int j=1; j<=a[i]; j++) {
			int xx, yy; cin >> xx >> yy;
			x[i][j] = xx; y[i][j] = yy;
		}
	}
	
	//bit全探索：0以上2^n未満の整数jが「1以上N以下の整数kについて、人kが正直者であることと、jを2進数表記した際にk − 1桁目が1であることが同値」という状態を表すことと定義。
	int ans = 0;
	int prm = 1 << n; //prm = n_P_2
	for(int bt=1; bt<prm; bt++) {
		bool frag = true;
		for(int i=1; i<=n; i++) {
			if(!(bt & (1<<(i-1)))) continue; //btのi-1桁目が0ならそのまま。
			for(int j=1; j<=a[i]; j++) {
				int bbt = (bt >> (x[i][j]-1)) & 1;
				if(bbt ^ y[i][j]) frag = false; //^: XOR
			}
		}
		if(frag) ans = max(ans, count(bt));
	}
	
	cout << ans << endl;
	return 0;
}

//std::string str;
//str = std::to_string(int i);
//bitset<3> s(N);
//int ans = (char)grid - '0';
//int id = lower_bound(all(arr), x) - arr.begin();
//cout << fixed << setprecision(10) << tld << endl;
//vector<int> sub(itr,itr+d); //イテレーターで部分数列(i=0...d)を指定
		
/*struct data {
	char *name;
	int age;
	int height;
	double weight;
};*/

/*string ans = w;
string &ref = ans;
rep(i, N) {
	ref[i] = arr[i];
}*/

/*map<int,int> mp;
for(auto p : mp) {
	ct += p.second*(p.second-1); }

map<int,int>::iterator itr;
for(itr = mp.begin(); itr != mp.end(); itr++) {
	ans += itr->second * (itr->second-1);
}*/


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

int main(){
  string S;
  cin >> S;
  int count = 0;
  
  for (int i = 0; i < S.size(); i++){
    
    if (i == 0){
      
      if (S.at(i) != 'h'){
        cout << "No" << endl;
        break;
      }
      else{
        count++;
      }
    }
    else if (i % 2 == 0){
      
      if (S.at(i) != 'h'){
        cout << "No" << endl;
        break;
      }
      else{
        count++;
      }
    }
    else{
      
      if (S.at(i) != 'i'){
        cout << "No" << endl;
        break;
      }
      else{
        count++;
      }
    }
  }

  if (count == S.size()){
    
    if (S.size() % 2 == 0){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
}
      
      
      


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
    #include <bits/stdc++.h>
    using namespace std;
    #define Rep(i,n) for(intl i=0;i<(intl)(n);i++)
    #define Rep1(i,n) for(intl i=1;i<(intl)(n)+1;i++)
    #define vec vector
    #define fi first
    #define se second
    #define pub push_back
    #define pob pop_back
    #define SortA(v) sort(v.begin(), v.end())
    #define SortD(v) sort(v.rbegin(), v.rend())
    #define All(a) (a).begin(),(a).end()
    using intl = int64_t;
    using vi = vec<intl>;
    using vvi = vec<vi>;
    using pi = pair<intl,intl>;
    using vpi = vec<pi>;
    vec<intl> dx = {0, 1, 0, -1, 1, 1, -1, -1};
    vec<intl> dy = {1, 0, -1, 0, 1, -1, 1, -1};
    constexpr intl INF = 9223372036854775807;
     
int main(){
  intl N;
  cin >>N;
  vpi primes(0);
  if(N == 1){cout <<0;return 0;}
  for(int i=2;i<=1000000;i++){
    if(N%i == 0){
      N /= i;
      primes.pub(make_pair(i,1));
      while(N%i == 0){
        primes.back().se ++;
        N /= i;
      }
    }
  }
  if(N != 1){
    primes.pub(make_pair(N,1) );
  }
  int cnt=0;
  for(auto p:primes){
    int i = 1;
    while(p.se >= i){
      p.se -= i;
      i ++;
      cnt ++;
    }
  }
  
  cout <<cnt;
}

Measured memory_bytes: 3604
//auto 関数名 = [(&:ラムダ外の引数をとる時))](引数の型1 引数名1, 引数の型2, 引数名2, ...) { 関数の処理 }; //inside main() define function. take care of };
// for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//   bitset<ビット数> s(tmp);
//   // (ビット列sに対する処理)
// }
// sort(配列変数.begin(), 配列変数.end());
// do {
//   // 順列に対する処理
// } while (next_permutation(配列変数.begin(), 配列変数.end()));
//const double PI = acos(-1); M_PI
// cout << fixed << setprecision(10);
// set<int>st{ 3,1,4,1,5,9,2,6,5,3,5 };
//     for (auto itr = st.begin(); itr != st.end(); ++itr) {
//         cout << *itr;
//     }
#include <bits/stdc++.h>
#include <regex>
using namespace std;
#define _GLIBCXX_DEBUG 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end() //sort(all(vec)); ,reverse(all(vec));etc
int main(){
  int a,b;
  cin>>a>>b;
  for(int i=1;i<1250;i++){
    //cout<<i<<" "<<(int)(i*0.08)<<" "<<(int)(i*0.1)<<endl;
    if((int)(i*0.08)==a&&(int)(i*0.1)==b){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<-1<<endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std; 
int main() {
long long N;
  cin>>N;
    int a;
  int b;
  int c;
  a=N/3;
  b=N/5;
  c=N/15;
  long long M;
  M=0.5*N*(N+1)-(1.5*(a)*(a+1))-(2.5*b*(b+1))+(7.5*c*(c+1));
 
  cout<<M<<endl;
}
  


Measured memory_bytes: 3636
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind
#define rt (a); return (a); 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
llint gcd(llint a, llint b) {
	if (b > a)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
llint Tow(int n) {//2のn乗
	if (n == 0)return 1;
	llint x = Tow(n / 2);
	x %= mod;
	x *= x;
	x %= mod;
	if (n % 2 == 1)x *= 10;
	x %= mod;
	return x;
}

int main(){
	int n;
	string s,t ;
	cin >> n >> s >> t;
	int x = n;
	rep(i, 0, n) {
		if (s.substr(i, n - i) == t.substr(0, n - i)) {
			x = i;
			break;
		}
	}
	cout << x + n << endl;
	return 0;
}

Measured memory_bytes: 256
/* HARDWORK IS THE KEY TO SUCCESS.
   RATING IS TEMPORARY , KNOWLEDGE IS PERMANENT.!!!*/

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define T int t = 1; cin>>t; while(t--)
#define ain int n,k,i; cin>>n; int a[n]; for(i=0;i<n;i++) cin>>a[i]
#define matin ll m,n; cin >> n >> m; ll a[n + 1][m + 1]; for(ll i=1;i<=n;i++) for(ll j=1;j<=m;j++) cin>>a[i][j];
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define I insert
#define pb push_back

const ll maxs = 1e5+3;
const ll maxs1 = 1e3+4;
const ll mod = 1e9 + 7;
inline ll add(ll a, ll b) { return (mod + a + b) % mod;}
inline ll sub(ll a, ll b) {return (a - b + mod) % mod;}
inline ll mul(ll a, ll b) {return (1ll * a * b) % mod;}
ll fastpow(ll x, ll y) {
    ll res = 1; x = x % mod; while (y > 0) { if(y & 1) res = (res * x) % mod; y = y >> 1;x = (x * x) % mod;}return res;}
ll inv(ll x) {
    return fastpow(x, mod - 2);
}



int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    
    char c;
    cin >> c;
    if(c >= 'a' && c <= 'z')
        cout << 'a';
    else
        cout << 'A';
    
    
    
    
    
    
    
    
}

Measured memory_bytes: 3640
n,m = [int(j) for j in input().split(" ")]
height = [int(j) for j in input().split(" ")]
neighbours = [[] for j in range(n)]
for _ in range(m):
    start, end = [int(j)-1 for j in input().split(" ")]
    neighbours[start].append(end)
    neighbours[end].append(start)

good = 0
for i in range(n):
    if len(neighbours[i]) == 0:
        good += 1
    else:
        if height[i] > max([height[j] for j in neighbours[i]]):
            good += 1

print(good)

Measured memory_bytes: 30044
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }

int main() {
    int n; cin >> n;
    if (n == 3) return !(cout << 2 << " " << 3 << " " << 25 << endl);
    vector<int> a = {2, 4, 3, 9, 8, 10, 6, 12};
    vector<int> res;
    if (n & 1) res.emplace_back(30000), n--;
    for (int i = 0; i < n; i++) res.emplace_back(a[i % 8] + i / 8 * 12);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 512
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
    }
    if n%2 == 0 || n%5 == 0{
        println!("-1");
        return;
    }

    let m = if n%7 == 0{
        9*n/7
    }else{
        9*n
    };

    let mut ans = 1;
    let mut tmp = 10;
    for i in 0..m{
        if (tmp)%m == 1{
            break;
        }
        tmp = (tmp*10)%m;
        ans += 1;
    }

    println!("{}",ans);
}


Measured memory_bytes: 2132
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
static const int MAXM=10e5;
vector<pair<long ,long> > vec;
long min(long a,long b){return a<b?a:b;}
int main(void){
	int N,M;
		cin >> N >>M;
	for(int i=0;i<N;i++){
		int a,b;	
			cin >> a >> b;
		vec.push_back(make_pair(a,b));
	}
	sort(vec.begin(),vec.end());
	int have=M;
	long pey=0;
	for(int i=0;i<N;i++){
		pair<long,long> P=vec[i];
		long a=P.first,b=P.second;
		pey+=a*min(have,b);
		have-=min(b,have);
		if(have==0)
			break;
		
	}
	cout << pey << endl;
	return 0;
}

Measured memory_bytes: 2420
#include <iostream>

using namespace std;

const int MAX_LEVEL = 55;
long long buns[MAX_LEVEL], patties[MAX_LEVEL], total[MAX_LEVEL];

long long no_of_patties(long long height, int level)
{
    const int OUTER_BUN = 1, MIDDLE_PATTY = 1;

    if(height >= total[level])
        return patties[level];
    if(height == 0 || height == OUTER_BUN)
        return 0;

    height -= OUTER_BUN;

    long long patties_here = 0;

    if(height < total[level - 1])
    {
        patties_here = no_of_patties(height, level - 1);
        height = 0;
    }
    if(height >= total[level - 1])
    {
        patties_here += patties[level - 1];
        height -= total[level - 1];
    }
    if(height >= MIDDLE_PATTY)
    {
        patties_here += MIDDLE_PATTY;
        height -= MIDDLE_PATTY;
    }
    if(height > 0)
    {
        patties_here += no_of_patties(height, level - 1);
    }

    return patties_here;
}

int main()
{
    int levels;
    long long height;
    cin >> levels >> height;

    total[0] = patties[0] = 1;
    buns[0] = 0;

    for(int i = 1; i <= levels; i++)
    {
        const int FIRST_BUN = 1, MIDDLE_PATTY = 1, LAST_BUN = 1;

        buns[i] = FIRST_BUN + buns[i - 1] + buns[i - 1] + LAST_BUN;
        patties[i] = patties[i - 1] + MIDDLE_PATTY + patties[i - 1];
        total[i] = FIRST_BUN + total[i - 1] + MIDDLE_PATTY + total[i - 1] + LAST_BUN;
    }

    long long total_patties = no_of_patties(height, levels);

    cout << total_patties;
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <functional>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	while(cin>>s) {
		string ans="NO";
		REP(i, s.size()) REP(j, s.size()-i+1) {
			string z = s.substr(0, i)+s.substr(i+j);
			if(z=="keyence") ans = "YES";
		}
		
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
while True:
    try:
        A = list(map(int,input().split(',')))
    except EOFError:
        break
    V1 = A [-2]
    V2 = A [-1]
    del A [-1]
    del A [-1]

    for i in range(len(A)):
        A [i] *= V1 + V2

    point = sum(A) // (V1 + V2) * V1
    for i in range(len(A)):
        if sum(A [0:i + 1]) >= point:
            print(i + 1)
            break

Measured memory_bytes: 7740
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include <functional>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <stack>

using namespace std;


int main() {
	
	int n, m,l;
	cin >> n >> m>>l;
	set<int> i;
	
	i.insert(n);
	i.insert(m);
	i.insert(l);
	if (i.size() == 2)cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	string s;
	cin>>s;
	if(s.substr(0,1)=="Y"&&s.substr(1,1)=="A"&&s.substr(2,1)=="K"&&s.substr(3,1)=="I"){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}

	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<string>
#include<cstdlib>
using namespace std;
unsigned long long a=2,b=1,c;
int n;
int main(){
	cin>>n;
	if(n==0){
		cout<<"2\n";
		return 0;
	}
	if(n==1){
		cout<<"1\n";
		return 0;
	}
	for(int i=2;i<=n;i++){
		c=a+b;
		a=b;
		b=c;
	}
	cout<<c<<endl;
 	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int n, m;
	scanf("%d %d", &n, &m);
	
	int a=0, b=0;
	for(int i=2; i<=n; i++){
		a = a+i-1;
	}
	for(int j=2; j<=m; j++){
		b = b+j-1;
	}
	printf("%d\n", a+b);
	return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
 
ostream& operator<<(ostream &out, string str) {
	for(char c : str) out << c;
	return out;
}
 
template<class L, class R> ostream& operator<<(ostream &out, pair<L, R> p) {
	return out << "(" << p.first << ", " << p.second << ")";
}
 
template<class T> auto operator<<(ostream &out, T a) -> decltype(a.begin(), out) {
	out << "{";
	for(auto it = a.begin(); it != a.end(); it = next(it))
		out << (it != a.begin() ? ", " : "") << *it;
	return out << "}";
}
 
void dump() { cerr << "\n"; }
template<class T, class... Ts> void dump(T a, Ts... x) {
	cerr << a << ", ";
	dump(x...);
}
 
#ifdef DEBUG
#  define debug(...) cerr << "[" #__VA_ARGS__ "]: ", dump(__VA_ARGS__)
#else
#  define debug(...) false
#endif
 
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define ST first
#define ND second
 
template<class T> int size(T && a) { return a.size(); }
 
using LL = long long;
using PII = pair<int, int>;
using LD = long double;

int mod = 1e9 + 7;
int mul(int a, int b) {
	return (LL) a * b % mod;
}

int qpow(int a, int n) {
	if(n == 0) return 1;
	if(n % 2 == 1) return mul(a, qpow(a, n - 1));
	return qpow(mul(a, a), n / 2);
}

int get_fac(int x) {
	int ret = 1;
	FOR(i, 2, x) ret = mul(ret, i);
	return ret;
}

int divi(int a, int b) {
	return mul(a, qpow(b, mod - 2));
}

int n_choose_k(int n, int k) {
	debug(n, k);
	int ret = get_fac(n);
	ret = divi(ret, get_fac(n - k));
	ret = divi(ret, get_fac(k));
	return ret;	
}

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

	int x, y;
	cin >> x >> y;

	if((x + y) % 3 != 0) {
		cout << "0\n";
		return 0;
	}

	int moves = (x + y) / 3;
	int type_2 = x - moves;
	if(0 <= type_2 && type_2 <= moves && (moves - type_2) * 2 + type_2 == y)
		cout << n_choose_k(moves, type_2) << "\n";
	else
		cout << "0\n";
}


Measured memory_bytes: 256
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
  
def main():
  n = int(input())
  s = input()
  
  if s[:n//2] == s[n//2:]:
    print('Yes')
  else:
    print('No')
  
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 2940
n, k = gets.chomp.split.map(&:to_i)
nums = gets.chomp.split(" ").map{|i| (i.to_f+1)/2}
nums_e_sum = [0]
nums_sum = 0
(0...n).each do |i|
  nums_sum += nums[i]
  nums_e_sum.push(nums_sum)
end
sum = []
(k..n).each do |j|
  sum.push(nums_e_sum[j]-nums_e_sum[j-k])
end

puts sum.max

Measured memory_bytes: 18748
#include <bits/stdc++.h>
using namespace std;
int a[100001];
int main(){
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; i++)
        scanf("%d", &a[i]);
    sort(a, a + n + 1);
    printf("%d", a[n / 2 + 1] - a[n / 2]);
    return 0;
}


Measured memory_bytes: 4216
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>

using namespace std;

int main(){
    int n,x;
    cin>>n>>x;
    vector<int> towns(n+1);
    towns.at(0)=x;
    
    for(int i=1;i<=n;i++) cin>>towns.at(i);
    sort(towns.begin(),towns.end());
    
    vector<int> kyori(n);
    for(int i=0;i<n;i++){
        kyori.at(i)=towns.at(i+1)-towns.at(i);
    }
    sort(kyori.begin(),kyori.end());
    
    for(int i=0;i<n-1;i++){
        int a=kyori.at(i);
        int b=kyori.at(i+1);
        
        while(b%a!=0){
            int amari=b%a;
            b=a;
            a=amari;
        }
        
        kyori.at(i)=a;
        kyori.at(i+1)=a;
    }
    
    cout<<kyori.at(kyori.size()-1)<<endl;
    
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define oo 1000000010

int main()
{
    ll n, a, b, ans = 0;
    cin >> n >> a >> b;
    ans += n/(a+b)*a;
    if(n%(a+b) < a) ans += n%(a+b);
    else if(n%(a+b) > a) ans += a;
	cout << ans;

    return 0;
}


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

#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN + 1];
int head=0,tail=0;
int n;

void enqueue(P);
P dequeue(void);

int main(void){
  P u;
  int c,i,q,elaps = 0;
  scanf("%d%d",&n,&q);

  for(i = 0;i < n;i++){
    scanf("%s%d",Q[i].name,&Q[i].t);
    enqueue(Q[i]);
  }

  while(head != tail){
     u = dequeue();
    if(u.t > q){
      u.t -= q;
      elaps += q;
      enqueue(u);      
    }else if(u.t <= q){
      elaps += u.t;
      printf("%s %d\n",u.name,elaps);
      /* if(head + 1 == LEN) head = 0; */
      /* else head++; */
    }
    //if(u.t == -1) exit(1);
  }
	
  return 0;
}

void enqueue(P x){
  Q[tail] = x;
  if(tail + 1 == LEN){
    tail = 0;
  }else tail++;
}

P dequeue(void){
  P x;
  
  x = Q[head];
  if(head + 1 == LEN){
    head = 0;
  }else head++;
  return x;
}
		
  



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

int main()
{
    long long N;
    std::cin >> N;
    std::vector<long long> A(N);
    std::vector<long long> S(N + 1);
    // [a_0, a_1, a_2, a_3]
    // a_0*a_1 + a_0*a_2 + a_0*a_3 + a_1*a_2 + a_1*a_3 + a_2*a_3
    // = a_0 * (a_1 + a_2 + a_3) + a_1 * (a_2 + a_3) + a_2 * a_3
    S[0] = 0;
    for (long long i = 0; i < N; i++)
    {
        std::cin >> A[i];

        S[i + 1] = (S[i] + A[i]) % 1000000007;
    }
    // S_0 = 0
    // S_1 = a_0
    // S_2 = a_0 + a_1
    // S_2 - S_0 = a_0 + a_1
    // S_j - S_i = a_i + a_(i+1) + ... + a_(j-1)
    long long ans = 0;
    for (long long i = 0; i < N; i++)
    {
        // a_i * (a_(i+1) + a_(i+2) + ... + a_(N-1))
        long long tmp = S[N] - S[i + 1];
        if (tmp < 0)
            tmp += 1000000007;
        tmp = (A[i] * tmp) % 1000000007;
        ans = (ans + tmp) % 1000000007;
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 6332
#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;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, f, n) for (int i = (f); i < (n); i++)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
ll const INF = 1LL << 60;

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

    vector<int> B(N - 1);
    rep(i, N - 1) cin >> B[i];

    vector<int> A(N, 0);
    A[0] = B[0];
    A[N - 1] = B[N - 2];

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

    int sum = 0;
    rep(i, N) { sum += A[i]; }
    cout << sum << endl;
    return 0;
}

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

int main() {
    int n;

    cin >> n;

    int* a = new int[n];

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

    int k = 0;
    for (int i = 0; i < 3200 / 400; ++i) {
        for (int j = 0; j < n; ++j) {
            if (a[j] >= i * 400 && a[j] < i * 400 + 400) {
                k++;
                break;
            }
        }
    }

    int l = 0;
    for (int i = 0; i < n; ++i) {
        if (a[i] >= 3200) {
            l++;
        }
    }

    cout << (k == 0 ? 1 : k) << ' ' << (k + l) << endl;

    delete a;
}

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

#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define M_PI 3.14159265358979323846
#define ALL(X) (X).begin(),(X).end()

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

ll a,b,x;

void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    cin >> a >> b >> x;

}

int solve(){
    input();
    ll k = a/x;
    ll l = b/x;
    ll ans = (a%x==0)?(l-k+1):(l-k);
    cout << ans << endl;
    
    return 0;   
}

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


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<stdio.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#include<math.h>
#include<unordered_set>
using namespace std;

const int MAX = 101;
const int INF = 1 << 30;

int main() {
	int grid[3][3];
	int amin = 0;
	bool ans = true;

	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++)cin >> grid[i][j];
	}

	for (int j = 0; j < 3; j++) {
		amin = min(grid[0][j], amin);
	}

	for (int j = 0; j < 3; j++) {
		int a = grid[0][j] - amin;

		for (int i = 0; i < 3; i++) {
			grid[i][j] -= a;
		}
	}

	for (int i = 0; i < 3; i++) {
		for (int j = 1; j < 3; j++) {
			if (grid[i][j - 1] != grid[i][j]) {
				ans = false;
			}
		}
	}

	if (ans)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
module ABC138

  ! <module>s to import
  use, intrinsic :: iso_fortran_env

  ! require all variables to be explicitly declared
  implicit none

  ! accessibility of <subroutine>s and <function>s in this <module>
  public :: task_A

  ! constants for this <module>
  integer, parameter, private :: len_string = 10

  ! contained <subroutine>s and <function>s are below
  contains

  subroutine task_A

    ! variables for this <subroutine>
    character(len=len_string, kind=1) :: given_string
    integer(INT16)                    :: given_integer

    ! STEP.01
    ! read out the given data
    read(unit=INPUT_UNIT, fmt=*) given_integer
    read(unit=INPUT_UNIT, fmt=*) given_string

    ! STEP.02
    ! output the answer of this task
    if ( given_integer .ge. 3200_INT16 ) then
      write(unit=OUTPUT_UNIT, fmt='(A)', advance='yes') trim(given_string)
    else
      write(unit=OUTPUT_UNIT, fmt='(A)', advance='yes') 'red'
    end if

    ! STEP.END
    return

  end subroutine task_A

end module ABC138


program main

  ! <module>s to import
  use, non_intrinsic :: ABC138

  ! require all variables to be explicitly declared
  implicit none

  call task_A

end program main

Measured memory_bytes: 256
N, M = map(int, input().split())
s = [list(map(int, input().split()))[1:] for i in range(M)]
p = list(map(int, input().split()))
cnt = 0
for a in range(2 ** N):
    flag = 1
    for i in range(M):
        if sum([(a >> (x - 1)) & 1 for x in s[i]]) % 2 != p[i]:
            flag = 0
            break
    cnt += flag
print(cnt)

Measured memory_bytes: 9176
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;
  if(n%2!=0) {
    cout << "No" << endl;
    return 0;
  }
  string s1=s.substr(0,n/2);
  string s2=s.substr(n/2);
  if(s1==s2) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

class Main{

    public static void main(String args[]){
	//BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	Scanner in= new Scanner(System.in);
	int[] vec = new int[10];
	for(int i=0;i<10;i++)vec[i] = in.nextInt();
	Arrays.sort(vec);
	for(int i=9;i>=7;i--){
	    System.out.println(vec[i]);
	}
    }

}

Measured memory_bytes: 12000
N, W = map(int, raw_input().split())

v = [0] * N
w = [0] * N
dp = [[ -1 for i in range(W + 1)] for j in range(N + 1)]

for i in range(N):
    v[i], w[i] = map(int, raw_input().split())


def rec(i, j):
    if dp[i][j] != -1:
        return dp[i][j]

    if i == N:
        res = 0
    elif j < w[i]:
        res = rec(i + 1, j)
    else:
        res = max(rec(i + 1, j), rec(i + 1, j - w[i]) + v[i])

    dp[i][j] = res
    return res

print(rec(0, W))

Measured memory_bytes: 22360