akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;

public class Main {
	public static void main(String args[]) throws InterruptedException {
		    Scanner sc = new Scanner(System.in);	
			
			int wid = sc.nextInt();
			int hum = sc.nextInt();
			int sp = sc.nextInt();
			int ans = 0;

			while((hum + sp)*ans + sp <= wid ){
				ans++;
			}

			System.out.println(ans-1);

		    sc.close(); }
}


Measured memory_bytes: 22612
//define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <x86intrin.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define chmin(x,y) x = min(x, y)
#define chmax(x,y) x = max(x, y)
#define V vector
V<int> dx = {-1, 1,  0, 0, -1, -1,  1, 1};
V<int> dy = { 0, 0, -1, 1, -1,  1, -1, 1};

ll dp[3030][3030][4];

int main () {
    int r, c, k; cin >> r >> c >> k;
    int v[r][c];
    memset(v, -1, sizeof(v));
    rep(i, k) {
        int R, C; cin >> R >> C; R--; C--;
        cin >> v[R][C];
    }
    
    memset(dp, 0, sizeof(dp));
    if (v[0][0] != -1) dp[0][0][2] = v[0][0];
    rep(i, r) {
        rep(j, c) {
            rep(p, 4) {
                //拾わない
                if (i!=0) chmax(dp[i][j][3], dp[i-1][j][p]);//上から
                if (j!=0) chmax(dp[i][j][p], dp[i][j-1][p]);//左から
                if (v[i][j] == -1) continue;

                //拾う
                if (i!=0) chmax(dp[i][j][2], dp[i-1][j][p] + v[i][j]);//上から
                if (j!=0 && p!=0) chmax(dp[i][j][p-1], dp[i][j-1][p] + v[i][j]);//左から
            }
        }
    }
    ll ans = 0;
    rep(p, 4) chmax(ans, dp[r-1][c-1][p]);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 325584
/*
 * a.cpp
 *
 *  Created on: 2019/06/08
 *      Author: MEIP-users
 */




#include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <locale>
#include <queue>
#include <tuple>
#include <map>
#include <fstream>

using namespace std;


#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1e9+10)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))




int main() {
	int n;
	cin >> n;
	vector<ll> as(n);
	rep(i, n){
		ll a;
		cin >> a;
		as[i] = a;
	}
	sort(as.begin(),as.end());
	ll ans = 0;
	if(n%2 == 0){
		REP(i, n){
			if(i < n/2-1){
				ans -= 2*as[i];
			}else if(i > n/2){
				ans += 2*as[i];
			}else if(i == n/2){
				ans += as[i];
			}else{
				ans -= as[i];
			}
		}
	}else{
		REP(i, n){
			if(i < (n-1)/2-1){
				ans -= 2*as[i];
			}else if(i > (n-1)/2){
				ans += 2*as[i];
			}else if(i == (n-1)/2){
				ans -= as[i];
			}else{
				ans -= as[i];
			}

		}
		ll amp = ans;
		ans = 0;
		REP(i, n){
			if(i < (n+1)/2-1){
				ans -= 2*as[i];
			}else if(i > (n+1)/2){
				ans += 2*as[i];
			}else if(i == (n+1)/2){
				ans += as[i];
			}else{
				ans += as[i];
			}

		}
		ans = max(ans,amp);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1152
X, Y, Z, K  = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

l = []
for a in A:
    for b in B:
        l.append(a+b)
l = sorted(l, reverse = True)[:K]

ans = []
for c in C:
    for k in l:
        ans.append(c + k)
        
ans = sorted(ans, reverse = True)
print(*ans[:K], sep="\n")

Measured memory_bytes: 221004
#include <bits/stdc++.h>
#define SIZE 10
using namespace std;
typedef long long ll;

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

	int K,X;
	int i,j;
	int tmp;
	int answer;
	int counter=0;
	double ave;
	vector<int> given;

	cin >> K >> X;

	if(500*K>=X){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a, b;
  cin >> a >> b;
  if (a.at(0) == b.at(2) && a.at(1) == b.at(1) && a.at(2) == b.at(0)) { cout << "YES" << endl; }
  else { cout << "NO" << endl; }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値

using namespace std;

// macro
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define DESCEND greater<int>()  // sort 降順
#define UNIQUE(vec) (vec).erase(unique(ALL((vec))), (vec).end());  // 必ずsortを行なってから
#define MIN(vec) *min_element(ALL((vec)))
#define MAX(vec) *max_element(ALL((vec)))
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値

// func declaration
template <class T> void printVec(vector<T>);
template <class T> void calcVec(vector<T>&, int, char);
bool checkMultiple(vector<int>&, int);
int ctoi(const char);
int dist_l2r(int, int);

// const
const int INF = 10000000;

/*MEMO
辞書順
abc < abcd, atcoder < atlas
*/

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> vec(N);
    REP(i, N) cin >> vec.at(i);

    int selects = N - K + 1;
    int distance = 1000000000;
    REP(i, selects) {
        int left = vec.at(i), right = vec.at(i + (K-1));
        int dist = dist_l2r(left, right);

        if (dist < distance) distance = dist;
    }
    cout << distance << endl;

    return 0;
}


// function
template <class T> void printVec(vector<T> vec) {
    // 1要素ずつ、空白・改行なしで出力
    REP(i, vec.size()) {
        cout << vec.at(i);
    }
    cout << endl;
}

template <class T> void calcVec(vector<T> &vec, int num, char ch) {
    // vec全体への演算
    if (ch == '+') {
        REP(i, vec.size()) {
            vec.at(i) += num;
        }
    } else if (ch == '-') {
        REP(i, vec.size()) {
            vec.at(i) -= num;
        }
    } else if (ch == '*') {
        REP(i, vec.size()) {
            vec.at(i) *= num;
        }
    } else if (ch == '/'){
        REP(i, vec.size()) {
            vec.at(i) /= num;
        }
    } else if (ch == '%') {
        REP(i, vec.size()) {
            vec.at(i) %= num;
        }
    }
}

bool checkMultiple(vector<int> &vec, int num) {
    // vecの中身が、全てnumの倍数かどうかのチェック
    int count = 0;
    REP(i, vec.size()) {
        if (vec.at(i)%num != 0) count++;
    }
    return (count == 0);
}

int ctoi(const char c) {
    if('0' <= c && c <= '9') return (c-'0');
    return -1;
}

int dist_l2r(int left, int right) {
    if (left >= 0 && right >= 0) {
        return right;
    } else if (left <= 0 && right <= 0) {
        return abs(left);
    } else {
        // 符号が違う時
        int min = (abs(left) < abs(right)) ? abs(left): abs(right);
        int max = (abs(left) > abs(right)) ? abs(left): abs(right);
        return min + (min + max);
    }
}


Measured memory_bytes: 768
digits = Array.new
while(true) do
  data = gets()
  if (data.nil? or data == "\n" or data == "\n\r") then break end
  x, y = data.split().map{|x| x.to_i}
  digits.push((x + y).to_s.length)
end

digits.each do |d|
  puts d
end

Measured memory_bytes: 6092
import java.util.*;

public class Main {

	public static void main(String[] args) {
		int n, x, count = 0;
		boolean flag = false;
		Scanner sc = new Scanner(System.in);
		while (true) {
			n = sc.nextInt();
			x = sc.nextInt();
			if (n == 0 && x == 0)
				break;
			for (int i = 1; i <= n; i++) {
				for (int j = 1; j <= n; j++) {
					for (int k = 1; k <= n; k++) {
						if (i + j + k == x)
							flag = true;
						if (i == j || j == k || k == i)
							flag = false;
						if (flag) {
							count++;
						}
						flag = false;
					}
				}
			}
			System.out.println(count / 6);
			count = 0;
		}
	}
}

Measured memory_bytes: 19732
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007LL
#define eps 1e-13
#define PI 3.141592653589793238L
#define INF 1000000011
#define INFLL 1000000000000000011LL
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define mp make_pair
#define F first
#define S second
#define pb(x) push_back(x)
#define fo(i,a,n) for(i = (a); i < (n); i++)
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define sws ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define gcd __gcd
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)((a).size())
#define io_file freopen("D:/Coding Problems/Contest/input_file.in", "r", stdin); freopen("D:/Coding Problems/Contest/output_file.out", "w", stdout)

ll modx(ll Base, ll exponent)
{
	ll ans = 1;
	if(Base == 1)
		return Base;
	while(exponent)
	{
		if(exponent & 1)
			ans = (ans * Base)%mod;
		Base = (Base * Base)%mod;
		exponent = exponent >> 1;
	}
	return ans;
}

ll inmodx(ll num)
{
	return (modx(num, mod-2LL));
}

bool cmp(pair < pii, int > a, pair < pii, int > b)//true for a before b
{
	if(a.F.F/900 < b.F.F/900)
		return 1;
	if(a.F.F/900 > b.F.F/900)
		return 0;
	if(a.F.S <= b.F.S)
		return 1;
	return 0;
}

const int N = (6e2) + 9;
const int M = (N<<2) + 9;
const int LOGN = ((int)log2(N)) + 3;
const int LOGM = ((int)log2(M)) + 3;
const int BUCK = 450;

int dp[N][N], pr[N], unpair[N];
ll g[N];

int calc_unpair(int l, int r)
{
	if(l > r)
		return 0;
	return (unpair[r] - unpair[l-1]);
}

void solve()
{
	int n, i, j, k, K, x, y, l, min_val, max_val;
	ll val, ans = 0;
	g[0] = 1;
	for(i = 2; i < N; i += 2)
		g[i] = (g[i-2]*1LL*(i-1))%mod;
	cin >> n >> K;
	n <<= 1;
	fo(i,1,n+1)
		unpair[i] = 1;
	fo(i,1,K+1)
	{
		cin >> x >> y;
		pr[x] = y;
		pr[y] = x;
		unpair[x] = 0;
		unpair[y] = 0;
	}
	K <<= 1;
	fo(i,1,n+1)
		unpair[i] += unpair[i-1];
	for(l = 2; l <= n; l+=2)
		fo(i,1,n+1)
		{
			j = i+l-1;
			if(j > n)
				break;
			min_val = i;
			max_val = j;
			fo(k,i,j+1)
				if(pr[k] > 0)
				{
					min_val = min(min_val, pr[k]);
					max_val = max(max_val, pr[k]);
				}
			if(min_val < i || max_val > j)
				continue;
			x = calc_unpair(i,j);
			y = n - K - x;
			val = g[x];
			for(k = i+1; k < j; k+=2)
				val = (val + mod - (dp[i][k]*g[calc_unpair(k+1,j)])%mod)%mod;
			dp[i][j] = val;
			val = (val*g[y])%mod;
			ans += val;
			// cout << i << " " << j << " : " << val << '\n';
		}
	ans %= mod;
	cout << ans << '\n';
	return;
}

int main()
{
	sws;
	// clock_t clk;
	// clk = clock();
	// io_file;
	// srand (time(NULL));

	//Code here
	int t = 1, cs;
	cout << fixed << setprecision(9);
	// cin >> t;
	fo(cs,1,t+1)
	{
		// cout << "Case #" << cs << ": ";
		solve();
	}
	// Code ends here

	// clk = clock() - clk;
	// cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int l;
long long int p10[22],w[22],now;
int cc(int i,int t){
	if(i==0){
		return 9-t;
	}
	return 10-labs(t);
}
void dfs(int i,long long int dif,long long int q){
	long long int bes = 0;
	for(int j=i; j<l; j++)
		bes += w[j] * 9;
	if(dif > bes || dif < -bes)return;

	if(i == l){
		now += q;
		return;
	}
	for(int t = (i==0?0:-9); t <= 9; t++){
		dfs(i+1, dif - t * w[i], q * cc(i, t));
	}
}
long long int calc(int len,long long int dif){
	p10[0] = 1;
	for(int i=1; i<len; i++)
		p10[i] = p10[i-1] * 10;
	l = 0;
	for(int i=len-1,j=0; i>j; i--,j++)
		w[l++] = p10[i] - p10[j];
	now = 0;
	dfs(0,dif,1);
	return now;
}
int main(){
	long long int tot = 0;
	int D;
	scanf("%d",&D);
	for(int len = 2; len <= 18; len++){
		tot += calc(len, D) * ((len % 2) ? 10 : 1);
	}
	cout << tot << endl;
	return 0;
}


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

using namespace std;

int m,n;
vector<int>v;

bool C(int x){

  int cnt=0,sum=0,i=0;
  while(i<n && cnt<m){
    if(sum+v[i]<=x)sum+=v[i],i++;
    else sum=0,cnt++;
  }
  return i==n && m>cnt;
}

int main(void){

  while(cin >> m >> n,m|n){
    v.clear();

    int l=0,r=100000000,a;
    for(int i=0;i<n;i++){
      cin >> a;
      v.push_back(a);
    }
    
    while(r-l>1){
      int mid=(l+r)/2;
      if(C(mid))r=mid;
      else l=mid;
    }
    cout << r << endl;
  }

  return 0;
}

Measured memory_bytes: 1216
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//239///F.Sugoroku
	int x,a;
	cin>>x>>a;
	if(x<a)cout<<0;
	else cout<<10;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


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

int main(){
    ll n,k;
    cin>>n>>k;
    ll a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    ll diff=12345678912,temp=0;
    for(int i=0;i<=n-k;i++){
        temp=a[i+k-1]-a[i];
        if(temp<diff)diff=temp;
    }
    cout<<diff;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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

int H,W;

int main(){
    cin>>H>>W;
    char s[H+2][W+2];
    rep(i,H+2){
        rep(j,W+2){
            if(i==0||i==H+1||j==0||j==W+1){
                s[i][j]='.';
                continue;
            }
            cin>>s[i][j];
        }
    }
    repi(i,1,H+1){
        repi(j,1,W+1){
            if(s[i][j]=='#'){
                if(s[i-1][j]=='#'||s[i+1][j]=='#'||s[i][j-1]=='#'||s[i][j+1]=='#'){
                    continue;
                }
                else{
                    out("No");
                    return 0;
                }
            }
        }
    }
    out("Yes");
}


Measured memory_bytes: 256
# include <iostream>

int main() {
	int sec;
	int h, m, s;

	std::cin >> sec;

	s = sec % 60;
	m = (sec % 3600) / 60;
	h = sec / 3600;

	std::cout << h << ":" << m << ":" << s << std::endl;

	std::cin >> sec;

	return 0;
}

Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
vector<pair<ll,ll>> primefac(ll a,ll b){
  ll N=__gcd(a,b);
  vector<pair<ll,ll>> data;
  for(int i=2;i<sqrt(N);i++){
    if(N%i!=0)continue;
    ll cnt=0;
    while(N%i==0){
      cnt++;
      N=N/i;
    }
    data.push_back(make_pair(i,cnt));
  }
  if(N!=1)data.push_back(make_pair(N,1));
  return  data;
}

int main(){
  ll a,b;
  cin>>a>>b;
  vector<pair<ll,ll>> ans=primefac(a,b);
  cout<<ans.size()+1<<endl;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
c = list(map(int, input().split()))

dp = [0] + [50000]*n

for i in range(m):
    for j in range(c[i], n+1):
        dp[j] = min(dp[j], dp[j-c[i]] + 1)

print(dp[n])

Measured memory_bytes: 9424
while n = gets.to_i
  break if n == 0
  s = gets.split
  i = 0
  while i < n
    s[i] = s[i].to_i
    i += 1
  end
  
  i = 1
  h = e = s[0]
  
  while i < n
    if e == s[i] - 1
      e = s[i]
    elsif h == e
      printf("%d ",h)
      h = e = s[i]
    else
      printf("%d-%d ",h,e)
      h = e = s[i]
    end
    i += 1
  end
  
  if h == e
    printf("%d\n",h)
  else
    printf("%d-%d\n",h,e)
  end
end

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

using namespace std;

bool isPalindrome(string s)
{
    string str = s;
    int n = s.length();
    int i = 0, j = n-1;
    while(i <= j)
    {
        if(s[i] != s[j]) return false;
        i++;j--;
    }

    return true;
}
int main()
{
    string s; cin >> s;
    int n = s.length();

    string first = s.substr(0, (n-1)/2);
    //cout << first << "\n";
    string second = s.substr((n+3)/2-1, (n-((n+3)/2)+1));
    //cout << second << "\n";
    if(isPalindrome(s) && isPalindrome(first) && isPalindrome(second))
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define c(n) cin>>n
#define co(n) cout<<n<<endl
using namespace std;
typedef long long ll;
typedef vector<long> vl;
typedef vector<string> vs;

int main(){
  int n,m,c;
  cin>>n>>m>>c;
  int a[m],b[m];
  rep(i,0,m) cin>>b[i];
  int d=0,ans=0;
  rep(i,0,n){
    rep(j,0,m){
      c(a[j]);
      d+=a[j]*b[j];
    }
    d+=c;
    if(d>0) ans++;
    d=0;
  }
  co(ans);
  
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

public class Program{
    public static void Main(){
        var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var N = nm[0];
        var M = nm[1];
        var Students = new List<StudentPos>();
        var Marks = new List<Mark>();
        for(int i=0; i<N; i++){
            var xy = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Students.Add(new StudentPos{
                posX = xy[0],
                posY = xy[1],
            });
        }
        for(int j=0; j<M; j++){
            var xy = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Marks.Add(new Mark{
                pX = xy[0],
                pY = xy[1],
                ID = j+1,
            });
        }
        foreach (var sp in Students){
            var ans = Marks.OrderBy(m=>m.Dist(sp.posX, sp.posY)).First();
            Console.WriteLine(ans.ID);
        }
    }
}

public class StudentPos{
    public int posX { get; set; }
    public int posY { get; set; }
}

public class Mark{
    public int pX { get; set; }
    public int pY { get; set; }
    public int ID { get; set; }
    public int Dist(int x, int y){
        return Math.Abs(this.pX-x)+Math.Abs(this.pY-y);
    }
}

Measured memory_bytes: 13524
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
#define YES(i) cout << ((i) ? "Yes" : "No") << endl;
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }

int main() {
    int n, sum = 0;
    cin >> n;
    VI w(n), a(n);
    FOR(i, n) {
        cin >> w[i];
        sum += w[i];
    }
    a[0] = w[0];
    FOR1(i, n) {
        a[i] = a[i - 1] + w[i];
    }
    int ans = INF;
    FOR(i, n - 1) {
        chmin(ans, abs(sum - a[i] - a[i]));
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t, u;
    cin >> s >> t >> u;
    cout << "A" << t[0] << "C" << endl;
    return 0;
}


Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<int,P>
#define vpp vector<PP>
#define fi first
#define se second
#define INF 1e9
#define MOD 1000000007
#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(x) (x).begin(),(x).end()
int main(){
    int n,z,w;
    cin>>n>>z>>w;
    vi vec(n);
    REP(i,n){
        cin>>vec[i];
    }
    if(n==1){
        cout<<abs(w-vec[0])<<endl;
        return 0;
    }
    cout<<max(abs(w-vec.back()),abs(vec[vec.size()-2]-vec[vec.size()-1]))<<endl;
    return 0;
}

Measured memory_bytes: 256
n,k = map(int,input().split())

c = ['1']*n

for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    
    for j in range(d):
        e = a[j]
        c[e-1] = ['0']

d = c.count('1')

print(d)


Measured memory_bytes: 9120
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author EDGE
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ASheepAndWolves solver = new ASheepAndWolves();
        solver.solve(1, in, out);
        out.close();
    }

    static class ASheepAndWolves {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            out.println(in.nextInt() > in.nextInt() ? "safe" : "unsafe");
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

    }
}



Measured memory_bytes: 25612
from math import sqrt
x0,y0,x1,y1 = map(int, input().split())
a = [x0,y0]
b = [x1, y1]
q = int(input())

CCW = {1: 'COUNTER_CLOCKWISE',
       2: 'CLOCKWISE',
       3: 'ONLINE_BACK',
       4: 'ONLINE_FRONT',
       5: 'ON_SEGMENT',}

def dot(a,b):
  return sum ([i * j for i, j in zip(a,b)])

def sub(a,b):
  return [a[0] - b[0], a[1] - b[1]]

def cross(a,b):
  return a[0] * b[1] - a[1] * b[0]

def _abs(a):
  return sqrt(a[0] ** 2 + a[1] ** 2)

def ccw(a, b, c):
  x = sub(b,a)
  y = sub(c,a)
  if cross(x, y) > 0:
    return 1
  if cross(x, y) < 0:
    return 2
  if dot(x,y)<0:
    return 3
  if _abs(x) < _abs(y):
    return 4
  return 5

for i in range(q):
  c = list(map(int, input().split()))
  print(CCW[ccw(a,b,c)])



Measured memory_bytes: 5692
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())
sum = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            sum += gcd(a,b,c)

print(sum)

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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define vc vector<char>
#define ii pair<int,int>
#define fi first
#define sc second
#define all(x) (x).begin(),(x).end()
#define get_bit(x, k) ((x >> k) & 1)
// ---------------------------------

void MAIN() {
  int n; cin >> n;
  int mi = n;
  for (int i = 1; i <= 5; i++) {
    int t; cin >> t;
    mi = min(mi, t);
  }
  cout << (n + mi - 1) / mi + 4 << '\n';
}

signed main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3652
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int W = sc.nextInt();
        int H = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int r = sc.nextInt();

          if ( (x-r >= 0) && (x+r <= W) && (y-r >= 0) && (y+r <= H)){
            System.out.println("Yes");
          }
          else {
            System.out.println("No");
          }
      }
  }


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

int main()
 {
  int n,a,m,c;
m=1000000000;
  cin >> n;
  for (int i=1;i<=n;i++)
{
cin>>a;c=0; while (a%2==0)
{
c++;a/=2;
}
m=min(m,c);if (m==0)break;
}
cout<<m<<endl;}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int A, B;
	cin >> A >> B;

	if (A <= 5) {
		cout << "0" << endl;
	} else if (A <= 12) {
		cout << B / 2 << endl;
	} else {
		cout << B << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) a.begin(),a.end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=2e5;
const int INF=1e9;
int main(){
	int N;cin>>N;
	int P[N+1];long vec[N+1];
	rep(i,1,N+1){ cin>>P[i];vec[P[i]]=i; }
	multiset<int> p{0,0,N+1,N+1};
	long a,b,c,d;long ans=0;
	for(int i=N;i>=1;i--){
        auto it=p.upper_bound(vec[i]);it--;it--;
		a=*it;it++;
        b=*it;it++;
		c=*it;it++;
		d=*it;
        ans+=((b-a)*(c-vec[i])+(vec[i]-b)*(d-c))*i;
        p.insert(vec[i]);
	}cout<<ans<<endl;
}

Measured memory_bytes: 6144
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

int N,K;
VI D;

bool check(int x) {
	while(x) {
		for(int u:D) if(u==x%10) return false;
		x/=10;
	}
	return true;
}

int main() {
	scanf("%d%d",&N,&K);
	for(int i=0;i<K;i++) {
		int in;
		scanf("%d",&in);
		D.PB(in);
	}
	int ans=N;
	while(!check(ans)) ans++;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
import numpy as np
N,D=map(int,input().split())
A=[]
for i in range(N):
    B=list(map(int,input().split()))
    A.append(B)

all_diffs = np.expand_dims(A, axis=1) - np.expand_dims(A, axis=0)
degree_distance = np.sqrt(np.sum(all_diffs ** 2, axis=-1))

Q=0
for i in range(N):
    for j in range(N):
        if degree_distance[i][j].is_integer()==True:
            Q+=1
            
        
print(int((Q-N)/2))

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

int main(){
    long long x, y;
    cin >> x >> y;

    long long ans = LLONG_MAX;
    if(x+y >= 0){
        ans = min(ans, x+y+1);
    }

    if(x-y >= 0){
        ans = min(ans, x-y+2);
    }

    if(-x+y >= 0){
        ans = min(ans, -x+y);
    }
    if(-x-y >= 0){
        ans = min(ans, -x-y+1);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  int N,M,X,A,B;
  cin >> N >> M >> X;
  A=0;
  B=0;
  int x=0;
  for(int i=0;i<M;i++){
    cin >> x;
    if(x<X){
      A ++;
    }else{
      B ++;
    }
  }
  cout << min(A,B) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
inline void read(ll &x) {
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
ll a[4],n,res=6e18;
ll solve(ll n, int S){
	assert((S>>2&1)&&(S>>3&1));
	ll res=0;
	/*if(S>>3&1)res+=n/8*a[3],n%=8;
	if(S>>2&1)res+=n/4*a[2],n%=4;
	if(S>>1&1)res+=n/2*a[1],n%=2;
	if(S>>0&1)res+=n/1*a[0],n%=1;*/
	res+=n/8*a[3],n%=8;res+=n/4*a[2],n%=4;
	assert(!n);return res;
}
int main() {
	rep(i,0,3)read(a[i]);rep(i,1,3)a[i]=min(a[i],a[i-1]*2);
	read(n);
	n*=4;
	cout<<solve(n,15);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<double, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<vector<int>> cnt(10, vector<int>(10));
	for (int i = 1; i <= n; ++i) {
		int a = i % 10;
		int b = i;
		while (b >= 10) b /= 10;
		cnt[a][b]++;
	}
	int ans = 0;
	rep(i, 10)rep(j, 10) ans += cnt[i][j] * cnt[j][i];
	cout << ans << endl;
 	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	var a int
	fmt.Scan(&n)
	sliceA := make([]int, n)
	sliceSum := make([]int, n)

	for i := 0; i < n; i++ {
		fmt.Scan(&a)
		sliceA[i] = a
	}

	// 累積和
	sumsum := 0
	for i := 0; i < n; i++ {
		sumsum += sliceA[i]
		sliceSum[i] = sumsum
	}

	// sumAll := 0
	// for i := 0; i < n; i++ {
	// 	sumAll += sliceA[i] * (sliceSum[n-1] - sliceSum[i])
	// 	sumAll = abc(sumAll)
	// }
	// fmt.Print(sumAll)

	sumAll := 0
	mod := 1000000007
	for i := 0; i < n; i++ {
		sum := (sliceSum[n-1] - sliceSum[i]) % mod
		sumAll += sliceA[i] * sum
		sumAll %= mod
	}
	fmt.Print(sumAll)

	// 計算量多い
	// for i := 0; i < n; i++ {
	// 	sum := 0
	// 	for j := i; j < n; j++ {
	// 		if i == j {
	// 			continue
	// 		}
	// 		sum += sliceA[i] * sliceA[j]
	// 	}
	// 	sumAll += sum
	// }
}

func abc(value int) int {
	flag := 1000000007
	ans := 0
	if value < flag {
		ans = value
	} else {
		ans = value % flag
	}
	return ans
}


Measured memory_bytes: 8564
#include <bits/stdc++.h>
using namespace std;
double dp[3000][3000];
//dp[i][j] is the probability of collecting j heads with i coins
//and it is the sum of the probability of getting either a tail, so the previous i-1 coins
//should have j heads, and so dp[i][j] = dp[i-1][j] * 1-pro_head
//or we get a head, in which case we need to have j-1 heads with the previous i-1 coins, in which
//case dp[i][j] += dp[i-1][j-1] *  pro_head
//when we have 0 heads, the probability only includes the first case, which is getting tails
//the answer is the sum of every probability i,j, where i is equal to n, the total number of coins
//and j is no less than ceil(n/2), which is equal to (n+1)/2 (since n is always odd) 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    dp[0][0] = 1;
    for (int coins=1; coins <= n; coins++) {
        double p_heads;
        cin >> p_heads;
        for (int numOfHeads = n; numOfHeads >= 0; numOfHeads--) {
            //first probability, we got a tails, this can occur for any number of heads
            dp[coins][numOfHeads] = dp[coins-1][numOfHeads] * (1-p_heads);
            //second probability, we got a heads, this can occur for any number of heads that is larger than 0
            dp[coins][numOfHeads] += dp[coins-1][numOfHeads-1] * p_heads;
            //the sum of these two pro-bilities, is equal to the total probability of having collected j heads with i coins 
        }
    }
    double ans = 0;
    for (int i=(n+1)/2; i <= n; i++) {
        ans += dp[n][i]; 
    }
    cout << setprecision(10) << fixed << ans << "\n";
    return 0;
}

Measured memory_bytes: 70528
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        string[] str = Console.ReadLine().Split(' ');
        int N = int.Parse(str[0]);
        int A = int.Parse(str[1]);
        int B = int.Parse(str[2]);
        str = Console.ReadLine().Split(' ');
        long[] V = new long[N];
        for(int i=0;i<N;i++){
            V[i] = long.Parse(str[i]);
        }
        Array.Sort(V);
        long sum = 0;
        for(int i=N-1;i>=N-A;i--){
            sum += V[i];
        }
        sb.Append(((double)(sum))/A+"\n");
        int p = N-A;
        while(p > 0 && V[p] == V[p-1]){
            p--;
        }
        int q = N-A;
        while(q < N-1 && V[q] == V[q+1]){
            q++;
        }
        Fact F1 = new Fact(N);
        long count1 = 0;
        if(q != N-1){
            count1 += F1.GetConv(q-p+1,q-N+A+1); 
        }
        else{
            for(int i=A;i<=Math.Min(B,N-p);i++){
                count1 += F1.GetConv(N-p,i);
            }
            count1 %= Define.mod;
        }
        Define.mod += 2;
        Fact F2 = new Fact(N);
        long count2 = 0;
        if(q != N-1){
            count2 += F2.GetConv(q-p+1,q-N+A+1); 
        }
        else{
            for(int i=A;i<=Math.Min(B,N-p);i++){
                count2 += F2.GetConv(N-p,i);
            }
            count2 %= Define.mod;
        }
        sb.Append(ModCalc(count1,count2)+"\n");
    }
    long ModCalc(long m7,long m9){
        decimal ans = ((long)1000000007*(long)1000000009) + m9 - m7;
        ans *= 500000004;
        ans %= ((long)1000000007*(long)1000000009);
        ans *= 1000000007;
        ans += m7;
        ans %= ((long)1000000007*(long)1000000009);
        return (long)ans;
    }
}
class Fact{
    public long[] f;
    public long[] rf;
    public Fact(int N){
        f = new long[N+1];
        rf = new long[N+1];
        for(int i=0;i<N+1;i++){
            if(i == 0){
                f[i] = 1;
            }
            else{
                f[i] = (f[i-1]*i)%Define.mod;
            }
        }
        for(int i=N;i>=0;i--){
            if(i == N){
                rf[i] = pow(f[N],Define.mod-2);
            }
            else{
                rf[i] = rf[i+1]*(i+1)%Define.mod;
            }
        }
    }
    public long pow(long N,long K){
        if(K == 0){
            return 1;
        }
        else if(K % 2 == 0){
            long t = pow(N,K/2);
            return t*t%Define.mod;
        }
        else{
            return N*pow(N,K-1)%Define.mod;
        }
    }
    public long GetFact(int N){
        return f[N];
    }
    public long GetConv(int N,int R){
        return ((f[N]*rf[R])%Define.mod*rf[N-R])%Define.mod;
    }
}
public static class Define{
    public static long mod = 1000000007;
}

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

int main() {
    int steps;

    cin >> steps;
    
    int numbers[steps];
    
    for(int i = 0; i < steps; i++) cin >> numbers[i];
    
    int i = 0;
    int record = 0;
    int cnt = 0;
    while(i < steps - 1){
        if(numbers[i] >= numbers[i + 1]){
            cnt++;
            if(cnt > record) record = cnt;
        }
        else cnt = 0;
        i++;
    }
    
    cout << record;
    
	return 0;
}


Measured memory_bytes: 640
n,h,w = (int(i) for i in input().split())
a = []
b = []
for i in range(n):
  a0,b0 = (int(i) for i in input().split())
  a.append(a0)
  b.append(b0)

count = 0
for i in range(n):
  if a[i]>=h and b[i]>=w:
  	count+=1
print(count)

Measured memory_bytes: 3188
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


MOD = int(1e09) + 7


def main():
    # sys.stdin = open("sample.txt")
    N, K = Scanner.map_int()
    X = Scanner.map_int()
    left = 0
    right = K - 1
    ans = int(1e09)
    while right < N:
        if Math.sign(X[left]) == Math.sign(X[right]):
            ans = min(ans, max(abs(X[left]), abs(X[right])))
        else:
            ans = min(ans, abs(X[left]) * 2 + abs(X[right]))
            ans = min(ans, abs(X[left]) + abs(X[right]) * 2)
        left += 1
        right += 1
    print(ans)


if __name__ == "__main__":
    main()


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

using namespace std;

int abs(int a){
  if (a>0){
    return a;
  }else{
    return a * (-1);
  }
}

int main(){
  int n,ans = 0,past = 0;
  cin >> n;
  vector<int> a_data(n+2,0);
  a_data[0] = 0;
  a_data[n+1] = 0;
  for(int i=1 ; i<=n ;i++){
    cin >> a_data[i];
    ans += abs(a_data[i] - past);
    past = a_data[i];
  }
  ans += abs(past);
  //cout << ans << endl;
  for(int i=1 ; i<=n ; i++){
    if((a_data[i]-a_data[i-1])*(a_data[i+1]-a_data[i])>=0){
      cout << ans << endl;
    }else if((a_data[i]-a_data[i-1]) > 0){
      //cout <<"hoge " << a_data[i]-a_data[i-1] << endl;
      if(a_data[i+1] > a_data[i-1]){
        cout << ans - abs(a_data[i+1]-a_data[i]) * 2 << endl;
      }else{
        cout << ans - abs(a_data[i]-a_data[i-1]) * 2 << endl;
      }
    }else{
      //cout <<"fuga " << a_data[i+1]-a_data[i] << endl;
      if(a_data[i+1] > a_data[i-1]){
        cout << ans - abs(a_data[i]-a_data[i-1]) * 2 << endl;
      }else{
        cout << ans - abs(a_data[i+1]-a_data[i]) * 2 << endl;
      }
    }
    past = 0;
  }
}


Measured memory_bytes: 1664
from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))

a.sort()
m = a[-1] // 2 + a[-1] % 2

i = bisect_left(a, m)

if i == 0:
    ans = str(a[-1]) + " " + str(a[0])
elif i == len(a)-1:
    ans = str(a[-1]) + " " + str(a[-2])
else:
    k = [a[i] - m, m - a[-1] % 2 - a[i-1]]
    s = min(k)
    s = k.index(s)
    ans = str(a[-1]) + " " + str(a[i-s])     

print(ans)

Measured memory_bytes: 14156
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <functional>
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int MAXN=1e5+10;
const int MAX=1e4+10;
const double eps=1e-6;



int main(){
    #ifdef ONLINE_JUDGE
    #else
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    #endif

    int juge=0;
    string s;
    cin>>s;
    if(s[0]==s[1]&&s[1]==s[2])
    	juge=1;
    else if(s[1]==s[2]&&s[2]==s[3])
    	juge=1;
    if(juge)	cout<<"Yes"<<endl;
    else	cout<<"No"<<endl;
    
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    
    int ans = 0;
    for(int i=1; i<=n; i+=2){
        int cnt =  0;
        rep2(j, 1, i+1){
            if(i%j==0)cnt++;
        }
        if(cnt==8)ans++;
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1000000007)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main() {
  ll n, k, ans=0, nm;
  cin >> n >> k;
  vector<ll> a(n), c(n, 0), r(n, 0);
  rep(i, n) cin >> a.at(i);
  for(int i = 0; i < n; i++) {
    for(int j = i+1; j < n; j++) {
      if(a.at(i) > a.at(j)) c.at(i)++;
    }
    for(int j = 0; j < i; j++) {
      if(a.at(i) > a.at(j)) r.at(i)++;
    }
  }
  for(int i = 0; i < n; i++) {
    ans += (r.at(i) * ((k * (k - 1) / 2) % mod)) % mod;
    ans += (c.at(i) * ((k * (k + 1) / 2) % mod)) % mod;
  }
  cout << ans % mod;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, c;
bool A[200001], B[200001];

int main() {
	cin >> N;
	for (int i = 1; i <= N; ++i) {
		cin >> A[i];
	}
	for (int i = N; i >= 1; --i) {
		B[i] = A[i];
		for (int j = i + i; j <= N; j += i) {
			B[i] ^= B[j];
		}
		c += B[i];
	}
	cout << c << endl;
	for (int i = 1; i <= N; ++i) {
		if (B[i])cout << i << sp;
	}
	cout << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize ("Ofast")
#pragma GCC omodtimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<long long,long long> ii; 	
typedef complex<long double> com;

const ll mod = 1e9+7;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin >> s;
	bool ok = false;
	for (int z=0;z<s.size();z++){
		if (s[z] == '7') ok = true;
	}
	if (ok)  cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin >> s;

  if (s[2] == s[3] && s[4] == s[5]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

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

int main() {
  int N;
  cin >> N;
  int H,J,I;
  H = N / 100;
  N = N %  100;
  J= N / 10;
  N = N % 10;
  I = N;
  cout << H + J + I << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
   ll n;
   cin>>n;
   ll a[n];
   ll flg=0,c=0,k;
   for(ll i=0;i<n;i++)
   cin>>a[i];
   for(ll i=0;i<n;i++)
   {
       if(a[i]==1 and flg==0)
       {
           flg=1;
           c++;
           k=2;
       }
       if(a[i]==k)
       {
           c++;
           k++;
       }
       
   }
   if(flg==0)
   cout<<-1;
   else
   cout<<n-c;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
	string s; cin >> s;
	int ans = 700;
	for (int i = 0; i < 3; ++i)
	{
		if (s[i]=='o') ans += 100;
	}
	cout << ans << endl;
}

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

int main(){
    int H,W;cin>>H>>W;
    vector<vector<char> > S(H);

    for(int i = 0; i < H ; i++){
        S[i].resize(W);
        for(int j = 0; j < W ; j++){
            cin >> S[i][j];
        }
    }
    vector<vector<int> > L(H),R(H),T(H),B(H);

    for(int i = 0 ; i < H ; i++){
        L[i].resize(W);
        T[i].resize(W);
        for(int j = 0; j < W ; j++){
            if(S[i][j] == '#'){
                L[i][j] = 0;
                T[i][j] = 0;
            }else{
                if(i == 0){
                    T[i][j] = 1;
                }else{
                    T[i][j] = T[i-1][j]+1;
                }
                
                if(j == 0){
                    L[i][j] = 1;
                }else{
                    L[i][j] = L[i][j-1]+1;
                }
            }
        }
    }
    for(int i = H-1 ; i >= 0 ; i--){
        R[i].resize(W);
        B[i].resize(W);
        for(int j = W-1 ; j >= 0 ; j--){
            if(S[i][j] == '#'){
                R[i][j] = 0;
                B[i][j] = 0;
            }else{
                if(i == H-1){
                    B[i][j] = 1;
                }else{
                    B[i][j] = B[i+1][j]+1;
                }
                if(j == W-1){
                    R[i][j] = 1;
                }else{
                    R[i][j] = R[i][j+1]+1;
                }
            }
        }
    }
    int res = 0;
    for(int i = 0; i < H ;i++){
        for(int j = 0; j < W ; j++){
            res = max(res,L[i][j]+T[i][j]+R[i][j]+B[i][j]-3);
        }
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 67072
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int h, w;
    cin >> h >> w;
    vector<vector<char>> a(h+2, vector<char>(w+2, '#'));
    rep(i, h) rep(j, w) {
        cin >> a[i+1][j+1];
    }
    rep(i, h+2) {
        rep(j, w+2) cout << a[i][j];
        cout << endl;
    } 
}

Measured memory_bytes: 256