akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,a[200009],ans=0;
	string s;
	cin>>s;
	n=s.size();
	for(int i=0;i<n-1/2;i++)
	{
		if(s[i]!=s[n-i-1])
			ans=1;
	}
	int j=0;
	for(int i=0;i<(n-1)/2;i++)
	{
		if(s[i]!=s[(n-1)/2-1-j])
			ans=1;	
		j++;
	}
	j=0;
	for(int i=((n+3)/2)-1;i<n;i++)
	{
		if(s[i]!=s[(n-1-j)])
		{
			ans=1;	
		}
		j++;
	}
	if(ans==0)
		cout<<"Yes";
	else
		cout<<"No";
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
//#pragma gcc optimize("Ofast, unroll-loops")
//#pragma gcc target("sse, sse2, sse3, ssse3, sse4, popcnt, abm, mmx, avx, avx2, tune = native")

using namespace std;

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

    string s;
    cin >> s;
    
    for (int i = 0; i < s.size(); i++)
        cout << 'x';
    cout << '\n';

    return 0;
}

//      *   *  *****  *   *  *   *
//     *   *  *      **  *  *   *
//    *****  *****  * * *  *   *
//   *   *      *  *  **  *   *
//  *   *  *****  *   *   ***

//      ***** ***** *   * *     ***** *   * ***** *****
//        *  *   * *   * *       *   **  *   *   *   *
//       *  *   * ***** *       *   * * *   *   *****
//   *  *  *   *   *   *       *   *  **   *   *
//  ****  *****   *   ***** ***** *   *   *   *


Measured memory_bytes: 256
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

int main(){
  ll N,D;
  cin >> N >> D;
  ll x,y;
  ll ans=0;
  for(ll i=0;i<N;++i){
    cin >> x >> y;
    if(x*x+y*y<=D*D) ++ans;
  }

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


Measured memory_bytes: 3628
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
using namespace std;
long long read(){
    long long xx=0,flagg=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
int n,q,i,j,x,y,book[300005],V[300005],W[300005],f[20][300005];
int ans[100005];
int top,qu[100005],nex[100005],to[100005],fir[300005];
void lj(int u,int v,int w){
	top++;
	nex[top]=fir[u];
	fir[u]=top;
	to[top]=v;
	qu[top]=w;
}
int maxx(int u,int v){
	return u>v?u:v;
}
void ss3(int w,int v,int sum){
	if(book[w]==9){
		ans[i]=maxx(ans[i],f[9][v]+sum);
		return;
	}
	ss3(w>>1,v,sum);
	if(v>=W[w])
		ss3(w>>1,v-W[w],sum+V[w]);
}
void ss2(int w){
	for(int top1=fir[w];top1;top1=nex[top1]){
		i=qu[top1];
		ss3(w,to[top1],0);
	}
	if(w*2<=n)
		ss2(w*2);
	if(w*2+1<=n)
		ss2(w*2+1);
}
void ss(int w){
	int k=book[w];
	for(i=1;i<W[w];i++)
		f[k][i]=f[k-1][i];
	for(i=W[w];i<=100000;i++)
		f[k][i]=maxx(maxx(f[k][i-1],f[k-1][i]),f[k-1][i-W[w]]+V[w]);
	for(int top1=fir[w];top1;top1=nex[top1])
		ans[qu[top1]]=f[k][to[top1]];
	if(book[w]<9){
		if(w*2<=n)
			ss(w*2);
		if(w*2+1<=n)
			ss(w*2+1);
	}
	else
		ss2(w);
}
int main(){
	n=read();
	for(i=1;i<=n;i++){
		book[i]=book[i>>1]+1;
		V[i]=read();
		W[i]=read();
	}
	q=read();
	for(i=1;i<=q;i++){
		x=read();y=read();
		lj(x,y,i);
	}
	ss(1);
	for(i=1;i<=q;i++)
		pus(ans[i],2);
    return 0;
}

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

using namespace std;

const int maxn = 100010;

vector<int> g[maxn];
bool vis[maxn];
int dis[maxn];
int n, m;

int cnt;
bool odd;
void bfs(int s) {
	cnt = 0;
	odd = false;
	dis[s] = 0;
	vis[s] = true;
	queue<int> q; q.push(s);
	while(!q.empty()) {
		s = q.front(); q.pop();
		cnt += 1;
		for(auto x: g[s]) if(!vis[x]) {
			vis[x] = true;
			dis[x] = dis[s] + 1;
			q.push(x);
		} else if((dis[s] ^ dis[x] ^ 1) & 1) {
			odd = true;
		}
	}
}

int main() {
	scanf("%d%d", &n, &m);
	for(int i = 0; i < m; ++i) {
		int u, v; scanf("%d%d", &u, &v);
		g[u].push_back(v);
		g[v].push_back(u);
	}

	long long ans = 0;
	int bk0 = 0, bk1 = 0, bb = 0;
	for(int i = 1; i <= n; ++i) if(!vis[i]) {
		bfs(i);
		if(cnt == 1) {
			bb++;
		} else {
			odd ? bk1 ++ : bk0 ++ ;
		}
	}
	ans = 2ll * (n - bb) * bb + 1ll * bb * bb;
	ans += 2ll * bk0 * bk0;
	ans += 2ll * bk0 * bk1;
	ans += 1ll * bk1 * bk1;
	cout << ans << endl;
	return 0;
}


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

typedef long long ll;

int main() {
    //freopen("in.txt", "r",stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin>>n;

    vector<pair<ll, ll> > v(n);
    ll a, b;
    for (int i=0;i<n;++i){
        cin>>a>>b;
        v[i] = make_pair(b,a);
    }
    sort(v.begin(), v.end());

    ll sum = 0;
    bool isOk = true;
    for (auto e : v){
        sum += e.second;
        if (sum>e.first){
            isOk = false;
            break;
        }
    }
    if (isOk) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 3456
#include <iostream>
using namespace std;
 
int main() {
    int n,m;
    cin >> n >> m;

    int a[100][100] = {};
    int b[100]={};
    int ans[100]={};
    int tmp[100]={};

    for (int i = 0; i < n; ++i){
        for (int j = 0; j<m; ++j){
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < m; ++i){
        cin >> b[i];
    }

    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j<m; ++j){
            tmp[j] = a[i][j] * b[j];
            ans[i] += tmp[j];
        }
    }

    for (int i = 0; i < n; ++i)
    {
        cout << ans[i] << endl;
    }

    return 0;
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>

using namespace std;

typedef long long ll;

int main() {
  string s, ans;
  cin >> s;
  rep(i, s.size()) {
    if (ans.size() > 0 && s[i] == 'B')
      ans = ans.erase(ans.size() - 1);
    else if (s[i] != 'B')
      ans += s[i];
  }
  cout << ans << endl;
  return 0;
}

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

#include <boost/operators.hpp>

class modint : private boost::operators<modint>, private boost::equivalent<modint> {
  modint(const long long x, const bool y)
      : x(x) {}

 public:
  static long long M;
  long long x;
  modint(const long long x = 0)
      : x((x % M + M) % M) {}
  modint operator-() const { return modint(x ? M - x : 0, true); }
  modint& operator+=(const modint& b) { return ((x += b.x) >= M ? x -= M : 0), *this; }
  modint& operator++() { return (++x >= M ? x -= M : 0), *this; }
  modint& operator-=(const modint& b) { return ((x -= b.x) < 0 ? x += M : 0), *this; }
  modint& operator--() { return (--x < 0 ? x += M : 0), *this; }
  modint& operator*=(const modint& b) { return x = x * b.x % M, *this; }
  modint& operator/=(const modint& b) { return *this *= b.pow(-1); }
  modint pow(long long b) const {
    long long r = 1, a = x;
    b = (b % (M - 1) + (M - 1)) % (M - 1);
    while (b) {
      if (b & 1) r = r * a % M;
      b = b >> 1;
      a = a * a % M;
    }
    return modint(r, true);
  }
  friend bool operator<(const modint& a, const modint& b) { return a.x < b.x; }
  friend std::istream& operator>>(std::istream& s, modint& a) { return s >> a.x, a = a.x, s; }
  friend std::ostream& operator<<(std::ostream& s, const modint& a) { return s << a.x; }
};
long long modint::M = 1000000007;

// #LIB#

using namespace std;
using ll = long long;
#define double long double
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repr(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(x, c) for (auto&& x : (c))
#define updatemax(t, v) ((t) = std::max((t), (v)))
#define updatemin(t, v) ((t) = std::min((t), (v)))
#define endl _endl
const char _endl = (cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout.precision(16), '\n');

int main() {
  string l;
  cin >> l;
  ll len = l.size();
  vector<bool> bit(len);
  rep(i, len) bit[i] = l[i] == '1';
  vector<vector<modint>> dp(len + 1, vector<modint>(2));
  dp[0][1] = 1;
  rep(i, len) rep(j, 2) {
    dp[i + 1][j & !bit[i]] += dp[i][j];              // 0
    if (!j || bit[i]) dp[i + 1][j] += dp[i][j] * 2;  // 1
  }
  cout << dp[len][0] + dp[len][1] << endl;
}


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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b,x; cin>>a>>b>>x;
	cout << (a<=x&&x<=a+b ? "YES":"NO") << endl;
	return 0;
}


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

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = (long long)1e9 + 7; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int X, t;
	
	cin>>X>>t;
	
	cout<<max(X-t,0ll)<<endl;
	
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main(){
    int a,b,t;
    cin >> a >> b >> t;
    cout << (t / a) * b << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <functional>
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
 
int main () {
  string s;
  cin >> s;
  int n;
  n = (int) s.length();
  bool f = true;
  int i = 0;
  while (i < (n+1)/2-1 && f){
    if (s[i] != s[n-1-i] || s[i] != s[(n-3)/2-i]){
      f = false;
    }
    i ++;
  }
  if (f){
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <complex>
#include <cassert>
using namespace std;

typedef complex<double> point;
typedef vector<point> polygon;

struct line : public vector<point> {
	line(point a, point b) { push_back(a); push_back(b); }
};

const double eps = 1e-10;
bool   equal(const double a, const double b) { return abs(a-b)<eps; }
bool   equal(const point& a, const point& b) { return abs(a-b)<eps; }
double dot  (const point& a, const point& b) { return (a*conj(b)).real(); }
double cross(const point& a, const point& b) { return (conj(a)*b).imag(); }
point  vec  (const line&  l)                 { return l[1]-l[0]; }
point  ortho(const point& v)                 { return v*point(0,1); }

int ccw(const point& a, const point& b, const point& c) {
	point u=b-a, v=c-a;
	if(cross(u,v) > 0 ) return +1; // ccw
	if(cross(u,v) < 0 ) return -1; // cw
	if(  dot(u,v) < 0 ) return +2; // cab
	if(norm(u)<norm(v)) return -2; // abc
	return 0;                      // acb
}

int ccw(const line& s, const point& p) {
	return ccw(s[0], s[1], p);
}

point crosspoint(const line& l, const line& m) {
	double A = cross(vec(l), vec(m));
	double B = cross(vec(l), l[1]-m[0]);
	if(abs(A)<eps) {			// parallel
		assert(abs(B)<eps);
		return m[0];			// sameline
	}
	return m[0] + B/A*vec(m);
}

polygon convex_cut(const polygon& g, const line& l, int f=0) {
	polygon h;
	const line m(l[f%2], l[(f+1)%2]);
	for(int i=0; i<g.size(); i++) {
		const point& a = g[i];
		const point& b = g[(i+1)%g.size()];
		if(ccw(m,a) != -1) h.push_back(a);
		if(ccw(m,a)*ccw(m,b) < 0) {
			point p = crosspoint(line(a,b), m);
			if((!equal(a,p)) && (!equal(b,p))) {
				h.push_back(p);
			}
		}
	}
	return h;
}

double area(const polygon& g) {
	double s=0;
	for(int i=0; i<g.size(); i++) {
		s += cross(g[i], g[(i+1)%g.size()]);
	}
	return s/2;
}

int main()
{
	int a,b,c,d,e,f,n=0;
	while(cin>>a>>b>>c>>d>>e>>f, a||b||c||d||e||f) {
		polygon g;
		g.push_back(point(    0,    0));
		g.push_back(point(10000,    0));
		g.push_back(point(10000,10000));
		g.push_back(point(    0,10000));

		point p,v;
		v = point(c-a, d-b);
		p = point(c+a, d+b)/2.0;
		g = convex_cut(g, line(p, p+ortho(v)));
		v = point(e-a, f-b);
		p = point(e+a, f+b)/2.0;
		g = convex_cut(g, line(p, p+ortho(v)));

		cout.setf(ios::fixed);
		cout.precision(8);
		cout << ++n << " " << area(g)/(100000000) << endl;
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 1

typedef long long ll;

const double pi = 3.141592653589793;
const long long MOD = 1e9 + 7;
const long long INF = 1e15;

int main(){
    ll L,R;
    cin >> L >> R;
    ll mini = INF;
    if(R - L + 1 >= 2019){
        cout << 0 << endl;
        return 0;
    }
    else{
        for(ll l = L; l <= R; l++){
            for(ll r = l+1; r <= R; r++){
                mini = min(mini, (l % 2019) * (r % 2019) % 2019);
            }
        }
    }
    cout << mini << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
 
class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		while(true){
			var d=ria();
			if(d[0]==0&&d[1]==0)return;
			int N=d[0];int r=d[1];
			int[] A=new int[N];
			int[] B=new int[N];
			for(int i=0;i<N;i++){
				A[i]=N-i;
			}
			for(;r>0;r--){
				d=ria();
				int p=d[0];int c=d[1];
				for(int j=p-1;j<p-1+c;j++)B[j-(p-1)]=A[j];
				for(int j=0;j<p-1;j++)B[c+j]=A[j];
				for(int j=0;j<p-1+c;j++)A[j]=B[j];
			}
			Console.WriteLine(A[0]);
		}
	}

	public Sol(){
	}




	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}

Measured memory_bytes: 5808
n = gets.to_i
a = gets.chomp.split.map(&:to_i)

first_array = []
last_array = []
n.times do |i|
  j = n - i - 1
  if i == 0
    first_array[0] = a[i]
    last_array[0] = a[j]
    next
  end

  first_new = first_array[i-1].gcd(a[i])
  last_new = last_array[i-1].gcd(a[j])
  first_array.push(first_new)
  last_array.push(last_new)
end

array = []
n.times do |i|
  if i == 0
    new = last_array[n-i-2]
    array.push(new)
    next
  end

  if i == n-1
    new = first_array[i-1]
    array.push(new)
    next
  end
  new = first_array[i-1].gcd(last_array[n-i-2])
  array.push(new)
end

p array.max

Measured memory_bytes: 12180
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int mxn= 2e2+5;
// check for forloop
// take input
// overflow
// intialize variable
// go for easy solution
#define mod 1000000007
ll INF = 1000000000000000005LL;
#define endl '\n'
void rishabh(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
int main(){
    rishabh();
    int n;
    cin>>n;
    ll arr[mxn],ans=0;
    for(int i=0;i<n;i++)cin>>arr[i];
    sort(arr,arr+n);
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(arr[i]+arr[j]>arr[k]){
                    if(arr[i]!=arr[j]&&arr[j]!=arr[k])
                    ans++;
                }
            }
        }
    }
    cout<<ans;
}



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

int main() {
	int N, ans;

	ans=0;

	cin >> N;
	vector<int> card(N);

	for(int num = 0; num < N; num++){
		cin >> card[num];
	}
	sort(card.begin(), card.end(), greater<int>());

	for(int num = 0; num < N; num++){
		if(num % 2 == 0){
			ans += card[num];
		}
		else{
			ans -= card[num];
		}
	}


 	 cout << ans << endl;
}


Measured memory_bytes: 384
#include<stdio.h>
int main(void)
{
	int a,b,c,i;
	int cnt=0;
	
	scanf("%d %d %d",&a,&b,&c);
	
	for(i=a;i<=b;i++){
		if(c%i==0){
			cnt++;
		}
	}
	printf("%d\n",cnt);
	
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> h(n);
	rep(snip_i, n) cin >> h.at(snip_i);
	rrep(i, n){
		if(i == n-1) continue;
		int diff = h.at(i) - h.at(i+1);
		if(diff > 0){
			if(diff > 1){
				cout << "No" << endl;
				return 0;
			}
			h.at(i)--;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <vector>
#include <string.h>
#include <queue>
#include <functional>
#include <algorithm>

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

struct edge_dat { ll from, to, cost; };
struct edge { ll to, cost; };

vector<edge>graph[100000];
vector<edge_dat> edgedata;
vector<pair<ll, ll>>vecdata;

ll n, m, c;
ll dist[100000];

void dijkstra()
{
	memset(dist, 0x7F, sizeof(dist));
	dist[0] = 0;
	priority_queue<P,vector<P>,greater<P>>que;
	que.push({0,0});
	while (!que.empty())
	{
		P p = que.top(); que.pop();
		ll cost = p.first;
		int from = p.second;
		if (cost > dist[from])continue;
		for (edge e : graph[from])
		{
			 ll alt = cost + e.cost;
			 if (dist[e.to] > alt)
			 {
				 dist[e.to] = alt;
				 que.push({ dist[e.to],e.to });
			 }
		}
	}
}

int main()
{
	scanf("%lld %lld %lld", &n, &m, &c);
	for (int i = 0; i < m; ++i)
	{
		ll a, b, d;
		scanf("%lld %lld %lld", &a, &b, &d);
		--a; --b;
		graph[a].push_back({ b,d });
		graph[b].push_back({ a,d });
		edgedata.push_back({ a,b,d });
	}
	dijkstra();
	ll edgesum = 0;
	for (edge_dat ed : edgedata)
	{
		ll first = max(dist[ed.from], dist[ed.to]);
		ll second = ed.cost;
		edgesum += second;
		vecdata.push_back({ first,second });
	}
	sort(vecdata.begin(), vecdata.end(), [](pair<ll, ll>p1, pair<ll, ll>p2) {return p1 > p2; });
	ll xtmp = 0;
	ll ans = 123456789012345l;
	while (!vecdata.empty())
	{
		ans = min(ans, xtmp * c + edgesum);
		ll nextx = vecdata.back().first;
		while (!vecdata.empty() && vecdata.back().first == nextx)
		{
			ll dist = vecdata.back().second;
			vecdata.pop_back();
			edgesum -= dist;
		}
		xtmp = nextx;
	}
	ans = min(ans, xtmp * c + edgesum);
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 27688
<?php
  $s["a"] = trim(fgets(STDIN));
  $s["b"] = trim(fgets(STDIN));
  $s["c"] = trim(fgets(STDIN));
  
  function play($t, $card){
      if(strlen($t[$card])==0){
          echo strtoupper($card);
          exit;
      }
      $trush = $t[$card][0];
      $t[$card] = substr($t[$card],1);
      play($t, $trush);
  }
  
  play($s, "a");

Measured memory_bytes: 4728
#include<stdio.h>

int main(void){
   int a,b,ans;

   scanf("%d",&a);
   scanf("%d",&b);

   if (a - 1 >= b )
     ans = 2 * a - 1;
   else if (b - 1 >= a)
     ans = 2 * b - 1;
   else
     ans = a + b;

   printf("%d",ans);

   return 0;
 }

Measured memory_bytes: 128
N, S = map(int, input().split())
a = list(map(int, input().split()))

dp1 = [0] * (S + 1)
ans = 0
for i in range(N):
  dp1[0] += 1
  dp2 = [0] * (S + 1)
  for j in range(S+1):
    dp2[j] += dp1[j]
    if j + a[i] <= S:
      dp2[j+a[i]] += dp1[j]
  dp1 = dp2[:]
  ans += dp1[-1]
  ans = ans % 998244353
print(ans)

Measured memory_bytes: 112476
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;


int main(){
    int a,b,c,i,j,k,m,n,r,x,y,z;

    scanf("%d",&n);
    printf("%d\n",180*(n-2));


    return 0;
}

Measured memory_bytes: 256
let s = stdin.ReadLine()
let t = stdin.ReadLine()
 
let rec solve m n = 
    let l = s.Length - t.Length
    if n > l 
        then (t.Length - m)
        else
            let mutable count = 0
            for i in 0 .. (t.Length - 1) do
                count <- if s.[n + i] = t.[i] then count + 1 else count
            let j = if count > m then count else m
            let np = n + 1
            solve j np
 
solve 0 0 |> printf "%d"



Measured memory_bytes: 29896
n = int(input())
list_a = list(map(int, input().split()))
list_b = list(map(int, input().split()))
list_c = list(map(int, input().split()))
list_a.sort()
list_b.sort()
list_c.sort()
list_a.append(10**10)
list_b.append(10**10)
list_c.append(10**10)

list_memo = []
i = 0
j = 0
k = 0
start = 0
list_ans = []
a_count = 0
while k < n:
    if list_c[k] == min(list_a[i], list_b[j], list_c[k]):
        list_memo.append(0)
        list_memo[-1] = sum(list_memo[start:-1])
        list_ans.append(list_memo[-1])
        start = len(list_memo) - 1
        k += 1
    elif list_b[j] == min(list_a[i], list_b[j], list_c[k]):
        list_memo.append(a_count)
        j += 1
    else:
        list_memo.append(0)
        a_count += 1
        i += 1
print(sum(list_ans))


Measured memory_bytes: 24756
import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int anser = a*b;
        String ans="";
        if (anser%2==0){
          ans="Even";
        }else{
            ans="Odd";
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21588
import java.nio.charset.IllegalCharsetNameException;
import java.util.*;
import java.lang.*;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long k = sc.nextLong();
		int[] a = new int[n];
		int[] b = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
		}
		Map<Integer, Long> map = new TreeMap<>();
		for (int i = 0; i < n; i++) {
			if (map.containsKey(a[i])) {
				map.put(a[i], map.get(a[i]) + b[i]);
			} else {
				map.put(a[i], (long)b[i]);
			}
		}
		for (int i = 1; i <= 100000; i++) {
			if (map.containsKey(i)) {
				k -= map.get(i);
			}
			if (k <= 0) {
				System.out.println(i);
				break;
			}
		}
	}
}

Measured memory_bytes: 92520
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author ExplodingFreeze
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define int long long
#define f(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
using pii=std::pair<int,int>;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); <-- PUT IN main()/solve()!

using namespace std;

int n,m,x;
class DPowerfulDiscountTickets {
public:
	void solve(std::istream& in, std::ostream& out) {
		multiset<int,greater<int>> a;
		in >> n >> m;
		f(i,0,n)
		{
			in >> x;
			a.insert(x);
		}
		f(i,0,m)
		{
			int l=*a.begin();
			a.erase(a.begin());
			a.insert(l/2);
		}
		int ans=0;
		for(auto x : a)
			ans+=x;
		out << ans << "\n";
	}
};


int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	DPowerfulDiscountTickets solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 4992
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define ms multiset
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("input.txt");ofstream out("output.txt");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); //uid<int> u1(5, 10); u1(rnd);

int main(){
    fast;
    ll a,b; cin>>a>>b;
    for(int q = b-a+1; q<=b+a-1; q++) cout<<q<<" ";
}

Measured memory_bytes: 256
import java.util.*;
import java.math.*;

public class Main {
  private static final int BASE = 30000;
  private static final int MAX_N = 20000;

  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    int[] p = new int[n];
    for (int i = 0; i < n; i++) {
      p[i] = s.nextInt();
    }
    int[] a = new int[n];
    int[] b = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = 1 + BASE * i;
      b[i] = BASE * (n - i);
    }
    for (int i = 0; i < n; i++) {
      a[p[i]-1] += i;
    }

    System.out.print(a[0]);
    for (int i = 1; i < n; i++) {
      System.out.print(" ");
      System.out.print(a[i]);
    }
    System.out.println();

    System.out.print(b[0]);
    for (int i = 1; i < n; i++) {
      System.out.print(" ");
      System.out.print(b[i]);
    }
    System.out.println();
  }
}


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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s, t;
	cin >> s >> t;
	int a = 0;
	s += t;
	REP(i, s.size()) {
		a *= 10;
		a += s[i] - '0';		
	}
	if ((int)sqrt(a)*(int)sqrt(a) == a)cout << "Yes" << endl;
	else cout << "No" << endl;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int n = s.size();
  if(s[0] == s[n - 1])
  {
    if(n & 1)
    {
      cout << "Second" << endl;
    }
    else cout << "First" << endl;
  }
  else
  {
    if(n & 1) cout << "First" << endl;
    else cout << "Second" << endl;
  }
  return 0;
}


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

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(si, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 5e5 + 10;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}


vector<int> g[N];
bool viss[N];
int vis[N];

// Normal DFS
void dfs(int curr, int par)
{
  for(auto x: g[curr])
    if(x != par)
      dfs(x, curr);
}

// DFS with visiting status
void dfs1(int curr, int par)
{
  viss[curr] = 1;
  for(auto x: g[curr])
    if(!viss[x])
      dfs1(x, curr);
}

// DFS with strongly connected component
void dfs2(int curr, int par, int num)
{
  vis[curr] = num;
  for(auto x: g[curr])
    if(vis[x] == 0)
      dfs2(x, curr, num);
}

// XOR from 0 to n
ll fxor(ll n)
{
  if(n < 0) return 0;
  if(n % 4 == 3) return 0;
  else if(n % 4 == 0) return n;
  else if(n % 4 == 1) return n^(n-1);
  else if(n%4 == 2) return n^(n-1)^(n-2);
}

// Power in logn with mod 1000000007
llt ppow(llt x, llt y)
{
  llt res = 1;
  while(y > 0){
    if(y&1)
      res = (res * x)%M;
    y = y >> 1;
    x = (x * x)%M;
  }
  return res;
}

// Factorial with dp
llt factdp[N];
llt fact(llt x)
{
  if(x == 0) return 1;
  if(x == 1) return 1;
  if(factdp[x] != -1) return factdp[x];
  return factdp[x] = (x*fact(x-1))%M;
}

// String return to base b
string ansConv ="";
void convert10tob(llt N, int b)
{
     if (N == 0)
        return;
     int x = N % b;
     N /= b;
     if (x < 0)
        N += 1;
     convert10tob(N, b);
     ansConv += to_string(x);
     return;
}

// Convert string to num wiht base b
llt convertstrtob(string a, int b)
{
  llt aa = 0;
  llt mul = 1;
  for(int i=a.length()-1; i>=0; i--)
  {
    int curr = a[i] - '0';
    aa += (curr * mul);
    mul *= b;
  }
  return aa;
}

// Union Find
// Find()
int parent[N], ran[N];

int find(int x)
{
    if(parent[x]==x)return x;
    else return parent[x]=find(parent[x]);
}
// Union()
void unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y)return;

    if(ran[x]<ran[y])
        parent[x]=y;
    else{
        parent[y]=x;
        if(ran[x]==ran[y])ran[x]++;
    }
}

// Main Code

int main()
{
  int n;
  cin>>n;
  list<int> l;
  bool f = true;
  int arr[n];
  rep(i, 0, n) {
    cin>>arr[i];
    if(f)
    {
      l.push_front(arr[i]); f = false;
    }
    else
    {
      l.push_back(arr[i]); f = true;
    }
  }
  if(n%2 == 0)
  {
    for(auto i = l.rbegin(); i != l.rend(); i++)
      cout<<*i<<" ";
  }
  else
  {
    for(auto i = l.begin(); i != l.end(); i++)
      cout<<*i<<" ";
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 23040
n, m = [int(_) for _ in input().split()]

if abs(n - m) >= 2:
    print(0)
else:
    if abs(n - m) == 1:
        res = 1
    else:
        res = 2
    for i in range(1, n+1):
        res *= i
        if res >= 1000000007:
            res = res % 1000000007
    for i in range(1, m+1):
        res *= i
        if res >= 1000000007:
            res = res % 1000000007
    print(res)


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

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(){
  while(1){
    int n, x;
    cin >> n >> x;
    if(n == 0 && x == 0) return 0;

    int ans = 0;
    REP(i, n-1){
      for(int j = i+1; j < n; j++){
        for(int k = j+1; k < n+1; k++){
          if(i + j + k == x) ans ++;
        }
      }
    }
    cout << ans << endl;
  }
}






Measured memory_bytes: 3092
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class Program
{
    #region Standard I/O
    readonly TextReader input;
    readonly TextWriter output;

    X[] ReadLine<X>(Func<string, X> func)
    {
        return input.ReadLine().Split(' ').Select(func).ToArray();
    }

    void WriteLineOne(object obj)
    {
        output.WriteLine("{0}", obj);
    }

    void WriteLineMany(params object[] objects)
    {
        output.WriteLine(string.Join(" ", objects.Select(obj => obj.ToString())));
    }
    #endregion

    long n, m;

    void Read()
    {
        var line = ReadLine(long.Parse);
        n = line[0];
        m = line[1];
    }

    static long BinarySearch(long ok, long ng, Func<long, bool> isOk)
    {
        while (Math.Abs(ok - ng) > 1)
        {
            var mid = (ok + ng) / 2;
            if (isOk(mid))
            {
                ok = mid;
            }
            else
            {
                ng = mid;
            }
        }
        return ok;
    }

    long Count(long n, long m, long k)
    {
        var s = n + k;
        var c = m - 2 * k;
        return k < 0 || s <= 0 || c <= 0 ? 0 : Math.Min(s, c / 2);
    }

    long Solve()
    {
        var l =
            BinarySearch(ok: 0L, ng: m / 2, isOk: k =>
                Count(n, m, k) - Count(n, m, k - 1) >= 0
            );
        return Count(n, m, l);
    }

    public void Run()
    {
        Read();
        WriteLineOne(Solve());
    }

    public Program(TextReader input, TextWriter output)
    {
        this.input = input;
        this.output = output;
    }

    public static void Main(string[] args)
    {
        new Program(Console.In, Console.Out).Run();
    }
}


Measured memory_bytes: 11348
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define SZ(X) ((int)(X).size())
#define endl "\n";
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	int n,m,a[10001],cnt=0;
	long long sum=0;
	cin>>n>>m;
	for (int i = 0; i < n; ++i)
		{
			cin>>a[i];
			sum+=a[i];
		}	
	for (int i = 0; i < n; ++i)
	{
		if((a[i]*4*m)>=sum){
				cnt++;
			}
	}

    if(cnt>=m) cout<<"Yes"; else cout<<"No";
   return 0;
}


Measured memory_bytes: 3636
import sys

def is_prime(x):
    i = 2
    while i ** 2 <= x:
        if x % i == 0:
            return False
            break
        i += 1
    else: return True


def solve():
    X = int(input())
    for i in range(100000):
        if is_prime(X + i):
            print(X + i)
            break

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3060
A, B, C = map(int, input().split())

if any([A % 2, B % 2, C % 2]):
	print(0)
	exit()

if A == B == C:
	print(-1)
	exit()

count = 0
while True:
	if any([A % 2, B % 2, C % 2]):
		break
	A, B, C = ((B+C)//2, (A+C)//2, (A+B)//2)
	count += 1
print(count)


Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>

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

ll N, aa[212345], l[212345], r[212345];

int main() {

	scanf("%lld", &N);
	rep(i, N) {
		ll a;
		scanf("%lld", &a);
		aa[a - 1] = i;
	}

	set<ll> s;
	s.insert(-1);
	s.insert(N);

	ll ans = 0;

	rep(i, N) {
		auto itr = s.lower_bound(aa[i]);

		ans += (*itr - aa[i]) * (aa[i] - *--itr) * (i + 1);

		s.insert(aa[i]);
	}

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

	return 0;
}


Measured memory_bytes: 12416
h, w = map(int, input().split())

s = [''] * h

for l in range(h):
  s[l] = list(input())

result = [''] * h
for i in range(h):
  result[i] = [''] * w
  for j in range(w):
    count = 0
    if s[i][j] == "#":
      result[i][j] = "#"
    else:
      for n in [-1, 0, 1]:
        for m in [-1, 0, 1]:
          if (i + n < 0) or (j + m < 0) or (i + n >= h) or (j + m >= w):
            continue
          elif s[i + n][j + m] == "#":
            count += 1
      result[i][j] = str(count)

for x in range(h):
  print(''.join(result[x]))

Measured memory_bytes: 3188
N = int(input())

if N > 9:
    if (N%(int("1" + (len(str(N)) - 1)*"0"))) == int((len(str(N)) - 1) * "9"):
        tmp = list(str(N))
        tmp = [int(item) for item in tmp]
        print(sum(tmp))
    else:
        tmp = list(str(N - (N%(int("1" + (len(str(N)) - 1)*"0"))) - 1))
        tmp = [int(item) for item in tmp]
        print(sum(tmp))
else:
    print(N)




Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod=MOD) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod=MOD) {
    return modpow(a, mod - 2, mod);
}

long long fac[200010], finv[200010], inv[200010];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < 200010; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

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

    ll ans=modpow(2,n);
    ans-=1;
    if(ans<0) ans+=MOD;

    COMinit();

    ll tmp=1;
    for(ll i=0;i<=a-1;i++){
        tmp=(tmp*(n-i))%MOD;
    }
    tmp=(tmp*finv[a])%MOD;

    //cout<<tmp<<endl;
    ans-=tmp;
    if(ans<0) ans+=MOD;
    
    tmp=1;
    for(ll i=0;i<=b-1;i++){
        tmp=(tmp*(n-i))%MOD;
    }
    tmp=(tmp*finv[b])%MOD;
    //cout<<tmp<<endl;
    ans-=tmp;
    if(ans<0) ans+=MOD;

    cout<<ans<<endl;
}

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

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define SUM(x) accumulate(ALL(x), 0)
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000

int main()
{
  ll N; cin >> N;
  vector<ll> A(N);
  REP(i, N) cin >> A[i];

  map <ll, ll> x;
  REP(i, N) x[i + A[i]]++;

  ll cnt = 0;
  REP(i, N) {
    if (x[i - A[i]] > 0) {
      cnt += x[i - A[i]];
    }
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 27532
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      a: usize,
      p: usize,
    }
    println!("{}", (3*a+p)/2);
}


Measured memory_bytes: 4352
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;

constexpr long double EPS = 1e-7;

struct point {
	long double x, y;
	point(long double x = 0.0, long double y = 0.0):x(x), y(y) {}
	point(const point &p):x(p.x), y(p.y) {}

	point operator+(const point &p) const {
		return point(x + p.x, y + p.y);
	}

	point operator-(const point &p) const {
		return point(x - p.x, y - p.y);
	}

	point operator*(long double s) const {
		return point(x * s, y * s);
	}
};

long double dot(const point &a, const point &b) {
	return a.x * b.x + a.y * b.y;
}

long double cross(const point &a, const point &b) {
	return a.x * b.y - a.y * b.x;
}

long double norm(const point &p) {
	return p.x * p.x + p.y * p.y;
}

int ccw(const point &a, point b, point c) {
	b = b - a;
	c = c - a;
	const long double t = cross(b, c);
	if(t > EPS) return 1;
	if(t < -EPS) return -1;
	if(dot(b, c) < 0) return 2;
	if(norm(b) < norm(c)) return -2;
	return 0;
}

point rotate(const point &p, long double theta) {
	const long double s = sin(theta), c = cos(theta);
	return point(c * p.x - s * p.y, s * p.x + c * p.y);
}

struct line {
	point a, b;
	line(const point &a_, const point &b_):a(a_), b(b_) {}
};

point crosspoint(const line &a, const line &b) {
	const long double t = cross(a.b - a.a, b.b - b.a);
	if(abs(t) < EPS) return a.a;
	return b.a + (b.b - b.a) * cross(a.b - a.a, a.a - b.a) * (1 / t);
}

typedef vector<point> polygon;

long double area(const polygon &p) {
	const int n = p.size();
	if(n < 3) return 0.0;

	long double res = cross(p[n - 1], p[0]);
	for(int i = 1; i < n; ++i) {
		res += cross(p[i - 1], p[i]);
	}
	return abs(res) * 0.5;
}

polygon convex_cut(const polygon &p, const line &l) {
	const int n = p.size();
	polygon res;
	for(int i = 0; i < n; ++i) {
		const int next = (i + 1) % n;
		const int tmp = ccw(l.a, l.b, p[i]);
		if(tmp != -1) res.emplace_back(p[i]);

		if(tmp * ccw(l.a, l.b, p[next]) < 0) {
			res.emplace_back(crosspoint(l, line(p[i], p[next])));
		}
	}

	return res;
}

bool ok(const point &g, const polygon &p) {
	const long double S_half = area(p) / 2.0;
	for(long double theta = 0; theta < M_PI; theta += 0.01) {
		const long double  S = area(convex_cut(p, line(g, g + rotate(point(10, 0), theta))));
		if(abs((S_half - S) / S_half) > EPS) return false;
	}

	return true;
}

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout.precision(5);
	cout.flags(ios::fixed);

	int n;
	cin >> n;

	point g(0, 0);
	polygon p;
	p.reserve(n);
	for(int i = 0; i < n; ++i) {
		int x, y;
		cin >> x >> y;
		p.emplace_back(x, y);
		g = g + p[i];
	}

	g = g * (1.0 / n);

	if(ok(g, p)) {
		cout << g.x << " " << g.y << endl;
	}
	else {
		cout << "NA" << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1280
s = input()
if len(s)%2:
    s1 = s[:len(s)//2]
    s2 = s[len(s)//2+1:][::-1]
else:
    s1 = s[:len(s)//2]
    s2 = s[len(s)//2:][::-1]
cnt = 0
for i in range(len(s1)):
    if s1[i]!=s2[i]:
        cnt+=1
print(cnt)

Measured memory_bytes: 3060
import java.util.Scanner;

class Main {
	public static void main(String args[]) {

	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int i;
	long sum = 0;

	for (i = 1; i <= n; i++ ) {
		if (i % 3 != 0 && i % 5 != 0) sum += i;
	}

	System.out.println(sum);
	}
}

Measured memory_bytes: 27104
#include <iostream>

size_t min3(size_t x, size_t y, size_t z) {
    return std::min(x, std::min(y, z));
}
size_t max3(size_t x, size_t y, size_t z) {
    return std::max(x, std::max(y, z));
}

size_t f (size_t x, size_t y) {
    size_t x1_cands[2] = {x / 3, x / 3 + 1};
    size_t y1 = y / 2;
    size_t y2 = y - y1;

    size_t d_cands[2];
    for (int i = 0; i < 2; i++) {
        size_t s1 = x1_cands[i] * y;
        size_t s2 = (x - x1_cands[i]) * y1;
        size_t s3 = (x - x1_cands[i]) * y2;
        d_cands[i] = max3(s1, s2, s3) - min3(s1, s2, s3);
    }
    
    return std::min(d_cands[0], d_cands[1]);

}

int main()
{
    size_t H, W;
    std::cin >> H >> W;

    if (H % 3 == 0 || W % 3 == 0) {
        std::cout << 0 << std::endl;
        return 0;
    }

    size_t par_mindiff = std::min(H, W);

    std::cout << min3(par_mindiff, f(H, W) , f(W, H)) << std::endl;
}


Measured memory_bytes: 256
N, A, B = map(int, input().split())


def f(a, b):
    return [
        p
        for p in [
            N - i * a + j
            for i in range(
                1,
                N // a + 1 if N % a > b - N // a else
                N // a
            )
            for j in range(1, a + 1)
        ] +
        [
            j
            for j in range(
                b - N // a if N % a > b - N // a else
                b - N // a + 1,
                N - (N // a) * a + 1 if N % a > b - N // a else
                N - (N // a - 1) * a + 1
            )
        ] +
        [
            j
            for j in reversed(
                range(
                    1,
                    b - N // a if N % a > b - N // a else
                    b - N // a + 1
                )
            )
        ]
    ]


# N - A + 1, N - A + 2, ..., N,
# N - 2A + 1, N - 2A + 2, ..., N - A,
# ...,
# N - floor(N / A)A + 1, N - floor(N / A)A + 2, ..., N - (floor(N / A) + 1)A,
# B - floor(N / A), B - floor(N / A) + 1, ..., N - floor(N / A)A
# B - floor(N / A) - 1, B - floor(N / A) - 2, ..., 1
# と構築する
ans = (
    -1 if A * B < N or A + B > N + 1 else
    ' '.join(
        str(p) if A >= B else
        str(N - p + 1)
        for p in f(max(A, B), min(A, B))
    )
)

print(ans)


Measured memory_bytes: 34376
#include <stdio.h>
#include <string.h>
#define M 36

typedef struct {
  char mark;
  int value;
}Card;

void BubbleSort(Card *, int);
void SelectionSort(Card *, int);
void disply(Card *, int);
int isStable(Card *, Card *, int);

int main(){
  Card C1[M+1], C2[M+1];
  int i, N;

  scanf("%d",&N);

//文字列と数字をそれぞれ格納
  for(i = 0; i < N; i++){
    scanf(" %c%d", &C1[i].mark, &C1[i].value);
  }

  for(i = 0 ;i < N; i++) C2[i] = C1[i];

  BubbleSort(C1, N);
  disply(C1, N);
  printf("Stable\n");

  SelectionSort(C2, N);
  disply(C2, N);

  if( isStable(C1, C2, N) == 0 ) printf("Stable\n");
  else printf("Not stable\n");

  return 0;
}

/*1 BubbleSort(C, N)
2   for i = 0 to N-1
3     for j = N-1 downto i+1
4       if C[j].value < C[j-1].value
5         C[j] と C[j-1] を交換*/
void BubbleSort(Card C1[], int N){
  int i, j;
  Card tmp;
  for(i = 0;i < N; i++){
    for(j = N-1; j > i; j--){
      if(C1[j].value < C1[j-1].value){
        tmp = C1[j];
        C1[j] = C1[j-1];
        C1[j-1] = tmp;
      }
    }
  }
}

/*7 SelectionSort(C, N)
8   for i = 0 to N-1
9     minj = i
10    for j = i to N-1
11      if C[j].value < C[minj].value
12        minj = j
13    C[i] と C[minj] を交換*/
void SelectionSort(Card C2[], int N){
  int i, j, minj;
  Card tmp;
  for(i = 0; i < N; i++){
    minj = i;
    for(j = i; j < N; j++){
      if(C2[j].value < C2[minj].value) minj = j;
    }
    tmp = C2[i];
    C2[i] = C2[minj];
    C2[minj] = tmp;
  }
}

void disply(Card C[], int N)
{
  int i;

  for( i = 0 ; i < N ; i++ ){
    if( i > 0 ) printf(" ");
    printf("%c%d", C[i].mark, C[i].value);
  }
  printf("\n");
}

/*1 isStable(in, out)
2   for i = 0 to N-1
3     for j = i+1 to N-1
4       for a = 0 to N-1
5         for b = a+1 to N-1
6           if in[i] と in[j] の数字が等しい && in[i] == out[b] && in[j] == out[a]
7             return false
8 return true*/
int isStable(Card C1[], Card C2[], int N){
  int i;

  for(i = 0; i < N; i++)
  if(C1[i].mark != C2[i].mark ) return 1;
  return 0;
}



Measured memory_bytes: 2108
#include <iostream>

using namespace std;

int main()
{
    int r;

    cin >> r;

    if(r < 1200)
    {
        cout << "ABC" << endl;
    }
    else if(r < 2800)
    {
        cout << "ARC" << endl;
    }
    else
    {
        cout << "AGC" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
 
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }
    sort(b.begin(), b.end());
    for (int i = 0; i < n; i++) {
        cin >> c[i];
    }
    sort(c.begin(), c.end());
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        ll i1 = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
        ll i2 = upper_bound(c.begin(), c.end(), b[i]) - c.begin();
        ans += i1 * (n - i2);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1408