akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod (ll)1000000007
#define INF LLONG_MAX/10
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int n;
vector<pair<double, double>> vec;
tuple<pair<double, double>, pair<double, double>, pair<double, double>> func(double nx, double ny, double mx, double my) {
	tuple<pair<double, double>, pair<double, double>, pair<double, double>> t;
	get<0>(t) = make_pair((nx * 2 + mx) / 3, (ny * 2 + my) / 3);
	get<2>(t) = make_pair((nx + mx * 2) / 3, (ny + my * 2) / 3);
	get<1>(t) = make_pair((nx + mx) / 2 - (my - ny) * sqrt(3) / 6, (ny + my) / 2 + (mx - nx) * sqrt(3) / 6);
	return t;
}
signed main() {
	cin >> n;
	vec.push_back(make_pair(0, 0));
	vec.push_back(make_pair(100, 0));
	rep(i, n) {
		rep(j, vec.size() - 1) {
			tuple<pair<double, double>, pair<double, double>, pair<double, double>> t = func(vec[j].first, vec[j].second, vec[j + 1].first, vec[j + 1].second);
			vec.insert(vec.begin() + j + 1, get<0>(t));
			vec.insert(vec.begin() + j + 2, get<1>(t));
			vec.insert(vec.begin() + j + 3, get<2>(t));
			j += 3;
		}
	}
	for (auto i : vec)printf("%.12lf %.12lf\n", i.first, i.second);
}


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

int main(){
  int n;
  cin >> n;
  int ans[110];
  rep(i,110)ans[i] = 0;
  rep(i,26){
    rep(j,15){
      if(i*4 + j*7 <= 100)ans[i*4+j*7] = 1;
    }
  }
  if(ans[n] == 1)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

#define N 100001
#define NIL -1

void Depth(int, int);
int Height(int);
int Sibling(int);
void ans(int);

struct Node{
  int p, left, right;
};

struct Node tree[N];
int H[N], D[N];

int main(){
  int n;
  int id, new_left, new_right;
  int root = 0;

  cin >> n;
  for(int i = 0 ; i < n ; i++){
    tree[i].p = tree[i].right = tree[i].left = NIL;
  }

  for(int i = 0 ; i < n ; i++){
    cin >> id >> new_left >> new_right;
    tree[id].left = new_left;
    tree[id].right = new_right;
    if(new_left != NIL){
      tree[new_left].p = id;
    }
    if(new_right != NIL){
      tree[new_right].p = id;
    }
  }

  for(int i = 0 ; i < n ; i++){
    if(tree[i].p == NIL){
      root = i;
    }
  }

  Depth(root, 0);
  Height(root);

  for(int i = 0 ; i < n ; i++){
    ans(i);
  }

  return 0;
}

void Depth(int x, int cnt){
  if(x == NIL){
    return;
  }
  D[x] = cnt;
  Depth(tree[x].left, cnt + 1);
  Depth(tree[x].right, cnt + 1);
}

int Height(int x){
  int h1 = 0, h2 = 0;
  if(tree[x].left != NIL){
    h1 = Height(tree[x].left) + 1;
  }

  if(tree[x].right != NIL){
    h2 = Height(tree[x].right) + 1;
  }

  if(h1 > h2){
    return H[x] = h1;
  }else{
    return H[x] = h2;
  }
}

int Sibling(int x){
  if(tree[x].p == NIL){
    return NIL;
  }
  if(tree[tree[x].p].left != x && tree[tree[x].p].left != NIL){
    return tree[tree[x].p].left;
  }

  if(tree[tree[x].p].right != x && tree[tree[x].p].right != NIL){
    return tree[tree[x].p].right;
  }

  return NIL;
}

void ans(int x){
  printf("node %d: parent = %d, sibling = %d, ", x, tree[x].p, Sibling(x));
  int deg = 0;
  if(tree[x].left != NIL){
    deg++;
  }
  if(tree[x].right != NIL){
    deg++;
  }

  printf("degree = %d, depth = %d, height = %d, ", deg, D[x], H[x]);

  if(tree[x].p == NIL){
    cout << "root" << endl;
  }
  else if(tree[x].left == NIL && tree[x].right == NIL){
    cout << "leaf" << endl;
  }
  else{
    cout << "internal node" << endl;
  }
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
#if 1
#define int long long
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define stoi stoll
#else
#define MAX INT_MAX
#define MIN INT_MIN
#endif
#define ALL(obj) (obj).begin(), (obj).end()
#define fi first
#define se second
const int NIL = -1;
const int MOD = 1000000007;
#define REP(i,n) for (int i=0; i < (n); ++i)
#define FOR(i,a,b) for (int i=(a); i < (b); ++i)
using namespace std;

int pow(int x, int n) {int res=1; while(n){if(n&1)res*=x;x*=x;n>>=1;} return res;}
int get_gcd(int a, int b){while(1){if (a < b) swap(a, b); if (b == 0) return a; a %= b;}}
int get_lcm(int a, int b){return a * b / get_gcd(a, b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//-------------------------テンプレここまで-------------------------//

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

  string s;
  cin >> s;

  REP(i,s.size()) {
    if ((i%2==0 && s[i] == 'L') || (i%2!=0 && s[i] == 'R')) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 256
Row = int(input())
List = []
for i in range (Row):
  List.append(list(map(int, input().split())))
x = 0
y = 0
T = 0
flag = True
for i in range(Row):
  reqT = abs(List[i][1]-x)+abs(List[i][2]-y)
  chck= List[i][0] - T - reqT
  if chck < 0 or chck % 2 == 1:
    flag = False
    break
  x = List[i][1]
  y = List[i][2]
  T = List[i][0]
if flag:
  print("Yes")
else:
  print("No")

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

using namespace std;

int main(){
    string S,T;
    int rightPredict=0;
    cin>>S>>T;
    for(int i =0;i<=2;i+=1){
        if (S[i]==T[i]){
            rightPredict+=1;
        }
    }
    cout<<rightPredict;
}

Measured memory_bytes: 256
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
#define INF 1000000000
#define MINF -INF
#define MAX 1100
ll d[MAX];
vector<P> G[MAX];
signed main(){
  init_io();
  ll v,e,r;
  cin >> v >> e >> r;
  ll s,t,di;
  for(int i=0;i<e;i++){
    cin >> s >> t >> di;
    G[s].push_back(P(t,di));
  }
  fill(d,d+MAX,INF);
  d[r] = 0;
  for(int c=0;c<v;c++){
    for(int i=0;i<v;i++){
      if(d[i]==INF) continue;
      for(auto nv:G[i]){
        if(d[i]+nv.second<d[nv.first]){
          d[nv.first] = d[i]+nv.second;
        }
      }
    }
  }
  for(int c=0;c<v;c++){
    for(int i=0;i<v;i++){
      if(d[i]==INF) continue;
      for(auto nv:G[i]){
        if(d[i]+nv.second<d[nv.first]){
          d[nv.first] = MINF;
        }
      }
    }
  }
  for(int i=0;i<v;i++){
    if(d[i]==MINF){
      cout << "NEGATIVE CYCLE\n";
      return 0;
    }
  }
  for(int i=0;i<v;i++){
    if(d[i]==INF) cout << "INF\n";
    else cout << d[i] << endl;
  }
}



Measured memory_bytes: 3292
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned __int128;

const ull B = 100000007;

vector<ull> rang;
int res;

ull Pow(ull a, ull b) {
	ull aa = a, ans = 1;
	for (ull i = 0; i < (ull)64; i++) {
		if ((b >> i) & (ull)1) {
			ans *= aa;
		}
		aa *= aa;
	}
	return ans;
}

void Rolling_Hash(int al, const string& b) {
	int bl = b.length();
	if (al > bl) return;

	ull t = 1, bh = 0;
	for (int i = 0; i < al; i++) t *= B;
	for (int i = 0; i < al; i++) bh = bh * B + b[i];
	for (int i = 0; i + al <= bl; i++) {
		if (binary_search(rang.begin(), rang.end(), bh)) {
			res++;
		}
		if (i + al < bl) bh = bh * B + b[i + al] - b[i] * t;
	}
}

int main()
{
	string S, T;
	ull Th = 0;
	cin >> S >> T;
	rang.reserve(52 * T.size());
	for (ull i = 0; i < T.size(); i++) Th = Th * B + T[i];
	for (ull i = T.size() - 1, kei = 1; ; i--, kei *= B) {
		for (int j = 'a'; j <= 'z'; j++) {
			if (j != T[i]) {
				rang.push_back(Th + (j - T[i]) * kei);
			}
		}
		for (int j = 'A'; j <= 'Z'; j++) {
			if (j != T[i]) {
				rang.push_back(Th + (j - T[i]) * kei);
			}
		}
		if (i == 0)
			break;
	}
	sort(rang.begin(), rang.end());
	Rolling_Hash(T.size(), S);
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 123176
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>
#include <cassert>
#include <cmath>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>

using namespace std;

#define INF 1e+9
#define mp make_pair
#define pb push_back
#define fi first
#define fs first
#define se second
#define i64 long long
#define li long long
#define lint long long
#define pii pair<int, int>
#define vi vector<int>

#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define fore(i, b, e) for (int i = (int)b; i <= (int)e; i++)

int main() {
#ifdef LOCAL
    freopen("inp", "r", stdin);
    //freopen("outp", "w", stdout);
#else
    // freopen(TASKNAME ".in", "r", stdin);
    // freopen(TASKNAME ".out", "w", stdout);
#endif
    int A, B;
    scanf("%d%d", &A, &B);
    if (A > 8 || B > 8) 
        printf(":(");
    else
        printf("Yay!");
}



Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N,M,P = map(int,readline().split())
ABC = np.array(read().split(),np.int64)

A = ABC[::3]
B = ABC[1::3]
C = ABC[2::3]

C = P-C

# bellman fordでAからBへの最短距離を求める

INF = 10**18
dist = np.full(N+1,INF,np.int64)
dist[1] = 0
for T in range(N+N+10):
    x = dist[A] + C
    update = (dist[B] > x) & (x < INF//2)
    b = B[update]; x = x[update]
    if T > N:
        dist[b] = -INF
    else:
        ind = x.argsort(); x = x[ind][::-1]; b=b[ind][::-1]
        dist[b] = x

answer = -dist[N]
if answer < 0:
    answer = 0
elif answer == INF:
    answer = -1
print(answer)

Measured memory_bytes: 14756
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <functional>
#include <bitset>
#include <utility>
#include <sstream>
#include <fstream>
#include <stack>
#include <cstdlib>
#include <complex>
#include <set>

using namespace std;

#define INF 1070000000LL
#define pb push_back
#define irep(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) irep(i,0,n)

typedef long long lint;
typedef pair<int, int> pint;
typedef vector<vector<pint> > Graph;


int main(){
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    if(s[k-1] == 'A')s[k-1]='a';
    else if(s[k-1] == 'B')s[k-1] ='b';
    else if(s[k-1] == 'C')s[k-1] = 'c';
    cout << s << endl;			 
}

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

int main(){
    int n; cin>>n;
    char tmp=' ';
    int ans = 0;
    string s; cin >> s;
    for(int i=0; i<n; i++){
        char c = s[i];
        if (tmp != c){
            ans ++;
            tmp = c;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3772
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int a,b;
    cin>>a>>b;
    cout<<max({a+b,a-b,a*b})<<endl;
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define pf push_front
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

void solve()
{
    int n, k;
    cin >> n >> k;

    cout << ((n - 1) + (k - 2)) / (k - 1) << endl;

}

signed main() {

    solve();

    return 0;
}

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

int main() {
    int n;
    cin >> n;
    int l[n];
    for (int i = 0; i < n; i++)
        cin >> l[i];
    
    sort (l, l+n);
    int sum = 0;
    for (int i = 0; i < n-1; i++) {
        sum += l[i];
    }
    if (l[n-1] < sum)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3652
def resolve():
    N, A, B = [int(i) for i in input().split()]
    sumA = 0
    for i in range(1, N + 1):
        tmp = eval("+".join(list(str(i))))
        if tmp < A or B < tmp:
            continue
        else:
            sumA += i
    print(sumA)


resolve()


Measured memory_bytes: 9084
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

typedef long long ll;
constexpr double PI = 3.141592653589793;
constexpr int INF = 1e9 + 10;
constexpr ll INFL = 1e18 + 10;

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

using namespace std;
//    cout << setprecision(20) << ans << "\n";



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

    ll k;
    cin >> k;

    if (k % 2 == 0 || k % 5 == 0){
        cout << -1 << "\n";
        return 0;
    }

    ll l = 9 * k;
    if(k % 7 == 0){
        l = 9 * k / 7;
    }
    else {
        l = 9 * k;
    }

    int digit = 0;
    ll target = 1;
    while(true)
    {
        target *= 10;
        digit++;
        if (target >= l && target % l == 1)
        {
            break;
        }

        if (target > l){
            target %= l;
        }
    }
    cout << digit << "\n";
    return 0;
}


Measured memory_bytes: 3656
# keyence2019C - Exam and Wizard
def main():
    N = int(input())
    A = tuple(map(int, input().split()))
    B = tuple(map(int, input().split()))
    dif = sorted(i - j for i, j in zip(A, B))
    ans, shortage = 0, 0
    for i in dif:
        if i < 0:
            ans += 1
            shortage += i
        else:
            break
    for i in dif[::-1]:
        if shortage >= 0:
            print(ans)
            return
        ans += 1
        shortage += i
    print(-1)


if __name__ == "__main__":
    main()

Measured memory_bytes: 18444
import re
W = input()
T = []
count = 0
while(1):
    line = input()
    if (line == "END_OF_TEXT"):
        break
    words = list(line.split())
    for word in words:
        T.append(word)
    
for word in T:
    matchOB = re.fullmatch(W, word.lower())
    if matchOB:
        count += 1

print(count)

Measured memory_bytes: 7656
s = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
h = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
c = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
d = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

n = int(input())

for i in range(n):
    suit, rank = input().split()
    if suit=="S":
        s[int(rank)-1] = 1
    elif suit=="H":
        h[int(rank)-1] = 1
    elif suit=="C":
        c[int(rank)-1] = 1
    else:
        d[int(rank) - 1] = 1


for i in range(0, 13, 1):
    if s[i] == 0:
        print("S ",end="")
        print(i+1)

for i in range(0, 13, 1):
    if h[i] == 0:
        print("H ",end="")
        print(i+1)

for i in range(0, 13, 1):
    if c[i] == 0:
        print("C ",end="")
        print(i+1)

for i in range(0, 13, 1):
    if d[i] == 0:
        print("D ",end="")
        print(i+1)


Measured memory_bytes: 5616
#include <bits/stdc++.h>
using namespace std;
using lint = long;
using ll = long long;
#define rep(i,n) for(lint (i) = 0;(i) < (lint)(n);(i)++)
#define repInRange(i,start,end) for(lint (i) = (start);(i) < (end);++(i))
using lpair = pair<lint,lint>;
using vl = vector<lint>;
using vll = vector<long long>;
using Llist = list<lint>;
using vs = vector<string>;
#define all(v) (v).begin(),(v).end()
#define out1(x) cout << (x) << '\n';

ll pow(ll k,ll l) {
	ll ret = 1;
	rep(i,l) {
		ret *= k;
	}
	return ret;
}

template <typename T>
T sum(vector<T> vec) {
	ll ret = 0;
	rep(i,vec.size()) {
		ret += vec.at(i);
	}
	return ret;
}

void Main() {
	string s;
	cin >> s;
	if ((s[0] == s[1] && s[1] == s[2])||(s[2] == s[3] && s[1] == s[2])) {
		out1("Yes");
		return;
    }
	out1("No");
}

signed main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	Main();
	return 0;
}


Measured memory_bytes: 256
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N,M,X = LI()
A =LI()
cost = 0
go_right = N-X
go_left = X
cost_right = 0
cost_left = 0
for i in range(X+1, N):
    if i in A:
        cost_right += 1

for j in range(1,X):
    if j in A:
        cost_left += 1

print(min(cost_left,cost_right))

Measured memory_bytes: 9212
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;

const int INF = 1e9+5;

template <typename T> void max_self(T& a , T b){
	a=max(a,b);
}

bool flag(pair<int,int> p) {
		return p.first ==0 || p.second == 0;
}

void min_self(ll& a ,ll b){
		a=min(a,b);
}

void test_case() {
	string a , b;
	cin >> a >> b;
	vector<vector<pair<int,pair<int,int>>>> dp(a.size()+1,vector<pair<int,pair<int,int>>>(b.size()+1,{-INF,{0,0}}));
	dp[0][0] = {0,{0,0}};
	for(int i = 0 ; i <(int) a.size() ; i++){
		for(int j=0 ; j < (int) b.size() ; j++){
			if(a[i]==b[j]){
				max_self(dp[i+1][j+1],make_pair(dp[i][j].first+1,make_pair(i,j)));
			}
			max_self(dp[i+1][j],make_pair(dp[i][j].first,make_pair(i,j)));
			max_self(dp[i][j+1],make_pair(dp[i][j].first,make_pair(i,j)));
		}
	}
	pair<int,pair<int,int>> answer = {0,{0,0}};
	for(int i = 0 ; i <= (int) a.size() ; i++) {
		for(int j = 0 ; j <= (int) b.size() ; j++) {
			max_self(answer,make_pair(dp[i][j].first,make_pair(i,j)));
		}
	}
	string s;
	pair<int,int> cur = answer.second;
	while(!flag(cur)){
		int i = cur.first;
		int j = cur.second;
		pair<int,int> previous = dp[i][j].second;
		if(previous == make_pair(i-1,j-1)){
			assert(a[i-1] == b[j-1]);
			s+=a[i-1];
		}
		cur=previous;
	}
	reverse(s.begin(),s.end());
	cout<<s<<"\n";
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int T=1;
	while(T--) {
		test_case(); 
		
	}
}


Measured memory_bytes: 108032
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL -1
using namespace std;
const int64_t MOD = 1e9 + 7;

int main() {
	int r, g, b;
	cin >> r >> g >> b;

	int n = 100 * r + 10 * g + b;

	cout << (n % 4 ? "NO" : "YES") << endl;
}

Measured memory_bytes: 3628
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

int max_sugar_sub(int x, int c, int d, int e, int f) {
  int cnt = -1;
  
  for (int i = 0; i <= e*x/c; i++) {
    for (int j = 0; j <= e*x/d; j++) {
      int sugar = i*c + j*d;
      if (sugar <= e*x && 100*x + sugar <= f) {
        cnt = max(cnt, sugar);
      }
    }
  }
  return cnt;
}

int main() {
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  
  int max_all = -1, max_sugar = -1,sugar;
  double max_con = -1;
  for (int i = 0; i <= f/(100*a); i++) {
    for (int j = 0; j <= f/(100*b); j++) {
      if (i == 0 && j == 0) {
        continue;
      }
      int water = 100*a*i + 100*b*j;
      
      if (water > f) {
        break;
      }
      int sugar = max_sugar_sub(water/100, c, d, e, f);
      
      double con = (double)sugar / (double)(water+sugar);
      
      if (con > max_con) {
        max_con = con;
        max_all = water + sugar;
        max_sugar = sugar;
        
      }
      
    }
  }
  
  printf("%d %d\n",max_all, max_sugar);
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstring>

using namespace std;

int dp[3002][3002];
string rj;

int main () {
	string s;
	string t;
	cin>>s;
	cin>>t;
	s=' '+s;
	t=' '+t;
	for(int i=1;i<=s.length();i++){
		for(int j=1;j<=t.length();j++){
			dp[i][j]=max(max(dp[i-1][j],dp[i][j-1]),dp[i-1][j-1]+bool(s[i]==t[j]));
		}
	}
	int x=s.length();
	int y=t.length();
	while(dp[x][y]!=0){
		if(dp[x][y]==dp[x-1][y-1]){
			x-=1;
			y-=1;
		}
		else if(dp[x-1][y]==dp[x][y-1] and dp[x-1][y]<dp[x][y]){
			rj+=s[x];
			x-=1;
			y-=1;
		}
		else{
			if(dp[x-1][y]>=dp[x][y-1]){
				x-=1;
			}
			else{
				y-=1;
			}
		}
	}
	if(rj.length()>0){
		for(int i=rj.length()-1;i>0;i--){
			cout<<rj[i];
		}
	}
	else cout<<"";



return 0;
}



Measured memory_bytes: 35456
#include <bits/stdc++.h>
#define int long long int
#define endl "\n"
using namespace std;
void solve()
{
	//Enter your code here Tanmay:)
	string s;
	cin>>s;
	if(s=="Sunny")
		cout<<"Cloudy";
	else if(s=="Cloudy")
		cout<<"Rainy";
	else if(s=="Rainy")
		cout<<"Sunny";
	
}
signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}
void fastscan(int &number) 
{ 
    //variable to indicate sign of input number 
    bool negative = false; 
    register int c; 
  
    number = 0; 
  
    // extract current character from buffer 
    c = getchar(); 
    if (c=='-') 
    { 
        // number is negative 
        negative = true; 
  
        // extract the next character from the buffer 
        c = getchar(); 
    } 
  
    // Keep on extracting characters if they are integers 
    // i.e ASCII Value lies from '0'(48) to '9' (57) 
    for (; (c>47 && c<58); c=getchar()) 
        number = number *10 + c - 48; 
  
    // if scanned input has a negative sign, negate the 
    // value of the input number 
    if (negative) 
        number *= -1; 
} 

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
#include <chrono>

#define _ << " " <<
#define all(v) v.begin(), v.end()
#define sp(n) fixed << setprecision(n)
#define ff first
#define ss second

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const ll mod = 1e9 + 7;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll n;
  cin >> n;
  cout << n * n * n << endl;
	return 0;
}

Measured memory_bytes: 256
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/03/12.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//  ABC130
//
//

#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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

// const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const ll MOD = 1000000007;
//#define __DBG__




void solve(void){
  
  int N, X;
    
  cin >> N >> X;
  
  vector<int> L(N+1), D(N+2,0);
  
  REP(i,N){
    cin >> L[i+1];
  }
  
  int count=1;
  
  D[1]=0;
  
  REP2(i,2,N+2){
    D[i]=D[i-1]+L[i-1];
    if(D[i]<=X){count++;}
  }
    
  cout << count << endl;
  
  return;
}

#define TESTCASES 1

int main(int argc, const char * argv[]) {
  
    cin.tie(0);
    ios::sync_with_stdio(false);

    REP(i,TESTCASES){
      solve();
    }
 
    return 0;
}



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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int a, b, c;

int main() {
	cin >> a >> b >> c;
	if (a==b && b ==c) cout << 1 << ln;
	else if (a==b || b==c || c==a) cout << 2 << ln;
	else cout << 3 << ln;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int h, w, a, b;
int m[1000][1000];
int hsum[1000];
int wsum[1000];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> h >> w >> a >> b;
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            if ((i < b && j < a) || (i >= b && j >= a))
            {
                cout << 0;
            }
            else
            {
                cout << 1;
            }
        }
        cout << "\n";
    }
}


Measured memory_bytes: 1280
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <deque>
#include <numeric>
#include <map>
#define rep(i,n) for (int i = 0; i < (n); ++i)
 
using namespace std;
 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
 
int main () {
	int N, K;
    cin >> N >> K;
	vi v(N);
	rep(i,N) {
		cin >> v[i]; 
	}
	int ans = 0;
	for (int a = 0; a<=min(N,K); ++a){
		for (int b = 0; a+b <= min(N,K); ++b){
			vector<int> pq;
			int s = 0;
			rep (i,a) {
				pq.push_back(v[i]);
				s += v[i];
			}
			for (int i = 0; i < b; ++i) {
				pq.push_back(v[N-1-i]);
				s += v[N-1-i];
			}
			sort(pq.begin(), pq.end());
			for (int i = 0; i < min(K - a - b, (int)pq.size()); ++i) {
				if (pq[i] < 0)
					s -= pq[i];
			}
			ans = max(ans,s);
		}
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 888
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int n;
    cin >> n;
    vi x(n),y(n);
    rep(i,n){
        cin >> x[i] >> y[i];
    }
    vi v(n);
    rep(i,n)v[i] = i;
    double ans = 0;
    do{
        rep(i,n-1){
            int a = v[i];
            int b = v[i+1];
            ans += sqrt((x[a]-x[b])*(x[a]-x[b])+(y[a]-y[b])*(y[a]-y[b]));
        }
    }while(next_permutation(all(v)));
    loop(i,1,n+1)ans /= i;
    cout << shosu(10) << ans << endl;
}


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

int main(){
    int n,ans=0;string s;cin>>n>>s;
    for(int i=0;i<n;i++){//区切る位置の調整
        vector<int> x(26),y(26);
        for(int j=0;j<i;j++){//xカウントする
            x.at(s.at(j)-'a')++;
        }
        for(int k=i;k<s.size();k++){//yカウント
            y.at(s.at(k)-'a')++;
        }
        int count=0;
        for(int l=0;l<26;l++){
            if(x.at(l)>0&&y.at(l)>0) count++;
        }
        ans=max(count,ans);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
    static const double pi = 3.141592653589793;
 typedef pair<int64_t,int64_t> P;
#define rep(i, n) for (int i = 0; i < (n); i++)
 #define all(v) (v).begin(),(v).end()
 using ll = long long;
using Graph = vector<vector<int>>;
const int MAX = 510000;
const int MOD = 1000000007;
 const int NINE=1000000000;
 
 
int main(){
ll N;
  cin>>N;
  vector<ll>op(N);
  vector<ll>ans(N);
  ll g=0;
  rep(i,N){
 ll p;
    cin>>p;
    op[i]=p;
  }
  for(int i=N-1;i>=0;i--){
  ll t=-1;
    ll count=0;
  ll h=op[i];
    while(count!=h){
    t++;
      if(t==N){
        break;
      g=1;
      }
      if(ans[t]==0){
      count++;
      
      }
    
    }
    ans[t]=h;
   
  if(g==1) break;
  }
   rep(i,N) if(ans[i]==0) g=1;
  if(g==0){
  rep(i,N){
  cout<<ans.at(i)<<endl;
  
  }
  }
  else cout<<-1;
  
  
  
  
  
}

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

def yakusuu(a):
    yakusuu=set()
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            yakusuu.add(i)
            yakusuu.add(a//i)
    yakusuu=sorted(list(yakusuu),reverse=True)
    return yakusuu

y=yakusuu(sum(a))

from itertools import accumulate
flag=0
for i in y:
    B=[A%i for A in a]
    C=sorted(B,reverse=True)
    B=list(accumulate(sorted(B)))
    C=list(reversed(list(accumulate([(i-c)%i for c in C]))))[1:]+[0]
    for j in range(n):
        if B[j]==C[j]:
            if B[j]<=k:
                print(i)
                flag=1
                break
            break
    if flag==1:
        break

Measured memory_bytes: 3188
#include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <math.h>
     
    #define BIG 2000000007
     
    #define MOD 1000000007
    typedef unsigned long long ull;
    typedef   signed long long sll;
     
    typedef struct {
    	int a;
    	int b;
    } hw;
     
    #define N_MAX 100000
    #define M_MAX 100000
     
    ull n, m, k;
    ull h, w;
    ull va, vb, vc, vd;
    ull a[N_MAX];
    // sll a[N_MAX];
    ull b[N_MAX];
    // ull dp[N_MAX][M_MAX + 1];
    char s[N_MAX + 1];
    // char t[N_MAX + 1];
    // hw arr[N_MAX];
     
    void swap_adj(ull *a, ull *b){
    	ull tmp = *b;
    	*b = *a;
    	*a = tmp;
    	return;
    }
     
    ull divide(ull a, ull b){
    	ull x = MOD - 2;
    	ull ans = 1;
    	while (x) {
    		if (x & 1) ans = (ans * b) % MOD;
    		b = (b * b) % MOD;
    		x /= 2;
    	}
    	return (a * ans) % MOD;
    }
     
    int digits(ull x){
    	int i = 1;
    	while (x >= 10) {
    		x /= 10;
    		i++;
    	}
    	return i;
    }
     
    int min(ull x, ull y){
    	return (x < y) ? x : y;
    }
     
    ull gcd(ull x, ull y){
    	if (x < y) {
    		return gcd(y, x);
    	} else if (y == 0) {
    		return x;
    	} else {
    		return gcd(y, x % y);
    	}
    }
     
    ull bitpow(ull a, ull x){
    	ull result = 1;
    	while (x) {
    		if (x & 1) {
    			result *= a;
    			result %= MOD;
    		}
    		x /= 2;
    		a = (a * a) % MOD;
    	}
    	return result;
    }
     
    int comp(const void *left, const void *right){
    	if ((*(int*)left) < (*(int*)right)) {
    		return -1;
    	} else if ((*(int*)left) > (*(int*)right)) {
    		return +1;
    	} else {
    		return 0;
    	}
    }
     
    // int nextroute(int arr[]){
    // 	int i = n - 1;
    // 	int j, x;
    // 	while (arr[i - 1] > arr[i]) i--;
     
    // 	x = n;
    // 	for (j = i; j < n; j++) {
    // 		if (arr[j] < arr[i - 1]) continue;
    // 		if (x == n || arr[x] > arr[j]) x = j;
    // 	}
    // 	arr[i - 1] ^= arr[x];
    // 	arr[x] ^= arr[i - 1];
    // 	arr[i - 1] ^= arr[x];
     
    // 	qsort(&arr[i], n - i, sizeof(int), comp);
    // 	return 0;
    // }
     
    ull solve(){
    	int i, j;
    	int x[256] = {0};
    	char alphabets[] = "abcdefghijklmnopqrstuvwxyz";
     
    	for (i = 0; s[i]; i++) {
    		x[s[i]] = 1;
    	}
     
    	for (i = 0; alphabets[i]; i++) {
    		if (!x[alphabets[i]]) {
    			printf("%c\n", alphabets[i]);
    			return 0;
    		}
    	}
    	puts("None");
     
     
    	return 0;
    }
     
    int main(void){
    	int i, j;
    	int x;
     
    	scanf("%s", s);
     
    	solve();
     
    	return 0;
    }

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

namespace ConsoleApplication1
{
    class Program
    {
        static StringBuilder sb = new StringBuilder();
        static int cnt;

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] A = new int[n];

            for(int i= 0; i < n; i++)
            {
                A[i] = int.Parse(Console.ReadLine());
            }

            ShellSort(A, n);

            foreach (var num in A)
            {
                sb.AppendLine(num.ToString());
            }

            Console.Write(sb);
        }

        static void ShellSort(int[] A, int n)
        {
            cnt = 0;

            int h = 1, m = 0;

            do
            {
                m++;
                h = h * 3 + 1;

            } while (h < n);

            int[] G = new int[m];

            for(int i = m-1, x = 0; i >= 0; i--)
            {
                x = x * 3 + 1;
                G[i] = x;
            }
            
            for(int i = 0; i < m; i++)
            {
                InsertionSort(A, n, G[i]);
            }
            
            sb.AppendLine(m.ToString());
            sb.AppendLine(string.Join(" ", Array.ConvertAll(G, g => g.ToString())));
            sb.AppendLine(cnt.ToString());
        }

        static void InsertionSort(int[] A, int n, int g)
        {
            for(int i = g; i < n; i++)
            {
                int v = A[i];
                int j = i - g;

                while (j >= 0 && A[j] > v)
                {
                    A[j + g] = A[j];
                    j = j - g;
                    cnt++;
                }

                A[j + g] = v;
            }
        }
    }
}

Measured memory_bytes: 96420
#include<bits/stdc++.h>
#define mo 1000000007
#define pi 3.1415926535898 
using namespace std;
long long read(){
    long long xx=0,flagg=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
int n,i,j,l[2005],r[2005],d[2005],x,y,z,flag,ans,max1,max2,min1;
char a[2005],b[2005],c[2005];
struct nyh{
	int l,r;
}o[2005];
bool cmp(nyh u,nyh v){
	return u.l<v.l||u.l==v.l&&u.r>v.r;
}
int main(){
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
   	scanf("%s%s",a,b);
   	n=strlen(a);
   	for(i=0;i<n;i++){
   		if(b[i]!='0')
   			flag=1;
   		if(a[i]!=b[i])
   			ans++;
   	}
   	if(flag==0){
   		if(ans!=0)
   			pus(-1,2);
   		else
   			pus(0,2);
   		return 0;
   	}
	min1=1000000000;
	for(j=n-1;j>=0;j--)
		if(b[j]=='1'){
			x=n-1-j;
			break;
		}
	for(j=0;j<n;j++){
		if(b[j]=='1')
			x=0;
		else
			x++;
		l[j]=x;
	}
	for(j=0;j<n;j++)
		if(b[j]=='1'){
			x=j;
			break;
		}
	for(j=n-1;j>=0;j--){
		if(b[j]=='1')
			x=0;
		else
			x++;
		r[j]=x;
	}
	min1=10000000;
	for(i=0;i<n;i++)
		d[i]=r[i];
	for(i=0;i<n;i++){
		ans=0;max1=0;max2=10000000;
		for(j=0;j<n;j++){
			c[j]=a[(j-i+n)%n];
			if(c[j]!=b[j])
				ans++;
		}
		
		for(j=0;j<n;j++)
			if(c[j]!=b[j]){
				o[j].l=l[(j-i+n)%n];
				o[j].r=r[(j-i+n)%n];
			}
			else{
				o[j].l=0;
				o[j].r=0;
			}
		sort(o,o+n,cmp);
		for(j=n;j>=0;j--){
			max1=max(max1,o[j].r);
			if(j!=0)
				max2=min(max2,(o[j-1].l+max1)*2);
			else
				max2=min(max2,max1*2);
		}
		ans+=max2+i;
		
		min1=min(min1,ans);
		for(j=0;j<n;j++)
			r[j]=max(r[j]-1,0);
	}
	for(i=0;i<n;i++)
		r[i]=d[i];
	for(i=1;i<n;i++){
		for(j=0;j<n;j++)
			l[j]=max(l[j]-1,0);
		ans=0;max1=0;max2=10000000;
		for(j=0;j<n;j++){
			c[j]=a[(j+i)%n];
			if(c[j]!=b[j])
				ans++;
		}
		
		for(j=0;j<n;j++)
			if(c[j]!=b[j]){
				o[j].l=l[(j+i)%n];
				o[j].r=r[(j+i)%n];
			}
			else{
				o[j].l=0;
				o[j].r=0;
			}
		sort(o,o+n,cmp);
		for(j=n;j>=0;j--){
			max1=max(max1,o[j].r);
			if(j!=0)
				max2=min(max2,(o[j-1].l+max1)*2);
			else
				max2=min(max2,max1*2);
		}
		ans+=max2+i;
		min1=min(min1,ans);
	}
	pus(min1,2);
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
 
int main() {
  int64_t x;
  cin >> x;
  int64_t s = 100;
  rep (i,3761) {
    s  = s + s / 100;
    if (s >= x) {
    cout << i + 1 << endl;
      break;
    }
    
  }
    }

Measured memory_bytes: 3580
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

void main() {
    int n;
    scan(n);

    int ans = n;

    foreach (a ; 0 .. n + 1) {
        int tmp;
        int b = n - a;
        while (a > 0) {
            tmp += a % 6;
            a /= 6;
        }
        while (b > 0) {
            tmp += b % 9;
            b /= 9;
        }
        ans = min(ans, tmp);
    }

    writeln(ans);
}










































void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
    int pointCount;
    double x[100], y[100];

    scanf("%d", &pointCount);

    for (int i = 0; i < pointCount; ++i) {
        scanf("%lf%lf", x+i, y+i);
    }

    double res[100] = {};

    int d = 1000000;

    for (int i = 0; i < d; ++i) {
        double r = M_PI * 2.0 / d * i;

        double px = cos(r);
        double py = sin(r);

        int m = 0;
        double md = -10000000000.0;

        for (int j = 0; j < pointCount; ++j) {
            if (md < px * x[j] + py * y[j]) {
                md = px * x[j] + py * y[j];
                m = j;
            }
        }

        res[m] += 1.0 / d;
    }

    for (int i = 0; i < pointCount; ++i) {
        printf("%.10lf\n", res[i]);
    }

    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#define lli long long int
#define uli unsigned long long int
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
using namespace std;
int main(){
  int a,p;
  cin>>a>>p;
  ou((a*3+p)/2);
}

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

#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) ((int) x.size())

typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 1e5 + 5;

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

  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;

  int sol = 1e9 + 5;

  REP(i, MAXN) {
    int nx = x - i;
    int ny = y - i;

    int tmp = 0;
    if(nx > 0) {
      tmp += nx * a;
    }
    if(ny > 0) {
      tmp += ny * b;
    }

    sol = min(sol, i * 2 * c + tmp);
  }

  cout << sol;

}


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

using namespace std;

int main()
{
    int n, S, a, M=2000000000, Ma=0;
    cin >> n;
    S = (1 << n);
    multiset <int> Se;
    multiset <int> :: iterator it;
    vector <int> V, T;
    for (int i = 0; i < S; i++)
    {
        cin >> a;
        Ma = max(a, Ma);
        Se.insert(M-a);
    }
    Se.erase(Se.find(M-Ma));
    V.push_back(M-Ma);
    for (int i = 0; i < n; i++)
    {
        for (int y = 0; y < V.size(); y++)
        {
            it = Se.upper_bound(V[y]);
            if (it != Se.end())
            {
                T.push_back(*it);
                Se.erase(Se.find(*it));
            }
        }
        for (int y = 0; y < T.size(); y++)
        {
            V.push_back(T[y]);
        }
        T.clear();
        sort(V.begin(),V.end());
    }
    if (Se.size() == 0)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 13816
s,t=input(),input()
n,m=len(s),len(t)
dp=[[0]*(m+1) for i in range(n+1)]
for i in range(n):
  for j in range(m):
    if s[i]==t[j]:
      dp[i+1][j+1]=dp[i][j]+1
    else:
      dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1])
ans=""
while m>0 and n>0:
  if s[n-1]==t[m-1]:ans=s[n-1]+ans;n-=1;m-=1
  elif dp[n][m]==dp[n-1][m]:n-=1
  else:m-=1
print(ans)

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

int main(){
   int n,k;
   long int sum=0;
   cin >> n >> k;
   vector<unsigned long int> h(n);
   for(int i=0; i<n; i++){
       cin >> h[i];
       
   }
   
   sort(h.begin(), h.end()); 
   reverse(h.begin(), h.end()); 
   for(int i=k; i<n; i++){
       sum=sum+h[i];
   }
   cout << sum << endl;

   return 0; 
}

Measured memory_bytes: 1792
n = int(input())
a,b,c = [],[],[]
for i in range(n):
    line = input()
    line = line.strip("\n").split(" ")
    a.append(int(line[0]))
    b.append(int(line[1]))
    c.append(int(line[2]))

def bottomup(a, b, c):
    dp = [[0 for _ in range(3)] for _ in range(n)]
    
    dp[(n-1)] = [a[n-1], b[n-1], c[n-1]]

    for i in range(n-2,-1,-1):
        dp[i][0] = a[i] + max(dp[i+1][1:])
        dp[i][1] = b[i] + max(dp[i+1][0], dp[i+1][2])
        dp[i][2] = c[i] + max(dp[i+1][:2])
    
    return max(dp[0])
    
print(bottomup(a,b,c))

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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
#define BIT(bit,a,n) for (int bit = a;bit < (1<<n);bit++) // {0, 1, ..., n-1} の部分集合の全探索 // n番目のフラグが立っている状態は (1<<n)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

#define MAX_N (int)2e5+20

typedef long long ll;
using namespace std;

ll n;
int main() {
    scanf("%lld",&n);
    ll ans = sqrt(n);
    ans = pow(ans,2);
    printf("%lld\n",ans);
    return 0;
}

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

int main(){
	string s,t;
	cin>>s>>t;
	ll ans=1e9;
	for(int i=0;i<=s.size()-t.size();i++){
		ll cnt=0;
		for(int j=0;j<t.size();j++){
			if(s[i+j]!=t[j])cnt++;
		}
		ans=min(ans,cnt);
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};


int main() {
    int n; cin >> n;
    vector<P> r(n), b(n);
    int x, y;
    rep(i,n) {
        cin >> x >> y;
        r[i].first = x;
        r[i].second = y;
    }
    rep(i,n) {
        cin >> x >> y;
        b[i].first = x;
        b[i].second = y;
    }

    sort(all(r));
    sort(all(b));

    int ans = 0;

    rep(i,n) { //blueの点のループ
        int k = 0;
        rep(j,n) { //red
            if (r[j].first >= b[i].first) break;
            k++;
        }
        int y_mx = -1; int bangou;
        bool exist = false;
        rep(j,k) { //y座標maxをとる
            if (r[j].second < b[i].second) {
                exist = true;
                if (y_mx < r[j].second) {
                    y_mx = r[j].second;
                    bangou = j;
                }
            }
        }
        if (exist) {
            ans++;
            r[bangou].first = 1000; //採用した点の実質削除
            sort(all(r));
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main(){
	int X;
	cin >> X;
	int n;
	for(int i = 1; i <= X; i++){
		int x = i;
		for(int j = 1;j <= X; j++){
			x = x * i;
			if(x <= X){
				n = max(n,x);
			}
		}
	}
	cout<<n<<endl;
}


Measured memory_bytes: 256