akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

long long ways[31];

long long howManyWays(int n) {
    if (ways[n]) {
        return ways[n];
    }
    if (n <= 0) {
        return ways[0] = 1;
    } else if (n == 1) {
        return ways[1] = howManyWays(0);
    } else if (n == 2) {
        return ways[2] = howManyWays(1) + howManyWays(0);
    } else {
        return ways[n] = howManyWays(n - 1) + howManyWays(n - 2) + howManyWays(n - 3);
    }
}

int main() {
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        long long way = howManyWays(n);
        cout << way / 3650 + 1 << endl;
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define rep(i,n) for(int i=0; i<(int)(n);i++)

int main(){
  int n,k;
  cin >> n >> k;
  string s;
  cin >> s;
  vi data;
  int x = 0;
  int tmp;
  int count = 0;
  char c;
  bool f0 = true;
  bool f1 = false;
  rep(i,n){
    c = s.at(i);
    if(c == '0'){
      if(f0){
        f0 = false;
        f1 = true;
        data.push_back(count);
        x++;
        count = 0;
      }
      count++;
    }else{
      if(f1){
        f1 = false;
        f0 = true;
        data.push_back(count);
        x++;
        count = 0;
      }
      count++;
    }
  }
  data.push_back(count);
  x++;
  if(x%2 == 0){
    data.push_back(0);
    x++;
  }
  int number = (x-1)/2;
  if(number <= k){
    cout << s.size() << endl;
    return 0;
  }
  vi acc(x);
  acc.at(0) = data.at(0);
  rep(i,x-1){
    acc.at(i+1) = acc.at(i) + data.at(i+1);
  }
  int maxi = acc.at(2*k);
  for(int i=2;2*k+i<x;i=i+2){
    tmp = acc.at(2*k+i) - acc.at(i-1);
    maxi = max(tmp,maxi);
  }
  cout << maxi << endl;
  //cout << x << endl;
  //rep(i,x) cout << data.at(i) << endl;
}

Measured memory_bytes: 1272
# https://atcoder.jp/contests/abc125/tasks/abc125_c

def main():
    import sys
    from fractions import gcd
    input = sys.stdin.readline

    def init(init_val):
        #set_val
        for i in range(n):
            seg[i+num-1]=init_val[i]    
        #built
        for i in range(num-2,-1,-1) :
            seg[i]=gcd(seg[2*i+1],seg[2*i+2]) 
        
    def update(k,x):
        k += num-1
        seg[k] = x
        while k:
            k = (k-1)//2
            seg[k] = gcd(seg[k*2+1],seg[k*2+2])
        
    def query(p,q):
        if q<=p:
            return ide_ele
        p += num-1
        q += num-2
        res=ide_ele
        while q-p>1:
            if p&1 == 0:
                res = gcd(res,seg[p])
            if q&1 == 1:
                res = gcd(res,seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = gcd(res,seg[p])
        else:
            res = gcd(gcd(res,seg[p]),seg[q])
        return res

    n = int(input())
    a = tuple(map(int,input().split()))

    #####単位元######
    ide_ele = 0

    #num:n以上の最小の2のべき乗
    num =2**(n-1).bit_length()
    seg=[ide_ele]*2*num
    init(a)

    ans = -1
    for i in range(n):
        ans = max(ans,gcd(query(0,i),query(i+1,n)))
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 88160
def isCLKWISE(ph) : return not ((ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0)
      
def ConvexHullScan(P):
    P = sorted(P)
    phU = [P[0],P[1]]
    for p in P[2:]:
        phU.append(p)
        if isCLKWISE(phU) : continue
        while(True):
            del phU[-2]
            try:
                if isCLKWISE(phU) : break
            except IndexError:
                break

    phL = [P[-1],P[-2]]
    for p in P[-3::-1]:
        phL.append(p)
        if isCLKWISE(phL) : continue
        while(True):
            del phL[-2]
            try:
                if isCLKWISE(phL) : break
            except IndexError:
                break
                
                
    ph = phU + phL[1:-1]
    return ph
  
n = range(int(input()))
P = [[int(x) for x in input().split()] for _ in n]
Q = ConvexHullScan(P)
Q.reverse()
print(len(Q))
idx = min([[x[1][1],x[1][0],x[0]] for x in enumerate(Q)])[2]
R = Q[idx:] + Q[:idx]
for r in R : print(r[0],r[1])

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

int n, mx, i, t, v[100005];
int main()
{
	cin >> n;
	for (i =0; i < n; i++) {
			scanf("%d",&t);
			v[t]++;
	}
	for (i = 1; i <= 100000; i++) mx = max(mx, v[i - 1] + v[i] + v[i + 1]);
	cout << mx;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<ll(b);i++)
#define repr(i,a,b) for(ll i=a;i>=ll(b);i--)
#define endl "\n"
#define ALL(x) x.begin(),x.end()
#define ALLR(x) x.rbegin(),x.rend()
#define INF 1e9
#define DEBUG(x) cout<<"debug: "<<x<<endl

int n;
int main() {
    cin >> n;
    set<string> s;
    rep(_, 0, n){
        string a; cin >> a;
        s.insert(a);
    }
    cout << s.size() << endl;
    return 0;
}


Measured memory_bytes: 15680
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
using lint = long long;

lint mypow(lint a, lint n) {
	lint res = 1;
	while (n > 0) {
		if (n & 1) res = res * a;
		a = a * a;
		n >>= 1;
	}
	return res;
}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int X;
	cin >> X;

	vector<int> ans;
	int tmp;
	for (int i = 2; i <= 10; i++) {
		for (int j = 1; j <= 100; j++) {
			tmp = mypow(j, i);
			if (tmp <= X) ans.emplace_back(tmp);
			else break;
		}
	}

	sort(ans.begin(), ans.end());
	cout << ans.back() << "\n";

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        int[] first = Arrays.stream(stdin.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        int n = first[0];
        int m = first[1];
        
        UnionFind uf = new UnionFind(n);
        for (int i = 0; i < m; i++) {
            int[] line = Arrays.stream(stdin.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
            int x = line[0] - 1;
            int y = line[1] - 1;
            int z = line[2];
            
            uf.union(x, y);
        }
        
        int ans = IntStream.range(0, n).map(uf::find).boxed().collect(Collectors.toSet()).size();
        System.out.println(ans);
    }
    
    private static class UnionFind {
        private int[] parents;

        public UnionFind(int n) {
            parents = IntStream.range(0, n).toArray();
        }
        
        public int find(int x) {
            if (parents[x] == x) {
                return x;
            } else {
                parents[x] = find(parents[x]);
                return parents[x];
            }
        }
        
        public void union(int x, int y) {
            x = find(x);
            y = find(y);
            if (x != y) {
                parents[y] = x; 
            }
        }
    }
}


Measured memory_bytes: 50120
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
int main()
{
	string s;
	cin>>s;
	string a=s.substr(0,3);
	cout<<a<<endl;
	return 0;
}

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

int main(void) {
  int s;
  cin >> s;
  map<int, int> mp;
  mp[s]++;
  int i = 1;
  while (1) {
    if (s % 2) {
      s = s * 3 + 1;
    } else {
      s = s / 2;
    }
    i++;
    if (mp[s] != 0) {
      cout << i << endl;
      break;
    }
    mp[s] = 1;
  }
  return 0;
}


Measured memory_bytes: 256
using System;

namespace Testcode
{
    class Program
    {
        static void Main(string[] args)
        {
           string[] d = Console.ReadLine().Split();
           int a = int.Parse(d[0]);
           int b = int.Parse(d[1]);
           int c = int.Parse(d[2]);
           
           if (a < b && b < c)
           {
               Console.WriteLine("Yes"); 
           }
           else
           {
               Console.WriteLine("No");
           }
        }
    }
}



Measured memory_bytes: 17944
from math import ceil
from collections import defaultdict, deque


def A(d, t, s):
  if t * s >= d:
    return 'Yes'
  return 'No'


def B(s, t):
  len_t = len(t)
  len_s = len(s)

  def _get_to_change(a, b):
    assert len(a) == len(b)
    to_change = 0
    for i in range(len(a)):
      if a[i] != b[i]:
        to_change += 1
    return to_change

  min_to_change = 1001
  for i in range(len_s - len_t + 1):
    to_change = _get_to_change(s[i:i + len_t], t)
    if to_change < min_to_change:
      min_to_change = to_change
  return min_to_change


def C(n, a):
  pass


def D(n):
  pass


def main():
  # d, t, s = map(int, input().split())
  # print(A(d, t, s))
  s = input()
  t = input()
  print(B(s, t))


if __name__ == '__main__':
  main()


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

int main() {
  int i;
  int sx, sy, tx, ty, gx, gy;

  scanf("%d %d %d %d", &sx, &sy, &tx, &ty);

  gx = tx - sx;
  gy = ty - sy;
  // first
  for (i = 0; i < gx; i++) {
    printf("R");
  }
  for (i = 0; i < gy; i++) {
    printf("U");
  }
  for (i = 0; i < gx; i++) {
    printf("L");
  }
  for (i = 0; i < gy; i++) {
    printf("D");
  }
  // second
  printf("D");
  for (i = 0; i < gx + 1; i++) {
    printf("R");
  }
  for (i = 0; i < gy + 1; i++) {
    printf("U");
  }
  printf("L");
  printf("U");
  for (i = 0; i < gx + 1; i++) {
    printf("L");
  }
  for (i = 0; i < gy + 1; i++) {
    printf("D");
  }
  printf("R");

  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
using namespace std;
char str[200010];
int ans,s1,s2,n;
int main(){
    int i;
    cin>>n;
    scanf("%s",str+1);
    int s=1,e=n;
    while(s<e){
        while(str[s]=='R') s++;
        while(str[e]=='W') e--;
        if(s>=e) break;
        ans++;
        s++;
        e--;
    }
    cout<<ans;
}


Measured memory_bytes: 3952
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		sc.close();

		if (x == 7 || x == 5 || x == 3) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


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


int main(){

    int x, a, b;

    cin >> x >> a >> b;

    int judge = b - a;

    if (judge <= 0){
        cout << "delicious" << endl;
    }
    else if (judge <= x)
        cout << "safe" << endl;
    else
        cout << "dangerous" << endl;


}

Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.trim().split('\n');

var line;
while (line = lines.shift()) {
	var cs = line.split('');
	var result;
	for (var i = 0; i < 26; i++) {
		var str = cs.reduce(function(prev, now) {
			var c;
			if (now < 'a' || now > 'z') {
				c = now;
			}
			else {
				c = String.fromCharCode((now.charCodeAt(0) + i) % 26 + 'a'.charCodeAt(0));
			}
			return prev + c;
		}, '');

		if (str.indexOf('the') >= 0 || str.indexOf('this') >= 0 || str.indexOf('that') >= 0) {
			result = str;
			break;
		}
	}
	console.log(result);
}

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

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

    if(D==22){
        cout << "Christmas Eve Eve Eve" << endl;
    }
    else if(D==23){
        cout << "Christmas Eve Eve" << endl;
        }
    else if (D == 24)
    {
        cout << "Christmas Eve" << endl;
    }
    else if (D == 25)
    {
        cout << "Christmas" << endl;
    }
}

Measured memory_bytes: 256
use std::io;
use std::io::prelude::*;

fn run(args: &Vec<String>) -> String {
    let s = args[0].to_string();
    let mut t = String::new();
    for c in s.chars() {
        match c {
            '0' => t.push(c),
            '1' => t.push(c),
            'B' => { t.pop(); },
            _ => unreachable!()
        }
    }
    t
}

fn main() {
    let stdin = io::stdin();
    let args = stdin.lock().lines().map(|l| l.unwrap()).collect();
    let r = run(&args);
    println!("{}", r);
}


Measured memory_bytes: 380
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException {
		try(final Scanner sc = new Scanner(System.in)){
			final long N = sc.nextLong();
			
			long answer = 0;
			for(long i = 1; i * i <= N; i++) {
				final long div = (N - i) / i;
				if(div <= 0) { break; }
				
				//if(div * i + i == N) {
				if(N / div == N % div) {
					//System.out.println(i + " * " + (div) + " + " + i + " = " + N);
					answer += div;
				}
			}
			for(long i = 1; i * i < N; i++) {
				if(N / i == N % i) {
					answer += i;
				}
			}
			
			System.out.println(answer);
		}
	}

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

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

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

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

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

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

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

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

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

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

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

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

using namespace std;

vector <int> d;
vector <vector <int>> a;
vector <int> q;

int main()
{
    int h, w, n;
    cin >> h >> w >> n;
    d.resize(n);
    for (int i = 0; i < n; i++){
        cin >> d[i];
        for (int j = 0; j < d[i]; j++){
            q.push_back(i + 1);
        }
    }
    a.resize(110, vector<int>(110, 0));
    int x = 0;
    for (int i = 0; i < h; i++){
        if (i % 2 == 0){
            for (int j = 0; j < w; j++){
                a[i][j] = q[x++];
            }
        }
        else{
            for (int j = w - 1; j >= 0; j--){
                a[i][j] = q[x++];
            }
        }
    }
    for (int i = 0; i < h; i++){
        for (int j = 0; j < w; j++){
            cout << a[i][j] << ' ';
        }
        cout << "\n";
    }
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<vector>

using namespace std;

typedef long long ll;

ll N, K;
ll a[200000 + 100];

int my_b_search(ll key, ll val, bool mode) {
	//mode -> trueならば昇順での二分探索 falseなら降順での二分探索
	int ok = mode ? -1 : N;
	int ng = mode ? N : -1;
	while (abs(ok - ng) > 1) {
		int mid = (ok + ng) / 2;
		if (val * a[mid] <= key)ok = mid;
		else ng = mid;
	}
	return ok;
}

bool f(ll key) {
	ll cnt = 0;
	for (int i = 0; i < N; i++) {
		if (a[i] >= 0) {
			cnt += my_b_search(key, a[i], true) + 1;
		}
		else {
			cnt += N - my_b_search(key, a[i], false);
		}
		if (key >= a[i] * a[i])cnt--;
	}
	return cnt >= 2 * K;
}

int main() {
	cin >> N >> K;
	for (int i = 0; i < N; i++)cin >> a[i];

	sort(a, a + N);
	
	ll ng = -1e18 - 100, ok = 1e18 + 100;
	while (abs(ok - ng) > 1) {
		ll mid = (ok + ng) / 2;
		if (f(mid))ok = mid;
		else ng = mid;
	}
	cout << ok << endl;
	return 0;
}


Measured memory_bytes: 1792
#!/usr/bin/env python3


def next_line():
    return input()


def next_int():
    return int(input())


def next_int_array_one_line():
    return list(map(int, input().split()))


def next_int_array_multi_lines(size):
    return [int(input()) for _ in range(size)]


def next_str_array(size):
    return [input() for _ in range(size)]


def main():
    r, c, k = map(int, input().split())
    dp = [[[0] * (c+1) for i in range(r+1)] for i in range(4)]
    v = [[0] * (c+1) for i in range(r+1)]
    for i in range(k):
        row, col, val = map(int, input().split())
        v[row][col] = val

    for row in range(1, r + 1):
        for col in range(1, c + 1):
            for num in range(0, 4):
                if num == 0:
                    dp[num][row][col] = dp[3][row-1][col]  # simple down
                else:
                    
                    dp[num][row][col] = max(dp[num-1][row][col],  # str
                                            dp[num][row][col-1],  # right x
                                            dp[3][row-1][col] + \
                                            v[row][col],  # down o
                                            dp[num-1][row][col-1] + \
                                            v[row][col],  # right o
                                            )
    print(dp[3][r][c])


if __name__ == '__main__':
    main()


Measured memory_bytes: 430048
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int X;
	scan(X);
	int sum=0;
	rep1(i,INF){
		sum+=i;
		if(sum>=X){
			prin(i);
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
nn = []
mm = []
for i in range(n):
    nn.append(list(input()))
for i in range(m):
    mm.append(list(input()))
for i in range(n-m+1):
    for j in range(n-m+1):
        count = 0
        for k in range(m):
            for l in range(m):
                if nn[i+k][j+l] != mm[k][l]:
                    break
                else:
                    count += 1
        if count == m*m:
            print("Yes")
            exit()
print("No")            

Measured memory_bytes: 3064
# 3 8 3   n l t
# 0 1     x w
# 3 2
# 6 1

n, l, t = gets.split.map(&:to_i)

array_x = []
array_w = []
n.times do 
  x_temp, w_temp = gets.split.map(&:to_i)
  array_x << x_temp
  array_w << w_temp
end

def round_once_plus(array)
  array << array[0]
  array.shift
end

def round_once_minus(array)
  array.unshift(array.last)
  array.pop
end

array_position = []
count_over = 0

array_x.each_with_index do |x, i|
  if array_w[i] == 1
    array_position << (x + t) % l
    count_over += (x + t) / l
  else # array_w[i] == 2
    array_position << (x - t) % l
    count_over += (x - t) / l
  end
end

array_position.sort!

if count_over > 0
  count_over = count_over % n
  count_over.times do
    round_once_plus(array_position)
  end
elsif count_over < 0
  count_over = count_over.abs
  count_over = count_over % n
  count_over.times do
    round_once_minus(array_position)
  end
end

puts array_position


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

int main(void) {
    int N;
    cin>>N;
    vector<int> T;
    T.push_back(0);
    // 解答時間
    for (int i = 1; i <= N; i++) {
        int t;
        cin>>t;
        T.push_back(t);
    }
    // ドリンク
    int M;
    cin>>M;
    for (int i = 1; i <= M; i++) {
        int p,x;
        cin>>p>>x;
        int time = 0;
        for (int j = 1; j <= N; j++) {
            if (j == p) time += x;
            else time += T.at(j);
        }
        cout << time << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define UP(a,b,i) for(int i=(a);i<=(b);i++)
#define DOWN(a,b,i) for(int i=(a);i>=(b);i--)
#define rep(a,b,i) UP(a,b-1,i)
ll ma=0x80000000;
ll mi=0x7fffffff;
const ll zfc=0xffffffff;
const ll mod=1e9+7;
using namespace std;
inline void input(ll &x)
{
    x=0;
    int f=1;
    char ch=getchar();
    while(!isdigit(ch))
	{
		if(ch=='-')f=-f;
		ch=getchar();
	}
    while(isdigit(ch))
	{
		x=x*10+(ch-'0');
		ch=getchar();
	}
    x*=f;
}
inline void output(ll x)
{
	if(x<0)
    {
        x=-x;
        putchar('-');
    }
    if(x/10>0)output(x/10);
    putchar(x%10+'0');
}
#define I(n) input(n);
#define O(n) output(n);
#define Enter() cout<<endl;
string st;
int main()
{
	cin>>st;
	rep(2,st.size(),i)
	{
		if(st[i]==st[i-1]&&st[i]==st[i-2])
		{
			{
				cout<<"Yes";
				Enter();
				return 0;
			}
		}
	}
	cout<<"No";
	Enter();
    return 0;
}

Measured memory_bytes: 256
// H -  go to school.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
using namespace std;
const int N = 1e5 + 5;
int n ,ansArr[N];
int main()
{
	int x;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x;
		ansArr[x] = i + 1;
	}
	cout << ansArr[1];
	for (int i = 2; i <= n;  i++) {
		cout << " " << ansArr[i];
	}
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int m,y;
    m = (s[0]-'0')*10+s[1]-'0';
    y = (s[2]-'0')*10+s[3]-'0';
    if(m <= 12 && y <= 12 && m!=0 && y!=0)
    {
        cout<<"AMBIGUOUS\n";
    }
    else if(m <= 12 && y >= 0 && m!=0)
    {
        cout<<"MMYY\n";
    }
    else if(m >= 0 && y <= 12 && y!=0)
    {
        cout<<"YYMM\n";
    }
    else
    {
        cout<<"NA\n";
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const double PI=acos(-1.0);
int main()
{
	double a, b, x;
	cin>>a>>b>>x;
	x/=(a*a);
	if(x>=b/2) printf("%.7lf\n", atan(2.0*(b-x)/a)/PI*180);
	else printf("%.7lf\n", atan(b*b/2.0/a/x)/PI*180);
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);

int main(){
	int h,d;
	while(cin>>h>>d,h|d){
		int y=0,x=0;
		vi hh(h);
		vi dd(d);
		REP(i,h){
			cin>>hh[i];
		}
		REP(i,d){
			cin>>dd[i];
		}
		sort(ALL(hh));
		sort(ALL(dd));
		int ans=0;
		while(y<h&&x<d){
			if(hh[y]==dd[x]){
				ans+=hh[y];
				y++;x++;
			}else if(hh[y]<dd[x]){
				ans+=hh[y];
				y++;
			}else{
				ans+=dd[x];
				x++;
			}
		}
		while(y<h){
			ans+=hh[y];
			y++;
		}
		while(x<d){
			ans+=dd[x];
			x++;
		}
		cout<<ans<<endl;
	}
}

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

int main()
{
  int n;
  cin>>n;
  vector<vector<bool>> grid(n,vector<bool>(n,true));
  vector<vector<int>> dist(n,vector<int>(n,0));
  rep(i,n)rep(j,n) dist[i][j]=min(i,min(j,min(n-i-1,n-j-1)));
  //rep(i,n){rep(j,n) cout<<dist[i][j]; cout<<"\n";}
  
  vector<int> dy = {0,1,0,-1}, dx = {1,0,-1,0};
  int res = 0;
  
  rep(i,n*n)
  {
    int p;
    cin>>p;
    p--;
    int sy = p/n, sx = p%n;
    grid[sy][sx] = false;
    queue<P> q;
    q.push(P(sy, sx));
    
    while(q.size())
    {
      int y = q.front().first, x = q.front().second;
      q.pop();
      int nd = dist[y][x];
      if(grid[y][x]) nd++;
      
      rep(j,4)
      {
        int ny = y+dy[j], nx = x+dx[j];
        if(ny<0||ny>=n||nx<0||nx>=n) continue;
        if(dist[ny][nx] > nd)
        {
          dist[ny][nx] = nd;
          q.push(P(ny, nx));
        }
      }
    }
    res += dist[sy][sx];
    
  }
  cout << res << endl;
  //rep(i,n){rep(j,n) cout<<dist[i][j]; cout<<"\n";}
  
  return 0;
}

Measured memory_bytes: 4668
// AOJ 2383: Rabbit Game Playing
// 2017.10.4 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

#define M 1000000007
int d[100002], n;

int cmp(int *a, int *b) { return *a - *b; }

int bsch(int x)
{
	int m, l = 0, r = n;

    while (l < r) {
        m = (l + r) >> 1;
        if (d[m] < x) l = m + 1; else r = m;
    }
	return l;
}

int main()
{
	int t, i;
	long long ans;

	scanf("%d%d", &n, &t);
	for (i = 0; i < n; i++) scanf("%d", d+i);
    qsort(d, n, sizeof(int), cmp);
    for (ans = 1, i = 0; i < n; i++) ans = (ans * (i+1-bsch(d[i]-t))) % M;
    printf("%lld\n", ans);
    return 0;
}

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



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

using namespace std;



typedef long long ll;

typedef pair<int,int> P;




int main(){

	
int x,y;
	cin>>x>>y;
	cout<<x+y/2<<endl;
}

	


Measured memory_bytes: 256
/**
*    author:  Dooloper
*    created: 25.07.2020 20:56:15
**/

#include <bits/stdc++.h>

#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int,int>;
using ll = long long;

const double PI = acos(-1);
const int mod = 1000000007;
class mint {
    long long x;
public:
    mint(long long x=0) : x((x%mod+mod)%mod) {}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n){
    cin >> a[i];
    if(i >= k){
      if(a[i] > a[i-k]){
        cout << "Yes" << endl;
      }else{
        cout << "No" << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3960
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n,m) for(int i=(n);i<(m);i++)
#define REP_EQ(i,n,m) for(int i=(n);i<=(m);i++)
#define CNT(i,n) for(int i=(n);i>0;i--)
#define REP_two(i,n,m) for(int i=(n);i<(m);i+=2)
#define ll long long
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
int MAX=1e9;
int MOD=1e9+7;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int ans=0;
  if(a*c<=b){
    ans=c;
  }else{
    ans=b/a;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;

/*
 * 2 1 3 1 2 3 4 2 4 5 5 2
 * 
 */ 
int add(int x, int y) {
	x += y;
	if (x > MOD)
		x -= MOD;
	return x;
}
const int N = 200 * 1000 + 5;
int main() {
	int n;
	cin >> n;
	vector<int> color(n + 1);
	vector<int> prv(n + 1);
	vector<int> last(N, -1);
	for (int i = 1; i <= n; i++) {
		cin >> color[i];
		prv[i] = (last[color[i]] == -1 ? i : last[color[i]]);
		last[color[i]] = i; 
	}
	vector<int> dp(n + 1, 0);
	dp[0] = 1;
	for (int i = 1; i <= n; i++) {
		dp[i] = add(dp[i], dp[i - 1]);
		if (i - prv[i] >= 2) {
			dp[i] = add(dp[i], dp[prv[i]]);
		}
	}
	cout << dp[n]; 
}


Measured memory_bytes: 3456
/*
                                Author: Ankit Kaul
**********************Code Belongs to Respective Author Only************************************
*/
 
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
 
#include <bits/stdc++.h>
 
#define endl       '\n'
#define PI          3.141592653589
#define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M           1000000007
#define int         long long int
#define inf         INT_MAX
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
using namespace std;
 
int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x) % M;
        x=(x*x)% M;
        n=n/2;
    }
    return result % M;
}
signed main()
{   jaldi
	int k,x;
	cin>>k>>x;
	k*=500;
	if(k<x)
	cout<<"No";
	else
	cout<<"Yes";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    string s;
    cin>>s;
    string n=s.substr(0,4);
    //cout<<n<<endl;
    if(n>"2019"){
        cout<<"TBD"<<endl;
        return 0;
    }
    else if(n=="2019"){
        string m=s.substr(5,2);
        //cout<<m<<endl;
        if(m>"04"){
            cout<<"TBD"<<endl;
            return 0;
        }
        else{
            cout<<"Heisei"<<endl;
            return 0;
        }
    }
    else{
        cout<<"Heisei"<<endl;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 256
#import sys
#import math
#import numpy as np
'''a,b= map(int,input().split())'''
#a, b, c = [list(map(int, input().split())) for _ in range(3)]
#li0= [int(x) for x in input().split()]
n,l= map(int, input().split())
#x = [list(map(int, input().split())) for _ in range(n)] 
li0= [int(x) for x in input().split()]
ans=1
count=0
for i in li0:
  count+=i
  if count<=l:
    ans+=1
  else:
    break
print(ans)
  


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;

/*
w+hCw= (w+h)! / w!h!
*/

ll l[35];

ll power(ll m, ll n){

    l[0]=m;
    for(ll i=1; i<35; i++){
        l[i] = (l[i-1]*l[i-1]) % MOD;
    }
    /*
    rep(i,35){
        cout << l[i] << " ";
    }
    cout << endl;
    */

    ll tmp = n;
    ll ans = 1;
    rep(i,35){
        if(tmp%2==1){
            ans = (ans*l[i]) % MOD;
        }
        tmp /= 2;
        //cout << ans << " ";
    }
    //cout << endl;
    return ans%MOD;

}

void solve(){

    ll x,y;
    cin >> x >> y;
    if((2*x-y)%3!=0||(2*y-x)%3!=0){
        cout << 0 << endl;
        return;
    }
    ll h = (2*x-y)/3;
    ll w = (2*y-x)/3;
    if(h<0||w<0){
        cout << 0 << endl;
        return;
    }
    ll ans = 1;
    rep(i,h+w){
        ans = (ans*(i+1))%MOD;
    }
    rep(i,h){
        ans = (ans * power(i+1,MOD-2))%MOD;
    }
    rep(i,w){
        ans = (ans * power(i+1,MOD-2))%MOD;
    }

    cout << ans << endl;


}


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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end()); } )
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define fi first
#define se second 

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using ld = long double;
using pll = pair<ll, ll>;

void buff() { ios::sync_with_stdio( false ); cin.tie( nullptr ); }

constexpr ll MOD = 1e9 + 7;

inline ll pow_mod( ll a, ll b, ll mod = MOD) {
    ll res = 1; a %= mod; assert(b >= 0);
    for(;b;b>>=1) {
        if(b&1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

// End of template code!
int main() 
{
    buff();
    int n;
    cin >> n;
    int ans = 0;
    n++;
    rep(i, 1, n) rep(j, 1, n) rep(k, 1, n) ans += __gcd(i, __gcd(j, k) );
    cout << ans << '\n';
    return 0;
}



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

using namespace std;

int32_t main() {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    string a;

    cin >> a;

    if(a=="ABC") {

        cout << "ARC" << '\n';

    } else {

        cout << "ABC" << '\n';

    }

    return 0;

}



Measured memory_bytes: 3528
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(),a.end()
#define forn(i,n) for(int i=0;i<int(n);i++)
#define forr(i,n) for(int i=int(n-1);i>=0;i--)
#define fora(i,a,b) for(int i=int(a);i<=int(b);i++)
#define forb(i,a,b) for(int i=int(a);i>=int(b);i--)
#define mod 1000000007
using namespace std;
using ll=long long int;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<ll> vii;
typedef pair<ll ,ll> pii;
const int dx[]={-1,1,0,0};
const int dy[]={0,0,-1,1};
void solve()
{
	string s,t;
	cin>>s>>t;
	int ans=1e9;
	forn(i,s.size()-t.size()+1)
	{
		int cur=0;
		forn(j,t.size())
		{
			if(s[i+j]!=t[j])cur++;
		}
		ans=min(ans,cur);
	}
	cout<<ans<<endl;
	
}
int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    int t=1;
  //  cin>>t;
    while(t--)
	solve();
    return 0;
}


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

int main(){
    int64_t N,A,B,C,D,E;
    cin>>N>>A>>B>>C>>D>>E;
    int64_t b=min({A,B,C,D,E});
    cout<<(N+b-1)/b+4<<endl;
    return 0;
}

Measured memory_bytes: 256
def suit_to_int(suit)
  case suit
  when 'S'
    0
  when 'H'
    1
  when 'C'
    2
  when 'D'
    3
  end
end

CARD_NUM = 13
SUITS = ['S','H','C','D']
n = gets.chop.to_i

card = Array.new(SUITS.size).map{Array.new(CARD_NUM,0)}

1.step n do
  suit, num = gets.chop.split(' ')
  suit = suit_to_int(suit)
  num = num.to_i
  card[suit][num-1] = 1
end

SUITS.each do |suit|
  1.step CARD_NUM do |num|
    if card[suit_to_int(suit)][num-1] == 0
      printf "%s %d\n", suit, num
    end
  end
end



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

using namespace std;

#define lc (1 + (idx << 1))
#define rc (2 + (idx << 1))
#define md ((st + nd) >> 1)
#define fi first
#define se second
#define pb push_back
typedef long long ll;

const int N = 16;
int a[N][N];
ll dp[N+1][1<<N], b[1<<N];

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			scanf("%d", &a[i][j]);
		}
	}
	for (int j = 1; j < (1 << n); j++) {
		for (int u = 0; u < n; u++) {
			if (j & (1 << u)) {
				for (int v = u + 1; v < n; v++) {
					if (j & (1 << v)) {
						b[j] += a[u][v];
					}
				}
			}
		}
	}
	memset(dp, -1, sizeof dp);
	dp[0][0] = 0;
	for (int i = 1; i <= n; i++) {
		dp[i][0] = 0;
		for (int j = 1; j < (1 << n); j++) {
			dp[i][j] = -1;
			int hold = j;
			do {
				if (dp[i-1][hold] != -1) {
					dp[i][j] = max(dp[i][j], dp[i-1][hold] + b[j^hold]);
				}
				--hold;
				hold &= j;
			} while (hold != j);
		}
	}
	ll res = 0;
	for (int i = 1; i <= n; i++) {
		res = max(res, dp[i][(1<<n)-1]);
	}
	printf("%lld", res);
	return 0;
}
/*
3
0 10 20
10 0 -100
20 -100 0
*/
/*
2
0 -10
-10 0
*/
/*
4
0 1000000000 1000000000 1000000000
1000000000 0 1000000000 1000000000
1000000000 1000000000 0 -1
1000000000 1000000000 -1 0
*/
/*
16
0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7
5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9
-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9
-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1
-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3
-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2
7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5
2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8
-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7
0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6
7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3
0 -1 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0
2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1
-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8
7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9
7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0
*/


Measured memory_bytes: 9472
#include<cstdio>
#include<iostream>
#define maxn 1000000
using namespace std;

bool swi = false;
long long cnt[maxn],color[maxn],n,m;

struct edge{
	int from,v;
}e[maxn];
int tot,first[maxn]; void insert(int u,int v){ tot++; e[tot].from = first[u]; e[tot].v = v; first[u] = tot;}

void dfs(int now){
	if(swi) return;
	for(int i = first[now];i;i = e[i].from){
		int v = e[i].v;
		if(!color[v]){
			color[v] = 3-color[now];
			cnt[color[v]]++;
			dfs(v);
		}else if(color[v] == color[now]){
			swi = true;
			return;
		}
	}
}

int main(){
	scanf("%lld%lld",&n,&m);
	
	for(int i = 1;i <= m;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		insert(x,y);
		insert(y,x);
	}
	
	swi = false;
	color[1] = 1;
	cnt[1]++;
	dfs(1);
	if(!swi) printf("%lld",1LL*cnt[1]*cnt[2]-m);
	else printf("%lld",1LL*n*(n-1)/2-m);
	return 0;
}

Measured memory_bytes: 11136
#include <stdio.h>
#include <deque>
#include <map>

struct PoolInfoEntry
{
	int position;
	int capacity;
};
typedef std::deque<PoolInfoEntry> PoolInfo;

typedef std::deque<int> PositionInfo;

int main( int argc , char** argv )
{
	int total_capacity = 0;
	int position = 0;
	PoolInfo pool_info;
	PositionInfo position_info;

	while( 1 )
	{
		int c = getchar();
		if( c == EOF )
		{
			break;
		}
		if( c == '\\' )
		{
			position_info.push_back( position );
		}
		if( c == '/' )
		{
			if( !position_info.empty() )
			{
				int start_position = position_info.back();
				int capacity = position - start_position;

				total_capacity += capacity;

				while( ( !pool_info.empty() ) && ( start_position < pool_info.back().position ) )
				{
					capacity += pool_info.back().capacity;
					pool_info.pop_back();
				}
				PoolInfoEntry entry;
				entry.position = start_position;
				entry.capacity = capacity;
				pool_info.push_back( entry );

				position_info.pop_back();
			}
		}
		position++;
	}

	printf( "%d\n" , total_capacity );
	printf( "%d" , pool_info.size() );
	for( PoolInfo::const_iterator itr = pool_info.begin() ; itr != pool_info.end() ; itr++ )
	{
		printf( " %d" , itr->capacity );
	}
	printf( "\n" );
	return 0;
}

Measured memory_bytes: 1084
#include<algorithm>
#include<array>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<iso646.h>
#include<queue>
#include<stack>
#include<string>
#include<vector>

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

#define FOR(counter,initial_value,condition) for(int counter = initial_value; counter < condition;counter++)

int digitSum(int n,int digit=8) {
	// digit > 2
	int x = 1;
	FOR(i,0,digit){
		x *= 10;
	}
	int sum = 0;
	FOR(i, 0, digit) {
		sum += n / x;
		n %= x;
		x /= 10;
	}
	sum += n;
	return sum;
}

int main()
{
	string s;
	cin >> s;
	cout << s.front() << s.size() - 2 << s.back() << endl;
}


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

e = [0 for i in range(n)]
_e = 0

for i in range(n):
  _e += (p[i] + 1) / 2
  if i >= k:
    _e -= (p[i - k] + 1) / 2
  e[i] = _e

print(max(e))

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

int main() {

    int t = 1;
    //cin>>t;

    while(t--) {

        ll a,b,c,k;
        cin>>a>>b>>c>>k;

        if((a+b)>=k) cout<<min(a,k)<<"\n";
        else cout<<a-(k-(a+b))<<"\n";

    }

}




Measured memory_bytes: 3596
#include<iostream>
#include<iomanip>
#include<string>
#include<set>
#include<vector>
#include<utility>
#include<algorithm>

using namespace std;

#define LL long long

int n;
vector<pair<string, pair<int, int>>>s;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		string S; int p;
		cin >> S >> p;
		s.push_back(make_pair(S, make_pair(100 - p, i + 1)));
	}
	sort(s.begin(), s.end());
	for (int i = 0; i < n; i++) {
		cout << s[i].second.second << endl;
	}
	return 0;
}

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

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	long long s; cin >> s;
	long long p = 1000000000, c = (s - 1LL) / p + 1LL;
	cout << 0 << " " << 0 << " " << c << " " << 1 << " " << c * p - s << " " << p << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int H;
	int W;
	int a;  /*??°???????????¨?????°*/
	int b;  /*??°???????????¨?????°*/
	int c;  /*??°???????????¨?????°*/
	int d;  /*??°???????????¨?????°*/
	
		while(1){
			scanf("%d %d", &H, &W);
				if(H == 0 && W == 0){
			break;
		}
		for (a = 1; a <= W; a++){
			printf("#");
		}
		printf("\n");
		for (b = 1; b <= (H-2); b++){
			printf("#");
			for(c = 1; c <= (W-2); c++){
				printf(".");
			}
			printf("#");
				printf("\n");
			}
		for (d = 1; d <= W; d++){
			printf("#");
			
			}
			printf("\n");
			printf("\n");
		
		}
		
		return (0);
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<int,int> ii;
typedef pair<ii,int> iii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define eb emplace_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"LINE %d: (%s) = ",__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }

const ll MAXn=2e3+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f3f3f3f3f;

ll a[MAXn];
ll d[MAXn][MAXn];
int main(){
    IOS();
    ll n,x;
    cin >> n >> x;
    for (int i=0;i<n;++i) cin >> a[i];
    for (int i=0;i<n;++i) for (int j=i;j<n;++j) {
        if (i == j) d[i][j] = a[i];
        else d[i][j] = min(d[i][j-1],a[j]);
    }
    ll ans = INF;
    for (ll k=0;k<n;k++) {
        ll cur = 0;
        for (ll i=0;i<n;++i) {
            ll l = i-k;
            if (l < 0) cur += min(d[0][i],d[n+l][n-1]);
            else cur += d[l][i];
        }
        ans = min(ans,cur + k * x);
    }
    cout << ans << endl;
}



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

vector<bool> isp(55555, true);

void init() {
    isp[0] = false;
    isp[1] = false;
    for(int i=2; i*i<55555; i++) {
        if(!isp[i]) continue;
        for(int j=i*i; j<55555; j+=i) {
            isp[j] = false;
        }
    }
}


int main() {
    init();
    int N;
    cin >> N;
    
    vector<int> res;
    rep(i, 55555) {
        if(isp[i] && i%5==1) res.push_back(i);
    }

    rep(i, N) {
        cout << res[i] << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)

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

    int max_bit = 31;
    vector<ll> a(n);
    vector<ll> b(n);
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
    }
    vector<ll> candidates;
    candidates.push_back(k);
    for(int i = 1; i < max_bit; i++){
        if(k&(1<<i)){
            ll tmp = k;
            tmp -= 1<<i;
            tmp |= (1<<i)-1;
            candidates.push_back(tmp);
        }
    }
/*
    for(int i = 0; i < candidates.size(); i++){
        cout << bitset<12>(candidates[i]) << endl;
    }
*/
    ll ans = -1;
    for(int i = 0; i < candidates.size(); i++){
        ll tmpsum = 0;
        for(int j = 0; j < n; j++){
            bool isOK = true;
            for(int bit = 0; bit < max_bit; bit++){
                if(!(candidates[i]&(1<<bit)) && a[j]&(1<<bit)){
                    isOK = false;
                    break;
                }
            }
            if(isOK){
                tmpsum += b[j];
            }
        }
        ans = max(ans,tmpsum);
    }
    cout << ans << endl;

}


Measured memory_bytes: 1792