akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair <ll, ll > pll;
//bool comp(
//
//	st pll &a, const pll &b) {
//	return a.first < b.first;
//}
//std::vector<int> enum_div(int n)//nの約数を列挙
//{
//	std::vector<int> ret;
//	for (int i = 1; i*i <= n; ++i)
//	{
//		if (n%i == 0)
//		{
//			ret.push_back(i);
//			if (i != 1 && i*i != n)
//			{
//				ret.push_back(n / i);
//			}
//		}
//	}
//	return ret;
//}

template<int N>
int factorial() {
	return factorial<N - 1>() * N;
}

template<>  /// 特殊化：factorial<N=”1”>だったら，値を返す
int factorial<1>() {
	return 1;
}

int main()
{
	priority_queue<int> q;
	ll h = 0, w = 0, k = 0, a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, ans = 0;
	string s = {};
	char x[302][302] = {};
	ll y[302][302] = {};
	if (1 == '1')
	{

	}
	cin >> a;
	cin >> s;
	for (int l1 = 0; l1 <= 9; l1++)
	{
		for (int i1 = 0; i1 < s.length(); i1++)
		{
			if (l1 == s[i1] - '0')
			{
				for (int l2 = 0; l2 <= 9; l2++)
				{
					for (int i2 = i1 + 1; i2 < s.length(); i2++)
					{
						if (l2 == s[i2] - '0')
						{
							for (int l3 = 0; l3 <= 9; l3++)
							{
								for (int i3 = i2 + 1; i3 < s.length(); i3++)
								{
									if (l3 == s[i3] - '0')
									{
										ans++;
										//cout << l1 << l2 << l3 << endl;
										break;
									}
								}

							}
							break;
						}
					}
				}
				break;
			}
		}
	}
	cout << ans << endl;


	//cout<<factorial<10><<endl;

	//cin >> a >> b;
	//for (int i = 0; i < a; i++)
	//{
	//	cin >> s[i];
	//	if (s[i] >= b)
	//	{
	//		ans++;
	//	}
	//}

	//cout << ans << endl;
	return 0;
}
//2つの組の数をソートしたりするやつ
//vector<pair<ll, ll> > hoges(a);
//for (int i = 1; i <= a; i++)
//{
//	cin >> h;
//	hoges[i - 1] = make_pair(h, i);
//}
//sort(hoges.begin(), hoges.end(), comp);
//for (int i = 0; i < a; i++)
//{
//	cout << hoges[i].second << endl;
//}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#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(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



int main(){
  int r, g;
  cin >> r >> g;
  int ans = 2*g - r;
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 3624
#include<iostream>

using namespace std;

int main(){
  int n,x,t;	cin >> n >> x >> t;
  
  int div = n/x;
  if(n%x == 0){
    cout << t*div << endl;
  }else{
   cout << (div+1)*t << endl; 
  }
	return 0;
}

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

class Main {
    static Scanner scanner = new Scanner();

    public static void main(String[]$) throws IOException {
        int n = scanner.nextInt();
        int t = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        long ans = t;
        for (int i = 0; i < n - 1; i++) {
            ans += Math.min(a[i + 1] - a[i], t);
        }
        System.out.println(ans);
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }

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

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

Measured memory_bytes: 50112
def main():
    N, M = list(map(int, input().split(' ')))
    
    Hn = list(map(int, input().split(' ')))
    
    ABn = []
    for _ in range(M):
        ABn.append(list(map(int, input().split(' '))))
    
    dic_path = {i+1:[] for i in range(len(Hn))}
    
    for i in range(M):
        a = ABn[i][0]
        b = ABn[i][1]
        
        dic_path[a].append([a, b])
        dic_path[b].append([b, a])
    
    # print(dic_path)
    
    result = 0
    for i, paths in dic_path.items():
        # print('---------', i)
        # print(i, paths)
        
        # continue
        if len(paths) == 0:
            # print('i:', i)
            result += 1
            continue
        # continue
        flag = True
        for path in paths:

            a = path[0]
            b = path[1]
            ha = Hn[a-1]
            hb = Hn[b-1]
            # print('a, b, ha, hb:', a, b, ha, hb)
            if hb >= ha:
                flag = False
                # print('a, b, ha, hb:', a, b, ha, hb)
                break

        if flag is True:
            # print('i:',i)
            result += 1
    print(result)




main()

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

#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}




void _main() {
        ll x, k, d; cin >> x >> k >> d;
        //7 2 3
        //1

        if (x >= 0) {
                ll moves = x / d;
                moves = min(moves, k);
                k -= moves;
                ll pos = x - moves * d;
                pos -= (k % 2) * d;
                cout << abs(pos);
        } else {
                ll moves = x / -d;
                moves = min(moves, k);
                k -= moves;
                ll pos = x + moves * d;
                pos += (k % 2) * d;
                cout << abs(pos);
        }
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}

Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int main(void){
    int x,y;
    while(true){
        cin >> x;
        cin >> y;
        if( x == 0 && y == 0 ){
            break;
        }
        if( x < y ){
            cout << x << " " << y << endl;
        }
        else {
            cout << y << " " << x << endl;
        }
    }
}


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

void solve(long long a, long long b){
    int ans;
    if (a <= b) ans = a;
    else ans = a - 1;
    cout << ans << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    solve(a, b);
    return 0;
}


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

const ll MAX_VAL = 1e9;
int H, W, h, w;
vvl ans;

void update(int y, int x, int val) {
    for (int i = y; i < H; i += h) {
        for (int j = x; j < W; j += w) {
            ans[i][j] = val;
        }
    }
}

void output() {
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            cout << ans[i][j] << " \n"[j==W-1];
        }
    }
}

int main() {
    cin >> H >> W >> h >> w;
    if (H % h == 0 and W % w == 0) {
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    ans.assign(H, vl(W, 0));
    update(0, 0, MAX_VAL-1);
    update(h-1, w-1, -MAX_VAL);

    output();
    return 0;
}


Measured memory_bytes: 4864
fun main() {
    readLine()!!.toInt()
    val list = readLine()!!.split(" ").map { it.toInt() }.toList()

    println(keisan(list))
}

fun keisan(list: List<Int>): Int {
    var count = 0
    var list1: MutableList<Int> = list.toMutableList()

    while(true) {
        var list2 = mutableListOf<Int>()

        for (i in 0..list1.lastIndex) {
            //偶数か判別して偶数の場合は2で割る。奇数の場合は終了
            var tmp = list1[i]
            val amari = tmp % 2
            if (amari == 0) {
                //2で割ってリストに突っ込む
                list2.add(tmp / 2)
            } else {
                //おわり
                return count
            }
        }
        list1 = list2
        count++
    }
}

Measured memory_bytes: 38032
#include<bits/stdc++.h>
using namespace std;
vector<int>v[200003],dp;
int n,a[200003],ans[200003];
void dfs(int x,int p){
	int idx=lower_bound(dp.begin(),dp.end(),a[x])-dp.begin(),tmp=dp[idx];
	dp[idx]=a[x];ans[x]=lower_bound(dp.begin(),dp.end(),INT_MAX)-dp.begin();
	for(int i=0;i<v[x].size();i++)
		if(v[x][i]!=p)
			dfs(v[x][i],x);
	dp[idx]=tmp;
}
int main(){
	scanf("%d",&n);dp=vector<int>(n,INT_MAX);
	for(int i=0;i<n;i++)scanf("%d",a+i);
	for(int i=1;i<n;i++){
		int x,y;
		scanf("%d%d",&x,&y);x--;y--;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	dfs(0,-1);
	for(int i=0;i<n;i++)cout<<ans[i]<<endl;
}

Measured memory_bytes: 28044
#include <iostream>
#include <vector>
#include <unordered_map>
#include <deque>
#include <list>
#include <set>
#include <random>
#include <deque>

using namespace std;
using ll = long long;
const int BIG = 100000007;

int main() {
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> deska(n,0);
    vector<ll> deskb(m,0);
    for(ll i = 0;i < n;++i)cin >> deska[i];
    for(ll i = 0;i < m;++i)cin >> deskb[i];

    ll max = 0;
    ll j = 0;
    ll sum = 0;
    for(j = 0;j < m;++j){
        if(sum + deskb[j] <= k)sum += deskb[j];
        else{
            break;
        }
    }

    --j;
    max = j + 1;

    for(ll i = 0;i < n;++i){
        sum += deska[i];
        while (sum > k && j >= 0){
            sum -= deskb[j];
            --j;
        }

        if(sum > k)break;

        if(max < i + j + 2){
            max = i + j + 2;
            //cout << (i + 1) << ":" << (j + 1) << endl;
        }
    }

    cout << max << endl;
}




Measured memory_bytes: 6052
#include<bits/stdc++.h>
using namespace std;
#define ld long double
#define lli long long int
#define vi vector<int>
#define vlli vector<lli>
#define vvi vector<vi >
#define str string
#define vs vector<str>
#define vb vector<bool>
#define slli set<lli>
#define mii map<int, int>
#define mlli map<int, lli>
#define msi map<str, int>
#define mp make_pair
#define pii pair<int, int>
#define pll pair<lli, lli>
#define vpii vector<pii >
#define vpll vector<pll >
#define pb push_back
#define loop(i, s, l, j) for(int i = s; i < l; i += j)
#define rloop(i, s, l, j) for(int i = s; i >= l; i -= j)
#define rep(i, n) loop(i,0,n,1)
#define rrep(i, n) rloop(i,n-1,0,1) 
#define fastio() ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ft first
#define sd second   
#define mit mii::iterator
#define vit vi::iterator
#define all(a) a.begin(),a.end()
#define min3(a, b, c) min(a, min(b, c))
#define mod 1000000007
#define inf 100000000000000000
#define limit 200005
#define minval -100000000000000000
/**********************************************************************************************************************************************/
int dx4[4] = {0, -1, 0, 1};
int dy4[4] = {1, 0, -1, 0};
int dx8[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int dy8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int Power(int base,int exp){int ans=1;  while(exp > 0){if(exp&1)ans=(1LL*ans*base)%mod; exp=exp>>1; base=(1LL*base*base)%mod;}  return ans;}
/**********************************************************************************************************************************************/ 

void input()
{
	int x;
	cin >> x;
	if(x == 0)
		cout << 1;
	else
		cout << 0;


}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
 
    fastio();
    int q = 1;
    //cin >> q;
    while(q--)
        input();
}

Measured memory_bytes: 3636
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
dic = dict()
 
for i in A:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1
 
ans = sum(A)
 
for i in range(Q):
    b, c = list(map(int, input().split()))
    x = 0
    if b in dic:
        x = dic.pop(b)
        if c in dic:    
            dic[c] += x
        else:
            dic[c] = x
    ans += x * (c-b)
    print(ans)

Measured memory_bytes: 84740
//  RAKSHIT KADAM
//ALWAYS USE &IT FOR ITERATING USING AUTO ...
//USE COUNT(STARTING ADDRESS, ENDING ADRESS ,VALUE) FOR FINDING THE COUNT IN THE RESPECTIVE DATA STRUCTURE
//NOTE THAT MEMSET CANT FILL THE DOUBLE VALUES;
//ACCUMULATE DOES NOT WORK PROPERLY IF VALUES START SUMMING BEYOND 1E9...
 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
#warning !!!check the size of arrayss!!!
 
// NUMERIC DEFINITIONS :
    #define INF 100000000000000005
    #define inf 1000000000
    #define MOD  1000000007
    #define newMOD  998244353
    #define MAX 300006
    #define pi 3.1415926535897932384626433832795
#define ld long double
 #define ll long long
 #define int long long
 
 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>
 
 #define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
 #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;
 
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;return (y%2 == 0)? p : (x * p) % m;}
ll modInverse(int a, int m){{ return power(a, m-2, m);}}
const int maxn = 500003;
   
void solve()
{
    ll n,k;cin>>n>>k;string s;cin>>s;
    char a = s[0];
    for(ll i=1;i<n && k;i++)
    {
        if(a!=s[i])
        {
            while(a!=s[i] && i<n)
            {
                s[i] = a;
                i++;
            }
               k--;
        }
     
    }
    ll ans =0;
    for(ll i=1;i<n;i++)
    {
        if(s[i]^s[i-1])continue;
        ans++;
    }
    cout<<ans<<endl;

}
 
signed main()
{
   Need_for_speed(activated);
//
//satisy
//    {
//  solve();
//   }
 
    solve();
    
    return 0;
}
 


Measured memory_bytes: 3800
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>

using namespace std;

int main(void) {
    int A;
    cin>>A;
    cout<<(A+1)/2<<endl;

}


Measured memory_bytes: 256
A,B,K  = map(int,input().split())
for i in range(K):
    if i % 2 == 0:
        if A % 2 == 1:
            A -= 1
        B += A//2
        A -= A//2
    else:
        if B%2 == 1:
            B -= 1
        A += B//2
        B -= B//2

print(A,B)


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

// Define
using ll = int64_t;
using ul = uint64_t;
using ld = long double;
using pii = pair<int, int>;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ul MAX = ULONG_MAX;
const char nl = '\n';

#define elif else if
#define def inline auto
#define run __attribute__((constructor)) def _

// Debug
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i < _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i > _##i; --i)
#define rep(i, n) inc(i, 0, n)
#define be(c) begin(c), end(c)

// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")

signed main(){
    int t, x;
    cin >> t >> x;
    cout << double(t)/x << nl;
}


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

string S;
long long K;

int main() {
  cin >> S >> K;
  for (int i = 0; i < min((long long)S.size(), K); i++) {
    if (S[i] != '1') {
      cout << S[i] << endl;
      return 0;
    }
  }
  cout << '1' << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <vector>
using namespace std;

typedef long long ll;

/*
const ll M = 1000000007;
vector<ll> fac(3001);
vector<ll> ifac(3001);
ll mpow(ll x, ll n){
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}
 
ll comb(ll a, ll b){
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0 || b < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}
*/


ll lcm(ll a,ll b){
 
  ll r, x, tmp;
  x = a * b;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return x/b;
}

ll gcd(ll a ,ll b){
    if(a==0){return b;}
    else if(b==0){return a;}
    else{
    ll tmp,r;
    if(a<b){
        tmp = a;
        a = b;
        b = tmp;
    }
    
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
    }
}




int main(void){
    const ll M = 1000000000;
    ll s;
    cin >> s;
    if(s == (M * M)){
        cout << 0 << " ";
        cout << 0 << " ";
        cout << 0 << " ";
        cout << M << " ";
        cout << M << " ";
        cout << 0 << endl;
    }
    else
    {
        ll A, B;
        A = s % M;
        B = (s - A) / M;
        cout << 0 << " ";
        cout << 0 << " ";
        cout << M << " ";
        cout << 1 << " ";
        cout << M - A << " ";
        cout << B + 1 << endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 256
import Foundation

let input_line: String = readLine()!
let i = Int(input_line)!
var array: [String] = Array()

for count in 0..<i {
  	let b = readLine()!
    array.append(b)
}

array.sort()

var ans: [String] = Array()

for k in array {
    if ans.last != k {
        ans.append(k)
    }
}

print(ans.count)

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

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


	long long lucas[86];
	lucas[0] = 2, lucas[1] = 1;
	for (int i = 2; i <= n; i++) lucas[i] = lucas[i - 1] + lucas[i - 2];


	cout << lucas[n] << endl;

	return 0;
}

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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  int H, W;
  int a[505][505];
  cin >> H >> W;
  queue<pair<P, P> > que;
  int cnt = 0;
  rep(i, H) {
    rep(j, W) {
      cin >> a[i][j];
    }
  }
  rep(i, H) {
    rep(j, W) {
      if (a[i][j] % 2 == 1 ) {
        if (j == W-1 && i != H-1) {
          a[i][j]--;
          a[i+1][j]++;
          que.push(mp(mp(i+1, j+1), mp(i+2, j+1)));
          cnt++;
        }
        else if (j != W-1 || i != H-1) {
          a[i][j]--;
          a[i][j+1]++;
          que.push(mp(mp(i+1, j+1), mp(i+1, j+2)));
          cnt++;
        }
      }
    }
  }
  cout << cnt << endl;
  while(!que.empty()) {
    cout << que.front()._1._1 << ' ' << que.front()._1._2 << ' ' << que.front()._2._1 << ' ' << que.front()._2._2;
    cout << endl;
    que.pop();
  }
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, std::less<>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//*/998244353;
const int base = 2187;
const double eps = 1e-8;
const int N = 100'000;
const int LOGN = 19;

int n, m, k;

void solve(int test) {
  cin >> n;
  for (int i = 0; i <= n; ++i) {
    if (int(i * 1.08) == n) {
      cout << i << '\n';
      return;
    }
  }
  cout << ":(\n";
}

void precalc() {
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i) {
    solve(i);
  }
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class E { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		long N = GetLong();
		var A = new long[N];
		var B = new long[N];
		for(long i = 0; i < N; i++)
		{
			A[i] = GetLong();
			B[i] = GetLong();
		}

		if(A.Zip(B, (x, y) => x == y).All(x => x))
		{
			WriteLine(0);
			return;
		}

		long min = long.MaxValue;
		for(long i = 0; i < N; i++)
		{
			if(A[i] > B[i])
				chmin(ref min, B[i]);
		}
		WriteLine(A.Sum() - min);
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 32236
#include<iostream>
#include<algorithm>
#include<string>
#include<numeric>
#include<vector>
#include<map>
using namespace std;

int n;

int main(){
  cin >> n;
  int x[n],y[n],h[n];
  for (int i=0;i<n;i++){
    cin >> x[i] >> y[i] >> h[i];
  }
  int x_a,y_a;
  int h_c;
  bool flag = true;
  for (int cx=0;cx<101;cx++){
    for (int cy=0;cy<101;cy++){
      h_c = -1;
      flag = true;
      for (int i=0;i<n;i++){
        if (h[i] > 0) {
          h_c = h[i]+abs(x[i]-cx)+abs(y[i]-cy);
          break;
        }
      }
      for (int i=0;i<n;i++){
        if (h[i] != max(0,h_c-abs(x[i]-cx)-abs(y[i]-cy))){
          flag = false;
          break;
        }
      }

      if (flag){
        x_a = cx;
        y_a = cy;
        break;
      }
    }
    if (flag) break;
  }

  cout << x_a << " " << y_a << " " <<  h_c << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <string.h>
#include <stack>
#include <map>
#include <unordered_map>
#include <climits>
using namespace std;
const int INF = 1e9;
#define ll long long
#define int ll
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
#define testcase \
    int t;       \
    cin >> t;    \
    while (t--)
#define pb push_back
#define endl "\n"
#define deb1(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << " | " << #y << ": " << y << endl
#define deb3(x, y, z) cout << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl
#define deb4(x, y, z, w) cout << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << " | " << #w << ": " << w << endl
#define deb5(a, b, c, d, e) cout << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(a) int((a).size())
#define pii pair<int, int>
#define fi first
#define se second
#define ld long double
#define vii vector<int>
#define all(v) v.begin(), v.end()
#define prec(n) fixed << setprecision(n)
const int MOD = (int)1e9 + 7;
const int MOD2 = 1007681537;
const ll LINF = (ll)1e18;
const ld PI = acos((ld)-1);
const ld EPS = 1e-12;
inline ll gcd(ll a, ll b)
{
    ll r;
    while (b)
    {
        r = a % b;
        a = b;
        b = r;
    }
    return a;
}
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
inline ll fpow(ll n, ll k, int p = MOD)
{
    ll r = 1;
    for (; k; k >>= 1)
    {
        if (k & 1)
            r = r * n % p;
        n = n * n % p;
    }
    return r;
}
template <class T>
inline int chkmin(T &a, const T &val) { return val < a ? a = val, 1 : 0; }
template <class T>
inline int chkmax(T &a, const T &val) { return a < val ? a = val, 1 : 0; }
inline void addmod(int &a, int val, int p = MOD)
{
    if ((a = (a + val)) >= p)
        a -= p;
}
inline void submod(int &a, int val, int p = MOD)
{
    if ((a = (a - val)) < 0)
        a += p;
}
inline int mult(int a, int b, int p = MOD) { return (ll)a * b % p; }
inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }
inline void get_arr(int arr[], int n)
{
    for (int i = 0; i < n; i++)
        cin >> arr[i];
}
inline void print_arr(int arr[], int n)
{
    for (int i = 0; i < n; i++)
        cout << arr[i] << " ";
    cout << endl;
}

int32_t main()
{
    int n,w;
    cin>>n>>w;
    int wt[n+1],arr[n+1];
    int v=0;
    for(int i=1;i<=n;i++)
    {
        cin>>wt[i];
        cin>>arr[i];
        v+=arr[i];
    }
    int dp[v+1];
    for(int i=0;i<=v;i++)
    {
        dp[i]=INF;
    }
    dp[0]=0;
    for(int i=1;i<=n;i++)
    {
        int a=wt[i];
        int b=arr[i];
        for(int j=v;j>=b;j--)
        {
            dp[j]=min(dp[j],dp[j-b]+a);
        }
    }
    for(int i=v;i>=0;i--)
    {
        if(dp[i]<=w)
        {
            cout<<i<<endl;
            break;
        }
    }
    // print_arr(dp,v+1);
}


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

int main()
{
    char array[6], c;
    for(int i = 0; i < 3; i++) cin >> array[i];
    for(int i = 3; i < 6; i++) cin >> array[i];
    
    int count = 0;
    for(int i = 0; i < 3; i++) if(array[i] == array[5-i]) count++;
    if(count == 3) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


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

#define matrix vector<vector<int>>

const int MOD = 1e9+7;
int GM(long long Num){
    return Num%MOD;
}
matrix new_matrix(int n ,int m){
    return matrix(n ,vector<int>(m));
}
matrix operator*(matrix a ,matrix b){
    matrix c(a.size() ,vector<int>(b[0].size() ,0));
    for(int i=0; i<a.size(); i++)
    for(int k=0; k<b.size(); k++)
    for(int j=0; j<b[0].size(); j++)
        c[i][j] = GM(c[i][j] + GM(a[i][k]*1LL*b[k][j]));
    return c;
}
matrix operator^(matrix a ,long long p){
    matrix x(a.size() ,vector<int>(a.size() ,0));
    for(int i=0; i<a.size(); i++)
        x[i][i] = 1;
    for( ; p; p>>=1){
		if(p & 1)
			x = x*a;
		a = a*a;
	}
    return x;
}

int main()
{
    int n; long long k;
    scanf("%d%lld",&n,&k);
    matrix r = new_matrix(n ,n);
    for(int i=0; i<n; i++)
    for(int j=0; j<n; j++)
        scanf("%d",&r[i][j]);

    r = r^k;
    int ans = 0;
    for(auto&v : r)
    for(auto&c : v)
        ans = GM(ans + c);

    printf("%d\n",ans);
}


Measured memory_bytes: 256
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define int long long
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 100000000000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 200005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t,dp[li][4][4];
int cev;
string s;
vector<int> v;

inline int f(int sira,int atla,int hak){
	int cevv=-inf;
	if(sira>n){
		if(hak)return -inf;
		return 0;
	}
	if(~dp[sira][atla][hak])return dp[sira][atla][hak];
	if(hak==1){
		cevv=max(cevv,f(sira+1,atla,0));
		if(atla==0)cevv=max(cevv,f(sira+1,1,1));
		if(atla==0)cevv=max(cevv,f(sira+1,1,0));
		cevv=max(cevv,f(sira+2,atla,1)+a[sira]);
	}
	else if(atla==1){
		cevv=max(cevv,f(sira+2,1,0)+a[sira]);
	}
	else{
		cevv=max(cevv,f(sira+1,1,0));
		cevv=max(cevv,f(sira+2,0,0)+a[sira]);
	}
	return dp[sira][atla][hak]=cevv;
}

main(void){
	memset(dp,-1,sizeof(dp));
	scanf("%lld",&n);
	//~ cout<<n%2<<endl;
	
	FOR scanf("%lld",&a[i]);
	if(n%2==0)cev=f(1,0,0);
	else cev=f(1,0,1);
	printf("%lld\n",cev);
	return 0;
}



Measured memory_bytes: 38140
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<cmath>
using namespace std;

typedef pair<int, int> P;
typedef long long ll;
const int INF = 100000000;

ll gcd( ll a, ll b ){
    ll tmp;
    if( a < b ) { tmp = a; a = b; b = tmp; }
    if( b < 1 ) return -1;

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

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


//入力
ll a, b, c, d;

int main(){

    cin >> a >> b >> c >> d;

    ll f_b = b - b/c - b/d + b/lcm(c, d);
    // ll f_a_1 = (a-1) - (a-1)/c - (a-1)/d + (a-1)/lcm(c, d);
    a--;
    ll f_a = a - a/c - a/d + a/lcm(c, d);

    cout << f_b - f_a << endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;;

public class Main {
	
    public static void main(String[] args) {
    	FastScanner sc = new FastScanner();
    	int n = sc.nextInt();
    	PriorityQueue<Integer> p = new PriorityQueue<>(Collections.reverseOrder());
    	
    	for(int i=0;i<n;i++){
    		p.add(sc.nextInt());
    	}
    	
    	int Alice = 0;
    	int Bob = 0;
    	boolean ATurn = true;
    	
    	for(int i=0;i<n;i++){
    		if(ATurn){
    			Alice += p.poll();
    			ATurn = false;
    		}
    		else{
    			Bob += p.poll();
    			ATurn = true;
    		}
    	}
    	
    	System.out.println(Alice-Bob);
    }
    
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 21332
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        List<String> array = new ArrayList<>();
        array.add(String.valueOf(s.charAt(0)));
        array.add(String.valueOf(s.charAt(1)));
        array.add(String.valueOf(s.charAt(2)));
        array.add(String.valueOf(s.charAt(3)));
        Collections.sort(array);
        if (array.get(0).equals(array.get(1)) && !array.get(1).equals(array.get(2)) && array.get(2).equals(array.get(3))) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21716
#include<iostream>
using namespace std;
int main(){
    int n,k,s;
    cin>>n>>k>>s;
    for(int i=0;i<n;i++){
        if(i<k)cout<<s<<" \n"[i==n-1];
        else cout<<(s==1000000000-1?1:1000000000-1)<<" \n"[i==n-1];
    }
    return 0;
}

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

int idx;
string s;

bool isCat(){
  if(s[idx] != 'm') return idx != 0;
  idx++;
  if(!isCat()) return false;
  if(s[idx++] != 'e') return false;
  if(!isCat()) return false;
  if(s[idx++] != 'w') return false;

  return true;
}

int main(){
  while(cin >> s){
    idx = 0;
    cout << (isCat() && idx == s.size() ? "Cat" : "Rabbit") << endl;
  }
}

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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }

const int MAX_N = 100;
int n;
double a[MAX_N];

int main()
{
  cin >> n;
  forn(i,n) cin >> a[i];

  double res = 0;
  forn(i,n) {
    res += 1.0/a[i];
  }

  printf("%.10f\n",1.0/res);

  return 0;
}


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

int main() {
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  cout << s1[0] << s2[1] << s3[2] << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int N,x,y,c=0,z=0;
  scanf("%d",&N);
  x= 800*N;
  for(int i=1;i<=N;i++){
    c++;
    if(c==15){
      z++;
      c -=15;
    }
  }
  y= 200*z;
  printf("%d",x-y);
  return 0;
}

Measured memory_bytes: 1728
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1e9;

using namespace std;

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

    vector<int> v(N,0);

    for(int i = 1; i < N; ++i)
    {
        if(s[i] == 'E')
            v[0]++;
    }

    for(int i = 0; i < N - 1; ++i){
        if(s[i] == 'W')
            v[i+1] = v[i] + 1; 
        else
            v[i+1] = v[i];
        if(s[i+1] == 'E')
            v[i+1] -= 1;
    }
    cout << *min_element(v.begin(), v.end()) << endl;
    return 0;
}



Measured memory_bytes: 1796
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 410, mod = 998244353;
int n,a[N];

inline int Mod(int x){
	return x>=mod?x-mod:x;
}
inline int power(int a,int b){
	int ret=1;
	for (;b;b>>=1,a=1ll*a*a%mod) if (b&1) ret=1ll*ret*a%mod;
	return ret;
}
int pw[N*N],fac[N],ifac[N];
inline void init(){
	pw[0]=1;
	For(i,1,n*n) pw[i]=2ll*pw[i-1]%mod; 
	fac[0]=1;
	For(i,1,n) fac[i]=1ll*fac[i-1]*i%mod;
	ifac[n]=power(fac[n],mod-2);
	Dow(i,n-1,0) ifac[i]=1ll*ifac[i+1]*(i+1)%mod;
}
inline int C(int n,int m){
	return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}

poly operator * (poly a,poly b){
	poly ret(siz(a)+siz(b)-1);
	FOR(i,0,siz(a)) FOR(j,0,siz(b)) ret[i+j]=(ret[i+j]+1ll*a[i]*b[j])%mod;
	return ret;
}
inline vector<poly> solve(int l,int r,int h){
	int mn=1e9;
	For(i,l,r) mn=min(mn,a[i]);
	vector<poly> ans(3);
	FOR(i,0,3) ans[i].resize(1),ans[i][0]=1;
	int L=l;
	while (a[L]==mn&&L<=r) ++L;
	int R=L;
	while (L<=r){
		while (R<r&&a[R+1]!=mn) ++R;
		auto tmp=solve(L,R,mn);
		vector<poly>nxt(3);
		FOR(i,0,3) nxt[i]=tmp[i]*ans[i];
		ans=nxt,L=R+1;
		while (L<=r&&a[L]==mn) ++L;
		R=L;
	}
	int len=r-l+1;
	FOR(i,0,3) ans[i].resize(len+1);
	For(i,1,mn-h){
		vector<poly>nxt(3);
		FOR(j,0,3) nxt[j].resize(len+1);
		For(j,0,len){
			if (ans[0][j]){
				nxt[0][j]=(nxt[0][j]+1ll*ans[0][j]*Mod(pw[j]+mod-1))%mod;
				For(k,1,len-j) nxt[0][j+k]=(nxt[0][j+k]+1ll*ans[0][j]*pw[j]%mod*C(len-j,k))%mod;
			}
			if (ans[1][j]){
				nxt[1][j]=(nxt[1][j]+1ll*ans[1][j]*Mod(pw[len-j]+mod-1))%mod;
				For(k,1,j) nxt[1][j-k]=(nxt[1][j-k]+1ll*ans[1][j]*pw[len-j]%mod*C(j,k))%mod;
			}
			if (ans[2][j]){
				For(k,0,len-j) nxt[2][j+k]=(nxt[2][j+k]+1ll*ans[2][j]*pw[j]%mod*C(len-j,k))%mod;
				nxt[1][len-j]=Mod(nxt[1][len-j]+ans[2][j]);
			}
		}
//		For(j,0,len) printf("%d ",nxt[0][j]);puts("");
//		For(j,0,len) printf("%d ",nxt[1][j]);puts("");
//		For(j,0,len) printf("%d ",nxt[2][j]);puts("\n");
		ans=nxt;
	}
	return ans;
}

int main(){
	n=read();
	For(i,1,n) a[i]=read();
	init();
	auto ans=solve(1,n,0);
	int Ans=ans[1][0];
	//For(i,0,n) Ans=Mod(Ans+ans[0][i]);
	printf("%d\n",Ans);
}

Measured memory_bytes: 4768
#include <bits/stdc++.h>
    using namespace std;
    #define ll long long
    int main()
    {
        string s;
        cin>>s;
        stack <char> x;
        for(ll i=0;i<s.size();i++){
            if(s[i]!='B'){
                x.push(s[i]);
            }
            else{
                if(!x.empty()){
                    x.pop();
                }
            }
        }
        std::vector<char> v ;
        while(!x.empty()){
            v.push_back(x.top());
            x.pop();
        }

        reverse(v.begin(),v.end());
        for(auto z : v){
            cout<<z;
        }
        return 0;
    }

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>


using namespace std;

struct node
{
	node *next;
	node *prev;
	int num;
};


node *head;


void initialize()
{
	head = (node *)malloc( sizeof(node) );
		head->next = head;
		head->prev = head;

}


void insert(int m)
{
	node *p = (node *)malloc( sizeof(node) );

	p->num = m;
	p->next = head->next;
	head->next->prev = p;
	p->prev = head;
	head->next = p;
}

void del(node *p)
{
	p->prev->next = p->next;
	p->next->prev = p->prev;

	free(p);

}

void deletefirst()
{
	del(head->next);
}

void deletelast()
{
	del(head->prev);
}

node* search(int key,int count)
{
	node* cur = (node *)malloc( sizeof(node) );
	cur = head->next;

	for(int i = 0; i < count; i++)
	{
		if (cur->num == key)
		{
			return cur;
		}
		cur = cur->next;
	}

    return NULL;
}

int main()
{
	node *pp = (node *)malloc( sizeof(node) );
	int n;
	int key;
	char str[12];

	int count = 0;

	initialize();

	scanf("%d", &n);

	for(int i = 0; i < n; i++)
	{
		scanf("%s", str);

		if (str[6] == 'F')
		{
			deletefirst();
			count--;

		}else if (str[6] == 'L')
		{
			deletelast();
			count--;

		}else
		{
			scanf("%d", &key);

			if (str[0] == 'i')
			{
				insert(key);
				count++;

			}else if (str[0] == 'd')
			{
				pp = search(key, count);
				if (pp != NULL)
				{
					del(pp);
					count--;
				}
			}
		}
	}

	pp = head->next;

	for(int i = 1; i <= count; i++)
	{
		if (i == count)
		{
			printf("%d\n", pp->num);
		}
		else
		{
			printf("%d ", pp->num);
		}
		pp = pp->next;
	}


	return 0;
}

Measured memory_bytes: 34380
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;


int main(){
    int x, y;
    cin >> x >> y;
    int mini = INF;
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < 2; j++){
            int xx = x, yy = y;
            int cnt = 0;
            if(i == 0){
                xx = -1 * xx;
                cnt++;
            }
            if(j == 0){
                yy = -1 * yy;
                cnt++;
            }
            if(xx <= yy){
                mini = min(mini, yy - xx + cnt);
            }
        }
    }
    cout << mini << endl;
    return 0;
}


Measured memory_bytes: 256
a = list(map(int,input().split()))
N = a[0]
L = a[1]
if L <= 0 and  L + N - 1 >= 0:
    print(int(N*(N - 1 + 2*L)/2))
elif L + N - 1 < 0:
    print(int((N*(N - 1 + 2*L)/2)-(L + N - 1)))
else:
    print(int((N*(N - 1 + 2*L)/2)-L))
    

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  string res = "";
  if(a^b==1){
    res = "Close";
  }else if(b==0 && c==0){
    res = "Close";
  }else{
    res = "Open";
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S, T;
const ll MOD = 998244353;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

int main() {
    cin>>N>>S;
    char last = 'A';
    ll ans = 0;
    rep(i,N){
        if(last != S[i]){
            ++ans;
        }
        last = S[i];
    }
    cout<<ans<<endl;
}

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

using namespace std;

int main(void) {
    string S;
    cin >> S;
    int N = S.size();
    int ans = INT32_MAX;
    for(int i=0; i<N-2; i++) {
        int num = (S[i]-'0')*100 + (S[i+1]-'0')*10 + S[i+2]-'0';
        int diff = abs(num - 753);
        ans= min(ans, diff);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
 
int main(){
    string w;
    cin >> w;
    int index[26];
    for(int i = 0; i < 26; i++){
        index[i] = 0;
    }
    for(int i = 0; i < w.length(); i++ ){
        index[(int)w[i] - 97]++;
    }
    for(int i = 0; i < 26; i++){
        if(index[i] % 2 != 0){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

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

using namespace std;

int main(){
  int a=0;
  string str;
  cin >> str;
  int b=str.size();
  for(int i=0;i!=b;i++){
    if(str[i] == '+'){
      a++;
    }
    else{
      a--;
    }
  }
  cout << a << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (ll)(n); i++)

int main() {
  ll n, m; cin >> n >> m;
  vector <pair <ll, ll>> v(n, pair <ll, ll> ());
  rep(i, n) {
    ll a, b; cin >> a >> b;
    v.at(i) = make_pair(a, b);
  }
  sort(v.begin(), v.end());
  ll res = 0;
  rep(i, n) {
    if (v.at(i).second >= m) {
      res += v.at(i).first * m;
      break;
    } else {
      res += v.at(i).first * v.at(i).second;
      m -= v.at(i).second;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 4736