akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
    /*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {
    int n;
    cin >> n;
    ll ans =0;
    for(int i=1;i<=1e6;i++){
        for(int j=1;j*i<n;j++){
        ans++;
        }
    }
    cout<<ans<<endl;
}
    



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

// K以下の得点sがコインを振り続けてK以上になる確率算出
double probabilityCalculation(int s, int K, double probability)
{
    if (s < K) {
        return probabilityCalculation(s * 2, K, probability / 2.0);
    }
    else
        return probability;
}

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

    double probabilityAccumulation = 0;
    // KがNを超えるか超えないか
    if (K <= N) {
        for (int i = 1; i <= K-1; i++) {
            probabilityAccumulation += probabilityCalculation(i, K, (double)1.0 / N);
        }
        cout << setprecision(15) << double(N-(K-1)) / N + probabilityAccumulation << endl;
    }
    else {
        for (int i = 1; i <= N; i++) {
            probabilityAccumulation += probabilityCalculation(i, K, (double)1.0 / N);
        }
        cout << setprecision(15) << probabilityAccumulation << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <ctype.h>
//#define DEBUG

int main(){

	char strW[11] ={};					//????????????????±?
	char END[12]={"END_OF_TEXT"};		//???????????¶??¨
	char strT[1001]={};					//????????????????????¨

	int i = 0;							//???????????°
	int cnt = 0;						//????????????

	scanf("%s",strW);			//????????????????±?????????????????????????
#ifdef DEBUG
	printf("strW???%s\n",strW);
#endif

	for(i = 0 ; strW[i] != '\0' ; i++){		//strW[i]???\0??????????????§for????????????
			strW[i] = tolower(strW[i]);		//(??§??????????????°)?°???????????????????
	}
#ifdef DEBUG
	printf("?°???????????????????????????????strW???%s\n",strW);
#endif


	/*???????????????????????????*/
	while(1){
		scanf("%s",strT);				//?¬?????????????????????????
#ifdef DEBUG
	printf("strT???%s\n",strT);
#endif
		if(!strcmp(strT,END)){			//strT???END_OF_TEXT?????£??????
			printf("%d\n",cnt);			//???????????????????????¨?????????
			return 0;					//??????????????????????????????
		}

		/*???????????£??????????????¨????°??????????????????????*/
		for(i = 0 ; strT[i] != '\0' ; i++){		//strT[i]???\0??????????????§for??????
			strT[i] = tolower(strT[i]);		//?????§??????????????°????°????????????????
		}

#ifdef DEBUG
	printf("?°???????????????????????????????strT???%s\n",strT);
#endif

		if(!strcmp(strT,strW)){			//strT???strW??¨?????´????????°strcmp????????????
			cnt++;						//????????´?????????????????¢???
		}

	}//?????????????????????????????§?????????return?????\?????§??????????????¨????????????
	return 0;

}

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

int main(void)
{
    int H, W;
    int h, w;
    int nh, nw;
    char buff[1024];
    int A[1024][1024];
    int Nw=0, t=0;
    int *prev_h, *prev_w, *new_h, *new_w, *tmp;
    int Nprev, Nnew;
    int i,j;

    scanf("%d%d",&H,&W);

    prev_h = malloc(sizeof(int)*H*W);
    prev_w = malloc(sizeof(int)*H*W);
    new_h = malloc(sizeof(int)*H*W);
    new_w = malloc(sizeof(int)*H*W);
    Nnew = 0;
    for(h=0;h<H;h++) {
        scanf("%s",buff);
        for(w=0;w<W;w++) {
            if(buff[w]=='#') {
                A[h][w] = 1;
                new_h[Nnew] = h;
                new_w[Nnew] = w;
                Nnew ++;
            } else {
                A[h][w] = 0;
                Nw ++;
            }
        }
    }

    while(Nw > 0) {
        t ++;
        tmp = prev_h; prev_h=new_h; new_h=tmp;
        tmp = prev_w; prev_w=new_w; new_w=tmp;
        Nprev = Nnew;
        Nnew = 0;
        for(i = 0; i < Nprev; i++) {
            h = prev_h[i];
            w = prev_w[i];
            for(j = 0; j < 4; j++) {
                switch(j) {
                    case 0:
                        nh = h+1; nw = w;
                        break;
                    case 1:
                        nh = h-1; nw = w;
                        break;
                    case 2:
                        nh = h; nw = w+1;
                        break;
                    case 3:
                        nh = h; nw = w-1;
                        break;
                }
                if(0<=nh && nh<H && 0<=nw && nw<W && A[nh][nw]==0) {
                    Nw --;
                    A[nh][nw] = 1;
                    new_h[Nnew] = nh;
                    new_w[Nnew] = nw;
                    Nnew ++;
                }
            }
        }
    }
    printf("%d\n",t);

    return 0;
}

Measured memory_bytes: 13056
using System;
using System.Collections;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var p = new Program();
        var array = p.ConvertIntArray(p.ReadInput());
        int result = array[2] -= array[0] - array[1];
        if(result < 0)
        {
            Console.WriteLine("0");
        }
        else
        {
            Console.WriteLine(result);
        }
    }

    public string[] ReadInput()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] ConvertIntArray(string[] x)
    {
        var convertedArray = new int[x.Length];
        for (var i = 0; i < x.Length; i++)
        {
            convertedArray[i] = int.Parse(x[i]);
        }

        return convertedArray;
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
 
using namespace std;
 
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
 
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
 //~ #define int ll
int mod=1e9+7;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename A,typename B> istream& operator>>(istream&,pair<A,B>&);
template<typename A> istream& operator>>(istream&,vector<A>&);
void add(int&,int);
int mul(int,int);
int powz(int,int);
int sub(int,int);
template<typename A> ostream& operator<<(ostream&,vector<A>&);
 
const int N=10001;

void solve(){
	int n;
	cin>>n;
	vi a(n);
	cin>>a;
	int cnt=0;
	for(int i=0;i<n;i++){
		if(a[i]!=(i+1))cnt++;
	}
	if(cnt==0||cnt==2)cout<<"YES";
	else cout<<"NO";
		
	
	
}
 
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	//~ cin>>tc;
	for(int _=0;_<tc;_++){
		//cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}
 
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
}
 
int sub(int a,int b){
	a-=b;
	if(a<0){
		a+=mod;
	}
	return a;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)res=mul(res,a);
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
	    output<<i<<' ';
	return output;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
wa = [0] * n
ac = [0] * n

for i in range(m):
    p,s = input().split()
    p = int(p) - 1
    if s == "WA":
        if ac[p] == 0:
            wa[p] += 1
    elif s == "AC":
        ac[p] = 1

x = 0
for i in range(n):
    x += wa[i] * ac[i]
        
print ("%d %d" % (sum(ac),x))

Measured memory_bytes: 4596
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 998244353;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll c(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }

int main() {
	int n, r = 0;
	cin >> n;
	vector<int> a(n);
	rep(i, 0, n) {
		cin >> a[i];
	}
	rep(i, 0, n)r ^= a[i];
	puts(r ? "No" : "Yes");
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define r(i,n) for(int i = 0; i<n; i++)
using namespace std;
 
int main(){
	int n,count1=0,count2=0, flag=0;
	cin >> n;
	vector<int> v(n);
	r(i,n) cin >>v.at(i);
  
  r(i,n){
    if(count1>v.at(i)){
      flag = 1;
      break;
    }
   count2=v.at(i)-1;
    if(count1<count2) count1 = count2;
  }
  
  if(flag)cout << "No" << endl;  //だめなとき
  else cout << "Yes" << endl;

}


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

int main(void){
    int n,m;
    cin >> n >> m;
    if(n*m==15)cout <<"*"<<endl;
    else if(n+m==15)cout<<"+"<<endl;
    else cout << "x" <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static const int INF = 1e9+7;

int N,M;
vector<vector<int>> G;
bool check[100000+10] = {false};
bool flag = true;

void dfs(int u){
    for(auto a : G[u]){
        if(!check[a]){
            check[a] = true;
            dfs(a);
        }
    }
}

int main(){
    cin>>N>>M;
    G.resize(N);

    for(int i=0; i<M; i++){
        int a,b;
        cin>>a>>b;
        a--,b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    vector<bool> visited(N,false);
    map<int,int> ans;

    queue<int> q1,q2;
    q2.push(0);
    visited[0] = true;

    dfs(0);

    for(int i=0; i<N; i++){
        if(!check[i]) flag = false;
    }

    while(!q2.empty()){

        while(!q2.empty()){
            int cur = q2.front();
            q2.pop();
            for(auto a : G[cur]){
                if(!visited[a]){
                    q1.push(a);
                    visited[a] = true;
                    ans[a] = cur+1;
                }
            }
        }

        while(!q1.empty()){
            int cur = q1.front();
            q1.pop();
            for(auto a : G[cur]){
                if(!visited[a]){
                    visited[a] = true;
                    ans[a] = cur+1;
                    q2.push(a);
                }
            }
        }
    }

    if(flag){
        cout<<"Yes"<<endl;
        for(int i=1; i<N; i++){
            cout<<ans[i]<<endl;
        }
    }

    else cout<<"No"<<endl;

    return 0;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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



void solve() {
	int A, B; cin >> A >> B;
    int res = B;
    if(A >= 6 && A <= 12){
        res = res/2;
    }else if(A <= 5){
        res = 0;
    }

    cout << res << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 4352
N = gets.to_i
as = gets.split.map(&:to_i)
asum = as.inject(:+)
nsum = (1..N).inject(:+) 
if asum % nsum != 0
    puts 'NO' 
    exit
end
atimes = asum / nsum

diff = []
N.times do |i|
    diff[i] = as[(i+1)%N] - as[i]
end

diff2 = []
N.times do |i|
    diff2[i] = diff[(i+1)%N] - diff[i]
end

times = 0
N.times do |i|
    if diff2[i] < 0
        n = -diff2[i]/N
        times += n
        diff2[i] += n * N
        diff2[(i+1)%N] -= n * N
    end
end

if atimes >= times && (atimes - times) % N == 0
    puts 'YES'
else
    puts 'NO'
end

Measured memory_bytes: 10252
n = int(input())
p = [int(input()) for _ in range(n)]
p_m = [0]*n
for i,j in enumerate(p):
    p_m[j-1] = i
res = -10**9
cnt = 0
prev = -1
for i in p_m:
    if prev <= i:
        cnt += 1
        prev = i
    else:
        res = max(res, cnt)
        cnt = 1
        prev = i
else:
    res = max(res, cnt)
print(n - res)


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

int n, k, a[202020], b[202020];

int main()
{
    cin >> k >> n;
    rep(i, n) cin >> a[i];
    a[n] = a[0] + k;

    int d = 0;
    for (int i = 0; i < n; i++)
    {
        d = max(d, a[i + 1] - a[i]);
    }
    cout << k - d << endl;
    
    return 0;
}

Measured memory_bytes: 1024
import math
import functools

def gcd(num : list):
    return functools.reduce(math.gcd, num)

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            while temp%i==0:
                temp //= i
            arr.append(i)

    if temp!=1:
        arr.append(temp)

    if arr==[]:
        arr.append(n)

    return arr

def main():
    N = int(input())
    A = list(map(int, input().split()))

    checked_prime = [0] * 1000001

    for a in A:
        if a != 1:
            fac_a = factorization(a)
            for f in fac_a:
                if checked_prime[f] == 0:
                    checked_prime[f] = 1
                else:
                    if gcd(A) == 1:
                        print("setwise coprime")
                        exit()
                    else:
                        print("not coprime")
                        exit()
    print("pairwise coprime")

if __name__ == "__main__":
    main()

Measured memory_bytes: 192096
#include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int a,b;
    while(cin >> a >> b, a||b){
        a = (b - a) / 100;
        cout << a % 5 << ' ' << a % 10 / 5 << ' ' << a / 10 << endl;
    }
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <tuple>
#include <numeric>
#include <utility>
#include <climits>
#include <float.h>
#include <cmath>
#define _USE_MATH_DEFINES
#include <math.h>
#pragma GCC target ("avx2")

using namespace std;

typedef long long ll;
typedef long double ld;
constexpr ll INF = LLONG_MAX;
constexpr double DINF = DBL_MAX;
constexpr ll mod = 1e9+7;
constexpr double PI = M_PI;

template<typename T>
vector<T> make_v(size_t a){
  	return vector<T>(a);
}
 
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts){
  	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

int main(){
  	cin.tie(0);
  	cout.tie(0);
  	ios::sync_with_stdio(false);
	
	long long n, a, b;
	cin >> n >> a >> b;
	if((b - a) % 2){
		long long ans = min(a - 1, n - b) + 1;
		ans += (b - a - 1) / 2;
		cout << ans << endl;
	}else{
		cout << (b - a) / 2 << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

W, H, N = map(int, input().split())

b = [[False] * W for _ in range(H)]

for i in range(N):
    X, Y, A = map(int, input().split())

    h0, h1, w0, w1 = -1, -1, -1, -1
    if A == 1:
        h0, h1, w0, w1 = 0, H, 0, X
    elif A == 2:
        h0, h1, w0, w1 = 0, H, X, W
    elif A == 3:
        h0, h1, w0, w1 = 0, Y, 0, W
    else:
        h0, h1, w0, w1 = Y, H, 0, W

    for x in range(w0, w1):
        for y in range(h0, h1):
            b[y][x] = True

cnt = 0
for y in range(H):
    for x in range(W):
        if not b[y][x]:
            cnt += 1

print(cnt)

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


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

  ll a,b;
  cin >> a >> b;

  ll h = 100;
  ll w = 100;
  vector<vector<char>> f(h, vector<char>(w, '#'));
  REP(i, h/2){
    REP(j, w)
    f[h-1-i][j] = '.';
  }

  ll cnt = 0;
  REP(i, h/2-1){
    REP(j, w){
      if(cnt < a-1){
        f[i][j] = '.';
        cnt++;
        j++;
      }
    }
    i++;
  }

  cnt = 0;
  REP(i, h/2-1){
    REP(j, w){
      if(cnt < b-1){
        f[h-1-i][j] = '#';
        cnt++;
        j++;
      }
    }
    i++;
  }


  cout << h << " " << w << endl;
  REP(i, h){
    REP(j, w)
      cout << f[i][j];
    cout << endl;
  }


}


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

string s;

int main()
{
	cin >> s;
	for (int i = 0; i < 3; i++)
	{
		if (s[i] == '7')
		{
			cout << "Yes" << endl;
			exit(0);
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3620
n, k = map(int, input().split())
s = input().rstrip()

starts = [0]
ends = []

for i in range(1, n-1):
    if s[i] == '1' and s[i-1] == '0':
        starts.append(i)
    if s[i] == '1' and s[i+1] == '0' and len(starts) == len(ends) + 2:
        ends.append(i)

ends.append(n-1)

ans = 0
m = len(ends)
for i in range(m-k+1):
    ans = max(ans, ends[i+k-1] - starts[i] + 1)

if k >= m:
    ans = n

print(ans)

Measured memory_bytes: 44784
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <array>
#include <list>
#include <stack>
#include <valarray>

using namespace std;

typedef unsigned uint;
typedef long long Int;
typedef unsigned long long UInt;

const int INF = 1001001001;
const Int INFLL = 1001001001001001001LL;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
Int lin() { Int x; scanf("%lld", &x); return x; }

int A[11111], B[11111];

int main() {
  int N = in();
  for (int i = 0; i < N; ++i) {
    A[i] = in();
  }

  Int rs = 0;
  for (int i = 0; i < N; ++i) {
    B[i] = in();
    if (A[i] > B[i]) {
      rs += A[i] - B[i];
    }
  }

  for (int i = 0; i < N; ++i) {
    if (A[i] < B[i]) {
      rs -= (B[i] - A[i]) / 2;
    }
  }

  puts(rs <= 0 ? "Yes" : "No");
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  int a[n],b[n],c[n];
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for(int i = 0; i < n; i++) {
    cin >> b[i];
  }
  for(int i = 0; i < n; i++) {
    cin >> c[i];
  }
  sort(a,a+n);
  sort(b,b+n);
  sort(c,c+n);
  long long int J = 0;
  long long int K = 0;
  long long int ans = 0;
  long long int tmp = 0;
  for(int i = 0; i < n; i++) {
    bool pre = true;
    ans += tmp;
    for(int j = J; j < n; j++) {
      if(b[j] >= c[i]) {
        break;
      }
      pre = false;
      J = j + 1;
      for(int k = K; k < n; k++) {
        if(a[k] >= b[j]) break;
        K = k+1;
      }
      tmp += K;
      ans += K;
    }
  }
  cout << ans << endl;

}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using Pi = pair < int , int >;
int main()
{
	int N;
	Pi A[100005], B[100005];
	int G[100005];

	cin >> N;

	for ( int i = 0; i < N; i++ ) {
		cin >> A[i].first; A[i].second = i;
	}
	for ( int i = 0; i < N; i++ ) {
		cin >> B[i].first; B[i].second = i;
	}

	sort(A, A + N); sort(B, B + N);
		
	for ( int i = 0; i < N; i++ ) {
		if ( A[i].first > B[i].first ) { cout << "No" << endl; return ( 0 ); }
	}
	
	for ( int i = 0; i < N; i++ ) {
		G[B[i].second] = A[i].second;
	}

	int cnt = 1;
	int cur = G[0];
	while ( cur != 0 ) cur = G[cur], cnt++;

	if ( cnt < N ) { cout << "Yes" << endl; return ( 0 ); }
		
	bool flag = false;
	for ( int i = 0; i < N - 1; i++ ) {
		if ( A[i + 1].first <= B[i].first ) {
			flag = true;
		}
	}

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

	return ( 0 );
}


Measured memory_bytes: 2176
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    string S;
    cin >> S;
    int checker = 0;
    int point = 0;
    int rcnt=0,lcnt=0;
    vector<int> res(S.size());
    for(int i=0;i<S.size()-1;i++){
        if(S[i]=='R')rcnt++;
        else lcnt++;

        if(S[i]=='R'&&S[i+1]=='L')point = i;
        
        if((S[i]=='L'&&S[i+1]=='R')||i==S.size()-2){
            if(i==S.size()-2)lcnt++;
            if((rcnt-lcnt)%2==0){
                res[point]=(rcnt+lcnt)/2;
                res[point+1]=(rcnt+lcnt)/2;
            }else{
                if(rcnt%2==1){
                    res[point]=(rcnt+lcnt)/2+1;
                    res[point+1]=(rcnt+lcnt)/2;
                }else{
                    res[point]=(rcnt+lcnt)/2;
                    res[point+1]=(rcnt+lcnt)/2+1;
                }
            }
            checker=0;
            rcnt=0;lcnt=0;
        }
    }
    rep(i,S.size())cout << res[i] << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
 
int main() {
  bool judge = 1;
  int baseline = 0;
  int N;
  cin >> N;
  vector<int> H(N);  
  for(int i = 0; i < N; i++) {
    cin >> H.at(i);
    if(baseline <= H.at(i)) baseline = H.at(i);
    if(i != 0) {
      if(baseline - H.at(i) >= 2) {
        judge = 0;
        break;
      }
    }
  }
  
  if(judge == 1) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}

Measured memory_bytes: 640
# -*- coding:utf8 -*-

n = int(input())
l = [int(input()) for _ in range(n)]
minv = l[0]
maxv = l[1] - l[0]
for x in l[1:]:
    if x - minv > maxv:
        maxv = x - minv
    if x < minv:
        minv = x
print(maxv)



Measured memory_bytes: 15100
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,z[100009],zz[100009],zzz[100009],dp[100009][4];
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a;
	for(b=1; b<=a; b++){
		cin>>z[b]>>zz[b]>>zzz[b];
	}
	dp[1][1]=z[1];
	dp[1][2]=zz[1];
	dp[1][3]=zzz[1];
	for(b=2; b<=a; b++){
		dp[b][1]=z[b]+max(dp[b-1][2],dp[b-1][3]);
		dp[b][2]=zz[b]+max(dp[b-1][1],dp[b-1][3]);
		dp[b][3]=zzz[b]+max(dp[b-1][1],dp[b-1][2]);
	}
	cout<<max(dp[a][1],max(dp[a][2],dp[a][3]));
	return 0;
}

Measured memory_bytes: 2944
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
using namespace std;

int main() {
    int H, W, N; cin >> H >> W >> N;
    map<pair<int, int>, long long> m;
    while (N--) {
        int a, b; cin >> a >> b;
        for (int i = -1; i <= 1; i++) for (int j = -1; j <= 1; j++) {
            if (2 <= a + i && a + i <= H - 1 &&
                2 <= b + j && b + j <= W - 1) m[{a + i, b + j}]++;
        }
    }
    vector<long long> cnt(10, 0);
    for (auto p: m) cnt[p.second]++;
    cnt[0] = 1LL * (H - 2) * (W - 2);
    for (int i = 1; i <= 9; i++) cnt[0] -= cnt[i];
    for (int i = 0; i < 10; i++) cout << cnt[i] << endl;
    return 0;
}

Measured memory_bytes: 56448
M,K=map(int,input().split())

if 2**M-1<K:
    print(-1)
    exit()
if M==1:
    if K==0:
        print(0,0,1,1)
    if K==1:
        print(-1)
    exit()

res=0
li=[]
for i in range(2**M):
    if i==K:
        continue
    li.append(i)
ans=[K]+li+[K]+li[::-1]
print(*ans)

Measured memory_bytes: 99840
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = list(input())

cnt0 = S.count("0")
cnt1 = S.count("1")

print(min(cnt0, cnt1) * 2)

Measured memory_bytes: 14292
#include <iostream>
#include <utility>
#include <stdint.h>
#include <string>

using namespace std;

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

  string S, T;
  cin >> S >> T;

  for (int n=0; n<N; ++n) {
    cout << S[n] << T[n];
  }
  cout << endl;

  return 0;
}


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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s,t;
  cin>>s>>t;
  int n = s.size();
  int m = t.size();
  
  if(n<m)
  {
    cout<<"UNRESTORABLE"<<endl;
    return 0;
  }
  bool ans = false;
  for(int i=n-m;i>=0;i--)
  {
    bool found = true;
    for(int j=0;j<m;j++)
    {
      if(s[i+j]=='?')
      {
        continue;
      }
      if(s[i+j]!=t[j])
      {
        found = false;
        break;
      }
    }
    if(found)
    {
      ans = true;
      for(int j=0;j<m;j++)
      {
        s[i+j] = t[j];
      }
      break;
    }
  }
  if(!ans)
  {
    cout<<"UNRESTORABLE"<<endl;
    return 0;
  }
  else
  {
    for(int i=0;i<n;i++)
    {
      if(s[i]=='?')
      {
        s[i]='a';
      }
    }
    cout<<s<<endl;
    return 0;
  }
}


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    int n, m, x;
    cin >> n >> m >> x;

    vector<int> a(m);
    for(int im=0;im<m;im++) {
        cin >> a.at(im);
    }

    int l=0, r=0;
    for(int im=0;im<m;im++) {
        if(a.at(im)<x) l++;
        else r++;
    }

    int ans = 1e9;
    ans = min(l, r);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x,y;
	scanf("%d%d",&x,&y);
	for(int i=0;i<=x;i++)
	{
		if(2*i+4*(x-i)==y)
		{
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}

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

int main(){
	// おまじない
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	ll N,K,R,S,P;
    string T;
	// 出入力
	cin >> N >> K;
    cin >> R >> S >> P;
    cin >> T;

    ll ans = 0;
    char old_c;
    char tmp_c;
    int tmp_ind=0;
    for(int i=0;i<K;i++){
        old_c = '0';
        tmp_ind = 0;
        while(i+K*tmp_ind < N){
            tmp_c = T[i+K*tmp_ind];
            tmp_ind +=1;
            if(old_c == tmp_c){
                old_c = '0';
            }else{
                if(tmp_c=='r'){
                    old_c = 'r';
                    ans +=P;
                }else if(tmp_c=='s'){
                    ans+=R;
                    old_c = 's';
                }else{
                    ans+=S;
                    old_c = 'p';
                }
            }
        }
    }

    cout << ans << "\n";


}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define int long long
using namespace std;
 
bool prime[1000009];
 
void era(){
    prime[0]=1;
    prime[1]=1;
    for(int i=2;i<1000009;i++){
        if(!prime[i]){
            for(int j=i+i;j<1000009;j+=i) prime[j]=1;
        }
    }
}
 
int dp[100009][2];
 
signed main(){
    era();
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)scanf("%ld",&a[i]);
    if(!prime[a[0]]){
        dp[0][0]=1;
        dp[0][1]=1;
    }
    for(int i=0;i<n;i++){
 
        // 1
 
        if( i+1<n && a[i]<a[i+1] &&!prime[a[i+1]] )dp[i+1][0] += dp[i][0];
        if( i+2<n && a[i]<a[i+1] &&!prime[a[i+1]] )dp[i+1][1] += dp[i][0];
 
        // 2
 
        if( i+2<n && a[i]<a[i+2] &&!prime[a[i+2]] )dp[i+2][0] += dp[i][1];
        if( i+3<n && a[i]<a[i+2] &&!prime[a[i+2]] )dp[i+2][1] += dp[i][1];
 
        dp[i+1][0]%=1000000007;
        dp[i+1][1]%=1000000007;
        dp[i+2][0]%=1000000007;
        dp[i+2][1]%=1000000007;
    }
    cout<<(dp[n-1][0]+dp[n-2][1])%1000000007<<endl;
}


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

using namespace std;
using ll = long long int;

template <typename T>
struct SegmentTree {
    using F = function<T(T, T)>;

    const T e;
    const F f;
    size_t sz;
    vector<T> tree;

    SegmentTree(size_t n, const F &f, const T &e = 0) : f(f), e(e) {
        sz = 1;
        while(sz < n) sz <<= 1;
        tree.assign(2*sz, e);
    }

    void set(typename vector<T>::iterator begin, typename vector<T>::iterator end) {
        copy(begin, end, tree.begin() + sz);
        for(size_t k=sz-1; k>0; k--)
            tree[k] = f(tree[2*k+0], tree[2*k+1]);
    }

    void update(size_t k, const T &x) {
        k += sz;
        tree[k] = x;
        while(k >>= 1)
            tree[k] = f(tree[2*k+0], tree[2*k+1]);
    }

    T query(size_t a, size_t b) const {
        b = min(b, sz);
        a = max((size_t)0, a);
        T l = e, r = e;
        for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
            if(a & 1) l = f(l, tree[a++]);
            if(b & 1) r = f(tree[--b], r);
        }
        return f(l, r);
    }

    T operator[](const size_t k) const {
        return tree[sz + k];
    }
};

int main(void) {
    // constexpr ll MOD = 1e9 + 7;
    constexpr ll MOD = 998244353;
    constexpr double PI = acos(-1);
    cout << fixed << setprecision(16);
    cin.tie(0); ios::sync_with_stdio(false);

    ll n;
    cin >> n;
    vector<pair<ll,ll>> xd(n);
    for(auto &t: xd) cin >> t.first >> t.second;
    sort(xd.begin(), xd.end());

    SegmentTree<ll> st(n+1, [&](ll a, ll b){return max(a, b);}, 0);

    vector<ll> dp(n+1);
    dp[n] = 1;
    dp[n-1] = 2;
    st.update(n-1, n);
    for(ll i=n-2; i>=0; i--) {
        ll j = lower_bound(xd.begin(), xd.end(), make_pair(xd[i].first + xd[i].second, (ll)-1e9)) - xd.begin();
        ll k = max(st.query(i, j), j);
        st.update(i, k);

        dp[i] = (dp[k] + dp[i+1]) % MOD;
    }

    cout << dp[0] % MOD << endl;
}


Measured memory_bytes: 9088
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
 
int h,w,k;
string s[303];
int cnt[303];

int ans[303][303];
int idx=1;

void go(int sx,int tx){
    vector<int> vy;
    rep(y,h){
        int sm=0;
        for(int x=sx;x<tx+1;x++){
            if(s[y][x]=='#') sm++;
        }
        if(0<sm) vy.push_back(y);
    }

    int pre=0;
    int ny=vy.size();
    rep(i,ny-1){
        for(int y=pre;y<vy[i]+1;y++){
            for(int x=sx;x<tx+1;x++){
                ans[y][x]=idx;
            }
        }
        idx++;
        pre=vy[i]+1;
    }

    for(int y=pre;y<h;y++){
        for(int x=sx;x<tx+1;x++){
            ans[y][x]=idx;
        }
    }
    idx++;
}

int main(){
    cin>>h>>w>>k;
    rep(i,h) cin>>s[i];

    rep(i,h){
        rep(j,w){
            if(s[i][j]=='#') cnt[j]++;
        }
    }

    vector<int> vx;
    rep(j,w){
        if(0<cnt[j]) vx.push_back(j);
    }

    int nx=vx.size();
    int pre=0;
    rep(i,nx-1){
        go(pre,vx[i]);
        pre=vx[i]+1;
    }

    go(pre,w);

    rep(y,h){
        rep(x,w){
            if(x) cout<<" ";
            cout<<ans[y][x];
        }
        cout<<endl;
    }

}


Measured memory_bytes: 4132
from operator import attrgetter
class Node:
    def __init__(self, id, children):
        self.id = id
        self.children = children
        self.childNode = []
        self.parent = -1
        self.depth = -1
        self.nodeType = ''

    def setChildNode(self, node):
        self.childNode.append(node)

    def __repr__(self):
        return self.__str__()

    def __str__(self):
        return 'node ' + str(self.id) + ': parent = ' + str(self.parent) + ', depth = ' + str(self.depth) + ', '\
                + self.nodeType + ', ' + self.children.__str__()

    def setNodeType(self):
        if self.parent == -1:
            self.nodeType = 'root'
        elif len(self.children) == 0:
            self.nodeType = 'leaf'
        else:
            self.nodeType = 'internal node'

def setDepth(node, depth):
    node.depth = depth
    for child in node.childNode:
        setDepth(child, depth + 1)

n = int(raw_input())
T = []
P = [-1] * n
for i in xrange(n):
    L = map(int, raw_input().split())
    id = L[0]
    T.append(Node(id, L[2:]))
    for child in T[i].children:
        P[child] = id
T.sort(key=attrgetter('id'))
root = P.index(-1)
for i, x in enumerate(P):
    T[i].parent = P[i]
    for cid in T[i].children:
        T[i].setChildNode(T[cid])

setDepth(T[root], 0)
for x in T:
    x.setNodeType()
    print x

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

int main()
{
	int n, k;
	cin >> n >> k;
	vector<int> av(n);
	for (auto& a : av) {
		cin >> a;
	}

	for (int ki = 0; ki < k; ++ki)
	{
		vector<int> bv(n+1, 0);
		for (int i = 0; i < n; ++i) {
			int l = max(0, i - av[i]);
			int r = min(i + av[i] + 1, n);
			++bv[l];
			--bv[r];
		}

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

		bv.pop_back();

		if (av == bv) {
			break;
		}
		av.swap(bv);
	}

	for (auto& a : av) {
		cout << a << " ";
	}
	cout << endl;

	return 0;
}

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

#define N_MAX 100

enum type {
	TYPE_NONE,
	TYPE_VAL,
	TYPE_PLUS,
	TYPE_MINUS,
	TYPE_MULT,
	TYPE_NUM
};

enum state {
	STATE_ERROR,
	STATE_REPEAT,
	STATE_LAST,
};

struct token {
	int type;
	int value;
};

void
parse(struct token *out, char *arg)
{
	switch (arg[0])
	{
	case '\0':
		out->type = TYPE_NONE;
		out->value = 0;
		return;
	case '-':
		if (arg[1] == '\0') {
			out->type = TYPE_MINUS;
			out->value = 0;
		} else {
			out->type = TYPE_VAL;
			out->value = strtol(arg, NULL, 0);
		}
		break;
	case '+':
		if (arg[1] == '\0') {
			out->type = TYPE_PLUS;
			out->value = 0;
		} else {
			out->type = TYPE_VAL;
			out->value = strtol(arg, NULL, 0);
		}
		break;
	case '*':
		out->type = TYPE_MULT;
		out->value = 0;
		break;
	default:
		out->type = TYPE_VAL;
		out->value = strtol(arg, NULL, 0);
		break;
	}
}

enum state
get_token(struct token *out)
{
	char buf[16];
	char c;
	int p = 0;

	while ((c = getchar())) {
		switch (c) {
		case ' ':
			buf[p] = '\0';
			parse(out, buf);
			return STATE_REPEAT;
		case '\n':
		case '\r':
			buf[p] = '\0';
			parse(out, buf);
			return STATE_LAST;
		default:
			if (p >= 16) {
				return STATE_ERROR;
			}
			buf[p++] = c;
		}
	}

	return STATE_ERROR;
}

void
run_plus(struct token *p1, struct token *p2)
{
	p1->type = TYPE_VAL;
	p1->value = p1->value + p2->value;
}

void
run_minus(struct token *p1, struct token *p2)
{
	p1->type = TYPE_VAL;
	p1->value = p1->value - p2->value;
}

void
run_mult(struct token *p1, struct token *p2)
{
	p1->type = TYPE_VAL;
	p1->value = p1->value * p2->value;
}

int
main(void)
{
	struct token stack[N_MAX];
	int p = 0;
	int s;

#define RUN2OP(op) do {\
	if (p >= 2) {\
		run_##op(stack + p - 2, stack + p - 1);\
		p = p - 1;\
	} else {\
		goto end;\
	}\
} while(0)

	while ((s = get_token(&stack[p])) != STATE_ERROR) {
		switch (stack[p].type) {
		case TYPE_VAL:
			p++;
			break;
		case TYPE_PLUS:
			RUN2OP(plus);
			break;
		case TYPE_MINUS:
			RUN2OP(minus);
			break;
		case TYPE_MULT:
			RUN2OP(mult);
			break;
		}
		if (s == STATE_LAST)
			break;
	}

#undef RUN2OP

end:
	if (p)
		printf("%d\n", stack[p - 1].value);

	return 0;
}



Measured memory_bytes: 2100
require 'set'

roll = lambda do |dice, p|
  dice.each_with_index.sort_by {|_, i| p[i] }.map(&:first)
end
permutations = Set.new
permutations << [0, 1, 2, 3, 4, 5]
todo = [[0, 1, 2, 3, 4, 5]]
until todo.empty?
  dice = todo.pop
  [[2, 1, 5, 0, 4, 3], [4, 0, 2, 3, 5, 1]].each do |p|
    d = roll[dice, p]
    unless permutations.member? d
      permutations << d
      todo << d
    end
  end
end
d1 = gets.split.map(&:to_i)
d2 = gets.split.map(&:to_i)
puts(d1.sort == d2.sort && permutations.find {|p| roll[d1, p] == d2 } ? 'Yes' : 'No')

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

int main() {
  string s; cin >> s;
  vector<int> v_rl(0), v_lr(1, -1);
  rep(i, s.size()-1) {
    if(s[i] == 'R' && s[i+1] == 'L') v_rl.push_back(i);
  }
  rep(i, s.size()-1) {
    if(s[i] == 'L' && s[i+1] == 'R') v_lr.push_back(i);
  }
  v_lr.push_back(s.size()-1);
  vector<int> ans(s.size(), 0);
  rep(i, v_rl.size()) {
    ans[v_rl[i]] += 1;
    ans[v_rl[i]] += (v_rl[i] - v_lr[i] - 1) / 2;
    ans[v_rl[i]] += (v_lr[i+1] - v_rl[i]) / 2;

    ans[v_rl[i] + 1] += 1;
    ans[v_rl[i] + 1] += (v_rl[i] - v_lr[i]) / 2;
    ans[v_rl[i] + 1] += (v_lr[i+1] - v_rl[i] - 1) / 2;
  }
  rep(i, s.size()) cout << ans[i] << ' ';
  cout << endl;
}


Measured memory_bytes: 1596
#include <stdio.h>

int main(void){
    int a,b,c,n=0;
    scanf("%d %d %d",&a,&b,&c);
    if(a==7||b==7||c==7){
        if((a==5&&b==5)||(b==5&&c==5)||(c==5&&a==5)){
            printf("YES\n");
            n++;
        }
    }
    if(n==0)printf("NO\n");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
using namespace std;
#include <bits/stdc++.h>
#include<utility>
#include <algorithm>
#include<iterator>
#define  go return 0
#define pb push_back
#define lp(j, n)  for(int j=0; j<(int)(n); ++j)
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v)   ((v).begin()), ((v).end())
#define sz(v)    ( (int)((v).size()) )
#define F first
#define S second
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pair<int,int> > vpii;
typedef map<int, int> mii;
const ll N=1e5+5;
ll arr[N],A[N]  ;
bool visited[N]={};
int main()
{
  int n,i=1;
  cin>>n;
  if(n==1)
  {
      cout<<4;
      go;
  }
  if(n==2)
  {
      cout<<4;
      go;
  }
  while(true)
  {
      if(n==1)
      {
          cout<<i+1;
          go;
      }
      if(n%2==0)
      {
          n/=2;
      }else
      {
          n=(3*n)+1;
      }
      i++;
  }


 go;
}


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

int main() {

  int N, A = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    A += r - l + 1;
  }
  cout << A << endl;

}


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

int main () {
  string s;
  cin >> s;
  
  int sum = 700;
  if (s[0] == 'o') {
    sum+=100;
  }
  if (s[1] == 'o') {
    sum+=100;
  }
  if (s[2] == 'o') {
    sum+=100;
  }
  cout << sum <<endl;  
}

Measured memory_bytes: 256
def main():
    h,w = map(int, input().split())
    s = []
    for i in range(h):
        ss = list(input())
        s.append(ss)

    now = [0,0]
    cnt = 0
    if s[0][0] == '#':
        cnt += 1
        # s[0][0] = '.'
    

    dp = [[-1] * w for i in range(h)]
    dp[0][0] = cnt

    for i in range(h):
        for j in range(w):
            tmp_up = 100000
            tmp_left = 100000
            change  = 0
            if s[i][j] == '#':
                change = 1
            if i == 0 and j == 0:
                continue
            if i != 0:
                if s[i-1][j] == '#' and s[i][j] == '#':
                    tmp_up = dp[i-1][j]
                else:
                    tmp_up = dp[i-1][j] + change
            if j != 0:
                if s[i][j-1] == '#' and s[i][j] == '#':
                    tmp_left = dp[i][j-1]
                else:

                    tmp_left = dp[i][j-1] + change

            dp[i][j] = min(tmp_up,tmp_left)


    print(dp[h-1][w-1])

if __name__ == '__main__':
    main()


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

int compare_char(char *a,char *b){
	return strcmp(a,b);
}

int intsort(const void *a, const void *b){
	return *(int*)b - *(int*)a;
	/*qsort(a,aの配列数,sizeof(int),intsort);*/
}

int longsort(const void *a, const void *b){
	long *A=(long *)a;
	long *B=(long *)b;
	if(*A>*B) return -1;
	if(*A<*B) return 1;
	return 0;
}

int main(){
  int i,N,K,a[200000],cnt=0;
  char ss[10000];
  scanf("%s",ss);
  N=strlen(ss);
  for(i=0;i<N;i++){
    if(ss[i]=='o')cnt++;
  }
  if(cnt+15-N>7){
    printf("YES");
  }else{
    printf("NO");
  }
  return 0;
}


Measured memory_bytes: 256
l,r=map(int,input().split())

minv = 3000

if r//2019!=(l-1)//2019:
    print(0)

else :
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            if minv > i*j%2019:
                minv = i*j%2019

    print(minv)



Measured memory_bytes: 9052
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using P = pair<int,int>;
using ll = long long;
static const int INF = 1000000000;
static const ll MOD = 1000000007;

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

int main(){
	int n, m, c;
	cin >> n >> m >> c;
	vector<int> b(m);
	rep(i, m) cin >> b[i];
	vector<vector<int>> a(n, vector<int>(m));
	rep(i, n) rep(j, m) cin >> a[i][j];
	
	int count = 0;
	for(int i = 0; i < n; ++i){
		int ans = 0;
		for(int j = 0; j < m; ++j){
			ans += a[i][j] * b[j];
		}
		ans += c;
		if(0 < ans) count++;
	}
	cout << count << endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N, A, B;
	cin >> N >> A >> B;

	co((N + 1 - A) * (N + 1 - B));

	Would you please return 0;
}

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


int main(void){
    string S,T; cin >> S >> T;
    int CHECK[29];
    for (int i = 0; i < 28; i++)
    {
        CHECK[i] = 0;
    }
    for (int i = 0; i < S.length(); i++)
    {
        if(CHECK[S[i] - 'a' + 1] == 0) CHECK[S[i] - 'a' + 1] = T[i] - 'a' + 1;
        else{
            if(CHECK[S[i] - 'a' + 1] != T[i] - 'a' + 1){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    for (int i = 0; i < 28; i++)
    {
        CHECK[i] = 0;
    }
    for (int i = 0; i < S.length(); i++)
    {
        if(CHECK[T[i] - 'a' + 1] == 0) CHECK[T[i] - 'a' + 1] = S[i] - 'a' + 1;
        else{
            if(CHECK[T[i] - 'a' + 1] != S[i] - 'a' + 1){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    
}

Measured memory_bytes: 776