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

int main() {
  int a,b,k;
  cin >> a >> b >> k;
  
  vector<int> data;
  
  for(int i=1;i<=min(a,b);i++){
    if(a%i==0&&b%i==0){
      data.push_back(i);
    }
  }
  sort(data.begin(),data.end(),std::greater<int>());
  cout << data.at(k-1);
}


Measured memory_bytes: 3624
if !ENV['RUBY_THREAD_VM_STACK_SIZE']
  require 'rubygems'
  exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'}, Gem.ruby, $0)
end

N = gets.to_i
E = Hash.new { |h, k| h[k] = {} }

(N - 1).times do
  x, y = gets.split.map(&:to_i)

  E[x][y] = E[y][x] = true
end

MOD = 10 ** 9 + 7
BLACK = 0
WHITE = 1
CACHE = Array.new(N + 1) { Array.new(2) }

def dfs(v, color, parent = -1)
  return CACHE[v][color] if CACHE[v][color]

  res = 1

  E[v].each_key do |u|
    next if u == parent

    if color == BLACK
      res = res * dfs(u, WHITE, v) % MOD
    else
      res = res * (dfs(u, BLACK, v) + dfs(u, WHITE, v)) % MOD
    end
  end

  CACHE[v][color] = res
end

puts (dfs(1, BLACK) + dfs(1, WHITE)) % MOD


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

#define int long long
#define rep(i, l, r) for (int i = (int)(l); i < (int)(r); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)x.size())
template <class T> bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

using vi = vector<int>;
using vvi = vector<vi>;
using P = pair<int, int>;

/*
 */

signed main(){
  int x;
  cin >> x;

  auto check = [](int k){
    bool ok = true;
    rep(i, 2, k) if(k%i == 0) ok = false;
    return ok;
  };

  for(int i = x; ; i++){
    if(check(i)){
      cout << i << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<utility>
#include<string>
#include<cmath>
#include<map>
#include<algorithm>
#include<tuple>
#include<stdio.h>

int main(){
    int n,k;
    std::cin>>n>>k;
    std::vector<double> p(n);
    for(int i = 0;i < n;i++){
        std::cin>>p[i];
        p[i] = (p[i] + 1) / 2;
    }
    std::vector<double> ru(n + 1);
    for(int i = 1;i < n + 1;i ++){
        ru[i] = ru[i - 1] + p[i - 1];
    }

    double max = 0.0;
    for(int i = k;i < n + 1;i++){
        max = std::max(max,ru[i] - ru[i - k]);
    }
    printf("%lf",max);
}

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

#ifdef DEBUG
#define NDEBUG
#include "cout11.h"
#endif
#undef NDEBUG
#include <cassert>

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))

#define INTSPACE 12
char _buf[INTSPACE*1000000 + 3];

int loadint() {
    if (fgets(_buf, INTSPACE+3, stdin)==NULL) return 0;
    return atoi(_buf);
}
int loadvec(vector<int>& v, int N=-1) {
    if (N == -1) {
        N = loadint();
        if (N==0) return 0;
    }
    int bufsize = INTSPACE*N + 3;
    if (fgets(_buf, bufsize, stdin)==NULL) return 0;
    v.resize(N);

    int i=0;
    bool last = false;
    for (char *p=&_buf[0]; ;) {
        char *q = p;
        while (*q > ' ') ++q;
        if (*q == 0x0D || *q == 0x0A) last = true;
        *q = 0;
        v[i++] = atoi(p);
        if (last || i == N) break;
        p = q+1;
    }
    // assert(i <= N);
    return i;
}


int main() {
    int N = loadint(); // 偶数
    vector<int> X(N);
    loadvec(X, N); // 1-1e9
    vector<int> orig(ALL(X));
    sort(ALL(X));
    int h = (N-1)/2; // 0
    int a = X[h], b = X[h+1];
    rep(i, N) {
        cout << ((orig[i] <= a) ? b : a) << endl;
    }
    return 0;
}


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

using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vvvd = vector<vector<vector<double>>>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pint = pair<int, int>;
using Graph = vvi;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

bool cmp(pint a, pint b) {return a.second < b.second;}
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
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, k;
    cin >> n >> k;
    string s;
    cin >> s;

    int score = 0;
    rep(i, n - 1) {
        if(s[i] == s[i + 1]) score++;
    }

    int ans = min(score + 2*k, n - 1);

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

Measured memory_bytes: 512
n,m=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(n)]


def ppp(cake):
    return cake[0]+cake[1]+cake[2]
def ppm(cake):
    return cake[0]+cake[1]-cake[2]
def pmp(cake):
    return cake[0]-cake[1]+cake[2]
def pmm(cake):
    return cake[0]-cake[1]-cake[2]
def mpp(cake):
    return -cake[0]+cake[1]+cake[2]
def mpm(cake):
    return -cake[0]+cake[1]-cake[2]
def mmp(cake):
    return -cake[0]-cake[1]+cake[2]
def mmm(cake):
    return -cake[0]-cake[1]-cake[2]

funcs=[ppp,ppm,pmp,pmm,mpp,mpm,mmp,mmm]
if m==0:
  print(0)
else:
  print(max(sum(sorted([func(cake) for cake in a])[-m:]) for func in funcs))

Measured memory_bytes: 3368
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
const ll M = 1e18;
int si[] = {-1, 0, 1, 0};
int sj[] = {0, -1, 0, 1};


int main() {
  int n;
  cin >> n;
  vector<int> a(n+1,0);
  rep(i,n) cin >> a[i+1];

  vector<int> x(n+1,0);
  for (int i = n; i > 0; i--){
    ll s = 0;
    for (int j = i; j <= n; j += i) s += x[j];
    if (s % 2 != a[i]) x[i]++;
  }

  int ans = 0;
  rep(i,n) ans += x[i+1];
  cout << ans << endl;
  rep(i,n) if (x[i+1] == 1) cout << i+1 << endl;

  return 0;
}


Measured memory_bytes: 4700
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define mst(a,b) memset(a,b,sizeof(a))
#define ALL(x) x.begin(),x.end()
#define pii pair<int,int>
#define lowbit(x) (x&(-x))
#define X first
#define Y second
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn=2000+50;
const int mod=998244353;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int mx=(1<<4);
const double PI=acos(-1.0);
const double eps=1e-9;
//void add(int &a,int b){
//    a+=b;
//    if(a>=mod)a-=mod;
//}
//int pdt(int x,int y) {
//    int ret;
//    __asm__ __volatile__ ("\tmull %%ebx\n\tdivl %%ecx\n":"=d"(ret):"a"(x),"b"(y),"c"(mod));
//    return ret;
//}
int main(){
#ifdef local
    freopen("in.txt","r",stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int ans=0;
    int n; cin>>n;
    for (int i=0;i<n;i++){
        int x; cin>>x;
        ans+=x-1;
    }
    cout<<ans<<"\n";
    return 0;
}


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

public class Main {	
	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		int N = fs.nextInt();
		int a[] = new int[N];
		int A = 0;
		int B = 0;

		for(int i=0; i<N; i++){
			a[i] = fs.nextInt();
		}
		Arrays.sort(a);

		for(int i=N-1; i>=0; i-=2){
			A += a[i];
		}
		for(int i=N-2; i>=0; i-=2){
			B += a[i];
		}

		System.out.println(A-B);




		

	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

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

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

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

		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) {
				a[i]=nextInt();
			}
			return a;
		}

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

	}
	
}


Measured memory_bytes: 22740
package main;

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

func main() {
	sc := NewScanner()
	S := sc.NextLine()

	old := rune(S[0])
	count := 0
	for _, v := range S {
		if old != v {
			count++
		}
		old = v
	}

	fmt.Println(count)
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r:rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf) + 1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf) + 1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    string s; cin >> s;
    string t; cin >> t;
    string ret = "Yes";
    if (s.size() != t.size() -1 ){
        ret = "No";
    }
    REP(i, s.size()){
        if (s[i] != t[i]){
            ret = "No";
        }
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 3568
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <tuple>
#include <cstring>
#include <map>
#include <iomanip>
#include <ctime>
#include <complex>
#include <cassert>
#include <climits>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _ << " " <<
#define all(X) (X).begin(), (X).end()
#define len(X) (X).size()
#define Pii pair<int, int>
#define Pll pair<ll, ll>
#define Tiii tuple<int, int, int>
#define Tlll tuple<ll, ll, ll>
#define PI 3.14159265358979324

int h, w, dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
char s[105][105];
bool b[105][105] = {};

void dfs(int x, int y) {
    b[x][y] = 1;
    if (x == h - 1 && y == w - 1) return;
    
    for (int i = 0; i < 4; i++) {
        int nx = x + dx[i], ny = y + dy[i];
        if (nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
        if (!b[nx][ny] && s[nx][ny] >= '1' && s[nx][ny] <= '6') {
            dfs(nx, ny);
        }
    }
}

int main() {
    cin >> h >> w;

    for (int i =0 ; i < h; i++) cin >> s[i];

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (j % 2 == 0 && i % 2 == 0) {
                if ((i + j) % 4 == 0 && s[i][j] != '6') s[i][j] = '0';
                if ((i + j) % 4 == 2 && s[i][j] != '1') s[i][j] = '0';
            }
            else {
                if (j % 4 == 1) {
                    if (i % 2 == 0 && s[i][j] != '3') s[i][j] = '0';
                }
                if (j % 4 == 3) {
                    if (i % 2 == 0 && s[i][j] != '4') s[i][j] = '0';
                }
                if (i % 4 == 1) {
                    if (j % 2 == 0 && s[i][j] != '2') s[i][j] = '0';
                }
                if (i % 4 == 3) {
                    if (j % 2 == 0 && s[i][j] != '5') s[i][j] = '0';
                }
            }
        }
    }

    for (int i = 0; i < h; i++ ) {
        for (int j = 0; j < w; j++) {
            //cerr << s[i][j];
        }
        //cerr << endl;
    }

    dfs(0, 0);

    cout << (b[h-1][w-1] ? "YES" : "NO") << endl;

}



Measured memory_bytes: 3232
#include<bits/stdc++.h>
using namespace std;
int x,y;
int ans=0;
int main() {
	scanf("%d%d",&x,&y);
	if(x==3) ans+=100000;
	else if(x==2) ans+=200000;
	else if(x==1) ans+=300000;
	if(y==3) ans+=100000;
	else if(y==2) ans+=200000;
	else if(y==1) ans+=300000;
	if(x==1 && y==1) ans+=400000;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var s, t string
	fmt.Scan(&s, &t)
	len := len(s)
	res := 0
	for i := 0; i < len; i++ {
		if s[i] != t[i] {
			res++
		}
	}
	fmt.Println(res)
}


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

#define long long long

long sol(long);

int main(){
	long a=0;
	cin>>a;
	cout<<sol(a)<<endl;
	return 0;
}

long pow10(long a){
	if(a<0)return 0;
	long r=1,c=10;
	while(a>0){
		if(a&1)r*=c;
		c*=c;
		a>>=1;
	}
	return r;
}

long will[50];

long dfs(long d,long pos,long n,long ned){
	if(abs(d-ned)>pow10(n-pos+1)-pow10((n+1)/2)-pow10(n/2)+pow10(pos-1))return 0;
	if(pos>(n+1)/2)return ned==d;
	long ans=0;
	for(will[pos]=-9;will[pos]<=9;will[pos]++){
		if(pos==1&&will[pos]==9)continue;
		if(pos==n/2+1&&will[pos]!=0)continue;
		if(will[pos]>=0)ans+=(9-will[pos]+(pos!=1))*dfs(d+(pow10(n-pos)-pow10(pos-1))*will[pos],pos+1,n,ned);
		else ans+=(10+will[pos])*dfs(d+(pow10(n-pos)-pow10(pos-1))*will[pos],pos+1,n,ned);
	}
	will[pos]=0;
	return ans;
}

long sol(long d){
	if(d%9)return 0;
	long ans=0;
	for(long i=2;pow10((i+1)/2)-pow10((i-1)/2)<=d;i++)
		ans+=dfs(0,1,i,d);
	return ans; 
}

Measured memory_bytes: 256
N,M = map(int,input().split())

switch = []


for _ in range(M):
    s = input().split()
    switch.append(s)
p = input().split()

#print(switch)
#print(p)
ans = 0
for i in range(1<<N):
    s = []
    for j in range(N):
        if (i>>j)&1 == 1:
            s.append(1)
        else:
            s.append(0)
    #print(s)
    
    cnt = 0
    for k in range(M):
        #cnt = 0
        a = 0
        for l in range(int(switch[k][0])):
            a += s[int(switch[k][l+1])-1]
        #print(a)
        #print(a%2)
        
        if a % 2 == int(p[k]):
            cnt += 1
        
    if cnt == M:
        ans += 1
            
print(ans)

Measured memory_bytes: 9152
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		try {
			int num = Integer.parseInt(reader.readLine());
			System.out.println((int)Math.pow(num, 3));
		} catch (Exception e) {
		}
	}
}

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

const int mx = 112345;
int dp[mx][2], a[mx];
int n;
bool solve(int K, bool f = 0) {
  if(K <= 0) return (K == 0);
  int &ans = dp[K][f];
  if(~ans) return ans;
  bool iwon = 0;
  for (int i = 0; i < n; i++) {
    iwon |= solve(K-a[i], !f);
  }
  return ans = !iwon;
}

int main(){
  int K;
  cin >> n >> K;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  memset(dp, -1, sizeof dp);
  cout << (solve(K) ? "Second" : "First") << endl;
}

Measured memory_bytes: 8960
#include <iostream>
#include <string>
#include <cstdlib>
#include <sstream>
#include <math.h>
using namespace std;

int main()
{
	int kisu,sisu;
	string moji[18] = {"","Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan","Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts"};
	while(cin >> kisu >> sisu,kisu,sisu)
	{
		int kotae[24] = {},tasu[24] = {};
		kotae[0] = kisu;
		for (int i = 0; i < 24; ++i)
			tasu[i] = kotae[i];

		for (int i = 0; i < sisu-1; ++i)
		{
			for (int j = 23; j >= 0; --j)
			{
				kotae[j] *=	kisu;
				if(kotae[j] >= 10000)
				{
					kotae[j+1] += kotae[j]/10000;
					kotae[j] -= kotae[j]/10000*10000;
				}
			}
		}
		for (int j = 23; j >= 0; --j)
		{
			if(kotae[j] != 0)
			{
				cout << kotae[j] << moji[j];
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 1208
function main(input) {
	// 定義
	input = input.split("\n");
	var a = parseInt(input[0], 10);
	var b = parseInt(input[1], 10);
	var c = parseInt(input[2], 10);
	var d = parseInt(input[3], 10);
	var e = parseInt(input[4], 10);
	var k = parseInt(input[5], 10);
	var ans = "Yay!";
	// 処理
	if (e - a > k) {
		ans = ":(";
	} else if (d - a > k) {
		ans = ":(";
	} else if (c - a > k) {
		ans = ":(";
	} else if (b - a > k) {
		ans = ":(";
	}
	if (e - b > k) {
		ans = ":(";
	} else if (d - b > k) {
		ans = ":(";
	} else if (c - b > k) {
		ans = ":(";
	}
	if (e - c > k) {
		ans = ":(";
	} else if (d - c > k) {
		ans = ":(";
	}
	if (e - d > k) {
		ans = ":(";
	}
	// 出力
	console.log(ans);
}
 main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21064
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<string>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>
#define MAXN 100000

using namespace std;
//int a[7][2]={0,0,1,0,2,1,3,1,4,1,5,1,6,2};
int main()
{
	long long x,ans=0;
	cin>>x;
	ans+=x/11*2;
	x%=11;
	if(x>0)
	{
		if(x>6)
			ans++;
		ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
//shara's here
//私は大きな男の子
//SPEEEEEEEEEED IS KEEEEEEEEEEY
//REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAAAAAAAAAAAAAAAAAAADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
#include <bits/stdc++.h>
using namespace std;
//fold
typedef string s;
typedef long long ll;
typedef long double ld;
const ll INF = 1e18 + 10;
const ll MINF = -(1e18 + 10);
#if defined(BANYANYA)
#include "/home/xsharawi/Desktop/cpp/debug.hpp"
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define pb push_back
#define vl vector<ll>
#define vll vector<vector<ll> >
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
//endfold
int main(){
	ll t;
	set<ll>x;
	cin>>t;
	while(t--){
	ll k; cin>>k;
	x.insert(k);
	}
	cout<<x.size()<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

return 0;}
/*
███████████████████████████████████████████████████
███████████████████████████████████████████████████
██████████████████████████████████▀████████████████
██████████████████████████████████░▀███████████████
██████████████████████████████▌███░░░▀▀████████████
██▀████████████████████▐██████░▐██░░░░░░▀▀█████████
██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███
█▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███
█▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████
██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████
███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████
███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████
████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████
█████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████
████████████████████████▄░░░░░░░░░░░░░░░▄░░████████
██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████
████████████████████████████████▄░░░░██▄███▀░░▀████
█████████████████████████████▀█████▄███▀▀▀░░▄▄░████
████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█
███████████████████████████▌░░░░░░░░░░░███████░░░▄█
███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██
███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀
░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█
▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███
▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████
▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀
*/


Measured memory_bytes: 256
S = [[{"a": 0, "b": 1, "c": 2}[s] for s in input()[::-1]]for _ in range(3)]
T = {0: "A", 1: "B", 2: "C"}

c = 0
while 1:
    c = S[c].pop()
    if not S[c]:
        print(T[c])
        exit()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main(){
 
    int j,k,A,B,C;
    cin >> A>>B>>C;

    if(A==5)j += 1;
    else if(A==7)k += 1;

    if(B==5)j += 1;
    else if(B==7)k += 1;

    if(C==5)j += 1;
    else if(C==7)k += 1;

    if(j==2&&k==1)cout<<"YES"<<endl;
    else cout <<"NO"<<endl;

    return 0;
}

Measured memory_bytes: 256
/* 
 * File:   main.cpp
 * Author: administrator
 *
 * Created on 2011å¹´8æ27æ¥, ä¸å12:42
 */

#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>
#include <map>
#include <set>
#include <math.h>
using namespace std;

/*
 * 
 */
struct node{
    int good,up;
}a[50];
bool cmp(node b,node c){
        return b.up<c.up;
}
int main(int argc, char** argv) {
    int n,i,j;
    while(scanf("%d",&n),n){
        for(i=1;i<=n;i++)
            scanf("%d %d",&a[i].good,&a[i].up);
        sort(a+1,a+n+1,cmp);
        int tot=0;
        for(i=1;i<=n;i++)
            if(tot>a[i].up)break;
            else {
                tot+=a[i].good;
                if(tot>a[i].up)break;
            }
        if(i==n+1)printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,n) (int i=a;i<n;i++)
#define per(i,a,n,s) (int i=n-1;i>=a;i--)
#define range(...) _overload3(__VA_ARGS__,per,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define vecin(x) for(auto&youso_: (x) ) cin >>  youso_
#define vecout(x) for(auto&youso_: (x) ) cout << youso_ << " " ; cout << 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; }
const int inf = 1e9+10;
const int mod = 1e9+7;
const long long llinf = 1e18;
#define _GLIBCXX_DEBUG
// head

int main(){
    int n,a;
    cin >>n;
    vector<int> A(n);
    for range(i,n){
        cin >> a;
        a--;
        A[a]=i+1;
    }
    vecout(A);
}

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

using namespace std;
/**
********************************************************************
******************* Author:Bisnu sarkar ****************************
********************************************************************
**/

#define ull            unsigned long long
#define ll             long long
#define vi             vector<int>
#define pb             push_back
#define mp             make_pair
#define pii            pair<int,int>
#define vit            vector<int> :: iterator
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second

#define what_is(x)     cerr << #x << " is " << x << endl;

///*....Debugger....*/

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it)
{
    cout << endl ;
}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a << ' ' ;
    err(++it, args...);
}

int dx[8]= {1,0,-1,0,-1,-1,1,1};
int dy[8]= {0,1,0,-1,-1,1,-1,1};
int ini()
{
    int x;
    scanf("%d",&x);
    return x;
}
long long inl()
{
    long long x;
    scanf("%lld",&x);
    return x;
}

const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);

int main()
{
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
   for(int i=0;s[i];i++){
    if(i+1 == k){
        s[i]=s[i]-'A' +'a';
    }
    
   }cout<<s<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cout << #x << ": " << x << ", "
#define debugln(x) cout << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const int mod = 1e9+7;

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

  ll n, k;
  cin >> n >> k;

  ll ans = 0;
  if (k == 2) {
    ll a = n/2;
    ll b = (n+1)/2;
    ans += a*a*a;
    ans += b*b*b;
  } else if (k % 2 == 0) {
    ll a = n/k;
    ll b = n/k;
    if (n%k >= k/2) {
      b++;
    }
    ans += a*a*a;
    ans += b*b*b;
  } else {
    ll a = n/k;
    ans += a*a*a;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    cout << a - b + 1;
}


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

int main(void) {
  int i, min, N, h[100], count, l, r;
  cin >> N;
  for(i = 0; i < N; i++) {
    cin >> h[i];
  }
  do {
    r = l;
    while(h[r + 1] != 0 && r <= N) {
      r++;
    }
    min = h[l];
    for(i = l + 1; i <= r; i++) {
      min = h[i] < min ? h[i] : min;
    }
    for(i = l; i <= r; i++) {
      h[i] -= min;
    }
    count += min;
    while(h[l] == 0 && l < N) {
      l++;
    }
  } while(l < N);

  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val f = (1..n).map { Integer.parseInt( readLine()!!.replace(" ","").reversed() ,2) }
    val p = (1..n).map { readLine()!!.split(" ").map { it.toInt() } }

    (1..1023).map { openJ ->
        f.foldIndexed(0L) { i, acc, openI ->
            val count = Integer.bitCount(openJ and openI)
            return@foldIndexed acc + p[i][count]
        }
    }.max().let { println(it) }
}

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

using namespace std;

int main(void){
    int n;
    vector<int> p;

    cin>>n;

    p.resize(n+1);

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

    int cnt = 0;
    for(int i=1; i<n-1; i++){
        if(p[i-1] < p[i] && p[i] < p[i+1])cnt++;
        else if(p[i-1] > p[i] && p[i] > p[i+1])cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <climits>
#include <memory>
#include <sstream>
#include <iomanip>

using namespace std;


int main() {

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

	int n, m;
	cin >> n >> m;
	vector<int> food(m);
	for (int i = 0; i < m; i++) {
		food[i] = 0;
	}

	for (int i = 0; i < n; i++) {
		int k;
		cin >> k;
		for (int j = 0; j < k; j++) {
			int tmp = 0;
			cin >> tmp;
			food[tmp-1]++;
		}
	}
	int ans = 0;
	for (int i = 0; i < m; i++) {
		if (food[i] == n) {
			ans++;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        ArrayList<Integer> row = new ArrayList<>();
        ArrayList<Integer> col = new ArrayList<>();

        Scanner inp = new Scanner(System.in);

        int total = 0;

        int end = 1;
        while (end != 0) {
            int num1 = inp.nextInt();
            int num2 = inp.nextInt();

            if (num1 == 0 && num2 == 0) {
                end = 0;
            } else {
                row.add(num1);
                col.add(num2);

                total++;
            }
        }

        for (int i = 0; i < total; i++) {
            int ro = row.get(i);
            int co = col.get(i);

            String firstSymbol = "#";

            for (int r = 0; r < ro; r++) {
                String nextSymbol = firstSymbol;
                for (int c = 0; c < co; c++) {
                    System.out.print(nextSymbol);

                    if (nextSymbol.equals("#") && c != co-1) {
                        nextSymbol = ".";
                    } else if (nextSymbol.equals(".") && c != co-1) {
                        nextSymbol = "#";
                    } else {
                        if (firstSymbol.equals("#")) {
                            firstSymbol = ".";
                        } else if (firstSymbol.equals(".")) {
                            firstSymbol = "#";

                        }
                    }
                }

                System.out.print("\n");
            }
            System.out.print("\n");
        }
    }
}



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

typedef long long ll;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const int maxn = 2e5+10;
                        
int a[maxn];

int main(void){
     #ifndef ONLINE_JUDGE
     freopen("in.txt", "r", stdin);
     freopen("out.txt", "w", stdout);
     #endif
    int n;
    cin >> n;
    ll sum = 0;
    for(int i = 2; i <= n/2; i++){
        sum += (n-1)/i;
    }
    sum += n-1;
    sum += (n-n/2-1);
    cout<<sum<<endl;
    return 0;
}




Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for (int i = 0; i < n; i++)
#define why(n, x)                                                              \
  int n;                                                                       \
  while (cin >> n, n != x)
#define iFOR(i, x, n) for (int i = x; i < n; i++)
#define fin << '\n'
#define __ << " " <<
#define ___ << " "
#define bash push_back
#define ALL(x) x.begin(), x.end()
#define SWAP(a, b) ((a != b) && (a += b, b = a - b, a -= b))
//#define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vit;
typedef map<string, int> mstit;
typedef vector<pii> vpi;
typedef greater<pii> gpi;
typedef priority_queue<pii, vpi, gpi> dijk;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
static const signed int dy[] = {0, -1, 0, 1, -1, 1, -1, 1};

bool inside(int x, int y, int w, int h) {
  return (x >= 0 && y >= 0 && x < w && y < h);
}
template <class T> T abs(T &x) { return x < 0 ? -x : x; }
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 qp(int a, ll b, int mo) {
  int ans = 1;
  do {
    if (b & 1)
      ans = 1ll * ans * a % mo;
    a = 1ll * a * a % mo;
  } while (b >>= 1);
  return ans;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

inline void solve() {

  string s, d;
  int n, k;
  cin >> s >> k;
  n = s.size();
  d = s;
  s += s;
  d = d[0] + d + d;
  ll sum = 0;
  ll a[5] = {};
  bool isC[2000] = {};
  for (int i = 1; i <= 2 * n; i++) {
    if (s[i - 1] == s[i] && !isC[i - 1]) {

      a[i < n]++;
      isC[i] = true;
    }
  }
  bool isc[2000] = {};
  int t[5] = {};
  for (int i = 1; i <= 2 * n + 1; i++) {
    if (d[i - 1] == d[i] && !isc[i - 1]) {
      t[i <= n]++;
      isc[i] = true;
    }
  }

  if (a[1] == t[1]) {
    sum = a[0] * k;

  } else if (a[1] == t[0]) {
    sum = a[0] * (k / 2) + a[1] * (k - k / 2);

  } else {
    sum = a[0] * (k - 1) + a[1];
  }

  cout << sum << endl;
}
struct xyz {
  xyz() {
    cin.tie(0), ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
  };
} xyzzy;
signed main() {
  solve();
  return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class abc165_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long X = in.nextLong();
            long base = 100;
            long year = 1;
            while (true) {
                base += Math.floor(base / 100);
                if (X <= base) {
                    out.println(year);
                    return;
                } else {
                    year++;
                }
            }
        }

    }
}



Measured memory_bytes: 35940
a, b, c, x = map(int, input().split())
total = 0
lst = {1:a, 0:b, -1:c}
for k, v in lst.items():
    if x:
        if x == v:
            total += k * v
            x -= v
        elif x > v:
            total += k * v
            x -= v
        else:
            total += k * x
            x -= x

print(total)
        

Measured memory_bytes: 9188
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

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

	cin >> N;
	vector<vector<long long int>>v(N, vector<long long int>(N));
	for (auto&i : v) {
		for (auto &j : i)cin >> j;
	}
	vector<long long int>p(1 << N);
	for (int i = 0; i < 1 << N; i++) {
		for (int j = 0; j < N; j++) {
			if (((i >> j) & 1) == 0)continue;
			for (int k = j + 1; k < N; k++) {
				if (((i >> k) & 1) == 0)continue;
				p[i] += v[j][k];
			}
		}
	}
	vector<long long int>dp(1 << N);
	for (int i = 0; i < 1 << N; i++) {
		dp[i] = p[i];
		int box = i;
		while (box) {
			dp[i] = max(dp[i], dp[i - box] + p[box]);
			box--;
			box &= i;
		}
	}
	cout << dp.back() << endl;
	return 0;
} 

Measured memory_bytes: 1280
### SNIPPET
  # n = gets.split.map(&:to_i)
  # array = n.times.map { gets.split.map(&:to_i) }
  # [].all?(&:even?)
  # a = [*1..m].repeated_combination(n).to_a
  # [1,2,3,4,5].select { |num| num.even? }  # => [2, 4]
  # ["a","a","b"].group_by(&:itself).map{|k,v| [k, v.count]}.to_h #=> {"a"=>2, "b"=>1}
  # 切り捨て: .floor(2).to_f ,切り上げ： .ceil(2).to_f,四捨五入: round(2)
  # 3.upto(6) do |i|, 6.downto(3) do |i|
  # 公約数125.gcd(100)、公倍数125.lcm(100)
  # PI = Math::PI
  # 高さ = a * Math.sin(w / 180.0 * Math::PI), 底辺 = a * Math.cos(w / 180.0 * Math::PI)
  # def chmax(a, b) a > b ? a : b end
  # INF = Float::INFINITY
  # def chmin(a, b) a < b ? a : b end

x = gets.to_i

puts x >= 30 ? "Yes" : "No"

Measured memory_bytes: 14284
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;

const ll mod = 1e9 + 7;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll 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 { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    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 { return mint(*this) /= a; }
};
istream& operator>>(istream& is, mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

int main() {
  int x, y;
  cin >> x >> y;
  if ((x + y) % 3 != 0) {
    cout << 0 << endl;
    return 0;
  }
  int n = (x + y) / 3;
  int r = x - n;
  if (r < 0) {
    cout << 0 << endl;
    return 0;
  }

  mint ans = 1;
  for (int i = 0; i < r; i++) ans *= (n - i);
  for (int i = r; i > 0; i--) ans /= i;

  cout << ans << endl;
}


Measured memory_bytes: 3636
N,K = map(int,input().split())
a = list(map(int,input().split()))

DP = [-1 for i in range(K+1)]
for i in range(a[0]):
    DP[i] = 0
DP[a[0]] = 1
for i in range(a[0]+1,K+1):
    p = 1
    for j in range(N):
        if i-a[j]<0:
            break
        p *= DP[i-a[j]]
    if p == 0:
        DP[i] = 1
    else:
        DP[i] = 0
if DP[K] == 1:
    print('First')
else:
    print('Second')

Measured memory_bytes: 45168
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <deque>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define ctoi(c) c - '0'
#define tos(s) to_string(s)

typedef long long ll;


int main() {
    int l,r,d;
    cin >> l >> r >> d;
    int ans = 0;
    for (int i = l; i <= r; i++) {
        if (i % d == 0) {
            ans++;
        }
    } 
    cout << ans << endl;
    return 0;
}

/*
ACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACAC                                                                              
                                   ******,  .,, .,, ,,,    ****.**              
                                   ** . .,,,,,,,,,,,,,,,,,,,,,. .,*             
                                   **,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.            
                                .,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.        
                                .,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.        
                    ****      ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,      
              ***************,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,    
         ********************,,,,,,,,,,,,,,@@@,,,,,,,,,,,/@@@,,,,,,,,,,,,,,,    
        ******************,,,,,,,,,,,,,,,,,,(,,.         ,,,,,,,,,,,,,,,,,,,    
       ********************,,,,,,,,,,,*,,,,,.     %&&&     .,,,,*,,,,,,,,,,,,.  
       ***,,,,,,,,,,,,,,*,,,,,,,,,,,,,,,,,,,,               ,,,,,,,,,,,,,,,,,   
       ,,,,,,,,,,,,,,,,,,,**,,,,,,,,,,.......      ##(     ........,,,,,,,,,,.  
     .,,,,,,,,,,,,,,,,,,**,,,,,,,,,,..............    ..............,,,,,,,,    
    .,,,,,,,,,,,,,,,,,,,**,,,,,,,,,.................................,,,,,,,,,   
   ,,,,,,,,,,,,,,,,,,,,***,,,,,,,....................................,,,,,,,,,  
   ,,,,,,,,,,,,,,,,,,,,**,,,,,,,,.....................................,,,,,,,   
   ,,,,,,,,,,,,,,,,,,,,,**,,,,,,,,....................................,,,,,,,   
   ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.....................................,,,,,     
   ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,...................................,.,,,,,     
    ,,,,,,,,,,,,,,,,,,,,,,,,,,,,.....................................,,,        
     ,,,,,,,,,,,,,,,,,,,,,,,,,,,,....................................,,,        
      ,,,,,,,,,,,,,,,,,,,,,,,,,,,,...................................,          
       ..,,,,,,,,,,,,,,,,,,,,,,,,,,.................................,           
       .........**.....       ,,,,,..............................               
        .......*......                  ****,**,       ,..****                  
        .......*,....                   .......        ......                   
          .......*....                   .....          .....                   
                                         ......          .....                  
*/

Measured memory_bytes: 3100
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}
int main(){
    int N; string s,t; cin >> s >> t;
    int ans = 0;
    if (s[0] == t[0]) ans++;
    if (s[1] == t[1]) ans++;
    if (s[2] == t[2]) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 256
let h = ref 0

let parent i = int_of_float (floor (float_of_int i) /. 2.)

let left i = 2*i

let right i = 2*i + 1

let extract (t : int array) =
  let rec max_heapify i =
    let l = left i in
    let r = right i in
    let m = if l <= !h && t.(l) > t.(i) then l else i in
    let m = if r <= !h && t.(r) > t.(m) then r else m in
    if m <> i then begin
      let tmp = t.(i) in t.(i) <- t.(m); t.(m) <- tmp;
      max_heapify m
    end
  in
  let ret = t.(1) in
  t.(1) <- t.(!h);
  decr h;
  max_heapify 1;
  ret

let insert x (t : int array) =
  incr h;
  t.(!h) <- x;
  let rec doit i =
    if i > 1 && t.(parent i) < t.(i) then begin
      let tmp = t.(i) in
      t.(i) <- t.(parent i);
      t.(parent i) <- tmp;
      doit (parent i)
    end
  in
  doit !h

let () =
  let t = Array.make 2000001 0 in
  let rec doit () =
    let op = Scanf.scanf "%s " (fun i -> i) in
    if op = "extract" then (Printf.printf "%d\n" (extract t); doit ())
    else if op = "end" then ()
    else (insert (Scanf.scanf "%d " (fun i -> i)) t; doit ())
  in
  doit ()

Measured memory_bytes: 20408
N=int(input())
numbers=[]
for _ in range(N):
    X,L=map(int,input().split())
    left=X-L
    right=X+L
    numbers.append([right,left])
numbers=sorted(numbers)
answer=1
large=numbers[0][0]
for  _ in range(len(numbers)-1):
    if numbers[answer][0]>large and numbers[answer][1]>=large:
        large=numbers[answer][0]
        answer+=1
    else:
        del numbers[answer]
print(answer)


Measured memory_bytes: 20872
// May this submission get accepted
#pragma GCC optimize ("O3")
#pragma GCC target("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
template<class T> bool chmax(T &a, const T &b) { if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(DUMPALL_ITR, (q).size()) { cerr << (q)[DUMPALL_ITR] << (DUMPALL_ITR == DUMPALL_ITR_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using  ld = long double;
using namespace std;

// 標準入出力
struct inp {
    size_t sz;
    inp(size_t _sz = 1) : sz(_sz) {}
    template <typename T> operator T () const { T a; cin >> a; return a; }
    template <typename T> operator vector<T> () const { vector<T> a(sz); for (size_t i = 0; i < sz; i++) cin >> a[i]; return a; }
    template <typename T, typename U> operator pair<T, U> () const { T f; U s; cin >> f >> s; return pair<T, U>(f, s); }
};
inp inp1; // input one
template <typename T> void say(T &x, char end = '\n') { cout << x << end; }
template <typename T> void say(vector<T> &x, char sep = ' ', char end = '\n') { for (size_t i = 0, sz = x.size(); i < sz; i++) { cout << x[i] << (i == sz-1 ? end : sep); } }

// モジュール


// 処理内容
int main() {
    
    ios::sync_with_stdio(false); // stdioを使うときはコメントアウトすること
    cin.tie(nullptr);            // インタラクティブ問題ではコメントアウトすること
    
    ll h = inp1;
    ll a = inp1;

    ll ans = (h + a - 1) / a;
    say(ans);
    
}

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

using namespace std;
int main(){
  string a,b;
  cin >> a >> b;
  for(int i = 0;i < b.size();i++){
      cout << a[i] << b[i];
  }
  if(a.size() != b.size())
    cout << a[a.size()-1];
  cout << endl;
}


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

signed main(){
    int n;

    cin >> n;
    int c,a1,a2,a[n],suma=0,maxa=-1*1e10;
    cin >>c;
    a1=c;
    suma+=a1;
    for(int i=1;i<n;i++){
        cin >> a2;
        a[i-1]=a2-a1;
        maxa =max(maxa,a[i-1]);
        a1=a2;
        suma+=a1;
    }
    a[n-1]=c-a1;
    maxa=max(maxa,a[n-1]);
    //cerr << maxa<<endl;
    int sum1=0,t=0;
    for(int i=0;i<n;i++){
        sum1+=(maxa-a[i])/n;
       // cerr << sum1<<endl;
        if((maxa-a[i])%n!=0){
            t=1;
            break;
        }
    }
    if(t==1||maxa!=sum1)cout <<"NO";
    else{
        int y= 2*suma- maxa*n*(n+1);
        if(y<0||y%(n*n*(n+1))!=0)cout <<"NO";
        else cout <<"YES";


    }
    return 0;
}

Measured memory_bytes: 1024