akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;

int main() {
  vector<int> abc(3);
  rep(i, 3) cin >> abc.at(i);
  sort(abc.begin(), abc.end());
  vector<int> ans = { 5, 5, 7 };
  if (abc == ans) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX(x,y) ((x>y)?x:y)


int main()
{
	long long int a, b, c, d;
	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
	long long int f[4], temp;
	temp=MAX(MAX(a*c,a*d),MAX(b*c,b*d));
	
	

	printf("%lld\n", temp);


	return 0;
}

Measured memory_bytes: 1732
# coding: utf-8

def dp(Hight, Width, lst_grid):
    dp_grid = [[0 for _ in range(Width)] for _ in range(Hight)]
    flag_w = False
    flag_h = False
    for h in range(Hight):
        for w in range(Width):
            if h==0:
                if lst_grid[h][w]=="#":
                    dp_grid[h][w:]==0
                    flag_w = True
                elif flag_w:
                    continue
                else:
                    dp_grid[h][w] = 1
            elif w==0:
                if lst_grid[h][w]=="#":
                    dp_grid[h:][w]==0
                    flag_h = True
                elif flag_h:
                    continue
                else:
                    dp_grid[h][w] = 1
            else:
                dp_grid[h][w] = dp_grid[h-1][w] + dp_grid[h][w-1]
            if lst_grid[h][w] == "#":
                dp_grid[h][w] = 0
    return dp_grid


H, W = map(int, input().split())
lst_grid = [input() for _ in range(H)]

dp_grid = dp(H, W, lst_grid)
print(dp_grid[H-1][W-1] % (10**9 + 7))

Measured memory_bytes: 158444
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

class Edge
{
public:
    int to, cost;
    Edge(){};
    Edge(int to0, int cost0){to = to0; cost = cost0;}
};

vector<vector<Edge> > edges;
vector<bool> check;

bool checkNg(int s, int t, int rest)
{
    check[s] = true;
    if(s == t)
        return rest != 0;

    for(unsigned i=0; i<edges[s].size(); ++i){
        int next = edges[s][i].to;
        if(check[next])
            continue;
        if(checkNg(next, t, rest - edges[s][i].cost))
            return true;
    }
    return false;
}

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        bool ok = true;
        map<string, int> index;
        edges.assign(n*2, vector<Edge>(0));
        for(int i=0; i<n; ++i){
            string s1, s2;
            int x;
            char c;
            cin >> c >> s1 >> c >> c >> c >> c >> x >> s2;

            int k1, k2;
            if(index.find(s1) == index.end()){
                k1 = index.size();
                index[s1] = k1;
            }else{
                k1 = index[s1];
            }
            if(index.find(s2) == index.end()){
                k2 = index.size();
                index[s2] = k2;
            }else{
                k2 = index[s2];
            }

            check.assign(2*n, false);
            if(checkNg(k1, k2, x))
                ok = false;

            edges[k1].push_back(Edge(k2, x));
            edges[k2].push_back(Edge(k1, -x));
        }

        if(ok)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}

Measured memory_bytes: 0
# D - Practical Skill Test

import sys

H, W, D = map(int, sys.stdin.buffer.readline().split())
A = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(H)]

place = [-1] * (H*W + 1)
for row in range(H):
    for col in range(W):
        place[A[row][col]] = (row, col)

cum_cost = [[0] for _ in range(D+1)]
for i in range(1, D+1):
    x = i
    y = x + D
    while y <= H*W:
        cum_cost[i].append(cum_cost[i][-1] + abs(place[x][0] - place[y][0]) + abs(place[x][1] - place[y][1]))
        x += D
        y += D

Q = int(sys.stdin.buffer.readline())

for _ in range(Q):
    L, R = map(int, sys.stdin.buffer.readline().split())
    ans = 0
    tmp = L % D
    if tmp == 0:
        print(cum_cost[-1][R // D - 1] - cum_cost[-1][L // D - 1])
    else:
        print(cum_cost[tmp][R // D] - cum_cost[tmp][L // D])

Measured memory_bytes: 23536
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MMOD 998244353
#define MAX 2010101
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
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;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll solve(ll n,ll x){
  if(n==0) return 1;
  ll len=(1ll<<(n+1))-3,num=(1ll<<n)-1;
  if(x==1) return 0;
  else if(x<=len+1) return solve(n-1,x-1);
  else if(x==len+2) return num+1;
  else if(x<=2*(len+2)) return num+1+solve(n-1,x-len-2);
  else return num*2+1;
}

int main(){
  ll N,X;
  cin>>N>>X;
  cout<<solve(N,X)<<endl;
  return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll mod=1e9+7;

int n;
vector<vector<ll>> sc;
ll dp[(1<<16)];
ll sums[(1<<16)];
ll calc(int mask)
{
  ll ans=0;
  for(int i=0;i<16;i++)
  {
    for(int j=i+1;j<16;j++)
    {
      if((mask&(1<<i))&&(mask&(1<<j)))
        ans+=sc[i][j];
    }
  }
  return ans;
}
void sumcalc(int n)
{
  for(int i=1;i<(1<<n);i++)
  {
    sums[i]=calc(i);
  }
}
ll solve(int mask)
{
  if(mask==0)
  return 0;
  if(dp[mask]!=-1)
  return dp[mask];
  ll ans=0;
  for(int sub=mask;sub!=0;sub=(sub-1)&mask)
  {
    ans=max(ans,sums[sub]+(solve(mask^sub)));
  }
  return dp[mask]=ans;
}
int main()
{
  memset(dp,-1,sizeof(dp));
  cin>>n;
  sc.resize(n,vector<ll>(n));
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<n;j++)
      cin>>sc[i][j];
  }
  sumcalc(n);
  cout<<solve((1<<n)-1)<<endl;
  return 0;
}


Measured memory_bytes: 4608
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
 
using namespace std;
 
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
 
int main() {
    string s;
    cin>>s;
    string a[3]={
        "Sunny",
        "Cloudy",
        "Rainy"
    };
    REP(i,3){
        if(s==a[i]){
            cout<<a[(i+1)%3]<<endl;
        }
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <cctype>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <vector>
#include <map>
#include <set>
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;

int main() {
	string s;
	cin >> s;

	string hi;
	for (int i = 0; i < s.size() / 2; i++) {
		hi.append("hi");
	}
	if (s == hi) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
from itertools import product
import sys
try:
    from typing import List
except ImportError:
    pass


def bsearch1(i: int, a: "List[int]"):
    lb = 0
    rb = len(a) + 1
    while lb + 1 < rb:
        m = (lb + rb) // 2
        if a[m] > i:
            rb = m
        else:
            lb = m
    return lb


def bsearch2(i: int, a: "List[int]"):
    lb = 0
    rb = len(a) + 1
    while lb + 1 < rb:
        m = (lb + rb) // 2
        if a[m] > i:
            lb = m
        else:
            rb = m
    return lb


def solve(N: int, A: "List[int]"):
    cumleft = [0] * (N + 1)
    for i in range(N):
        cumleft[i + 1] = cumleft[i] + A[i]

    cumright = [0] * (N + 1)
    for i in reversed(range(N)):
        cumright[i] = cumright[i + 1] + A[i]

    mleft = [bsearch1(cumi // 2, cumleft) for cumi in cumleft]
    mright = [bsearch2(cumi // 2, cumright) for cumi in cumright]
    ans = cumright[0]
    for i in range(2, N + 1 - 2):
        j1s = {mleft[i] - 1, mleft[i], mleft[i] + 1} - {0, i}
        j2s = {mright[i] - 1, mright[i], mright[i] + 1} - {i, N}
        for j1, j2 in product(j1s, j2s):
            p = cumleft[j1]
            q = cumleft[i] - cumleft[j1]
            r = cumleft[j2] - cumleft[i]
            s = cumright[j2]
            ans = min(ans, max(p, q, r, s) - min(p, q, r, s))
    print(ans)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()


Measured memory_bytes: 104312
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

ll factorial(ll n) {
  ll answer = 1;
  while (n > 1) {
    answer *= n;
    answer %= mod;
    n--;
  }
  return answer;
}

ll combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

ll permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
// for (auto p : prime_factor(n)) {
//	while (p.second--) {
//		cout << p.first << endl;
//	}
//}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

int main() {
  int n;
  string s;
  cin >> n >> s;
  REP(i, s.size()) {
    REP(j, n) {
      s[i]++;
      if (s[i] == '[') {
        REP(j, 26) { s[i]--; }
      }
      if (s[i] == '{') {
        REP(j, 26) { s[i]--; }
      }
    }
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
typedef pair<int,P>P2;
#define F first
#define S second

signed main(){
	int n;
	cin>>n;
	int a[n];
	r(i,n)cin>>a[i];
	sort(a,a+n);

	int A=a[n/2-1];
	int B=a[n/2];

	if(A==B)cout<<0<<endl;
	else cout<<B-A<<endl;
}

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

int st, la;
string s;

int main() {
  cin >> s;
  st = -1;
  rep (i, s.size()) {
    if (st == -1 && s[i] == 'A') st = i;
    if (s[i] == 'Z') la = i;
  }
  cout << la - st + 1 << endl;
  return 0;
}


Measured memory_bytes: 3756
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define inf 1000000000000000000
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define f first
#define s second
#define pb push_back
#define mp make_pair
bool ans = false;
string s;
int a[150], i;
char c;
int main(){
cin >> s;
for(int i=0; i<s.size(); i++){
    a[s[i]]++;
}
for(int i=97; i<=122; i++){
    if(a[i]==0){printf("%c", i);ans=true; break;}
}
if(!ans)cout <<"None";

return 0;}


Measured memory_bytes: 512
import sys


import heapq
class Dijkstra:
    INF = 10**18

    def __init__(self, N, Graph=[[-1]]):
        self.N = (N+1)
        self.dist = [self.INF] * (N+1)
        if Graph[0][0]!=-1: self.G = Graph
        else: self.G = [[] for _ in range(N+1)]

    def insert(self, From, To, Cost):
        self.G[From].append([To, Cost])

    def reset(self):
        for i in range(self.N): self.dist[i] = self.INF

    def dijkstra(self, st):
        self.reset()
        hq = [(0, st)]
        heapq.heapify(hq)
        while len(hq):
            tmp = heapq.heappop(hq)
            now, now_dist = tmp[1], tmp[0]
            if self.dist[now] <= now_dist: continue
            self.dist[now] = now_dist
            for to in self.G[now]:
                heapq.heappush(hq, (now_dist+to[1], to[0]))

def main():
    input=sys.stdin.readline
    n, m, s = map(int, input().split())
    MAX_MONEY = 2600
    dj = Dijkstra((n+1)*(MAX_MONEY+1))

    for i in range(m):
        a, b, c, d = map(int, input().split())
        a, b = a-1, b-1
        for j in range(c, MAX_MONEY):
            dj.insert(a*MAX_MONEY+j, b*MAX_MONEY+(j-c), d)
            dj.insert(b*MAX_MONEY+j, a*MAX_MONEY+(j-c), d)

    for i in range(n):
        a, b = map(int, input().split())
        for j in range(MAX_MONEY-a-1):
            dj.insert(i*MAX_MONEY+j, i*MAX_MONEY+(j+a), b)

    s = min(s, MAX_MONEY-1)
    dj.dijkstra(0*MAX_MONEY+s)

    for i in range(1, n):
        ans = 10**18
        for j in range(MAX_MONEY):ans = min(ans, dj.dist[i*MAX_MONEY + j])
        print(ans)

if __name__=="__main__":
  main()


Measured memory_bytes: 174596
a, b, c, d, e, f = gets.split.map(&:to_i)

tmp = {}
tmp[:waters] = []
(0..30).each do |i|
  (0..30 - i).each do |j|
    sum = 100 * a * i + 100 * b * j
    tmp[:waters] << sum
  end
end

tmp[:sugars] = []
(0..100).each do |i|
  (0..100 - i).each do |j|
    sum = c * i + d * j
    tmp[:sugars] << sum
  end
end

ret = ""
parcent = -1
tmp[:waters].each do |x|
  tmp[:sugars].each do |y|
    next if x + y > f

    tmp[:parcent] = 100 * y / (x + y).to_f
    next if tmp[:parcent] > 100 * e / (100 + e).to_f

    if parcent < tmp[:parcent]
      parcent = tmp[:parcent]
      ret = "#{x + y} #{y}"
    end
  end
end
puts ret


Measured memory_bytes: 1788
use whiteread::parse_line;

fn main() {
    let n: usize = parse_line().unwrap();
    let a: Vec<usize> = parse_line().unwrap();
    let mut cnt = 0;

    for i in 0..n {
        if i == a[a[i] - 1] - 1 {
            cnt += 1;
        }
    }
    println!("{}", cnt / 2);
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }
 
using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;
 
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};
 
const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod


#include <bits/stdc++.h>
using namespace std;
signed main(){
    int N; cin>>N;
    double ans = 1;
    ans = N*2*3.14159265358979;
    cout << fixed << setprecision(10);
    cout<<ans<<endl;
}

Measured memory_bytes: 3804
s = int(input())

a = [0]*1000000
a[0] = s
i = 1
d = {}
d[s] = 1
while True:
    if a[i-1] % 2 == 0:
        a[i] = a[i-1] // 2
    else:
        a[i] = 3 * a[i-1] + 1

    if d.get(a[i]) is None:
        d[a[i]] = 1
    else:
        print(i+1)
        exit()

    i += 1

Measured memory_bytes: 10868
#include "bits/stdc++.h"

using namespace std;
#define rep(i, n) for (int64_t i = 0; i < n; i++)

const double PI = 3.14159265358979323846;

vector<vector<int64_t>> data1;

void search(vector<int64_t> data, int depth)
{
}


int main()
{
	int k;
	string s;
	cin >> k >> s;
	if (s.size() > k)
	{
		s.resize(k);
		cout << s << "..." << endl;
		
	}
	else
	{
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int X[11][7];
int Xor(int i,int j){
	if(i==j)return 0;
	return 1;
}
int main()
{
	X[0][0]=0;X[0][1]=1;X[0][2]=1;X[0][3]=1;X[0][4]=1;X[0][5]=1;X[0][6]=1;
	X[1][0]=0;X[1][1]=0;X[1][2]=0;X[1][3]=0;X[1][4]=1;X[1][5]=1;X[1][6]=0;
	X[2][0]=1;X[2][1]=0;X[2][2]=1;X[2][3]=1;X[2][4]=0;X[2][5]=1;X[2][6]=1;
	X[3][0]=1;X[3][1]=0;X[3][2]=0;X[3][3]=1;X[3][4]=1;X[3][5]=1;X[3][6]=1;
	X[4][0]=1;X[4][1]=1;X[4][2]=0;X[4][3]=0;X[4][4]=1;X[4][5]=1;X[4][6]=0;
	X[5][0]=1;X[5][1]=1;X[5][2]=0;X[5][3]=1;X[5][4]=1;X[5][5]=0;X[5][6]=1;
	X[6][0]=1;X[6][1]=1;X[6][2]=1;X[6][3]=1;X[6][4]=1;X[6][5]=0;X[6][6]=1;
	X[7][0]=0;X[7][1]=1;X[7][2]=0;X[7][3]=0;X[7][4]=1;X[7][5]=1;X[7][6]=1;
	X[8][0]=1;X[8][1]=1;X[8][2]=1;X[8][3]=1;X[8][4]=1;X[8][5]=1;X[8][6]=1;
	X[9][0]=1;X[9][1]=1;X[9][2]=0;X[9][3]=1;X[9][4]=1;X[9][5]=1;X[9][6]=1;
	while(true){
		int N;
		int P[101];
		scanf("%d",&N);
		if(N==-1)break;
		P[0]=10;
		for(int i=1;i<=N;i++)scanf("%d",&P[i]);
		for(int i=0;i<N;i++){
			for(int j=0;j<7;j++){
				if(Xor(X[P[i]][j],X[P[i+1]][j]))printf("1");
				else printf("0");
			}
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 1160
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let N = read!(usize);

    let z = if N % 2 == 0 {
        let mut t = 10;
        let mut n = 0;

        while t <= N {
            n += N / t;
            t *= 5;
        }
        n
    } else {
        0
    };

    println!("{}", z)
}


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

//#define DEBUG

using namespace std;

template <class T>
void print_vect(std::vector<T> v){
    for(int i = 0 ; i < v .size(); i++) cout << v[i] << " ";
    cout << endl;
}


void solve(){
    char c;
    cin >> c;
    if( std::isupper(c) > 0){
        cout << 'A' << endl;
    }else{
        cout << "a" << endl;
    }
}

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/

    #ifdef DEBUG
    int TEST_CASES = 2;
    while(TEST_CASES--){
    #endif // DEBBUG

    solve();

    #ifdef DEBUG
    }
    #endif // DEBUG
    
    return 0;
}


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

using namespace std;

double prob[3002];

double dp[3002][3002];

double solve(int n){
	dp[0][0] = 1;
  	for(int i = 0; i<n; ++i){
    	for(int j = 0; j<=i; ++j){
        	//dp[i][j] theke head nia jaite pari dp[i+1][j+1] e
          	double cp = prob[i+1];
          	dp[i+1][j+1] = dp[i+1][j+1] + dp[i][j]*cp;
          	//dp[i][j] theke tail nia jaite pari dp[i+1][j] e
          	double cpp = 1.0-cp;
            dp[i+1][j] = dp[i+1][j] + dp[i][j]*cpp;
        }
    }
  	double s = 0.0;
  	for(int i = 0; i<=n; ++i){
    	int curhead = i;
      	int curtail = n-i;
        if(curhead>curtail){
        	s = s+dp[n][i];
        }
    }
  	return s;
}

int main(){
	int n;
  	scanf("%d",&n);
  	for(int i = 1; i<=n; ++i){
    	scanf("%lf",&prob[i]);
    }
  	double ans = solve(n);
  	printf("%.10lf\n",ans);
  return 0;
}

Measured memory_bytes: 68992
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n,g,s,b,q;
	scanf("%d",&n);
	if(n>=1000&&n<=9999){
	q = n / 1000;
	b = (n - q*1000) / 100;
	s = (n - q*1000 - b*100) / 10;
	g = (n - q*1000 - b*100 - s*10) / 1;
	if(q==b&&q==s||b==s&&b==g||q==b&&q==s&&q==g)
		printf("Yes\n");
	else
		printf("No\n");
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAX=1e9+5;
int main()
{
	int n; cin>>n;
	int h[n];
	for(int i=0;i<n;i++)
	{
		cin>>h[i];
	}
	vector<int> dp(n,MAX);
	dp[0]=0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<i+3;j++)
		{
			if(j<n)
			{
				int t=h[i]-h[j];
				if(t<0)
				{
					t=t*(-1);
				}
				if(dp[j]>(dp[i]+t))
				{
					dp[j]=dp[i]+t;
				}
			}
		}
	}
	cout<<dp[n-1]<<"\n";
	return 0;
}


Measured memory_bytes: 1024
import math
N = int(input())
A = list(map(int, input().split()))

maxA = max(A) + 1

C = [0] * maxA

g = 0

for a in A:
    C[a] += 1
    g = math.gcd(g, a)

pairwise = True

for i in range(2, maxA):
    cnt = 0
    for j in range(i, maxA, i):
        cnt += C[j]

    if cnt > 1:
        pairwise = False

if pairwise:
    print("pairwise coprime")
    exit()

if g == 1:
    print("setwise coprime")

else:
    print("not coprime")

Measured memory_bytes: 194256
#include <bits/stdc++.h>
#define int long long int
#define pb push_back

#define mod 1000000007
#define sp fixed<<setprecision(12)
using namespace std;
/*
const int MAX=10000005;
//vector<int> primes;
bitset<MAX> is_prime;
void sieve(){
    is_prime.set();
    is_prime[0]=is_prime[1]=0;
    for(int i=4;i<MAX;i+=2){
        is_prime[i]=0;
    }
    for(int i=3;i*i<MAX;i+=2){
        if(is_prime[i]){
            //primes.pb(i);
            for(int j=i*i;j<MAX;j+=i){
                is_prime[j]=0;
            }
        }
    }
}
*/
/*
void lcs(char s1[],char s2[]){
    int n=strlen(s1);
    int m=strlen(s2);
    vector<vector<int>> dp(n+1,vector<int>(m+1,0));
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            int sum=0;
            if(s1[i-1]==s2[j-1]){
                sum=1+dp[i-1][j-1];
            }
            else{
                sum=max(dp[i-1][j],dp[i][j-1]);
            }
            dp[i][j]=sum;
        }
    }
    
    int index=dp[n][m];
    //cout<<index<<endl;
    char ans[index+1];
    ans[index]='\0';
    index--;
    int x=n;
    int y=m;
    while(x>0 and y>0){
        if(dp[x-1][y]==dp[x][y-1] and dp[x-1][y]!=dp[x][y]){
            ans[index]=s1[x-1];
            index--;
            x--;
            y--;
        }else if(dp[x-1][y]>dp[x][y-1]){
            x--;
        }else{
            y--;
        }

    }
    //reverse(ans.begin(),ans.end());

    cout<<ans;
    return;
}
*/
bool isvalid(int a[],int mid,int k,int n){
    int ans=0;
    for(int i=0;i<n;i++){
        int f=(a[i]+mid-1)/mid;
        f--;
        ans+=f;
    }
    return (ans<=k);
}

void solve(){
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int low=1,high=(1e9)+7;
    //cout<<high;
    while(low<high){
        int mid=low+(high-low)/2;
        if(isvalid(a,mid,k,n)){
            high=mid;
        }
        else{
            low=mid+1;
        }

    }
    cout<<low<<'\n';
}


int32_t main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    //double    pi=3.14159265358979323846;
    //sieve();
    int t=1;
    
    //cin>>t;

    for(int tc=1;tc<=t;tc++){
       solve();

    }
    
    return 0;
    
}

Measured memory_bytes: 5172
#include <iostream>
#include <string>
#define rep(i, n)for(int i=0; i<n; i++)
using namespace std;

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

    int num[1000]{};
    rep(i,1000){
        string strint = to_string(i);
        if(i<10){
            strint[2] = strint[0];
            strint[0] = strint[1] = '0';
        }else if(i<100){
            strint[2] = strint[1];
            strint[1] = strint[0];
            strint[0] = '0';
        }
        bool flag[3] {};
        int j=0;
        rep(k, n){
            if(s[k]==strint[j]){
                flag[j] = 1;
                j++;
            } 
        }
        if(flag[0]==1 && flag[1]==1 && flag[2]==1){
            num[i] =1;
        }
    }

    int ans=0;
    rep(i,1000){
        if(num[i]==1) ans++;
    }

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


Measured memory_bytes: 3752
#include<stdio.h>
int main(){
    int a,b,c;
    char str;
    while(1){
        scanf("%d%s%d",&a,&str,&b);
        if(str == '+'){c=a+b;printf("%d\n",c);}
        else if(str == '-'){c=a-b;printf("%d\n",c);}
        else if(str == '*'){c=a*b;printf("%d\n",c);}
        else if(str == '/'){c=a/b;printf("%d\n",c);}
        else break;
    }
    return 0;
}

Measured memory_bytes: 600
#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);
  
  vector<string> v = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
  string s;
  cin >> s;
  
  ll n = v.size();
  ll now;
  REP(i, n){
    if(v[i] == s)
      now = i;
  }
  
  cout << n-now << endl;    
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



int main() {
  int a,b;
  cin>>a>>b;

  vector<int> p(26);
  rep(i,a*b){
    char c;
    cin>>c;
    p[c-'a']++;
  }

  int ki=0;
  int yo=0;
  int sum=0;
  rep(i,26){
    if(p[i]%2==1) ki++;
    sum+=p[i]/4;
  }

  bool ok=true;

  if(a%2==1&&b%2==1){
    if(ki!=1) ok=false;
    if(sum<(a/2)*(b/2)) ok=false;
  }
  else {
    if(ki>0) ok=false;
    if(sum<(a/2)*(b/2)) ok=false;
  }

  cout << (ok?"Yes":"No") << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int N,X;
    cin >> N >> X;
    vector<int> L(N);
    int cnt = 1,iti=0;
    for(int i=0;i<N;i++){
        cin >> L.at(i);
        iti += L.at(i);
        if(iti<=X) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

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;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#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 yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

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 x;
  cin>>x;
  if(x>=30)
    yes;
  else
    no;
}



Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }
#define INF           1e9
#define INFL          static_cast<lint>(INF)
#define REP(i,n)      for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)     for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)     for(lint i=n-1;i>=0;--i)
#define REPR1(i,n)    for(lint i=n;i>0;--i)
#define REPI(i,ini,n) for(lint i=(ini),i##_len=(n);i<i##_len;++i)
#define REPC(i,obj)   for(auto i:obj)
#define R_UP(a,b)     (((a)+(b)-1)/(b))
#define ALL(obj)      (obj).begin(),(obj).end()
int main()
{
	int a = in(), b = in();
	cout << (a + b == 15 ? '+' : a * b == 15 ? '*' : 'x') << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	vector<bool> one_array(10,false),two_array(100,false),three_array(1000,false);
	for(int i=n-1;i>=0;i--){
		int dig = int(s[i]-'0');
		for(int j=0;j<100;j++){
			if(two_array[j]){
				three_array[dig*100+j]=true;
			}
		}

		for(int j=0;j<10;j++){
			if(one_array[j]){
				two_array[dig*10+j]=true;
			}
		}
		one_array[dig]=true;
	}

	int ans=0;
	for(int i=0;i<three_array.size();i++)
		ans += (three_array[i] ? 1 : 0);
	cout << ans << "\n";
}

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

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

void answer1() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  
  int a, b;
  cin >> a >> b;
  if (2 * b < a) {
    cout << a - 2 * b << endl;
  } else {
    cout << 0 << endl;
  }
}


int main() {
  answer1();
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int h, w;
    while (cin >> h >> w && h) {
        for (int i=0; i<h; i++) {
            for (int j=0; j<w; j++)
                cout << ((i+j)%2 ? '.' : '#');
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3072
#交点、非平行の保証付
def vc(p,q):
    return[p[0]-q[0],p[1]-q[1]]

def cross(u,v):
    return(u[0]*v[1]-u[1]*v[0])

n = int(input())
for _ in range(n):
    x0,y0,x1,y1,x2,y2,x3,y3 = map(int,input().split())
    p0,p1,p2,p3 = [x0,y0],[x1,y1],[x2,y2],[x3,y3]
    v01 = vc(p1,p0)
    v02 = vc(p2,p0)
    v03 = vc(p3,p0)
    d1 = cross(v01,v02)
    d2 = cross(v01,v03)
    #print(v01,v02,v03,d1,d2)
    if d1 == 0:
        #print("p2")
        print(*p2)
    elif d2 ==0:
        #print("p3")
        print(*p3)
    else:
        mu = abs(d1)/(abs(d1)+abs(d2))
        #print(mu)
        v23 = vc(p3,p2)
        ans = [p2[0]+mu*v23[0], p2[1]+mu*v23[1]]
        print(*ans)



Measured memory_bytes: 5636
//Multiple of 2 and N
#include <bits/stdc++.h>
using namespace std;

int main(){
    vector<int>vec(3);
    for(int i=0;i<3;i++){
        cin>>vec.at(i);
    }
    //sort(vec.begin(),vec.end())//昇順ソート,123
    //sort(vec.begin(),vec.end(),greater<int>());//降順ソート,321
    vector<int>cost={
        abs(vec.at(0)-vec.at(1)),
        abs(vec.at(1)-vec.at(2)),
        abs(vec.at(2)-vec.at(0)),       
    };
    sort(cost.begin(),cost.end(),greater<int>());
    cost.at(0)=0;
    cout<<cost.at(0)+cost.at(1)+cost.at(2)<<endl;

    return 0;
}


Measured memory_bytes: 256
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

s = input()
n = int(s) -1

print(list[n])

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

int main() {
  int N; cin >> N;
  int num =0;
  
  vector<string> S(N);
  for (int i = 0; i < N; i++) {
  cin >> S.at(i); 
  }
  
  sort(S.begin(), S.end());
  
  for (int i = 0; i < N; i++) {
  if (i==0) num=1 ;
  else if (S.at(i) != S.at(i-1)) num++;
  }
    cout << num << endl;
}


Measured memory_bytes: 9508
#include <iostream>
#include <string>

std::string calc(std::int64_t val, const std::string& before)
{
    if (val == 0)
    {
        return before;
    }
    const auto calcVal = (val - 1);
    constexpr auto DIV = 26;
    char digit = 'a' + calcVal % DIV;
    return calc(calcVal / DIV, std::string(1, digit) + before);
}

int main()
{
    std::int64_t n;
    std::cin >> n;

    std::cout << calc(n, "");
}

Measured memory_bytes: 3628
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,z,w=map(int,input().split())
    A=list(map(int,input().split()))
    dp=[[None]*2 for _ in range(n+1)] # dp[i][turn] 消費枚数i,turnの手から始まるときの最適解

    def dfs(i,turn)->NoneType:
        if(dp[i][turn] is not None): return

        # i+1からn-1のdp[1-turn]を埋めておく(i=n-1のときterminate)
        for j in range(i+1,n):
            dfs(j,1-turn)

        res=-INF if(turn==0) else INF
        if(turn==0):
            for j in range(i+1,n):
                res=max(res,dp[j][1])
            y=A[i-1] if(i!=0) else w
            res=max(res,abs(A[-1]-y))
        else:
            for j in range(i+1,n):
                res=min(res,dp[j][0])
            x=A[i-1]
            res=min(res,abs(A[-1]-x))
        dp[i][turn]=res

    dfs(0,0)
    print(dp[0][0])
resolve()

Measured memory_bytes: 49884
a, b, k = map(int, input().split())

if (b - a)  < k * 2:
    for i in range(a, b+1):
        print(i)
    exit()
else:
    for i in range(a,a+k):
        print(i)
    for i in range(b-k+1,b+1):
        print(i)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 2000000010;
constexpr ll INF= 2000000000000000000;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;
typedef pair<int,P> PP;

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;
}

ll mod(ll val, ll M) {
    ll res = val % M;
    if(res < 0) {
        res += M;
    }
    return res;
}

// N^P mod M（ただしM == -1の時はmodを取らない）
template<typename T>
T RS(T N, T P, T M){
    if(P == 0) {
        return 1;
    }
    if(P < 0) {
        return 0;
    }
    if(P % 2 == 0){
        ll t = RS(N, P/2, M);
        if(M == -1) return t * t;
        return t * t % M;
    }
    if(M == -1) {
        return N * RS(N,P - 1,M);
    }
    return N * RS(N, P-1, M) % M;
}

int main() {
    int A;
    cin >> A;
    cout << A + A * A + A * A * A << endl;
}


Measured memory_bytes: 3632
class DoublyLinkedList:
    def __init__(self):
        self.nil = self.make_node(None)
        self.nil['next'] = self.nil
        self.nil['prev'] = self.nil

    def make_node(self,v):
        return {'key':v, 'next':None, 'prev':None}

    def dump(self):
        n = self.nil['next']
        while True:
            if n['key'] == None:
                break
            else:
                print str(n['key']),
                n = n['next']
        print


    def insert(self,v):
        n = self.make_node(v)
        n['next'] = self.nil['next']
        self.nil['next']['prev'] = n
        n['prev'] = self.nil
        self.nil['next'] = n

    def delete(self,v):
        self.delete_node(self.list_search(v))

    def delete_node(self,n):
        if n['key'] == None: return
        n['next']['prev'] = n['prev']
        n['prev']['next'] = n['next']

    def list_search(self,v):
        cur = self.nil['next']
        while (cur['key'] != None) and (cur['key'] != v):
            cur = cur['next']
        return cur

    def deleteFirst(self):
        self.delete_node(self.nil['next'])

    def deleteLast(self):
        self.delete_node(self.nil['prev'])

n = int(raw_input())
commands = []
for i in range(n):
    commands.append(raw_input())

l = DoublyLinkedList()
for c in commands:
    a = c[6]
    if a == "F":
        l.deleteFirst()
    elif a == "L":
        l.deleteLast()
    else:
        val = int(c[7:])
        op = c[0]
        if op == "i":
            l.insert(val)
        else:
            l.delete(val)

l.dump()

Measured memory_bytes: 463228
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
	ios::sync_with_stdio(false); cin.tie(0);
	string s, t;
	cin >> s >> t;
	int n = (int) s.length();
	int m = (int) t.length();
	vector<vector<int>> dp(n + 1, vector<int>(m + 1));
	vector<vector<int>> back(n + 1, vector<int>(m + 1, -1));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (s[i] == t[j]) {
				dp[i + 1][j + 1] = dp[i][j] + 1;
				back[i + 1][j + 1] = 0;
			} else if (dp[i + 1][j] < dp[i][j + 1]) {
			dp[i + 1][j + 1] = dp[i][j + 1];
			back[i + 1][j + 1] = 1;
			} else {
			dp[i + 1][j + 1] = dp[i + 1][j];
			back[i + 1][j + 1] = -1;
			}
		}
	}
	string ans;
	int i = n, j = m;
	while (i && j) {
		if (back[i][j] > 0) i--;
		if (back[i][j] < 0) j--;
		if (back[i][j] == 0) {
			ans += s[i - 1];
			i--;
			j--;
		}
	}
	cout << string(ans.rbegin(), ans.rend()) << endl;
	return 0;	
}

Measured memory_bytes: 70912
use std::io;

fn main() {

    let mut input_str = String::new();
    io::stdin().read_line(&mut input_str)
        .expect("Failed to read line")
        ;

    // let input_numbers = split_input(&input_str);

    let vec: Vec<&str> = input_str.split(" ").collect();

    let mut int_vec: Vec<i32> = Vec::new();
    for v in vec {
        //int_vec.push(
        let input_num: i32 = match v.trim().parse() {
            Ok(num) => num ,
            Err(_)  => panic!("input wrong number."),
        };

        int_vec.push(input_num);
    }

    if int_vec[0] * int_vec[1] % 2 == 0 {
        println!("Even");
    } else {
        println!("Odd");
    }
}


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

int main(void){
    int n,i;
    string s,t;

    cin >> n >> s >> t;

    for(i=0; i<n; i++){
        cout << s.at(i) << t.at(i);
    }
    cout <<endl;

    return 0;
}

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

#define ll long long
#define l long
int main() {
	// your code goes here
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	int n;
	cin>>n;
	vector <tuple <string,int,int> > v;
	for(int i=0;i<n;i++)
	{
	    string s;
	    int p;
	    cin>>s>>p;
	    p=-p;
	    v.push_back(make_tuple(s,p,i+1));
	}
	sort(v.begin(),v.end());
	for(int i=0;i<n;i++) cout<<get<2>(v[i])<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int k,n;
    string s;
    cin >> n >> s >> k;
    for(int i=0;i<n;i++){
        if(s[i] != s[k-1])s[i] = '*';
    }
    cout << s << endl;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
int x,y,ans;


int  main(){
    cin>>x>>y;
    for(int i=0;i<2;i++){
        if(x>y){ans+=x;x--;}
        else if(x<=y){ans+=y;y--;}
    }
    cout<<ans<<endl;
}




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

p = [0] * Q
q = [0] * Q
info = [[0] * N for _ in range(N)]
total = [[0] * N for _ in range(N)]

intminus = lambda x:int(x)-1

for s in range(M):
    L,R = map(intminus,input().split())
    info[L][R] += 1
for t in range(Q):
    p[t], q[t] = map(intminus,input().split())

total[0][0] = info[0][0]
for i in range(1,N):
    total[i][0] = total[i-1][0] + info[i][0]
for j in range(1,N):
    total[0][j] = total[0][j-1] + info[0][j]
for i in range(1,N):
    for j in range(1,N):
        total[i][j] = total[i][j-1] + total[i-1][j] - total[i-1][j-1] + info[i][j]

for t in range(Q):
    if p[t] != 0:
        print(total[q[t]][q[t]] - total[q[t]][p[t]-1] - total[p[t]-1][q[t]] + total[p[t]-1][p[t]-1])
    else:
        print(total[q[t]][q[t]])

Measured memory_bytes: 20280
object Main extends App{
  val nwh = io.StdIn.readLine().split(' ').map(_.toInt)

  var row = Array.fill(nwh(2))(false)
  var col = Array.fill(nwh(1))(false)
//  var mas = Array.fill(nwh(2))(Array.fill(nwh(1))(false))

  for(i <- 0 until nwh(0)){
    val xyw = io.StdIn.readLine().split(' ').map(_.toInt)
    val miny = if(xyw(1) >= xyw(2)) xyw(1) - xyw(2) else 0
    val minx = if(xyw(0) >= xyw(2)) xyw(0) - xyw(2) else 0
    val maxy = if(xyw(1) + xyw(2) <= nwh(2)) xyw(1) + xyw(2) - 1 else nwh(2) - 1
    val maxx = if(xyw(0) + xyw(2) <= nwh(1)) xyw(0) + xyw(2) - 1 else nwh(1) - 1

    for(j <- miny to maxy){
      row(j) = true
    }

    for(k <- minx to maxx){
      col(k) = true
    }
  }

  println(if(row.count(p => p) == nwh(2) || col.count(p => p) == nwh(1)) "Yes" else "No")
}

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

int _not(int val){return 2-val;}
int _or(int lhs,int rhs){return max(lhs,rhs);}
int _and(int lhs,int rhs){return min(lhs,rhs);}
int val(int& i,const string& s,const vector<int> &pqr);
int section(int &i,const string& s,const vector<int>& pqr);
int formula(int& i,const string& s,const vector<int>& pqr);

bool is_nega(int& i,const string& s){
  bool res=0;
  for(;i<s.size() && s[i]=='-';i++){
    res=!res;
  }
  return res;
}

int val(int &i,const string &s,const vector<int> &pqr){
  int res=-1;
  if(isalpha(s[i])){
    res=pqr[s[i]-'P'];
    i++;
  }
  else{
    assert(isdigit(s[i]));
    res=s[i]-'0';
    i++;
  }
  return res;

}

int section(int &i,const string& s,const vector<int>& pqr){
  int res=-1;
  if(s[i]=='('){
    i++;
    res=formula(i,s,pqr);
    i++;
  }
  else{
    res=val(i,s,pqr);
  }
  return res;

}

int formula(int& i,const string& s,const vector<int>& pqr){
  bool is_n=is_nega(i,s);
  int lhs=section(i,s,pqr);
  if(is_n) lhs=_not(lhs);
  if(i>=s.size()) return lhs;
  char op=s[i];
  i++;
  if(op==')'){
    i++;
    return lhs;
  }
  is_n=is_nega(i,s);
  int rhs=section(i,s,pqr);
  if(is_n) rhs=_not(rhs);
  if(op=='+') return _or(lhs,rhs);
  if(op=='*') return _and(lhs,rhs);
  return -1;
  
}

int main(){
  string s;
  while(cin>>s,s!="."){
    int cnt=0;
    for(int p=0;p<=2;p++){
      for(int q=0;q<=2;q++){
	for(int r=0;r<=2;r++){
	  vector<int> pqr={p,q,r};
	  int i=0;
	  int ret=formula(i,s,pqr);
	  cnt+=(ret==2);
	}
      }
    }
    cout<<cnt<<endl;
  }
  return 0;
}

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

int main()
{
	string s;
	cin >> s;
	
	if (s[2] == s[3] and s[4] == s[5])
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256