akhauriyash/Code-Regression huggingface dataset:
(function main() {
  let line = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('');
  let height_list = [0];
  let current_height = 0;
  while(line[0] === '/')line.shift();
  line.forEach(function(e, i){
      if (e === '\\') current_height -= 1
      else if (e === '_') current_height += 0
      else current_height += 1
      height_list.push(current_height);
  });

  // console.log(height_list.join(','));
  let sum = 0;
  let holes = [];
  for (;height_list.length > 1;) {
    let h = makeHole(height_list);
    if (h > 0) {
      sum += h;
      holes.push(h);
      // console.log(h, height_list.join(','));
    }
  }

  console.log(sum);
  console.log(holes.length && holes.length + ' ' + holes.join(' '));
})();

function makeHole(list) {
    begin = list.shift();
    if (begin <= list.reduce((a, b) => Math.max(a, b), -100000)) {
      area = 0;
      while (true) {
      if (list.length == 0 || begin <= list[0]) break;
        area += begin - list.shift();
      }
      return area;
    } else {
      return 0;
    }
}



Measured memory_bytes: 21040
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<sstream>
#include<iostream>
using namespace std;
int ans[15][1<<11];

int n,s;
int dfs(int sum,int B,int depth){
    ans[depth][sum]++;
    int bit_cnt = 0;
    int num = 0;
    for(int i = 0;i < 10;i++){
        if(B&(1<<i))continue;
        num += dfs(sum + (depth+1)*i,B+(1<<i),depth+1);
    }
    return num;
}
int main(){

    dfs(0,0,0);
    while(cin>>n>>s){
        cout<<ans[n][s]<<endl;
    }


    return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
using namespace std;
#define ll long long
int main()
{ll N,M;
cin>>N>>M;
ll a[N];
vector<pair<ll,ll>> vec(M);
for(ll i=0;i<N;i++)
   {cin>>a[i];
   }
for(ll i=0;i<M;i++)
   {cin>>vec[i].second >>vec[i].first;
   }
sort(a,a+N);
sort(vec.begin(),vec.end());
reverse(vec.begin(),vec.end());
int update=0;
for(ll i=0;i<M && update<N;i++)
   {for(ll j=0;j<vec[i].second;j++)
       {if(a[update]<vec[i].first)
           a[update]=vec[i].first;
        update++;
        if(update>=N)
          {break;
          }
           
       }
       
   }
ll sum = 0;
for(ll i=0;i<N;i++)
  {sum+=a[i];
      
  }
cout<<sum;
}


Measured memory_bytes: 2560
n = int(input())

before = ["0"]
for i in range(n-1):
    next = []
    for elem in before:
        m = 1
        for j in range(len(elem)):
            m = max(m, int(elem[j])+1)
        for j in range(m+1):
            next.append(elem+str(j))
    before = next[:]

before.sort()
d = {"0":"a", "1":"b", "2":"c", "3":"d", "4":"e", "5":"f", "6":"g", "7":"h", "8":"i", "9":"j"}
for elem in before:
    ans = []
    for i in range(len(elem)):
        ans.append(d[elem[i]])
    print("".join(ans))


Measured memory_bytes: 13816
#include <bits/stdc++.h>
using namespace std;
#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 all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;
typedef long long ll;

const int MOD = 1e9+7;
const int INF = 1e9;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin>>N;
    ll a[N][3];
    rep(i,N)cin>>a[i][0]>>a[i][1]>>a[i][2];
    ll dp[N+1][3] = {};
    dp[0][0] = dp[0][1] = dp[0][2] = 0;
    rep(i,N)rep(pre,3)rep(pos, 3){
        if(pre == pos)continue;
        dp[i+1][pos] = max(dp[i+1][pos], dp[i][pre] + a[i][pre]);
    }
    cout<<max({dp[N][0],dp[N][1],dp[N][1]})<<endl;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);

    int D, N;
    cin >> D >> N;

    if(N == 100) N = 101;

    for(int i = 0; i < D; i++) {
        N *= 100;
    }

    cout << N << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 100000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

char s[50][50];
int h, w;

int main()
{
    ll x;
    cin >> x;
    int ans = 0;
    ll tmp = 100LL;
    while (tmp < x) {
        tmp = tmp + tmp / 100LL;
        ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define vii vector <int>
#define vll vector <long long>
#define pii pair <int, int>
#define repDown(i,a,n) for(int i=n;i>a;i--)
#define rep(i,a,n) for(int i=a;i<n;i++)
#define endl '\n'
#define mem(a,b) memset(a, b, sizeof a)
#define max(a,b,c) max(c, min(a,b))
#define min(a,b,c) min(c, min(a,b))
ll mod=1000000007;
using namespace std;
void print(vector <int> &arr){
	for(int i=0;i<arr.size();i++)
		cout<<arr[i]<<" ";
	
	cout<<endl;
}
void printll(vector <ll> &arr){
	for(int i=0;i<arr.size();i++)
		cout<<arr[i]<<" ";
	
	cout<<endl;
}

int main(){
/////////////////////////////////////////////////////////////////////
//	ios_base::sync_with_stdio(false);
//	cin.tie(nullptr);
//	cout.tie(nullptr);
//	cerr.tie(nullptr);
//For fast IO
///////////////////////////////////////////////////////////////////// 

	string s1, as="";
	cin>>s1;
	int t,a=0,f;
	char ch;
	cin>>t;
	while(t--){
		int q;
		cin>>q;
		if(q==1) a=1-a;
		else{
		cin>>f>>ch;
		if((f==1 && a==1) || (f==2 && a==0)){
			s1+=ch;
		}
		else as+=ch;	
		}
		
	}
	reverse(as.begin(), as.end());
		s1=as+s1;
		if(a==1) reverse(s1.begin(), s1.end());
		cout<<s1<<endl;
	return 0;
}

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

int main() {
    int N;
    double T, A;
    cin >> N >> T >> A;

    // 各地点の平均気温
    double t[N];
    for (int i = 0; i < N; ++i) {
        double H;
        cin >> H;
        t[i] = T - H * 0.006;
    }

    // tがAに最も近いindex
    int ans = 0;
    for (int i = 1; i < N; ++i) {
        // 地点iの方が近ければ更新
        if (abs(A - t[i]) < abs(A - t[ans])) ans = i;
    }

    // 0-indexedで保持していたことに注意
    cout << ans + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
A = list(map(int,input().split()))

BC = [list(map(int,input().split())) for _ in range(m)]

A.sort()
from bisect import bisect_left as bl
from operator import itemgetter

BC.sort(key = itemgetter(1),reverse = True)
#record = [0]*(n+1)
ans = 0
last = -1
count = 0
for b,c in BC:
    point = bl(A,c)-1
    if point == -1:
        break
    elif point >= last:
        ans += min(b,point-last)*c
        last = min(b+last,point)
        count += 1
    else:
        break
if count > 0:
    print(ans+sum(A[last+1:]))
else:
    print(sum(A))

Measured memory_bytes: 33004
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <limits>
#include <numeric>
#include <type_traits>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define REVERSE(s) reverse(s.begin(), s.end());
#define SUM(s) accumulate(s.begin(), s.end(), 0LL);
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define int ll
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
int ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }


int n, m;
vector<vector<int>> e;
//これを始まりとする最長パス
vector<int> lp;

int f(int t) {
	if (e[t].size() == 0) {
		lp[t] = 1;
		return 1;
	}
	if (lp[t] > 0) {
		return lp[t];
	}
	int m = 0;
	rep(i, e[t].size()) {
		auto tn = e[t][i];
		m = max(f(tn), m);
	}
	lp[t] = m + 1;
	return m + 1;
}

int main() {
	cin >> n >> m;

	e.resize(n);
	lp.resize(n);

	rep(i, m) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		e[x].push_back(y);
	}

	int ans = 0;
	rep(i, n) {
		auto z = f(i);
		ans = max(ans, z);
	}
	cout << ans - 1 << endl;
}




Measured memory_bytes: 8192
class PrintARectangle:
    def output(self, H, W):
        s = ""
        for w in range(W):
            s += "#"
        for h in range(H):
            print s
        print

if __name__ == "__main__":
    pr = PrintARectangle()
    while True:
        h, w = map(int, raw_input().split())
        if h == 0 and w == 0:
            break
        pr.output(h, w)

Measured memory_bytes: 6444
//--------Anivia_kid---------//
//-------did you test n = 1 ?-------//
#include<bits/stdc++.h>
 
using namespace std;
 
#define fi first
#define se second
#define pb push_back

typedef long long ll; 
const int MOD = 1e9 + 7;
const int MAXN = 1e5 + 100;

void Anivia_kid(){
	int n;
	cin>>n;
	vector<int> v(n);
	for(int i = 0; i < n; i++){
		cin>>v[i];
		if(v[i] % 2 == 0){
			if(v[i] % 3 != 0 && v[i] % 5 != 0){
				cout<<"DENIED\n";
				return;
			}
		}
	}
	cout<<"APPROVED\n";

	return;
}
 
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int q = 1;
	//cin>>q;
	while(q--){
		Anivia_kid();
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <queue>
#include <memory>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>

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

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

int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    int max = 0,tmp = 0;
    rep(i,n-1){
        if(h[i] >= h[i+1]){
            tmp++;
        }else{
            if(max < tmp) max = tmp;
            tmp = 0;
        }
    }
    if(max < tmp) max = tmp;

    cout << max << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for(ll i = 0;i < n;i++)
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

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

  int n, p;
  cin >> n >> p;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int odd = count_if(a.begin(), a.end(), [](auto i){return i%2;});
  int even = n - odd;

  if (odd == 0) {
    if (p==0) n++;
    else {
      cout << 0;
      return 0;
    }
  }
  cout << (1LL << n-1) << endl;
}


Measured memory_bytes: 256
import sys

input()
a = []
for s in sys.stdin:
    a.append(int(s))

maxv = -2000000000000000
minv = a[0]
for i in range(1, len(a)):
    maxv = max(maxv, a[i] - minv)
    minv = min(minv, a[i])

print(maxv)



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

#define int long long
#define pb emplace_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define F first
#define S second
#define fast ios:: sync_with_stdio(false),cin.tie(0);

int32_t main(){
	fast;
	string s;
	cin >> s;
	if(s == "Sunny")    cout << "Cloudy";
	else if(s == "Cloudy")  cout << "Rainy";
	else    cout << "Sunny";
}







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

l = [input() for _ in range(2)]
s, t = l[0], l[1]

s_list = sorted([_ for _ in s])
s_dict_min = ''.join(s_list)

t_list = sorted([_ for _ in t], reverse=True)
t_dict_max = ''.join(t_list)

if s_dict_min < t_dict_max:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 10564
n,m=map(int,input().split())
e=[set() for _ in range(n+1)]
for _ in range(m):
  a,b=map(int,input().split())
  e[a].add(b)
  e[b].add(a)

closed_path=set()
n=1
answer=[]

while True:
  answer.append(n)
  closed_path.add(n)
  for i in e[n]:
    if i not in closed_path:
      n=i
      break
  else:
    break

n=1
answer.reverse()
del answer[-1]

while True:
  answer.append(n)
  closed_path.add(n)
  for i in e[n]:
    if i not in closed_path:
      n=i
      break
  else:
    break

print(len(answer))
print(*answer)

Measured memory_bytes: 37152
N = int(input())
Action = [list(map(int, input().split())) for i in range(N)]


# dp[i][j] := i日目に行動jを行った場合の最大値
dp = [[0] * 3 for i in range(N + 1)]

for i in range(N):
    for j in range(3):
        dp[i + 1][(j + 1) % 3] = max(dp[i + 1][(j + 1) % 3], dp[i][j] + Action[i][j])
        dp[i + 1][(j + 2) % 3] = max(dp[i + 1][(j + 2) % 3], dp[i][j] + Action[i][j])

print(max(dp[-1]))


Measured memory_bytes: 47320
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

cnt = mx = 0
for i in range(1, N):
    if A[i] <= A[i-1]:
        cur = A[i]
        cnt += 1
    else:
        mx = max(mx, cnt)
        cnt = 0
mx = max(mx, cnt)

print(mx)


Measured memory_bytes: 14276
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a==5&&b==7&&c==5)
    {
        cout<<"YES";
    }
    else if(a==5&&b==5&&c==7)
    {
        cout<<"YES";
    }
    else if(a==7&&b==5&&c==5)
    {
        cout<<"YES";
    }
    else
        cout<<"NO";



    return 0;
}



Measured memory_bytes: 256
#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 rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    int N;
    cin >> N;
    int a[N];
    int sum = 0;
    rep(i, N) cin >> a[i], sum += a[i];
    int ans = 0;
    rep(i, N){
        if(abs(a[ans]*N-sum) > abs(a[i]*N-sum)) ans = i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
/*多倍長整数/cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define addf(T) [](T a, T b){return (a + b);}
#define minf(T) [](T a, T b){return min(a, b);}
#define maxf(T) [](T a, T b){return max(a, b);}


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acos(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll lcm(ll number1, ll number2) {//lcmを求める
	return number1 / gcd(number1, number2) * number2;
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int h, n;
	scanf("%d%d", &h, &n);
	vector<pair<int, int>> a(n);
	int ok = 10001, ng = 0;
	rep(i, n)scanf("%d%d", &a[i].second, &a[i].first);

	sort(all(a), greater<pair<int, int>>());

		vector<int> dp(h + 1);
		fill(all(dp), INF);
		dp[h] = 0;
		for (int j = 0; j < n; ++j) {
			for (int k = h; k >= 0; --k) {
				if (k - a[j].second >= 0) dp[k - a[j].second] = min(dp[k - a[j].second], dp[k] + a[j].first);
				else dp[0] = min(dp[0], dp[k] + a[j].first);
			}
		}

	printf("%d\n", dp[0]);

	Please AC;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = 16714589;
const int N = 1e5 + 555; // TL MB
const double PI = acos(-1.0);
double eps = 1e-6;

void solve()
{
	ll z;
	cin >> z;
	for(ll i = -1000; i <= 1000; ++i){
		for(ll j = -1000; j <= 1000; ++j){
			ll x = i * i * i * i * i;
			ll y = j * j * j * j * j;
			if(x - y == z)
			{
				cout << i << " " << j << '\n';
				return;	
			}
		}
	}
}


 
 
int main()
{
	Red;
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
  	int T = 1; 
  	//cin >> T; 
  	for(int i = 1; i <= T; ++i){
  		solve();
  	}
    return 0;
}

Measured memory_bytes: 3664
use std::collections::HashSet;
use std::cmp;

fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let a: Vec<usize> = s.trim().split_whitespace().map(|x| x.parse().unwrap()).collect();
    let mut h: HashSet<usize> = HashSet::new();
    let mut x: usize = 0;
    for i in &a {
        if *i < 3200 {h.insert(*i/400);} else {x += 1;}
    }
    println!("{} {}", cmp::max(1, h.len()), h.len()+x);
}



Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int i,k,m,n,t;
int a[1000000];
int main()
{
	scanf("%d%d",&n,&k);
	long long ans=k;
	for(int i=0;i<2*n-2;i++){
		scanf("%d",&t);
		if(a[--t]++||!t)ans=ans*(k-a[t])%1000000007;
	}
	printf("%d",ans);
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>

using namespace std;

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

template<typename T> struct edge {
  using Type = T;
  int to;
  T cap;
  int rev_id;

  edge(int to_,T cap_,int rev_id_) : to(to_),cap(cap_),rev_id(rev_id_){};
};


template<class T> struct Graph_for_flow {
  vector<vector<T>> G;
  vector<bool> used;
  int V,E;

  Graph_for_flow(int V_) {
    init(V_);
  }

  void init(int V_) {
    V = V_;

    G.clear();
    G.resize(V);

    used.resize(V);

  }

  void add_edge(int from,int to,typename T::Type cap) {
    if(from < 0 || from >= V || to < 0 || to >= V ) {
      cerr << "warning" << endl;
    }

    G[from].push_back(T(to,cap,G[to].size()));
    G[to].push_back(T(from,0,G[from].size() - 1));
  }

  typename T::Type dfs(int v,int t,typename T::Type f) {
    if(v == t) return f;

    used[v] = true;

    for(auto &e : G[v]) {
      if(!used[e.to] && e.cap > 0) {
        typename T::Type d = dfs(e.to,t,min(f,e.cap));
        if(d > 0) {
          e.cap -= d;
          G[e.to][e.rev_id].cap += d;
          return d;
        }
      }
    }
    return 0;
  }

  typename T::Type max_flow(int s,int t) {
    typename T::Type flow = 0;
    for(;;) {
      fill(used.begin(),used.end(),false);
      typename T::Type f = dfs(s,t,1e9);
      if(f == 0)break;
      flow += f;
    }
    return flow;
  }
};
int main() {
  int V,E;

  cin >> V >> E;

  Graph_for_flow<edge<long long> > graph(V);

  rep(i,E) {
    long long u,v,c;

    cin >> u >> v >> c;

    graph.add_edge(u, v, c);

  }

  cout << graph.max_flow(0, V - 1) << endl;
  return 0;
}



Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string N;
  cin >> N;
  if ((N[0] == N[1] && N[1]== N[2]) || (N[1] == N[2] && N[2]== N[3])) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

namespace IO
{
char gc()
{
#ifdef FREAD
	static char buf[1<<21], *P1 = buf, *P2 = buf;
	if(P1 == P2)
	{
		P1 = buf;
		P2 = buf + fread(buf, 1, 1<<21, stdin);
		if(P1 == P2) return EOF;
	}
	return *(P1++);
#else
	return getchar();
#endif
}
template<typename Tp> bool get1(Tp &x)
{
	bool neg = 0;
	char c = gc();
	while( c != EOF && (c < '0' || c > '9') && c != '-' ) c = gc();
	if(c == '-') c = gc(), neg = 1;
	if(c == EOF) return false;
	x = 0;
	for(; c>='0' && c<='9'; c = gc()) x = x*10 + c - '0';
	if(neg) x = -x;
	return true;
}
template<typename Tp> void printendl(Tp x)
{
	if(x<0)putchar('-'),x=-x;
	static short a[40], sz;
	sz = 0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
	puts("");
}
} // namespace IO
using IO::get1;
using IO::printendl;
#define get2(x,y) get1(x) && get1(y)
#define get3(x,y,z) get2(x,y) && get1(z)
#define get4(x,y,z,w) get3(x,y,z) && get1(w)
#define pb push_back
#define mp std::make_pair
#define ff first
#define ss second
typedef long long LL;
typedef unsigned long long uLL;
typedef std::pair<int,int> pii;
const int inf = 0x3f3f3f3f;
const LL Linf = 1ll<<61;

const int maxn = 211;
int n, tot;
LL a[maxn], b[maxn];
char s[maxn];

bool in(LL x)
{
	for(int i=0; i<tot; i++) if(x & b[i] & -b[i]) x ^= b[i];
	return (x == 0);
}
void add(LL x)
{
	for(int i=0; i<tot; i++) if(x & b[i] & -b[i]) x ^= b[i];
	if(x == 0) return;
	for(int i=0; i<tot; i++) if(x & -x & b[i]) b[i] ^= x;
	b[tot++] = x;
}


void solve()
{
	get1(n);
	for(int i=1; i<=n; i++) get1(a[i]);
	scanf("%s", s+1);
	
	tot = 0;
	for(int i=n; i>=1; i--)
	{
		if(s[i] == '1')
		{
			if(!in(a[i]))
			{
				puts("1");
				return;
			}
		}
		else add(a[i]);
	}
	puts("0");
}

int main()
{
	int tc;
	get1(tc);
	while(tc--) solve();
	return 0;
}

Measured memory_bytes: 3764
#include<iostream>
using namespace std;
int main()
{
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    if(k <= a)
        cout << k;
    else if(k <= a + b)
        cout << a;
    else
        cout << a - (k - b - a);
    return 0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll a[100001];
    ll n;
    cin>>n;
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(ll i=0;i<n;i++)
    {
        if(a[i]==0)
        {
            cout<<"0\n";
            return 0;
        }
    }
    ll prod=1;
    for(ll j=0;j<n;j++)
    {
        if(a[j]<=1000000000000000000/prod)
        {
            prod*=a[j];
        }
        else
        {
            cout<<"-1\n";
            return 0;
        }
    }
    cout<<prod<<"\n";
    
}

Measured memory_bytes: 4360
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	int n;
	cin >> n;
	vi a(n);
	rep(i,n) {
		cin >> a[i];
	}
	rep(i,n/2) cout << a[n-1-2*i] << " ";
	if(n%2){
      	cout << a[0] << " ";
		rep(i,n/2) cout << a[2*i+1] << " ";
    }
  	else{
      	rep(i,n/2) cout << a[2*i] << " ";
    }
  	cout << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 3072
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("sse,sse2")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

template<class T>
using ordered_set = tree <T, null_type ,  less<T> ,  rb_tree_tag ,  tree_order_statistics_node_update>;

template<class T>
using ordered_multiset = tree <T, null_type ,  less_equal<T> ,  rb_tree_tag ,  tree_order_statistics_node_update>;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using vvii = vector<vii>;

#define all(x) x.begin(), x.end()
#define all_r(x) x.rbegin(), x.rend()
#define pb push_back
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define REP(i, n) for(int i = n; i >= 0; --i)
#define f first
#define s second

int main() {
	ios_base :: sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin >> n;
	string name;
	while(n > 0) {
		name.pb((n - 1) % 26 + 'a');
		n = (n - 1) / 26;
	}
	reverse(all(name));
	cout << name << '\n';
 	return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
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; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int n, m;
string s;
vector<int> res;

int main(){
    cin >> n >> m;
    cin >> s;
    int now = n;
    while (1) {
        bool flag = true;
        if (now <= m) {
            res.push_back(now);
            break;
        }
        for (int i = m; i > 0; --i) {
            if (s[now - i] == '1') continue;
            now -= i;
            res.push_back(i);
            flag = false;
            break;
        }
        if (flag) {
            cout << -1 << endl;
            return 0;
        }
    }

    for (int i = res.size() - 1; i >= 0; --i) {
        cout << res[i] << " ";
    }
    cout << endl;
}

Measured memory_bytes: 3972
#include <iostream>
#include <string>
#include <vector>
#include<algorithm>
#include <stdio.h>
#include <bitset>
#include<math.h>
#include<list>
#include<map>
using namespace std;
typedef long long ll;
#define PI 3.14159265358979323846  



int main() {
	double n,preans;
	int ans=0;
	cin >> n;
	for (int i = 0; i <= n; i++) {
		preans = i * 1.08;
		if ((int)preans == n) {
			ans = i;
			break;
		}
	}
	if (ans != 0) {
		cout << ans << endl;
	}
	else {
		cout << ":(" << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)

int main(){
    
    // 1. 入力情報.
    int T;
    scanf("%d", &T);
    
    // 2. N枚のクッキーの美味しさの合計.
    // ex.
    // 4 108
    // 108
    // 127 19
    // 127 127 108
    // 127 127 127 19
    // -> 合計 400 となる.
    rep(i, T){
        int n, d, ans;
        scanf("%d %d", &n, &d);
        if(n == 1){
            ans = d;
        }else{
            if(n & 1) ans = 127 * (n - 1) + d;
            else      ans = 127 * (n - 1) + (d ^ 127);
        }
        printf("%d\n", ans);
    }
    return 0;
    
}

Measured memory_bytes: 256
import sys, itertools
def input(): return sys.stdin.readline()
def inpl(): return [int(i) for i in input().split()]
N, K = inpl()
Sushi = []
Neta = set()
ans = 0
for _ in range(N):
    t, d = inpl()
    Sushi.append((d, t))
Sushi.sort(reverse = True)
Db = []
Nd = []
for i in range(K):
    d, t = Sushi[i]
    if t not in Neta:
        Neta.add(t)
        ans += d
    else:
        Db.append(d)
neta = len(Neta)
Db = [0] + list(itertools.accumulate(Db))
Db.reverse()
for i in range(N-K):
    d, t = Sushi[K+i]
    if t not in Neta:
        Neta.add(t)
        Nd.append(d)
Nd = [0] + list(itertools.accumulate(Nd))
print(ans + max([(neta + i)**2 + j + k for i, (j, k) in enumerate(zip(Db, Nd))]))

Measured memory_bytes: 59376
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        int b = s.nextInt();
        int c = s.nextInt();
        if(a+b+c>=22){
            System.out.println("bust");
        }else {
            System.out.println("win");
        }
    }
}

Measured memory_bytes: 22740
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
xyc = []

for i in range(M):
    x, y, c = map(int, input().split())
    x -= 1
    y -= 1
    xyc.append(a[x] + b[y] - c)

xyc.sort()

print(min(min(a)+min(b), xyc[0]))

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

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)

// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cerr << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define debug(...) CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) (__VA_ARGS__)

using namespace std;
using ll = long long;
using P = pair<int, int>;

void Main() {
  string s;
  cin >> s;
  if (s[2]==s[3] && s[4] == s[5]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j;
    string s,t;
    cin>>s>>t;
    int m=s.length();int n=t.length();
    int dp[m+1][n+1];
    for(i=0;i<=m;i++)
    {
        for(j=0;j<=n;j++){
        if(i==0 || j==0)
        dp[i][j]=0;
        else if(s[i-1]==t[j-1])
        dp[i][j]=dp[i-1][j-1]+1;
        else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    int indx=dp[m][n];
    char ch[indx+1];i=m;j=n;
    ch[indx]='\0';
    while(i>0 && j>0)
    {
        if(s[i-1]==t[j-1]){ch[indx-1]=s[i-1];i--;j--;indx--;}
        else if(dp[i-1][j]>dp[i][j-1])i--;
        else j--;
    }
    cout<<ch<<"\n";
    return 0;
}

Measured memory_bytes: 35456
import java.util.Scanner;

class Main{
 public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int M = sc.nextInt();
   int[] A =new int[M];;
   int sum=0;
   
   for(int i=0;i<M;i++){
      A[i] = sc.nextInt();
      sum=sum+A[i];
   }

   if(sum<=N){
     System.out.println(N-sum);
   }
   else{
     System.out.println(-1);
   }
 
 }
}


Measured memory_bytes: 46536
#include<stdio.h>

int main(){
  int a, b;
  int x, y, i;
  scanf("%d%d",&a, &b);
  if(a <= b) {
    x = a;
    y = b;
  }
  else{
    x = b;
    y = a;
  }
  for(i = 0;i<y;i++){
    printf("%d",x);
  }
}

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

bool is_prime(const unsigned n){
    switch(n){
        case 0: // fall-through
        case 1: return false;
        case 2: // fall-through
        case 3: return true;
    } // n > 3 が保証された

    if(n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である

    // 6の倍数前後の数を使って試し割りをする
    for(unsigned i = 5; i * i <= n; i += 6) {
        if(n % i     == 0) return false; // (6の倍数)-1
        if(n % (i+2) == 0) return false; // (6の倍数)+1
    }

    return true;
}

int main(){
    long long n;
    cin >> n;

    vector<long long> prime;

    for(long long i = 2; i <= 55555; i++){
        if(is_prime(i) == true and i % 5 == 1) prime.push_back(i);
    }

    for(long long i = 0; i < n; i++){
        if(i != n-1) printf("%lld ", prime[i]);
        else printf("%lld\n", prime[i]);
    }
    return 0;
}

Measured memory_bytes: 3752
#include<stdio.h>
int main()
{
	int n;
	int a, ans, b;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		a = i * 1.08;
		if (n == a) {
			printf("%d\n", i);
			break;
		}
	}
	if (n<a) {
		printf(":(\n");
	}
	return 0;
}


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

int main(void){
    int n;
    scanf("%d", &n);
    int odd,even;
    int ans=0;
    for(int i=0;i<(n+1)/2;i++){
        scanf("%d %d", &odd,&even);
        if((odd%2)==1){ans++;}
    }

    printf("%d",ans);
}


Measured memory_bytes: 1732
// Problem : D - Line++
// Contest : AtCoder Beginner Contest 160
// URL : https://atcoder.jp/contests/abc160/tasks/abc160_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

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

#ifdef LOCAL
#define DEBUG(...) cerr << #__VA_ARGS__ << ": ", debug(__VA_ARGS__);
#else
#define DEBUG(...)
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator << (ostream &os, const vector<T> &v) {os << "["; for (int i=0; i<(int)v.size(); i++) {if (i) os << ", "; os << v[i];} return os << "]";}
void debug() {cerr << "\n";} template<typename T, typename... Args> void debug(T x, Args... args) {cerr << x << "; "; debug(args...);}

int dist[2000][2000], ret[2000] = {};

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    
    int n, x, y;
    cin >> n >> x >> y;
    x--, y--;
    
    for (int i=0; i<n; i++)
        for (int j=i; j<n; j++)
            dist[i][j] = dist[j][i] = j - i;
    
    for (int i=0; i<n; i++)
        for (int j=i; j<n; j++)
            if (min(dist[i][x] + dist[y][j], dist[i][y] + dist[x][j]) + 1 < dist[i][j])
                dist[i][j] = min(dist[i][x] + dist[y][j], dist[i][y] + dist[x][j]) + 1;
    
    for (int i=0; i<n; i++)
        for (int j=i; j<n; j++)
            ret[dist[i][j]]++;
    
    for (int k=1; k<n; k++)
        cout << ret[k] << "\n";

    return 0;
}


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

int main() {
    string s, key = "keyence", ans = "NO", str;
    cin >> s;
    if (s == key) ans = "YES";
    rep(i, s.size()) {
        REP(j, i, s.size()) {
            str = s.substr(0, i) + s.substr(j);
            //cout << str << endl;
            if (str == key) ans = "YES";
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int a,b,c;cin>>a>>b>>c;
  int ans=3;
  if(a==b) --ans;
  if(b==c) --ans;
  if(c==a) --ans;
  if(a==b && b==c) cout << 1<<endl;
  else cout << ans <<endl;

  return 0;
}


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

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

    string s;

    cin >> s;

    int sum = 0;
    for(int i = 0; i < s.size(); i++)
    {
        sum += s[i] - '0';
    }
    //cout << sum << '\n';
    if(sum % 9)
    {
        cout << "No" << '\n';
    }
    else
    {
        cout << "Yes" << '\n';
    }



    return 0;
}



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

int main() {
    int X;
    cin >> X;
    int A, B;
    A = X /100;
    B = X - 100 * A;
    if(B <= 5 * A){
        cout << 1 << endl;
    }
    else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <array>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>

#define INF_LL 9000000000000000000
#define INF 2000000000

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

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

class SegTree{
	int n;
	vector<ll> seg;
public:
	SegTree(int n_){
		n = 1;
		while(n < n_) n *= 2;

		REP(i, n*2-1){
			seg.push_back(0);
		}
	}

	void add(int i, int x){
		i += n-1;
		seg[i] += x;
		while(i > 0){
			i = (i-1)/2;
			seg[i] = seg[i*2+1] + seg[i*2+2];
		}
	}

	int getSum(int s, int t){
		return getSum_solve(s, t, 0, 0, n);
	}
	
	int getSum_solve(int s, int t, int x, int l, int r){
		if(t <= l || r <= s) return 0;
		if(s <= l && r <= t) return seg[x];
		int res = 0;

		res += getSum_solve(s, t, x*2+1, l, (l+r)/2);
		res += getSum_solve(s, t, x*2+2, (l+r)/2, r);

		return res;
	}
};

class BIT{
	int n;
	vector<int> dat;
public:
	BIT(int _n){
		n = 1;
		while(n < _n) n = n << 1;
		REP(i, n){
			dat.push_back(0);
		}
	}

	int sum(int i){
		int s = 0;
		while(i){
			s += dat[i];
			i -= i & -i;
		}
		return s;
	}

	void add(int i, int x){
		while(i <= n){
			dat[i] += x;
			i += i & -i;
		}
	}
};

int main(void){
	int n, q;
	cin >> n >> q;
	BIT sg(n);
	REP(i, q){
		int com, x, y;
		cin >> com >> x >> y;
		if(com == 0){
			sg.add(x, y);
		}else{
			cout << sg.sum(y)-sg.sum(x-1) << endl;
		}
	}
}

Measured memory_bytes: 3420
#include <stdio.h>

int main(void){
	int a,b;
	
	int d,r;
	double f;
	
	scanf("%d %d",&a,&b);
	d=a/b;
	r=a%b;
	f=(double)a/(double)b;

	
	printf("%d %d %lf\n",d,r,f);
	return 0;
	
	}

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


using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0; i<ll(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;



int main() {
	
	int n, k;
	cin >> n >> k;
	if (n * 500 >= k)cout << "Yes" << endl;
	else cout << "No" << endl;

}


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

inline int ToDigit(char c) { return c - '0'; }

int main() {
  cout << setprecision(15);
  string s;
  cin >> s;
  int a = ToDigit(s[0]); 
  int b = ToDigit(s[1]); 
  int c = ToDigit(s[2]); 
  int d = ToDigit(s[3]); 
  int op = 0;
  for (int i = 0; i < 8; ++i) {
    int ans = a;
    ans += (i & 0b001) ? b : -b;
    ans += (i & 0b010) ? c : -c;
    ans += (i & 0b100) ? d : -d;
    if (ans == 7) {
      op = i;
      break;
    }
  }
  cout << a << ((op & 0b001) ? "+" : "-");
  cout << b << ((op & 0b010) ? "+" : "-");
  cout << c << ((op & 0b100) ? "+" : "-");
  cout << d << "=7" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include<math.h>
using namespace std;


int main() {
  string c;
  cin >> c;
  if((c == "a")||(c == "e")||(c == "i")||(c == "o")||(c == "u"))
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}


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

ll gcd(ll a, ll b)
{
    if (a < b) {
        a ^= b;
        b ^= a;
        a ^= b;
    }

    return b ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}

std::vector<bool> IsPrime;

void sieve(size_t max){
    if(max+1 > IsPrime.size()){     // resizeで要素数が減らないように
        IsPrime.resize(max+1,true); // IsPrimeに必要な要素数を確保
    }
    IsPrime[0] = false; // 0は素数ではない
    IsPrime[1] = false; // 1は素数ではない

    for(size_t i=2; i*i<=max; ++i) // 0からsqrt(max)まで調べる
        if(IsPrime[i]) // iが素数ならば
            for(size_t j=2; i*j<=max; ++j) // (max以下の)iの倍数は
                IsPrime[i*j] = false;      // 素数ではない
}

int main(){
  ll A, B;
  cin >> A >> B;
  ll num = gcd(A, B);
  // sieve(num);
  ll result = 1;
  // for(int i = 0; i<=num;i++){
  //   if(IsPrime.at(i)){
  //     if(num % i == 0){
  //       result++;
  //     }
  //   }
  // }

  ll gg = num;
  for(ll i = 2; i*i<=gg; i++){
    if(num % i == 0){
      result++;
      // cout << i << " ";
    }
    while(num % i ==0){
      num/= i;
    }
  }

  if(num != 1){
    result++;
  }

  cout << result << endl;


}


Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt(); int b = sc.nextInt();
    if (a % 2 == 1 && b % 2 == 1) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

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

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


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  sort(all(a));

  ll ans = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i] >= 0) ans += a[i];
    else ans -= a[i];
  }
  if (a[n-1] < 0) ans += 2*a[n-1];
  if (a[0] > 0) ans -= 2*a[0];
  cout << ans << endl;

  ll sum = a[0];
  for (int i = 1; i < n-1; ++i) { //正の要素を引く
    if (a[i] >= 0) {
      cout << sum << " " << a[i] << "\n";
      sum -= a[i];
    }
  }
  cout << a[n-1] << " " << sum << "\n";
  sum = a[n-1] - sum;
  for (int i = 1; i < n-1; ++i) {
    if (a[i] < 0) {
      cout << sum << " " << a[i] << "\n";
      sum -= a[i];
    }
  }
  return 0;
}

Measured memory_bytes: 3992
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>

using namespace std;

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQUE(a)  (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int n;
double x[100000],r[100000];

bool check(double y){
	double a=-1e6,b=2e6,c;
	REP(i,n){
		c = x[i] - sqrt(r[i] * r[i] - y * y);
		a=max(a,c);
		c = x[i] + sqrt(r[i] * r[i] - y * y);
		b=min(b,c);
	}
	return b>=a;
}

// O(N log N)
int main() {
	cin >> n;
	double low=0, high = 1e9;
	REP(i,n)cin >> x[i] >> r[i], high=min(high,r[i]);
	REP(_,50){
		double mid = (low+high)/2;
		(check(mid) ? low : high) = mid;
	}
	cout << fixed << low << endl;
	return 0;
}

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

using namespace std;

int main()
{
    int n;

    std::cin >> n;

    std::vector<int> p;
    p.resize(n);

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

    int ans = 0;
    for(int i=1; i<n-1;++i)
    {
        if((p[i-1]<p[i] && p[i]<p[i+1]) || (p[i-1]>p[i] && p[i]>p[i+1]))
            ans++;
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str;
		String[] arrStr;
		try {
			loop: while (true) {
				str = br.readLine();
				arrStr = str.split(" ");

				int a = Integer.parseInt(arrStr[0]);
				char op = arrStr[1].charAt(0);
				int b = Integer.parseInt(arrStr[2]);

				int ans = 0;
				switch (op) {
				case '+':
					ans = a + b;
					break;
				case '-':
					ans = a - b;
					break;
				case '*':
					ans = a * b;
					break;
				case '/':
					ans = a / b;
					break;
				case '?':
					break loop;
				}

				System.out.println(ans);

			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 17096