akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    int n;
    cin >> n;
    int a[n + 1];
    rep(i, n + 1) {
        cin >> a[i];
    }
    ll sum[n + 2] = {};
    for (int i = n; i >= 0; i--) {
        sum[i] = sum[i + 1] + a[i];
    }
    ll ans = 0, now = 1;
    rep(i, n + 1) {
        ans += min(now, sum[i]);
        now -= a[i];
        if(now < 0){
            cout << -1 << endl;
            return 0;
        }
        now = min(now * 2, LINF);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4768
# ------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# ------------------- fast io --------------------
from math import gcd, ceil

def pre(s):
    n = len(s)
    pi = [0] * n
    for i in range(1, n):
        j = pi[i - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] = j
    return pi


def prod(a):
    ans = 1
    for each in a:
        ans = (ans * each)
    return ans

def lcm(a, b): return a * b // gcd(a, b)


def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else "0" * (length - len(y)) + y


for _ in range(int(input()) if not True else 1):
    n = int(input())
    #n, k = map(int, input().split())
    #a, b = map(int, input().split())
    #c, d = map(int, input().split())
    #a = list(map(int, input().split()))
    #b = list(map(int, input().split()))
    #s = input()
    print("Yes" if n>=30 else "No")

Measured memory_bytes: 62972
#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>;
const int INF = 1000000001;

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

int main() {
  ll n;
  cin >> n;
  ll ans = (n - 1) * n / 2;
  cout << ans << endl;
  return 0;
}


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

int N;
int H[100000];

signed main() {
  cin >> N;
  for(int i=0; i<N; i++) cin >> H[i];
  
  int ans = 0;
  int c = 0;
  for(int i=0; i<N-1; i++) {
    if(H[i+1] <= H[i]) c++;
    else c=0;
    ans = max(ans, c);
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
N = int(input())
*A, = map(int, input().split())
B = [0 for _ in range(N)]
ans = []
for i in reversed(range(1, N+1)):
    temp = 0
    for j in range(2*i, N + 1, i):
        temp ^= B[j-1]
    if A[i-1] != temp: B[i-1] = 1; ans.append(i)
print(len(ans))
print(*ans)

Measured memory_bytes: 14132
#include <algorithm>
#include <cstdio>
#include <climits>
#include <queue>
#include <vector>
using namespace std;

int d[10][10];

int main() {
	for (;;) {
		int n; scanf("%d", &n);
		if (n == 0) break;
		for (int u = 0; u < 10; u++)
			for (int v = 0; v < 10; v++)
				d[u][v] = (u == v) ? 0 : (INT_MAX / 2);
		int N = 0;
		for (; n > 0; n--) {
			int a, b, c;
			scanf("%d%d%d", &a, &b, &c);
			d[a][b] = c;
			d[b][a] = c;
			N = max(N, max(a + 1, b + 1));
		}
		for (int k = 0; k < N; k++)
			for (int u = 0; u < N; u++)
				for (int v = 0; v < N; v++)
					d[u][v] = min(d[u][v], d[u][k] + d[k][v]);
		int umin = 0, dmin = INT_MAX;
		for (int u = 0; u < N; u++) {
			int dsum = 0;
			for (int v = 0; v < N; v++)
				dsum += d[u][v];
			if (dsum < dmin) {
				umin = u;
				dmin = dsum;
			}
		}
		printf("%d %d\n", umin, dmin);
	}
}

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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int N;

signed main() {
    cin >> N;
    int ans = 0;
    int cur = 1;
    for (int i = 0; i < 40; i++) {
        if (N & 1 == 1) {
            ans += 1LL << i;
            N -= cur;
        }
        N /= 2;
        cur *= -1;
    }
    if (ans == 0) {
        cout << ans << endl;
        return 0;
    }
    bitset<40> a(ans);
    bool flag = false;
    for (int i = 39; i >= 0; i--) {
        if (a[i])flag = true;
        if (flag)cout << a[i];
    }
    cout << endl;
}


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, m, y, k, z, N;
string s, t, d, c;


// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>s;
	n = s.length();
	for(ll i=1;i<n;i++) {
		if(s[i] == s[i-1]) {
			cout<<i<<" "<<i+1;newl;
			return;
		}
	}
	for(ll i=2;i<n;i++) {
		if(s[i] == s[i-2]) {
			cout<<i-1<<" "<<i+1;newl;
			return;
		}
	}
	cout<<"-1 -1";newl;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 3776
#include <iostream>
#include <cmath>

using namespace std;

int main(){

    int  D,T,S;

    cin >> D >> T>>S;

    double min= 0.0;

    min = (double) D /(double) S;

    if(min <= double(T)){
        cout<<"Yes" <<endl;
    }
    else{
        cout<<"No" <<endl;
    }


}



Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().execute();
	}

	public void execute() {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		final int H = sc.nextInt();
		final int W = sc.nextInt();

		System.out.println(((1 + N - H) * (1 + N - W)));

		sc.close();
	}

}


Measured memory_bytes: 22100
x,y = list(map(int, input().split()))
ans=0
if abs(x) < abs(y):
    if x<0:
        ans+=1
    ans+=abs(y)-abs(x)
    if y<0:
        ans+=1
elif abs(x) > abs(y):
    if x>0:
        ans+=1
    ans+=abs(x)-abs(y)
    if y>0:
        ans+=1
else:
    if x!=y:
        ans+=1
print(ans)

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

int main(){
    int N,A,O=0;
    cin >> N;
    REP(i,N){
        cin >> A;
        if(A%2==1){
            O++;
        }
    }
    if(O%2==1){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(v) v.begin(),v.end()

const int maxn = 1e5 + 100;
const ll inf = 2e18, mod = 1e9 + 7;

int n, m;
vector<int> graph[maxn];
deque<int> ans;
bool visited[maxn], found;

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

	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;

		if (ans.empty()) {
			ans.pb(u);
			ans.pb(v);
			visited[u] = true;
			visited[v] = true;
		}

		graph[u].pb(v);
		graph[v].pb(u);
	}

	while (true) {
		bool flag = false;
		for (int i : graph[ans.front()]) {
			if (!visited[i]) {
				ans.pf(i);
				visited[i] = true;
				flag = true;
				break;
			}
		}
		for (int i : graph[ans.back()]) {
			if (!visited[i]) {
				ans.pb(i);
				visited[i] = true;
				flag = true;
				break;
			}
		}
		if (!flag) {
			break;
		}
	}
	cout << ans.size() << endl;
	for (int i : ans) {
		cout << i + 1 << ' ';
	}
	cout << endl;
}



Measured memory_bytes: 9504
#include <cstdio>
#include <cmath>
int n;
long double x[1005], y[1005], X, Y, d, e;
long double dist(double a, double b) {
    return a*a + b*b;
}
int main() {
    int ggg=scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        int gg=scanf("%Lf %Lf", &x[i], &y[i]);
        X += x[i]; Y += y[i];
    }
    X /= n; Y /= n;
    double P = 0.1;
    for (int i = 0; i < 300000; i++) {
        int f = 0;
        d = dist(X - x[0], Y - y[0]);
        for (int j = 1; j < n; j++) {
            e = dist(X - x[j], Y - y[j]);
            if (d < e) { d = e; f = j; }
        }
        X += (x[f] - X)*P;
        Y += (y[f] - Y)*P;
        P *= 0.999;
    }
    printf("%.6Lf", sqrtl(d));
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(void){
  int N;
  cin >> N;
  int a[N+1];
  int i, j=1;
  for(i=1; i<=N; i++)
    cin >> a[i];

  int count = 0;
  for(i=1; i<=N; i++){
    if(a[i] != j)
      count++;
    else
      j++;
  }

  if(count != N)
    cout << count << endl;    
  else
    cout << "-1"<< endl;
  
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define endl "\n"
 
int32_t main()
{
	fast;
	int n;
	cin>>n;
	vector<int> v(pow(2, n));
	for(int i=0;i<pow(2, n);i++)
	{
		cin>>v[i];
	}
	sort(v.begin(), v.end(), greater<int>());
	vector<int> v1(pow(2, n), 0);
	vector<int> s;
	s.push_back(v[0]);
	v1[0]=1;
	for(int i=0;i<n;i++)
	{
		int sa=s.size();
		int k=0;
		for(int j=0;j<pow(2, n);j++)
		{
			if(k==sa)
				break;
			if(v1[j]==0 && v[j]<s[k])
			{
				// cout<<v[j]<<' '<<s[k]<<endl;
				v1[j]=1;
				k++;
				s.push_back(v[j]);
			}
		}
		if(k<sa)
		{
			cout<<"No"<<endl;
			return 0;
		}
		sort(s.begin(), s.end(), greater<int>());
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 6516
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 //= 2

    else:
        if B % 2 == 1:
            B -= 1
        A += B // 2
        B //= 2

print(A, B)


Measured memory_bytes: 2940
from bisect import bisect_left


def main():
    N, L = map(int, input().split(" "))
    taste = []
    for i in range(N):
        taste.append(L + i)
    taste.sort()
    zero = bisect_left(taste, 0)
    if zero == 0:
        eat = taste[0]
    elif zero == N:
        eat = taste[-1]
    elif abs(taste[zero]) >= abs(taste[zero - 1]):
        eat = taste[zero - 1]
    else:
        eat = taste[zero]
    print(sum(taste) - eat)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
import copy
l = [int(x) for x in input()]
l1 = copy.copy(l)
l2 = copy.copy(l)
c = 0
c1 = 0
for i in range(len(l1)-1):
  if l1[i] == l1[i+1]:
    if l1[i] == 0:
      l1[i+1] = 1
    else:
      l1[i+1] = 0
    c += 1
for i in range(len(l2)-1,0,-1):
  if l2[i] == l2[i-1]:
    if l2[i] == 0:
      l2[i-1] = 1
    else:
      l2[i-1] = 0
    c1 += 1
print(min(c,c1))

Measured memory_bytes: 5912
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<62)-1
#define MAX 1000000000
bool f(int X){
    printf("? %lld\n",X*10);
    char S; cin>>S;
    return S=='Y';
}
void solve(){
    int ans=10;
    while(1){
        printf("? %lld\n",ans-1);
        char S; cin>>S;
        if(S=='Y'){
            printf("! %lld\n",ans/10);
            return;
        }
        ans*=10;
    }
}
signed main(){
    int memo=10;
    while(1){
        printf("? %lld\n",memo);
        string S; cin>>S;
        if(S=="N") break;
        memo*=10;
        if(memo>=1e11){
            solve();
            return 0;
        }
    }
    int left=memo/10,right=memo-1;
    while(left+1<right){
        int mid=(left+right)/2;
        if(f(mid)) right=mid;
        else left=mid;
    }
    int ans=right;
    if(f(left)) ans=left;
    printf("! %lld\n",ans);
}


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

using namespace std;

using ll = long long;

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

    int n;
    string s;
    cin >> n >> s;

    deque<char> deq;
    stack<char> st;
    for (int i = 0; i < n; ++i) {
        if (s[i] == '(') {
            st.push(s[i]);
            deq.push_back(s[i]);
        }
        else {
            if (st.empty()) {
                deq.push_front('(');
                deq.push_back(')');
            }
            else {
                st.pop();
                deq.push_back(')');
            }
        }
    }

    while (!st.empty()) {
        st.pop();
        deq.push_back(')');
    }

    for (char c : deq) cout << c;
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>

using namespace std;

void solve()
{
	string O, E;
	cin >> O >> E;
	string ans = "";
	if (O.size() == E.size())
	{
		for (int i = 0; i < O.size(); ++i)
		{
			ans += O[i];
			ans += E[i];
		}
	}
	else
	{
		for (int i = 0; i < E.size(); ++i)
		{
			ans += O[i];
			ans += E[i];
		}
		ans += O[O.size() - 1];
	}
	cout << ans << endl;
}

int main()
{
	solve();
	return(0);
}

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

using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

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

    size_t N;
    cin >> N;

    vector<int> value(N), cost(N);
    for (auto &vi : value) cin >> vi;
    for (auto &ci : cost) cin >> ci;

    int res = 0;
    for (size_t i = 0; i < N; ++i) {
        int diff = value[i] - cost[i];
        if (diff > 0) res += diff;
    }

    cout << res << "\n";

    return 0;
}


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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

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

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

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

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

//実行部
void Main()
{
  ll n, l; cin >> n >> l;
  ll S = 0;
  vll a(n); rep(i, n) { a[i] = l + i; S += a[i]; }
  vpll flag(n); rep(i, n) { flag[i] = mp(abs(a[i]), a[i]); }
  sort(all(flag));
  fin(S - flag[0].second)
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	if(n-(n&(-n))==0)
	{
		cout<<"No";
		return 0;
	}
	puts("Yes");
	printf("1 2\n2 3\n3 %d\n%d %d\n%d %d\n",n+1,n+1,n+2,n+2,n+3);
	for(int i=4;i+1+n<=2*n;i+=2)
		printf("%d %d\n%d %d\n%d %d\n%d %d\n",1,i,1,i+1,i,i+1+n,i+1,i+n);
	if(n%2==0)
	{
		for(int i=4;i<n;i++)
			if((n^i^1)!=3&&(n^i^1)<n)
			{
				printf("%d %d\n%d %d\n",n,i,2*n,(n^i^1));
				return 0;
			}
	}
	return 0;
}

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

using namespace std;

int main() {
    long long n;
    cin >> n;
    if (n % 2 == 1)cout << 0 << endl;
    else {
        n /= 2;
        long long x = 0;
        while (n > 0) {
            x += n / 5;
            n /= 5;
        }
        cout << x << endl;
    }
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

const inf = 1 << 60

func ri() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func fill(a []int, n int) {
	for i := 0; i < len(a); i++ {
		a[i] = n
	}
	return
}

func smaller(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	sc.Split(bufio.ScanWords)
	n, k := ri(), ri()
	h := make([]int, n+2)
	for i := 0; i < n; i++ {
		h[i] = ri()
	}
	h = append(h, []int{inf, inf}...)
	dp := make([]int, n+10)
	fill(dp, inf)
	dp[0] = 0
	for i := 0; i < n; i++ {
		for j := 1; j <= k && i+j < n; j++ {
			dp[i+j] = smaller(dp[i+j], dp[i]+abs(h[i+j]-h[i]))
		}
	}
	fmt.Println(dp[n-1])
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    char a[200];
    int n,flag=1;
    scanf("%s",a);
    n=strlen(a);
    for(int i=1; i<=(n-1)/2; i++)
        if(a[i-1]!=a[n-i])
        {
            flag=0;
            break;
        }
    if(!flag)
    {
        printf("No");
        return 0;
    }
    for(int i=0; i<(n-1)/2; i++)
        if(a[i]!=a[(n-1)/2-1-i])
        {
            flag=0;
            break;
        }
    if(!flag)
    {
        printf("No");
        return 0;
    }
    for(int i=(n+3)/2-1; i<=n-1; i++)
        if(a[i]!=a[(n+3)/2-1+n-1-i])
        {
            flag=0;
            break;
        }
    if(!flag)
    {
        printf("No");
        return 0;
    }
    printf("Yes");
    return 0;
}



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

using namespace std;
#define X first
#define Y second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define debug(x) cerr << #x << " = " << (x) << endl;
template<typename T>
ostream& operator<<(ostream& o, vector<T>& v) {
    for (auto& x : v) o << x << ' ';
    return o;
}

vvi adj;
vi vis;
int dfs(int u){
    int sz = 1;
    vis[u] = 1;
    for (int v : adj[u]){
        if (vis[v] == 0){
            sz += dfs(v);
        }
    }
    return sz;
}

int main(){
    std::ios_base::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    vi arr(n), brr(n);
    for (int i = 0; i < n; i++) cin >> arr[i];
    for (int i = 0; i < n; i++) cin >> brr[i];

    map<int, int> mmap;
    int xval = 0;
    for (int i = 0; i < n; i++){
        xval ^= arr[i];
        mmap[arr[i]]++;
    }
    mmap[xval]++;
    int oldval = xval;

    xval = 0;
    for (int i = 0; i < n; i++){
        xval ^= brr[i];
        mmap[brr[i]]--;
    }
    mmap[xval]--;
    map<int, int> indx;
    int id=0;
    for (auto &it : mmap){
        if (it.Y != 0) {
            cout << -1 << endl;
            return 0;
        }
        indx[it.X] = id++;
    }

    arr.push_back(oldval);
    brr.push_back(xval);

    vis.assign(id, 0);
    adj.resize(id);

    int res = -1;
    for (int i = 0; i <= n; i++){
        if (arr[i] != brr[i] || i == n){
            adj[ indx[arr[i]] ].push_back( indx[brr[i]] );
            if (i < n) res++;
        }
    }

    for (int i = 0; i < id; i++){
        if (vis[i] == 0) {
            res += (dfs(i) > 1 || indx[oldval] == i);
        }
    }

    cout << max(res, 0) << endl;
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

int root[SIZE];

void init() {
    for( int i = 0; i < SIZE; ++i ) {
        root[i] = i;

    }
}

int Root( int x ) {
    if( x == root[x] ) return x;
    return root[x] = Root( root[x] );

}

bool Unite( int x, int y ) {
    int rx, ry;
    rx = Root( x );
    ry = Root( y );

    if( rx == ry ) return false;
    if( rx < ry ) {
        root[ry] = rx;

    } else {
        root[rx] = ry;

    }
    return true;

}

vector<LL> tree[SIZE];

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

    int N;
    cin >> N;

    LL res = 0;
    for(LL i = 0; i < N; ++i) {
        res += (i + 1) * (N - i);
    }

    for(LL i = 0; i < N - 1; ++i) {
        LL a, b;
        cin >> a >> b;
        a--;
        b--;
        if(a > b) swap(a, b);
        res -= (a + 1) * (N - b);
    }
    cout << res << endl;

    return 0;
}



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

using namespace std;
using ll = long long;

ll gcd(ll a,ll b){while(a&&b){if(a>b) a = a%b;else b = b%a;}return a+b;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}

int main()
{
    int n; cin >> n;
    cout << lcm(n, 2) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;
#define rep(n) for( int i = 0 ; i < n ; i++ )
#define REP(n) for( int i = 1 ; i <= n ; i++ )
#define repll(n) for( ll i = 0 ; i < n ; i++ )
#define REPll(n) for( ll i = 1 ; i <= n ; i++ )
#define rep2(n) for( int j = 0 ; j < n ; j++ )
#define REP2(n) for( int j = 1 ; j <= n ; j++ )
#define repll2(n) for( ll j = 0 ; j < n ; j++ )
#define REPll2(n) for( ll j = 1 ; j <= n ; j++ )

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n , k;
    cin >> n >> k;
    int a[n];
	int c = 1000000000;
	for( int i = 0 ; i < n ; i++ ) cin >> a[i];
	for( int i = 0 ; i < n - k + 1 ; i++ ) c = min( c , a[i + k - 1] - a[i] + min( abs( a[i] ) , abs( a[i + k - 1] ) ) );
    cout << c;
}

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

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

using namespace std;

using ll = long long;

template<class Integer>
std::vector<Integer> divisors(Integer n) {
    std::vector<Integer> ds;
    for (Integer i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            Integer j = n / i;
            ds.push_back(i);
            if (j > i) {
                ds.push_back(j);
            }
        }
    }
    return ds;
}

int main() {
    ll N;
    cin >> N;
    auto ds = divisors(N);
    ll result = LLONG_MAX;
    for (ll d: ds) {
        result = min(result, d + N / d - 2);
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 384
#include <cstdio>

int main()
{
  char s[1001];
  scanf("%s", s);
  int x = 1, y = 1;
  for (char *p = s; *p; ++p)
  {
    switch (*p)
    {
      case 'N':
        if ((y & 4) == 0) y = 2;
        else y = 7;
        break;
      case 'S':
        if ((y & 2) == 0) y = 4;
        else y = 7;
        break;
      case 'E':
        if ((x & 4) == 0) x = 2;
        else x = 7;
        break;
      case 'W':
        if ((x & 2) == 0) x = 4;
        else x = 7;
        break;
    }
  }
  puts((y & x & 1) == 1 ? "Yes" : "No");
  return 0;
}


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

int main(){
    int n;
    cin>>n;
    map<string,int> mp;
    int ans=0;
    rep(i,n){
        string s;
        cin>>s;
        if(mp[s]==0){
            ans++;
        }
        mp[s]+=1;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
  
  int n,k; cin>>n>>k;
  vector<int> a(n);
  for(auto &i:a) cin>>i;
  --k; --n;
  cout << (n+k-1)/k << endl;
  
}


Measured memory_bytes: 3784
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    c = collections.defaultdict(int)
    for _ in range(n):
        c[S()] += 1
    m = I()
    for _ in range(m):
        c[S()] -= 1

    return max(0, max(c.values()))


print(main())




Measured memory_bytes: 5716
import java.util.TreeSet;
import java.util.Scanner;
import java.util.Iterator;

class Elem implements Comparable<Elem> {
	public int a_, n_, idx_;
	public Elem (int a, int n, int idx) {
		a_ = a;
		n_ = n;
		idx_ = idx;
	}
	public int compareTo (Elem o) {
		if (a_ != o.a_)
			return a_ - o.a_;
		return idx_ - o.idx_;
	}
}

public class Main {

	public static void main (String[] args) {
		int N;
		long K;
		Scanner sc = new Scanner (System.in);
		N = sc.nextInt ();
		K = sc.nextLong ();
		TreeSet<Elem> set = new TreeSet<Elem> ();
		for (int i=0; i<N; i++) {
			int a = sc.nextInt ();
			int b = sc.nextInt ();
			set.add (new Elem (a, b, i));
		}
		Iterator<Elem> iter = set.iterator ();
		long sum = 0;
		while (iter.hasNext ()) {
			Elem e = iter.next ();
			sum += e.n_;
			if (sum>=K) {
				System.out.println (e.a_);
				break;
			}
		}
	}
}

Measured memory_bytes: 89744
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n; i++)
#define all(v) (v).begin(), (v).end()
#define decimal fixed << setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
const int INF = 1e9;
const LL LLINF = 1e16;

template< int mod >
struct ModInt{
    int x;

    ModInt() : x(0) {}
    ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

    ModInt &operator+=(const ModInt &p){
        if((x += p.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator-=(const ModInt &p){
        if((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator*=(const ModInt &p)
    {
        x = (int) (1LL * x * p.x % mod);
        return *this;
    }

    ModInt &operator/=(const ModInt &p)
    {
        *this *= p.inverse();
        return *this;
    }

    ModInt operator-() const { return ModInt(-x); }

    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

    bool operator==(const ModInt &p) const { return x == p.x; }

    bool operator!=(const ModInt &p) const { return x != p.x; }

    ModInt inverse() const
    {
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) {
        t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
        }
        return ModInt(u);
    }

    friend ostream &operator<<(ostream &os, const ModInt< mod > &p)
    {
        return os << p.x;
    }

    friend istream &operator>>(istream &is, ModInt< mod > &a)
    {
        long long x;
        is >> x;
        a = ModInt< mod >(x);
        return (is);
    }

};

const int mod = 1e9 + 7;
using modint = ModInt< mod >;

modint dp[220][10101];

int main(){
    int n, w;
    cin >> n >> w;
    vector<int> a(n+1);
    rep(i, n) cin >> a[i];
    a[n] = INF;
    sort(all(a));
    dp[0][0] = 1;
    rep(i, n){
        rep(k, i)for(int j=w; j >=0; j--){
            if(j+a[i] <= w) dp[k][j+a[i]] += dp[k][j];
        }
        rep(j, w+1){
            if(j+a[i] <= w) dp[i+1][j+a[i]] += dp[i][j];
        }
    }
    modint ans = 0;
    rep(i, n+1){
        rep(j, w+1){
            if(j + a[i] > w) ans += dp[i][j];
            // cout << dp[i][j] << " ";
        }
        // cout << endl;
    }
    cout << ans << endl;

}



Measured memory_bytes: 11856
#include<iostream>
#include<vector>
#include<queue>
using namespace std;

int main() {
	long long N{}, M{};
	cin >> N >> M;

	priority_queue<int> price;
	for (size_t i = 0;i < N;++i) {
		int temp;
		cin >> temp;
		price.push(temp);
	}

	for (size_t i = 0;i < M;++i) {
		int temp = price.top();
		price.pop();
		price.push(temp / 2);

	}

	long  long total = 0;
	for (size_t i = 0;i < N;++i) {
		total += price.top();
		price.pop();
	}
	cout << total << endl;

}

Measured memory_bytes: 892
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

int main() {
    string s;
    cin>>s;
    int cnt=0;
    for(int i=0;i<s.size();i++){
        if(s.at(i)=='S'){
            cnt++;
        }
        else{
            int x=cnt;
            x--;
            cnt=max(0,x);
        }
    }
    cout<<2*cnt<<endl;





    return 0;
}


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

using namespace std;

const int MAX = 1e6;
 
bool prime[MAX];
 
void make(){
    fill(prime,prime+MAX,true);
   
    prime[0] = prime[1] = false;
    for(int i = 2 ; i*i < MAX ; i++){
	if(prime[i]){
	    for(int j = i*i ; j < MAX ; j += i){
		prime[j] = false;
	    }
	}
    }
}
 
int main(){
    int n,p;
 
    make();
    while(true){
	cin >> n >> p;
	if(n == -1 && p == -1) break;
 
	vector<int> v;
	for(int i = n+1 ; i < n+500 ; i++){
	    if(prime[i]) v.push_back(i);
	}
 
	vector<int> ans;
	for(int i = 0 ; i < (int)v.size() ; i++){
	    for(int j = i ; j < (int)v.size() ; j++){
		ans.push_back(v[i]+v[j]);
	    }
	}
	sort(ans.begin(),ans.end());
 
	cout << ans[p-1] << endl;
    }  
    return 0;
}

Measured memory_bytes: 4092
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(int i=0,i##_len=(n); i<i##_len; ++i)
#define srep(i,s,t) for(int i=(s);i<(t);++i)
#define rng(obj) (obj).begin(), (obj).end()
#define maxs(x,y) (x=max((x),(y)))
#define mins(x,y) (x=min((x),(y)))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x=max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T>>
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vp = vector<P>;
inline int in() { int x; cin>>x; return x;}
template <class T> inline istream& operator>>(istream&i,v(T)&v)
{ rep(j,sz(v))i>>v[j];return i;}
template <class T> string join(const v(T)&v)
{ stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template <class T> inline ostream& operator<<(ostream&o,const v(T)&v)
{ if(sz(v))o<<join(v); return o;}
template <class T1,class T2> inline istream& operator>>(istream&i ,pair<T1,T2>&v)
{ return i>>v.fi>>v.se;}
template <class T1,class T2> inline ostream& operator<<(ostream&o ,pair<T1,T2>&v)
{ return o<<v.fi<<","<<v.se;}
template <class T> inline ll suma(const v(T)& a) 
{ ll res(0); for(auto&& x:a) res += x; return res;}
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const double eps = 1e-10;
#define dame {puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;
#define fileio ifstream inputfile( argv[1] ); cin.rdbuf(inputfile.rdbuf());
//----------------------------------------------------------------
int main(int argc,char* argv[]){
 //   fileio
    vi dp(MX,INF);
    int n = in();
    vi h(n);
    cin>>h;
    h.pb(INF);
    h.pb(INF);
    dp[0] = 0;
    rep(i,n){
        mins(dp[i+1], dp[i]+abs(h[i]-h[i+1]));
        mins(dp[i+2], dp[i]+abs(h[i]-h[i+2]));
    }
    cout<<dp[n-1]<< endl;
}

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

#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

string N;
int dp[1100000][2];
signed main() {
    cin >> N;
    rep(i, 1100000)rep(j, 2) { dp[i][j] = INT_MAX; }
    dp[0][0] = 0;
    rep(i, N.size()) {
        chmin(dp[i + 1][0], dp[i][0] + N[i] - '0');
        if (N[i] != '9') { chmin(dp[i + 1][0], dp[i][1] + N[i] - '0' + 1); }
        if (N[i] != '0') { chmin(dp[i + 1][1], dp[i][0] + 10 - (N[i] - '0')); }
        chmin(dp[i + 1][1], dp[i][1] + 10 - (N[i] - '0' + 1));
    }
    cout << min(dp[N.size()][0], dp[N.size()][1] + 1) << endl;
}

Measured memory_bytes: 18564
#include<iostream>
using namespace std;
int f[300010];
int V,n;
int main()
{
	cin>>V;
	int w[7]= {0,100,101,102,103,104,105};
	int c[7]= {0,100,101,102,103,104,105};
//    for(int i=1; i<=n; i++)
//    {
//        scanf("%d%d",&w[i],&c[i]);
//    }
	for(int i=1; i<=6; i++)
		for(int j=w[i]; j<=V; j++)//注意此处，与0-1背包不同，这里为顺序，0-1背包为逆序
			f[j]=max(f[j],f[j-w[i]]+c[i]);
	if(f[V]==V) cout<<1<<endl;
	else cout<<0<<endl;
	return 0;
}

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

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        int d = Integer.parseInt(sc.next());
        sc.close();

        if (Math.abs(a - c) <= d || (Math.abs(a - b) <= d && Math.abs(b - c) <= d)) {
            out.printf("Yes\n");
        } else {
            out.printf("No\n");
        }
        out.flush();
    }
}


Measured memory_bytes: 21716
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include<algorithm>
#include <numeric>
using namespace std;

int main(){
  string S,T;
  cin >> S;
  cin >> T;
  bool flag=false;
  for(int i=0;i<S.size();i++){
   S=S[S.size()-1]+S;
    S.pop_back();
    if(S==T) flag=true;
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
 
     String[] nyu=sc.nextLine().split(" ");

//     String nyu=sc.nextLine();
int A=Integer.parseInt(nyu[0]);
int B=Integer.parseInt(nyu[1]);
//int C=Integer.parseInt(nyu[2]);
//int D=Integer.parseInt(nyu);

//StringBuffer sb = new StringBuffer(nyu);
//		String dst = sb.reverse().toString();

//     String nyu2=sc.nextLine();
//int E=Integer.parseInt(nyu2);



//double A=Double.parseDouble(nyu[0]);
//double B=Double.parseDouble(nyu[1]);
/*
switch(C){
case 7:
case 5:
case 3:
System.out.println("YES") ;
break;
default:
System.out.println("NO") ;

break;
}
*/

//int res=Math.min((A*B),C);

//for(String tem:nyu){
//if(tem.equals("1"))res++;
//}
//int res=0;
//for(int i=0;i<300;i++){
//if(num[i]==1)res=i;
//}

//char[] c = nyu.toCharArray();


//System.out.println(nyu+"-"+line_r_2+"-"+nyu2+"-"+line_r_1);



if(A+B>=10){
//double res=Math.ceil((AB)/2);

System.out.println("error");
//}else if((C-B)<A){
//System.out.println("safe");

}else{
System.out.println(A+B);

}




	}
}

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

int main(){
  ll N; cin >> N;
  string S; cin >> S;
  
  ll Q; cin >> Q;
  // O(NQ)で答えられれば十分
  
  for(ll i = 0; i < Q; i++){ 
    ll k; cin >> k;
    
    ll ans = 0;
    
    ll d = 0,m = 0,dm = 0;
    
    for(ll j = 0; j < N; j++){
      
      if( j >= k ){ //除去する必要性が出てくる
        if( S[j-k] == 'D'){ d--; dm -= m;}
        if( S[j-k] == 'M'){ m--; }
      }
      
      if( S[j] == 'D'){ d++;}
      if( S[j] == 'M'){ dm += d; m++;}
      if( S[j] == 'C'){ ans += dm;}
      
    }
    
    cout << ans << endl;
    
  }
  
  return 0;
}
        


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

#define INF 1000000010
#define INFLL ((1LL<<62)-5)
#define FO(i,a,b) for (int (i) = (a); (i) < (b); ++(i))
#define sz(v) int(v.size())

using namespace std;
//PAIRS:
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pii;
typedef long long ll;

/*~~~~TEMPLATE END~~~~*/

int N;
ll L, a[100005];


int main() {
    scanf ("%d %lld", &N, &L);
    FO (i,1,N+1) scanf ("%lld", &a[i]);
    FO (i,1,N) {
        if (a[i] + a[i+1] >= L) {
            printf ("Possible\n");
            FO (p,1,i) {
                printf ("%d\n", p);
            }
            for (int p = N-1; p >= i+1; p--) {
                printf ("%d\n", p);
            }
            printf ("%d\n", i);
            return 0;
        }
    }
    printf ("Impossible\n");
    return 0;
}


Measured memory_bytes: 1536
def bSort(a):
    for i in range(len(a)):
        for j in range(len(a)-1, i, -1):
            if a[j] > a[j-1]:
                a[j], a[j-1] = a[j-1], a[j]

    return a

n = int(input())
list = [int(i) for i in input().split()]

d = bSort(list)


A = 0
B = 0

for i in range(n):
    if i % 2 == 0:
        A += d[i]
    else:
        B += d[i]
        
print(A-B)

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

using namespace std;

int main() {
    cin.sync_with_stdio(false);

    string s;
    cin >> s;

    int price = 700;
    if (s[0] == 'o')
        price += 100;
    if (s[1] == 'o')
        price += 100;
    if (s[2] == 'o')
        price += 100;

    cout << price << endl;

    return 0;
}

Measured memory_bytes: 764
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
// point**10^100 回は偶数回
int main(void){
    char str[1000000];
    int **num;
    scanf("%s", str);
    int N = strlen(str);
    num = (int **)calloc(2, sizeof(int*));
    for(int i=0; i<2; i++)
        num[i] = (int *)calloc(N, sizeof(int));
    int m=0;
    int i=0;
    int k=0;
    int j=0;
    while(str[i]!='\n'){
        if(m==1){
            if(str[i]=='R'){
                num[0][j]=k;
                j++;
                k=0;
                m=0;
            }
        }
        if(str[i]=='L'&& m==0) {m=1;num[1][j]=i;}
        k++;
        i++;
    }
    i=0;
    int sum=0;
    while(num[0][i]!=0){
        sum+=num[0][i];
        i++;
    }
    num[0][j]=N-sum;
    int size_num=j+1;
    int *array;
    array = (int *)calloc(N, sizeof(int));
    for(int j=0; j<N; j++)
        array[j]=0;

    for(int k=0,j=0; k<size_num; k++){
        for(int i=0; i<num[0][k]; i++){
            if(abs(num[1][k]-j)%2==1){
                array[num[1][k]-1]++;
            }
            if(abs(num[1][k]-j)%2==0){
                array[num[1][k]]++;
            }
            j++;
        }
    }
    for(int i=0; i<N; i++)
        printf("%d ", array[i]);
    putchar('\n');
    return 0;
}


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

#define pb push_back
#define S second
#define F first
#define sz size()
#define eps 0.000001
#define oo 2000000007
#define endl '\n'
#define bg begin()
#define nd end()
#define up upper_bound
#define lw lower_bound
#define debug(x) #x << " = " << x << "; "
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;


int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s, p;
	cin >> s >> p;
	int n = s.size(), m = p.size();
	int dp[n+1][m+1];
	for(int i = 0; i <= n; i++){
		for(int j = 0; j <= m; j++){
			if (i == 0 || j == 0) dp[i][j] = 0;
    		else if (s[i - 1] == p[j - 1]){
    			dp[i][j] = dp[i - 1][j - 1] + 1;
    		}
    		else dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);	
		}
	}
	stack<char> rb;
	int ans = dp[n][m];
	for(int i = n; i >= 1; i--){
		for(int j = m; j >= 1; j--){
			if(s[i - 1] == p[j - 1] && ans == dp[i - 1][j - 1] + 1){
				rb.push(s[i-1]);
				ans--;
				break;
			}
		}
	}
	while(rb.size()){
		cout << rb.top();
		rb.pop();
	}
	cout << endl;
	
}

Measured memory_bytes: 35456
/* Start coding only after you have clear idea.*/
#pragma GCC optimize(2)
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <iomanip>
#include <set>
using namespace std;
typedef long long ll;
const int N = 2e5 + 11;
#define inf 2000000007
#define mod 1000000007
#define IosF ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

void D() {
  ll x, res = 0;
  cin >> x;
  string s;
  cin >> s;
  res = x * 100 * (s[0] - 48);
  res += x * 10 * (s[2] - 48);
  res += x * (s[3] - 48);
  res /= 100;
  cout << res << endl;
}
int main() {
    IosF;
 	D();	
	return 0;
}

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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const long long INF = 1LL << 60;

int main()
{
    int N;
    cin >> N;
    long long dp[N+1];
    rep(i, N+1) dp[i] = INF;
    dp[0] = 0;

    vector<int> cost = {1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049};

    repd(i, 1, N+1) {
        rep(j, cost.size()) {
            if (i >= cost[j]) chmin(dp[i], dp[i - cost[j]] + 1);
        }
    }

    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 1024
//* AuThOr GaRyMr *//
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define ff fflush(stdout)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int n,m;
int a[1000+10];
vector<int> each[1000+10];
int dp[8192];
int main(){	
	cin>>n>>m;
	rb(i,1,m){
		cin>>a[i];
		int bi;
		cin>>bi;
		rb(j,1,bi){
			int ci;
			scanf("%d",&ci);
			each[i].PB(ci);
		}
	}
	memset(dp,0x3f,sizeof(dp));
	dp[0]=0;
	int upp_=(1<<(n))-1;
//	cout<<upp_<<endl;
	rb(mask,0,upp_){
		rb(i,1,m)
		{
			int is=mask;
			for(auto it:each[i]){
				is|=(1<<(it-1));
			}
//			cout<<mask<<endl;
			dp[is]=min(dp[is],dp[mask]+a[i]);
		}
	}
	cout<<(dp[upp_]==INF? -1:dp[upp_]);
	return 0;
}


Measured memory_bytes: 384