akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main()
{
	int n, x, i;
	long long a[100005];
	while (scanf("%d%d", &n, &x) != EOF)
	{
		for (i = 1; i <= n; i++)
		{
			scanf("%lld", &a[i]);
		}
		long long num = 0;
		if (a[1]>x)
		{
			num += a[1] - x;
			a[1] = x;
		}
		for (i = 2; i <= n; i++)
		{
			int k = a[i] + a[i - 1] - x;
			if (k>0)
			{
				num += k;
				a[i] -= k;
			}
		}
		printf("%lld\n", num);
	}
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <cmath>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int mod = (int)1e9 + 7, INF = (int)1e9;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };


int main(void) {
    double a, b, h, m, al, be, ang, bt;

    scanf("%lf%lf%lf%lf", &a, &b, &h, &m);

    al = h * M_PI / 6.0 + m * M_PI / 360;
    be = m * M_PI / 30.0;

    ang = abs(al - be);

    bt = a * a + b * b - (a * b * cos(ang) * 2);

    printf("%.12lf\n", sqrt(bt));

    return 0;
}

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

#define fi first
#define se second
#define mp make_pair
#define int long long
#define pb push_back

using namespace std;
typedef long long ll;

const int mod = 998244353;
const int maxn = 3e5 + 5;

int power(int a, int b)
{
  if (b == 0) return 1;
  int res = power(a, b / 2);
  if (b & 1) return 1ll * res * res % mod * a % mod;
  return 1ll * res * res % mod;
}

int fact[maxn], ifact[maxn];
int N, A, B, K;

int kCn(int k, int n)
{
  if (k > n) return 0;
  return 1ll * fact[n] * ifact[k] % mod * ifact[n - k] % mod;
}

signed main(void)
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  if (fopen("A.INP", "r")){
    freopen("A.INP", "r", stdin);
    freopen("A.OUT", "w", stdout);
  }
  cin >> N >> A >> B >> K;
  fact[0] = 1;
  for (int i = 1; i <= N; ++i){
    fact[i] = 1ll * fact[i - 1] * i % mod;
  }
  ifact[N] = power(fact[N], mod - 2);
  for (int i = N - 1; i >= 0; --i){
    ifact[i] = 1ll * ifact[i + 1] * (i + 1) % mod;
  }
  int res = 0;
  for (int i = 0; i <= N; ++i){
    int j = (K - i * A) / B;
    if (j < 0 || j > N || j * B + i * A != K) continue;
    res += 1ll * kCn(i, N) * kCn(j, N) % mod;
    res %= mod;
  }
  cout << res << '\n';
}


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

/*alias*/
#define REP(i,n) for (int i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
using ll=long long;

using namespace std;

/*input*/
int n;
string s[10001];

/*funcs*/


/*main*/
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    int ab[n];
    int fb[n];
    int la[n];
    int fl[n];
    for(int i=0;i<n;i++){
        int t=s[i].length();
        ab[i]=0;
        fb[i]=0;
        la[i]=0;
        fl[i]=0;
        if(s[i][t-1]=='A'&&s[i][0]=='B'){
            fl[i]=1;
            fb[i]=0;
            la[i]=0;
        }else if(s[i][t-1]=='A'){
            fl[i]=0;
            fb[i]=0;
            la[i]=1;
        }else if(s[i][0]=='B'){
            fl[i]=0;
            fb[i]=1;
            la[i]=0;
        }else{
            fl[i]=0;
            fb[i]=0;
            la[i]=0;
        }
        for(int j=0;j<t-1;j++){
            if(s[i][j]=='A'&&s[i][j+1]=='B'){
                ab[i]++;
            }
        }
    }
    int sum=0;
    int first=0;
    int last=0;
    int both=0;
    for(int i=0;i<n;i++){
        sum=sum+ab[i];
        first=first+fb[i];
        last=last+la[i];
        both=both+fl[i];
    }
    int ans=0;
    if(both==n){
        ans=sum+n-1;
    }else if(both==0){
        if(first<last){
            ans=sum+first;
        }else{
            ans=sum+last;
        }
    }else{
        if(first==0&&last==0){
            ans=sum+both-1;
        }else if(first==0||last==0){
            ans=sum+both;
        }else{
            if(first<last){
                ans=sum+both+first;
            }else{
                ans=sum+both+last;
            }
        }
    }
    cout<<ans;
}

Measured memory_bytes: 1024
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <bitset>
#include <iostream>
#include <deque>
#include <functional>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

using namespace std;

#define int long long

#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

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

#define debug(x) cerr << #x << ": " << x << endl;

const int MOD = 1e9 + 7;

template <typename T>
T gcd(T m, T n) { return n == 0 ? m : gcd(n, m % n); }
template <typename T>
T lcm(T m, T n) { return n * m / gcd(n, m); }

signed main(void)
{
  int num;
  bool flag;

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

  flag = true;
  num = 0;
  for (int i = 0; i < n; ++i)
  {
    num += v[i].second;
    if (num > v[i].first)
    {
      flag = false;
    }
    if (!flag)
      break;
  }

  if (flag)
    cout << "Yes";
  else
    cout << "No";
  cout << endl;
}


Measured memory_bytes: 6384
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}

template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}


signed main(void) {
	int n , x;
	cin >> n >> x;
	vector<int>a(n);
	rep(i, n) {
		cin >> a[i];
	}
	int ret = 0;
	rep(i, n) {
		if (i == 0) {
			if (a[0] > x) {
				ret += a[0] - x;
				a[0] = x;
			}
		}
		else {
			if (a[i] + a[i - 1] > x) {
				ret += a[i] + a[i - 1] - x;
				a[i] = x - a[i - 1];
			}
		}
	}
	print(ret);
}

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

int main() {
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  long long ans = 0, d;
  if (2*c <= a + b) {
    ans += 2*c*min(x, y);
    if (x <= y) {
      ans += min(b*(y - x), 2*c*(y - x));
    }
    else {
      ans += min(a*(x - y), 2*c*(x - y));
    }
  }
  else {
    ans += a*x + b*y;
  }
  cout << ans << 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(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f=true){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f=true){cout<<(f?"YES":"NO")<<endl;}
#define ANS(a) cout<<a<<endl

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);
    int N, D; cin >>N >> D;
    vector<vector<int>> v(N,vector<int>(D)); cin >> v;

    set<int> sq;
    for (int n=1; n*n<=40*40*D;n++) {
        sq.insert(n*n); //cout <<FMT(n*n)<<endl;
    }

    int ans = 0;
    for (int i = 0; i < v.size() - 1; i++) {
        for (int j = i + 1; j < v.size(); j++) {
            int s = 0;
            for (int m = 0; m < D; m++) {
                int d = v[i][m] -  v[j][m];
                s += d*d;
            }
            if (sq.count(s)) ans++;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;
const int N=500005;
int a[N],b[N],t[N],n,p[N],c[N];
vector<pair<int,int>>v;
set<pair<int,int>>s;
set<int>sa,sb;
int main()
{
	scanf("%d",&n);
	if(n<=12)
	{
		for(int i=1;i<=n;i++)
			scanf("%d",&a[i]);
		for(int i=1;i<=n;i++)
			scanf("%d",&b[i]);
		for(int i=1;i<=n;i++)
			p[i]=i;
		do
		{
			int fl=1;
			for(int i=1;i<=n;i++)
			{
				c[i]=b[p[i]];
				if(c[i]==a[i])
				{
					fl=0;
					break;
				}
			}	
			if(fl)
			{
				puts("Yes");
				for(int i=1;i<=n;i++)
					printf("%d ",c[i]);
				return 0;
			}
		}while(next_permutation(p+1,p+n+1));
		puts("No");
		return 0;
	}
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		sa.insert(x);
		a[x]++;
		t[x]++;
	}
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		sb.insert(x);
		b[x]++;
		t[x]++;
	}
	for(int i=1;i<=n;i++)
		if(t[i])
			s.insert(make_pair(-t[i],i));
	for(int zh=1;zh<=n;zh++)
	{
		int x=s.begin()->second;
		s.erase(s.begin());
		if(!s.size())
		{
			puts("No");
			return 0;
		}
		if(a[x]>b[x])
		{
			for(auto y:sb)
			{
				if(y!=x)
				{
					v.emplace_back(x,y);
					a[x]--;
					t[x]--;
					if(!a[x])
						sa.erase(x);
					if(t[x])
						s.insert(make_pair(-t[x],x));
					s.erase(make_pair(-t[y],y));
					b[y]--;
					t[y]--;
					if(!b[y])
						sb.erase(y);
					if(t[y])
						s.insert(make_pair(-t[y],y));
					break;
				}
			}
		}
		else
		{
			for(auto y:sa)
			{
				if(y!=x)
				{
					v.emplace_back(y,x);
					b[x]--;
					t[x]--;
					if(!b[x])
						sb.erase(x);
					if(t[x])
						s.insert(make_pair(-t[x],x));
					s.erase(make_pair(-t[y],y));
					a[y]--;
					t[y]--;
					if(!a[y])
						sa.erase(y);
					if(t[y])
						s.insert(make_pair(-t[y],y));
					break;
				}
			}
		}
	}
	sort(v.begin(),v.end());
	puts("Yes");
	for(auto i:v)
		printf("%d ",i.second);
	return 0;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k; cin >> n >> k;
    unordered_map<int, int> mp;
    for (int i = 0; i < n; i++) {
        int x; cin >> x;
        mp[x]++;
    }
    vector<int> a;
    for (auto p : mp) {
        a.push_back(p.second);
    }
    int total = (int) mp.size();
    sort(a.begin(), a.end());
    int ans = 0;
    for (auto x : a) {
        if (total <= k) {
            cout << ans;
            return 0;
        }
        total--;
        ans += x;
    }
    return 0;
}


Measured memory_bytes: 13172
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

constexpr lint mod=1e9+7;

lint sum(lint n)
{
	return ((n*(n+1))/2)%mod;
}
int main()
{
	lint N,K;
	lint A[20010]={};
	cin >> N >> K;
	for(int i=0;i<N;i++)
	{
		cin >> A[i];
	}

	lint ans=0;
	for(int i=0;i<N;i++)
	{
		lint right=0;
		lint left=0;
		for(int j=0;j<N;j++)
		{
			if(A[i]>A[j])
			{
				
				if(i<j)
					right++;
				else
					left++;
				left%=mod;
				right%=mod;
			}
		}
		
		ans+=(left*(sum(K-1)%mod))%mod;
		ans%=mod;
		ans+=(right*(sum(K)%mod))%mod;
		ans%=mod;


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

}



Measured memory_bytes: 384
n,m=input().split()
n=int(n)
m=int(m)
f=[0]*n
wa=[0]*n
ac=0
for i in range(m):
    p,s=input().split()
    p=int(p)-1
    if f[p]==1:
        continue
    if s=="WA":
        wa[p]+=1
    else:
        ac+=1
        f[p]=1
x=0
for i in range(n):
    if f[i]==1:
        x+=wa[i]
print(ac,x)

Measured memory_bytes: 10376
#include<bits/stdc++.h> 
using namespace std;
#define ll long long
#define mod 1000000007ll
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define db(x) cout << #x << " = " << x << '\n'
#define sep cout << "\n********************************************\n"
#define fast  ios_base::sync_with_stdio(false), cin.tie(NULL)
int main(int argc, char const *argv[])
{
    fast;
    ll n;
    cin >> n;
    vpll a(n);
    for (int i = 0; i < n; ++i)
    {
    	cin >> a[i].x;
    	a[i].y = i + 1;
    }
    sort(a.begin(), a.end());
    for (int i = 0; i < n; ++i)
    {
    	cout << a[i].y << ' ';
    }
    return 0;
}

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

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

  int x, a; cin >> x >> a;
  if(x < a) {
    cout << 0 << '\n';
    return 0;
  } else {
    cout << 10 << '\n';
    return 0;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MOD  1000000007
#define ll long long
#define int long long
# define INF 1000005
#define ar array
# define fr first
# define sc second
#define wt(x) int x;cin>>x;while(x--)
#define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl
//#define cerr if(false)cerr
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> pbds;

void  c_p_c(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
 
#ifndef ONLINE_JUDGE
  freopen("input1.txt","r",stdin);
  freopen("output1.txt","w",stdout);
#endif
 }
 
int power(int a,int b,int mod){
    a=a%mod;
    if(a==0){
        return 1;
    }
    int res=1;
    while(b){
        if(b&1){
            res=(res*a)%mod;
        }
        b>>=1;
        a=(a*a)%mod;
    }
    return res;
 }
 
int  MMI(int p){
    return power(p,MOD-2,MOD);
}
struct BIT{
       int N;
       vector<int>bit;
       void init(int n){
          N=n;
          bit.assign(n+1,0);
       }
       void update(int idx,int i){
        while(idx<=N){
            bit[idx]=i;
            idx+=idx&(-idx);
        }
       }
       int sum(int idx){
        int ans=0;
        while(idx>0){
            ans+=bit[idx];
            idx-=idx&(-idx);
        }
        return ans;
       }
       int prefsum(int l,int r){
        return sum(r)-sum(l-1);
       }

};
const int SIZE = 1<<20;
int cnt[SIZE];
int32_t main()
{
    c_p_c();
    int n;
   cin>>n;
   int ans=0;
  
   for(int i=1;i<=n;i++)
    { 
       int x;
       cin>>x;
       cnt[x]++;
       ans+=x;     

}

    int q;
    cin>>q;
    while(q--){
        int b,c;
        cin>>b>>c;
       ans-=cnt[b]*b;
       ans+=cnt[b]*c;
       cnt[c]+=cnt[b];
       cnt[b]=0;

       cout<<ans<<"\n";
    }
    


 
    
      return 0;
       }
        
        

        




Measured memory_bytes: 4364
from collections import defaultdict
N,M,*A = map(int, open(0).read().split())
ls = [0]*10
ls[1] = 2
ls[2] = 5
ls[3] = 5
ls[4] = 4
ls[5] = 5
ls[6] = 6
ls[7] = 3
ls[8] = 7
ls[9] = 6
dic = defaultdict(int)
for a in A:
  k = ls[a]
  dic[k] = max(dic[k],a)
dp = [-1]*(N+1)
for k in dic.keys():
  if k>N:
    continue
  dp[k] = dic[k]
for i in range(N+1):
  for k in dic.keys():
    if i-k>0 and dp[i-k]!=-1:
      m = dp[i-k]*10+dic[k]
      dp[i] = max(dp[i], m)
print(dp[N])

Measured memory_bytes: 14820
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
ll cnt=0;
bool path[41][41];
bool ans[41][41];
ll ans_sum=0;
ll ans_max=0;
ll cur_max;
ll cur_sum;
int num[41];
bool used[41];

int main(void){
	n=40;
	printf("%d\n",n);
	for(int i=0;i<5;i++){
		for(int j=i+1;j<n;j++){
			path[i][j]=true;
			path[j][i]=true;
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			printf("%c",path[i][j]?'Y':'N');
		}
		printf("\n");
	}
	return 0;
} 


Measured memory_bytes: 3188
#include <stdio.h>

bool belongTo(int* group, int len, int x, int y) {
  bool yes = false;
  for (int i = 0; i < len; i++) {
    if (x == group[i]) {
      if (yes) {
        return true;
      }
      yes = true;
    }

    if (y == group[i]) {
      if (yes) {
        return true;
      }
      yes = true;
    }
  }
  return false;
}

int main(void) {
  int x, y;
  scanf("%d%d", &x, &y);

  int groupA[] = {1,3,5,7,8,10,12};
  int lenA = sizeof(groupA) / sizeof(int);
  if (belongTo(groupA, lenA, x, y)) {
    printf("Yes");
    return 0;
  }

  int groupB[] = {4,6,9,11};
  int lenB = sizeof(groupB) / sizeof(int);
  if (belongTo(groupB, lenB, x, y)) {
    printf("Yes");
    return 0;
  }

  int groupC[] = {2};
  int lenC = sizeof(groupC) / sizeof(int);
  if (belongTo(groupC, lenC, x, y)) {
    printf("Yes");
    return 0;
  }

  printf("No");
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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

int H,W;
int c[10][10],ans=0,check[10]={};

int main(){
    cin>>H>>W;
    int A[H][W];
    rep(i,10)rep(j,10)cin>>c[i][j];
    rep(i,H)rep(j,W)cin>>A[i][j];
    rep(k,10)rep(i,10)rep(j,10)c[i][j]=min(c[i][j],c[i][k]+c[k][j]);
    rep(i,H){
        rep(j,W){
            if(A[i][j]!=-1){
                ans+=c[A[i][j]][1];
            }
        }
    }
    out(ans);
}


Measured memory_bytes: 512
import sys
import math

from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s
def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n-1)
def mCn(m, n):
    def factorial_ntimes(m, n):
        r = 1
        while n:
            r *= m
            m -= 1
            n -= 1
        return r
    return int(factorial_ntimes(m, n) / factorial(n))

l = load()
print((l/3) ** 3)

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

int main(){
  int a;
  cin>>a;
  double num=0;
  for(int i=0;i<a;i++){
    int n;
    cin>>n;
    num+=1.000000000000000/n;
  }
  cout<<1/num<<endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;

#define int long long
#define endl "\n"
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define mod 1000000007
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}

int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}



signed main() {
	int h, w,a;
	cin >> h >> w;
	vector<vector<char>>vec(h+2, vector<char>(w+2, '.'));
	for(int i=1; i<h+1; i++) {
		for (int j = 1; j < w + 1; j++) {
			cin >> vec[i][j];
		}
	}
	for (int i = 1; i < h + 1; i++) {
		for (int j = 1; j < w + 1; j++) {
			if (vec[i][j] == '#') {
				continue;
			}
			a = 0;
			if (vec[i + 1][j-1] == '#') {
				a++;
			}
			if (vec[i + 1][j] == '#') {
				a++;
			}
			if (vec[i + 1][j + 1] == '#') {
				a++;
			}
			if (vec[i][j - 1] == '#') {
				a++;
			}
			if (vec[i][j + 1] == '#') {
				a++;
			}
			if (vec[i - 1][j - 1] == '#') {
				a++;
			}
			if (vec[i - 1][j] == '#') {
				a++;
			}
			if (vec[i - 1][j + 1] == '#') {
				a++;
			}
			vec[i][j] = a + '1' - 1;
		}
	}
	for (int i = 1; i < h + 1; i++) {
		for (int j = 1; j < w + 1; j++) {
			cout << vec[i][j];
		}
		cout << endl;
	}
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string sl;
long long k;
int main(){
	cin >> sl >> k;
	long long l=sl.size();
	if(string(l,sl[0])==sl){
		cout<< l*k/2 << endl;
	}
	else{
		long long ans1=0;
		for(int i=0;i<l-1;i++){
			if(sl[i%l]==sl[(i+1)%l]){
				ans1++;
				i++;
			}
		}
		sl=sl+sl;
		long long n=l*2;
		long long ans2=0;
		for(int i=0;i<n-1;i++){
			if(sl[i%n]==sl[(i+1)%n]){
				ans2++;
				i++;
			}
		}
		printf("%lld\n",ans1+(ans2-ans1)*(k-1));	
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int a, b, tmp;

  cin >> a >> b;

  while(a!=0 && b!=0){
    if(a < b)
      swap(a,b);
    tmp = a;
    a = b;
    b = tmp%b;
  }
  cout << a << endl;

  return 0;
}

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int>vec(M);
    for(int i = 0; i<M; i++){
        cin >> vec.at(i);
    }
    int X = 0;
    for(int i = 0; i<M; i++){
        X += vec.at(i);
    }
    if((N-X)>=0){
        cout << (N-X) << endl;
    }
    else{
        cout << "-1" << endl;
    }
    
}

Measured memory_bytes: 3672
B1 = list(map(int, input().split()))
B2 = list(map(int, input().split()))
B3 = list(map(int, input().split()))
B= B1+B2+B3
N = int(input())
for n in range(N):
  num = int(input())
  B = [0 if i == num else i for i in B]
  if (B[0]+B[1]+B[2])*(B[3]+B[4]+B[5])*(B[6]+B[7]+B[8])*(B[0]+B[3]+B[6])*(B[1]+B[4]+B[7])*(B[2]+B[5]+B[8])*(B[0]+B[4]+B[8])*(B[2]+B[4]+B[6]) == 0:
    print('Yes')
    exit()
print('No')

Measured memory_bytes: 3064
import java.util.*;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		int N = Integer.parseInt(in.readLine());
		if (N % 2 == 1) {
			System.out.println((N / 2));
		} else {
			System.out.println((N / 2 - 1));
		}
	}
}


Measured memory_bytes: 20948
#include<iostream>
#include<queue>
#include<cstring>
#include<stdlib.h>
#include<algorithm>
#include<math.h>
#include<map>
#define INF 1<<21
using namespace std;
typedef pair<int,int> P;
queue< P > houzyu[10005];
int w,h;
char maps[102][102][10];
int ruiseki[102][102];
int sx,sy,gx,gy;
int n=0;
int dp[105][105]={0};
int memtan(int now,int x,int y);
main(){
  for(int i=0;i<100;i++){
    for(int j=0;j<100;j++){
      ruiseki[i][j]=i+j;
    }
  }
  while(1){
    cin>>w>>h;
    for(int i=0;i<max(h,w)+5;i++){
      for(int j=0;j<max(h,w)+5;j++){
	dp[i][j]=INF;
      }
    }
    if(w==0&&h==0)break;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cin>>maps[i][j];
	if(strcmp(maps[i][j],".")!=0){
	  if(strcmp(maps[i][j],"S")==0){
	    sx=j;
	    sy=i;
	  }
	  else if(strcmp(maps[i][j],"G")==0){
	    gx=j;
	    gy=i;
	  }
	  else{
	    if(atoi(maps[i][j])>n){
	      n=atoi(maps[i][j]);
	    }
	    P p;
	    p.first=j;
	    p.second=i;
	    houzyu[atoi(maps[i][j])].push(p);
	  }
	}
      }
    }
    cout<<memtan(1,sx,sy)<<endl;
    for(int i=1;i<=n;i++){
      while(!houzyu[i].empty()){
	houzyu[i].pop();
      }
    }
    n=0;
  }
  return 0;
}

int memtan(int now,int x,int y){
  if(now>n){
    return abs(gx-x)+abs(gy-y);
  }
  else if(dp[x][y]!=INF){
    return dp[x][y];
  }
  else{
    int sizes=houzyu[now].size();
    int mins=INF;
    for(int i=0;i<sizes;i++){
      mins=min(mins,memtan(now+1,houzyu[now].front().first,houzyu[now].front().second)+abs(x-houzyu[now].front().first)+abs(y-houzyu[now].front().second));
      houzyu[now].push(houzyu[now].front());
      houzyu[now].pop();
    }
    return dp[x][y]=mins;
  }
}

Measured memory_bytes: 8140
// Why am I so dumb? :c
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair

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

#define fi first
#define se second

using namespace std;

typedef long long ll;

int arr[605][605];

char s[605][605];

bool u[26];

int n, ans;

int rectSum(int ax, int ay, int bx, int by) {
	int ret = arr[bx][by];
	ret -= arr[ax - 1][by];
	ret -= arr[bx][ay - 1];
	ret += arr[ax - 1][ay - 1];
	return ret;
}

void solve() {                   
	scanf("%d", &n);

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

    for (int i = 0; i < n; ++i) {
    	for (int j = 0; j < n; ++j) {
    		s[i + n][j] = s[i][j];
    		s[i][j + n] = s[i][j];
    		s[i + n][j + n] = s[i][j];
    	}
    }

    for (int diff = -n + 1; diff < n; ++diff) {
    	for (int i = 1; i < n * 2; ++i) {
    		for (int j = 1; j < n * 2; ++j) {
    			arr[i][j] = 0;

    			if (j + diff < 1 || j + diff >= n * 2) {
    				continue;
    			}

    			if (i - diff < 1 || i - diff >= n * 2) {
    				continue;
    			}

				if (s[i][j] == s[j + diff][i - diff]) {
					arr[i][j] = 1;
				}    				                 		
    		}
    	}

    	for (int i = 1; i < n * 2; ++i) {
    		for (int j = 1; j < n * 2; ++j) {
				arr[i][j] += arr[i - 1][j];
				arr[i][j] += arr[i][j - 1];
				arr[i][j] -= arr[i - 1][j - 1];    			
    		}
    	}

    	for (int sti = 1, stj; sti <= n; ++sti) {
    		stj = sti - diff;

    		if (stj < 1 || stj > n) {
    			continue;
    		}

    		ans += (rectSum(sti, stj, sti + n - 1, stj + n - 1) == n * n);
    	}                                   
    }                      

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

int main() {    
    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 2048
#include<iostream>
using namespace std;
int main()
{
	int a, b, c, k;
	int count = 0;

	cin >> a >> b >> c;
	cin >> k;

	for (; a >= b;) {
		count++;
		b *= 2;
	}
	for (; b >= c;) {
		count++;
		c *= 2;
	}
	//cout << count << endl;
	if (count <= k) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
#define MAX 100
int main(){
  int A[MAX];
  int i,j,k,key,N;
  scanf("%d",&N);
  for(i=0; i<N; i++){
    scanf(" %d",&A[i]);
  }
  
  for(k=0; k<N; k++){
      printf("%d",A[k]);
      if(k==N-1) break;
      printf(" ");
    }
    printf("\n");    
  for(i=1; i<=N-1; i++){
    key = A[i];
    j = i-1;
    while(j>=0 && A[j]>key){
      A[j+1] = A[j];
      j--;
     }
    A[j+1] = key;
    for(k=0; k<N; k++){
      printf("%d",A[k]);
      if(k==N-1) break;
      printf(" ");
    }
    printf("\n");
  }
    return 0;
}



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

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

    int n, c = 0;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a.at(i);
    sort(a.begin(), a.end());
    rep(i, n - 1)
    {
        if (a.at(i) == a.at(i + 1))
            c++;
    }
    if (c == 0)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 1152
# B - Echo
# https://atcoder.jp/contests/abc145/tasks/abc145_b
n = int(input())
s = list(input())

def string_match(str):
    length = len(str)
    half = length//2
    fore_str = str[0:half]
    aft_str = str[half:]
    flg = True
    for i in range(0, half):
        if fore_str[i] != aft_str[i]:
            flg = False
            break
    return flg


if n % 2 != 0:
    flg = False
else:
    flg = string_match(s)

if flg:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
N, K = map(int, input().split())
lis=[]
for i in range(N):
    a, b = map(int, input().split())
    lis.append([a,b])
    
lis.sort()
i=0
while K>0:
    K=K-lis[i][1]
    i+=1


print(lis[i-1][0])

Measured memory_bytes: 20096
// unolight {{{
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(c) begin(c),end(c)
#define REP(i,n) for ( int i=0; i<(int)(n); i++ )
#define REP1(i,a,b) for ( int i=(int)(a); i<=(int)(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long LL;

void RI() {}

template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}

template<typename T>
void _dump( const char* s, T&& head ) { cerr<<s<<"="<<head<<endl; }

template<typename T, typename... Args>
void _dump( const char* s, T&& head, Args&&... tail ) {
    int c=0;
    while ( *s!=',' || c!=0 ) {
        if ( *s=='(' || *s=='[' || *s=='{' ) c++;
        if ( *s==')' || *s==']' || *s=='}' ) c--;
        cerr<<*s++;
    }
    cerr<<"="<<head<<", ";
    _dump(s+1,tail...);
}

#define dump(...) _dump(#__VA_ARGS__, __VA_ARGS__);

template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.first<<","<<p.second<<")"; }

template<typename Iter>
ostream& _out( ostream &s, Iter b, Iter e ) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}

template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
template<typename T>
ostream& operator <<( ostream &s, const set<T> &c ) { return _out(s,ALL(c)); }
template<typename A, typename B>
ostream& operator <<( ostream &s, const map<A,B> &c ) { return _out(s,ALL(c)); }

// }}}
const int MAX_N = 105;
int n, A[MAX_N][3];
void input() {
    RI(n);
    REP(j, 2) {
        REP(i, n) {
            RI(A[i+1][j+1]);
        }
    }
}

void solve() {
    REP1(i,1,n) {
        REP1(j, 1, 2) {
            A[i][j] += max(A[i-1][j], A[i][j-1]);
        }
    }
    printf("%d\n", A[n][2]);
}

int main( int argc, char *argv[] ) {
    input();
    solve();
    return 0;
}


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


int main() {
  int A, B;
  cin >> A >> B;
  int result = 0;
  for (int i = A; i <= B; ++i) {
    vector<vector<int>> cnt(2, vector<int>(10, 0));
    int num = i;
    for (int j = 4; 0 <= j; --j) {
      int ans = num / pow(10, j);
      if (j == 0 || j == 4) {
        ++cnt[0][ans];
      } else if (j == 1|| j == 3) {
        ++cnt[1][ans];
      }
      num -= ans * pow(10, j);
    }
    int c = 0;
    for (int j = 0; j < 2; ++j) {
      for (int k = 0; k < 10; ++k) {
        if (cnt[j][k] == 2) {
          ++c;
          // break;
        }
      }
    }
    if (c == 2) {
      ++result;
    }
  }
  cout << result << endl;
}

Measured memory_bytes: 256
import bisect


def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = is_prime[1] = False

    for i in range(2, n+1):
        if is_prime[i]:
            for j in range(2 * i, n + 1, i):
                is_prime[j] = False

    table = [i for i in range(1, n + 1) if is_prime[i]]
    return is_prime, table


_, prime_table = sieve(10**5 + 4)

x = int(input())
print(prime_table[bisect.bisect_left(prime_table, x)])

Measured memory_bytes: 4236
#include<iostream>
#include<string>
#include<vector>
int main(int, char**)
{
	int number = 0;
	std::cin >> number;

	std::string buff1;
	std::string buff2;
	for (int count = 0; number > count; ++count)
	{
		std::cin >> buff1 >> buff2;

		std::vector<std::string> sum;
		sum.reserve(10);
		int carry = 0;
		for (int offset = 0; buff1.length() > offset || buff2.length() > offset; offset += 8)
		{
			auto cutoff = [](const std::string& buff, const int offset)->int
			{
				if (buff.length() <= offset)
				{
					return 0;
				}
				if (buff.length() <= offset + 8)
				{
					return std::stoi(buff.substr(0, buff.length() - offset));
				}
				return std::stoi(buff.substr(buff.length() - offset - 8, 8));
			};
			int num1 = cutoff(buff1, offset);
			int num2 = cutoff(buff2, offset);
			std::string sum_buff = std::to_string(num1 + num2 + carry);
			
			if (8 < sum_buff.length())
			{
				carry = std::stoi(sum_buff.substr(0, 1));
				sum.emplace_back(sum_buff.substr(1));
			}
			else
			{
				carry = 0;
				sum.emplace_back(sum_buff);
			}
		}
		if (10 < sum.size() || (sum.size() == 10 && sum[0].length() == 8 && 0 != carry))
		{
			std::cout << "overflow";
		}
		else
		{
			if (0 != carry)
			{
				std::cout << std::to_string(carry);
			}
			for (int index = static_cast<int>(sum.size()) - 1; 0 <= index; --index)
			{
				if (index != static_cast<int>(sum.size()) - 1 && 8 != sum[index].length())
				{
					for (int count = 0; 8 - sum[index].length() > count; ++count)
					{
						std::cout << "0";
					}
					std::cout << sum[index];
				}
				else
				{
					std::cout << sum[index];
				}
			}
		}
		std::cout << std::endl;
	}
}


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



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

Measured memory_bytes: 256
import java.io.*;

class Main{
	public static void main(String[]args)throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String str=br.readLine();
		String[] num=str.split(" ");
		
		int a=Integer.parseInt(num[0]);
		int b=Integer.parseInt(num[1]);
		int c=Integer.parseInt(num[2]);
		int div=0;
		
		for(int i=a;i<=b;i++){
			if(c%i==0){
				div++;
			}
		}
		System.out.println(div);
	}
}

Measured memory_bytes: 24432
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}


long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

//ここまでライブラリ
//ここから本文

long long int tpimin(vector<int> a) {
	int MIN = 1000000000;
	int number = 0;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
		number = i;
	}
	return number;
}


int main() {
	string s;
	vector<int> a(170);
	cin >> s;
	for (int i = 0; i < s.length(); i++) {
		a.at(s.at(i))++;
	}
	for (int i = 0; i < 120; i++) {
		if (a.at(i) % 2 != 0) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main(){
	int n,m;
    cin>>n>>m;
    set<lli> adj[n];
    lli a,b;
    for(int i=0;i<m;i++){
        cin>>a>>b;
        adj[a-1].insert(b-1);
        adj[b-1].insert(a-1);
    }
    lli ans = 0;
    bool v[n] = {false};
    for(int i=0;i<n;i++){
        if(!v[i]){
            set<lli> s;
            vector<lli> d;
            v[i] = true;
            d.push_back(i);
            int j=0;
            s.insert(i);
            while(j< d.size()){
                for(auto x: adj[d[j]]){
                    if(s.find(x) == s.end()){
                        s.insert(x);
                        d.push_back(x);
                        v[x] = true;
                    }
                }
                j++;
            }
            ans = max(ans, (lli)s.size());
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 42576
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int cnt[100010];
int main()
{
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		cnt[a]++;
	}
	int ans = 0;
	for (int i = 1; i < 100000; i++) {
		ans = max(ans, cnt[i - 1] + cnt[i] + cnt[i + 1]);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3912
N, Q = map(int, input().split())
S = input()

a = [0] * N
c = [False] * N
for i in range(1, N):
    if S[i - 1:i + 1] == "AC":
        a[i] = a[i - 1] + 1
        c[i] = True
    else:
        a[i] = a[i - 1]

for i in range(Q):
    l, r = map(int, input().split())
    if l - 1 == 0:
        print(a[r - 1])
    elif c[l - 1] is True:
        print(a[r - 1] - a[l - 1])
    else:
        print(a[r - 1] - a[l - 1])

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

using namespace std;

int main() {
	int X,Y;
	cin >> X >> Y;

	Y = Y - 2*X;
	if (0 != Y %2) {
		cout << "No" << endl;
			return 0;
	}
	if ((Y / 2 <= X) &&(0 <= Y / 2)){
		cout << "Yes" << endl;
			return 0;
	}

	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>

int main()
{
    // input
    int N;
    std::cin >> N;

    // solve
    int cnt = 0;
    for (int i = 1; i <= N; i++)
    {
        if (i % 2 == 1)
        {
            cnt++;
        }
    }

    // answer
    double ans = double(cnt) / double(N);
    std::cout << ans << std::endl;
}


Measured memory_bytes: 256
#pragma GCC optimize (3)
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define PII pair<int,int>
#define ll long long
#define ull unsigned long long
#define INFI 2147483647
#define INFL 9223372036854775807
#define INFU 18446744073709551615
using namespace std;
const double PI = acos(-1.0);
const double eps = 1e-6;
inline int read()
{
	int x = 0, f = 1;
	char ch = getchar();
	while (ch<'0' || ch>'9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
char s[3], t[3];
int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	int a, b;
	while (scanf("%d%d", &a, &b) == 2) {
		if (b == 1) cout << 0 << endl;
		else if (a >= b) cout << 1 << endl;
		else {
			int res = 1;
			while ((res - 1)*(a - 1) + a < b) res++;
			cout << res << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main() {
	int i, n, mae=0, usi=0;
	char s[100];
	scanf("%d%s", &n, s);

	for (i=0; i < n ;i++) {
		if (s[i] == '(') mae++;
		if (s[i] == ')') {
			if (mae != 0) mae--;
			else usi++;
		}
	}

	for (i=0; i < usi ;i++) printf("(");
	printf("%s", s);
	for (i=0; i < mae ;i++) printf(")");
	printf("\n");
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<stdio.h>

using namespace std;

int calculatoin(int a,int b,string mark)
{
  if(mark=="+") return a+b;
  else if(mark=="-") return a-b;
  else if(mark=="*") return a*b;
  else if(mark=="/") return a/b;
  else if(mark=="%") return a%b;
}

int main(int argc,char* argv[])
{
  int a,b,answer;
  string mark;
  while(1)
  {
    cin >> a >> mark >> b;
    if(mark=="?") break;
    answer=calculatoin(a,b,mark);
    cout << answer << endl;
  }
}

Measured memory_bytes: 3140
N,M=map(int,input().split())
s=[list(map(int,input().split())) for x in range(M)]

max_left=0
min_right=N

for i in range(M):
    if s[i][0]>max_left:
        max_left=s[i][0]
    if s[i][1]<min_right:
        min_right=s[i][1]
        
cnt=0
for j in range(max_left,min_right+1):
    cnt+=1
print(cnt)

Measured memory_bytes: 27104
import sys
input=sys.stdin.readline
import math

def main():

    x1,y1,x2,y2 = map(int, input().split())
    t = math.pi/2
    x3 = x2 + (x2-x1) * math.cos(t) - (y2-y1) * math.sin(t)
    y3 = y2 + (x2-x1) * math.sin(t) + (y2-y1) * math.cos(t)
    x4 = x3 + (x3-x2) * math.cos(t) - (y3-y2) * math.sin(t)
    y4 = y3 + (x3-x2) * math.sin(t) + (y3-y2) * math.cos(t)
    print(round(x3), round(y3), round(x4), round(y4))

if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i=0; i<N; i++) cin >> a[i];
  sort(a.begin(),a.end(),greater<int>());
  int acnt = 0;
  int bcnt = 0;
  for (int i=0; i<N; i++) {
    if (i%2 == 0) acnt += a[i];
    else bcnt += a[i];
  }
  int ans = acnt - bcnt;
  cout << ans << endl;
}

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

#define ALL(a) (a).begin(), (a).end()
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define rep(i, n) FOR(i, 0, n)
#define repi(i, n) FOR(i, 1, n + 1)
#define pp(v) cerr << #v "=" << (v) << endl;
#define ppa(v) cerr << "- " << #v << endl; rep(i,v.size()) cerr << #v << "[" << i << "] = " << v[i] << endl;
#define div_ceil(a,b) ((a) + ((b) - 1)) / (b)
#define UNIQUE(v) v.erase( unique(ALL(v)), v.end() );
#define INF 0x3f3f3f3f
#define LLINF 1000111000111000111LL
#define MOD 1000000007
#define TIME system("date +%M:%S.%N")
using Graph = vector<vector<int>>;
using ll = long long;
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// ABC110C 方針
// 設問の操作は互換であり、すなわち変換が全単射（置換）であることが必要十分条件
// map<char,set<char>>

int main() {
  string s,t;cin>>s>>t;
  int n = s.size();
  map<char,set<char>> f,g;

  rep(i,n) {
    f[s[i]].insert(t[i]);
    g[t[i]].insert(s[i]);
  }

  bool ans = true;
  for (auto v : f) if (v.second.size()>1) ans = false;
  for (auto v : g) if (v.second.size()>1) ans = false;

  cout << (ans?"Yes":"No") << endl;
}


Measured memory_bytes: 776
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int _pow10[18];

int sunuke(int N)
{
	int res = N;
	int digiNum[18] = { 0 };
	int digiN = 0;
	int Sn = 0;
	int t = N;
	do
	{
		digiN++;
		digiNum[digiN] = t % 10;
		Sn += digiNum[digiN];
		t /= 10;
	} while (t > 0);

	double resn = (double)N / Sn;

	rep(i, 1, digiN + 1)
	{
		N += (9 - digiNum[i])*_pow10[i];
		Sn += (9 - digiNum[i]);
		if (chmin(resn, (double)N / Sn))
		{
			res = N;
		}
	}

	return res;
}

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

	_pow10[1] = 1;
	rep(i, 2, 17)
	{
		_pow10[i] = _pow10[i - 1] * 10;
	}

	int K;
	int c = 0;
	int N = 1;
	cin >> K;
	while (c < K)
	{
		cout << N << endl;
		N = sunuke(N + 1);
		c++;
	}

	return 0;
}

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

int main() {
  ll n,m;
  cin >> n >> m;
  ll pena=0;
  ll col=0;
  
  string tempAns;
  ll tempQ;
  unordered_map<ll, string> mp;
  unordered_map<ll, ll> pc;
  for(ll i = 0; i<m; i++){
    cin >> tempQ;
    cin >> tempAns;
    if(tempAns != "AC"){
      if(mp[tempQ] != "AC")
        pc[tempQ]++;
    }else{
      mp[tempQ] = "AC";
    }
  }
  
  for(auto itr = mp.begin(); itr != mp.end(); itr++){
    if(itr->second == "AC"){
      col++;
      pena += pc[itr->first];
    }
  }
  cout << col << ' ' << pena << endl;
  return 0;
}

Measured memory_bytes: 13220
#include <stdio.h>

#define MAX 500000
#define INFTY 1000000000

int cunt=0;
int L[MAX/2+2],R[MAX/2+2];

void merge(int *,int,int,int);
void mergeSort(int *,int,int);

int main(){
  int A[MAX];
  int n,i;

  scanf("%d",&n);
  for(i=0;i<n;i++){
  scanf("%d",&A[i]);
}

  mergeSort(A,0,n);

  for(i=0;i<n;i++){
  if(i)printf(" ");
  printf("%d",A[i]);
}
  printf("\n");

  printf("%d\n",cunt);
  
  return 0;
}

  
  void merge(int A[],int left,int mid,int right){
  int n1=0;
  int n2=0;
  int i,j,k;
  
  n1 = mid - left;
  n2 = right - mid;
  
  for(i=0;i<=n1;i++)L[i]=A[left + i];
  for(i=0;i<=n2;i++)R[i]=A[mid + i];
  
  L[n1]=INFTY;
  R[n2] =INFTY;
  
  i=j=0;
  for(k=left;k<right;k++){
  cunt++;
  if(L[i] <= R[j]){
  A[k]=L[i++];
}
  
  else {
  A[k]=R[j++];
}
}
}

  void mergeSort(int A[],int left,int right){
  int mid=0;

  if(left + 1 < right){
  mid = (left + right) / 2;

  mergeSort(A,left,mid);
  mergeSort(A,mid,right);
  merge(A,left,mid,right);
}
}
  



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

int main(){

  int n;
  cin >> n;
  std::vector<int> v(n);

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

  int wa = 0;
  int nijouwa=0;
  for (int i=0; i<n; ++i){
    wa += v[i];
    nijouwa += v[i] * v[i];
  }
  cout << (wa * wa - nijouwa)/2 << endl;

  return 0;
}


Measured memory_bytes: 256
n=int(input())
abc=[list(map(int,input().split())) for _ in range(n)]
dp=[[0]*3 for _ in range(n+1)]
for i in range(1,n+1):
    dp[i][0]=abc[i-1][0]+max(dp[i-1][1],dp[i-1][2])
    dp[i][1]=abc[i-1][1]+max(dp[i-1][0],dp[i-1][2])
    dp[i][2]=abc[i-1][2]+max(dp[i-1][0],dp[i-1][1])
print(max(dp[n]))

Measured memory_bytes: 47384