akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
#include<numeric>
#include<iostream>
#include<array>
#include<string>
#define _USE_MATH_DEFINES

#include<math.h>
#include<unordered_map>

#define min(a,b) (a)>(b)?(b):(a)
#define max(a,b) (a)>(b)?(a):(b)

using namespace std;

int main()
{
	int a[100], b[100];
	int n;
	double p1 = 0.0, p2 = 0.0, p3 = 0.0, pi = 0.0;

	cin >> n;

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

	for (int i = 0; i < n; i++)
	{
		p1 += abs(a[i] - b[i]);
	}

	for (int i = 0; i < n; i++)
	{
		p2 += abs(a[i] - b[i])*abs(a[i] - b[i]);
	}
	p2 = sqrt(p2);

	for (int i = 0; i < n; i++)
	{
		p3 += abs(a[i] - b[i])*abs(a[i] - b[i])*abs(a[i] - b[i]);
	}
	p3 = pow(p3, 1.0 / 3.0);

	pi = abs(a[0] - b[0]);
	for (int i = 0; i < n; i++)
	{
		pi = max(pi, abs(a[i] - b[i]));
	}

	printf("%lf\n%lf\n%lf\n%lf\n", p1, p2, p3, pi);
}

Measured memory_bytes: 3340
#include <iostream>
#include <vector>
#include <cmath>

#define MAX_N 200
#define MAX_V 1000
#define INF pow(10, 12)

using namespace std;

int main()
{

    int N, W;
    cin >> N >> W;
    vector<long> w(N);
    vector<long> v(N);
    for (int i = 0; i < N; i++)
        cin >> w[i] >> v[i];

    vector<vector<long>> dp(MAX_N + 1, vector<long>(MAX_N * MAX_V + 1));
    dp[0] = vector<long>(MAX_N * MAX_V + 1, INF);
    dp[0][0] = 0;

    for (int i = 0; i <= N; i++)
    {
        for (int j = 0; j <= MAX_N * MAX_V; j++)
        {
            if (j < v[i])
            {
                dp[i + 1][j] = dp[i][j];
            }
            else
            {
                dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i]);
            }
        }
    }

    long res = 0;
    for (int i = 0; i < MAX_N * MAX_V; i++) if (dp[N][i] <= W) res = i;

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 316160
#include <bits/stdc++.h>
using namespace std;
 
#define trace(...) __f( #__VA_ARGS__ , __VA_ARGS__ )
template <typename Arg1>
void __f( const char* name , Arg1&& arg1 ) {
        cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f( const char* na , Arg1&& arg1 , Args&&... args ) {
        const char* c = strchr( na + 1 , ',' );
        cerr.write( na , c - na ) << " : " << arg1 << " , ";
        __f( c + 1 , args... );
}
#define endl "\n"
#define all(V) V.begin(),V.end()
#define Unique(V) sort(all(V)),V.erase(unique(all(V)),V.end())
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long int LL;
typedef pair <int,int> pii;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const long long INF = 1e18;
const int N = 1e5 + 5;
 
string s;
int len;
LL dp[ N ][ 20 ];
 
LL solve( int idx , int rem ) {
        if( idx >= len ) return rem%13 == 5;
        if( dp[idx][rem] != -1 ) return dp[idx][rem];
        LL ret = 0;
        if( s[idx] != '?' ) {
                ret = ( ret%MOD + solve( idx + 1 , ( rem%13*10%13 + (s[idx]-'0')%13 )%13 )%MOD )%MOD;
        }
        else {
                for( int i = 0; i <= 9; i++ ) {
                      ret = ( ret%MOD + solve( idx + 1 , ( rem%13*10%13 + i%13 )%13 )%MOD )%MOD;
                }
        }
        return dp[idx][rem] = ret;
}
int main( ) {
        IO;
        #ifdef LOCAL
            //freopen( "input.txt" , "r" , stdin );
        #endif // LOCAL
        cin >> s;
        len = s.size();
        LL ans = 0;
        memset( dp , -1 , sizeof( dp ) );
        if( s[0] == '?' ) {
                for( int i = 0; i <= 9; i++ ) {
                      ans = ( ans%MOD + solve( 1 , i )%MOD )%MOD;
                }
        }
        else ans = ( ans%MOD + solve( 1 , s[0] - '0' )%MOD )%MOD;
        cout << ans%MOD << endl;
        return 0;
}





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

using namespace std;

int a[500000];
int dp[500000];

int main(){
	
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=1;i<=n;i++){
		dp[i]=INT_MAX;
	}
	dp[0]=0;
	for(int i=0;i<n;i++){
		if(i+1<n) dp[i+1]=min(dp[i+1],dp[i]+abs(a[i]-a[i+1]));
		if(i+2<n) dp[i+2]=min(dp[i+2],dp[i]+abs(a[i]-a[i+2]));
	}
	cout<<dp[n-1];
	
	return 0;
	
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define frw(i, a, b) for(int i = a; i < b; i++)
#define fi first
#define se second
#define pb push_back
#define in insert
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) int(a.size())
#define pii pair<int, int>
#define piii pair<int, pii>
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define vpii vector<pii>
#define P pair<ll, ll>
#define V vector<ll>
#define C vector<char>
#define vpiii vector<piii>
#define vpll vector<pll>
#define vplll vector<plll>
#define mod 1000000007
#define rep(i, s, n) for (ll i = (ll)(s); i < (ll)(n); i++)
ll maax=1000001;
ll p[10000001];

 ll dp[200000];

int inv(ll x,ll y)
{
	//ll y=mod-2;
	unsigned int res=1;
	while(y>0)
	{
		if(y&1)
			res=(res*x)%mod;
		y=y>>1;
		x=(x*x)%mod;
	}
	return res;
}
void seive()
{
	p[0]=1;
	p[1]=1;
	for(int i=2;i<maax;i++)
	{
		if(p[i]==0)
		{
			for(int j=2*i;j<maax;j+=i)
			{
				if(p[j]==0)
					p[j]=i;
	
			}
			p[i]=i;
		}
	}
}
ll md(ll a){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}
int main()
{
	int n;
	cin>>n;
	int a[n];
	int t=0;
	for(int i=0;i<n;i++)
	{

		cin>>a[i];
		if(a[i]==t+1)
			t++;
	}
	if(t==0)
		cout<<"-1";
	else
		cout<<n-t;

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
  using namespace std;
  long long MOD=1000000007;
  #define IOS() ios_base::sync_with_stdio(0); cin.tie(0);
  typedef long long ll;
  #define pb push_back
  typedef pair<int,int> pi;
  int dp[22][1<<22];

  ll solve(std::vector<vector<int>>& compat , int i , int n , int womanset)
  {
      if(i==(n+1) )
      {
        if(womanset==0)
          return 1;
        else
          return 0;

      }

      if(dp[i][womanset]!=-1)
        return dp[i][womanset];


      ll ans=0ll;
      for(int woman=0;woman<n;woman++)
      {
        bool available = (womanset & (1<<woman)) ? 1 : 0 ;
        if(available && compat[i][woman+1])
        {
          ans= ( ans+ solve(compat , i+1 , n , womanset ^ (1<<woman)) ) % MOD;
        }

      }

      return dp[i][womanset]=ans;
  }


int main()
{
    int n;cin>>n;
    std::vector< vector<int> > compat ( n+1 , vector<int> (n+1) );
    std::vector<int> temp;
    int val;
    memset(dp , -1 ,  sizeof dp);
    for(int i=1;i<=n;i++)
    {
     
      for(int j=1;j<=n;j++)
      {
        cin>>compat[i][j];
      }
      
    }


    cout<<solve(compat , 1 , n , (1<<n)-1 )<<endl;
    return 0;
    
} 

Measured memory_bytes: 364056
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
//ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;
const int N = 1e5;
string s;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> s;
  int ans=0, l=sz(s);
  FOR(i, 0, l/2) if(s[i]!=s[l-i-1]) ans++;
  cout << ans << endl;
}

Measured memory_bytes: 256
const input = require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);
const nin=()=>{const r = input[0];input.shift();return Number(r);}
const sin=()=>{const r = input[0];input.shift();return String(r);}
const out = (...a) => {console.log(...a);}
const min = (...a) => {return Math.min(...a);}
const rep = (n, callback) => {for(let i = 0;i < n; i++){callback();}}
const main = () => {
  let [p, q, r] = [nin(),nin(),nin()];
  out(min(p + q, q + r, r + p));
}
main();

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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  int n, m;
  scanf("%d", &n);
  map<string, int> blue, red;
  char buf[20] = { '\0' };
  for (int i = 0; i < n; ++i) {
    scanf("%s", buf);
    ++blue[string(buf)];
  }
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    scanf("%s", buf);
    ++red[string(buf)];
  }
  int ans = 0;
  for (map<string, int>::iterator iter = blue.begin(); iter != blue.end(); ++iter) {
    ans = max(ans, iter->second - red[iter->first]);
  }

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


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

using namespace std;

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

	if (X == 7 || X == 5 || X == 3) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

}






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

int main() {
    int a,b,c,d,p; cin >> a >> b >> c >> d >> p;

    const int cost_x = a * p;
    const int cost_y = (p < c) ? b : b + (p - c) * d;
    const int cost = min(cost_x, cost_y);

    cout << cost << endl;
}


Measured memory_bytes: 3104
// Problem : E - NEQ
// Contest : AtCoder - AtCoder Beginner Contest 172
// URL : https://atcoder.jp/contests/abc172/tasks/abc172_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define int long long
#define fastio                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0);
#define sz(a) (int)((a).size())
#define pb push_back
#define mp make_pair
#define db1(x) cout << #x << "=" << x << endl
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z)                                                       \
  cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define dbp(x) \
  cout << #x << "= {" << (x.first) << ", " << (x.second) << "}" << endl;
#define dbv(v)                         \
  {                                    \
    cout << #v << " : ";               \
    for (auto x : v) cout << x << ' '; \
    cout << endl;                      \
  }
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define rep2(i, a, b) for (int i = a; i >= b; i--)
#define die(x) return cout << x << '\n', 0;

using namespace std;

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

const int MOD = 1e9 + 7;

const int MAX = 5e5;
ll modulo(ll a, ll b, ll n) {
  ll x = 1, y = a;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x * y) % n;  // multiplying with base
    }
    y = (y * y) % n;  // squaring the base
    b /= 2;
  }
  return x % n;
}
vi fact(MAX + 1), factinv(MAX + 1);

void pre() {
  fact[0] = 1;
  factinv[0] = 1;
  for (int i = 1; i <= MAX; ++i) {
    fact[i] = (fact[i - 1] * i) % MOD;
    factinv[i] = (factinv[i - 1] * modulo(i, MOD - 2, MOD)) % MOD;
  }
}

int mult(int a, int b) { return (a * b) % MOD; }
int nCr(int n, int r) {
  if (n < r) {
    return 0;
  }
  if (n == r || r == 0) return 1;
  return mult(fact[n], mult(factinv[r], factinv[n - r]));
}
int nPr(int n, int r) { return mult(fact[n], factinv[n - r]); }

int32_t main() {
  fastio;
  //  freopen("input.txt", "r", stdin);
  //  freopen("output.txt", "w", stdout);
  int testcases;
  testcases = 1;
  // cin>>testcases;
  pre();
  while (testcases--) {
    int n, m;
    cin >> n >> m;

    int ans = 0;
    int sign = 1;
    for (int i = 0; i <= n; i++) {
      ans = (ans + sign * mult(nCr(n, i), nPr(m - i, n - i))) % MOD;
      sign = sign * -1;
    }
    cout << (mult(ans, nPr(m, n)) + MOD) % MOD << '\n';
  }

  return 0;
}


Measured memory_bytes: 10968
#include <iostream>
using namespace std;
 
int main()
{
    int w,h,x,y,r;
    cin >> w >> h >> x >> y >> r;
 
    if(r <= x && x <=  w-r && r <= y && y <= h-r)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}



Measured memory_bytes: 3116
V, E, r = map(int, input().split())

INF = 2 << 21
G, dist = [None for i in range(E)], [INF for j in range(V)]


class Edge:
    def __init__(self, f, t, cost):
        self.f = f
        self.t = t
        self.cost = cost


def bellman_ford(s):
    dist[s] = 0
    for i in range(V):
        for j in range(E):
            e = G[j]
            if dist[e.f] < INF and dist[e.f] + e.cost < dist[e.t]:
                dist[e.t] = dist[e.f] + e.cost

                if i == V - 1:
                    return True

    return False


def main():
    for i in range(E):
        s, t, d = map(int, input().split())
        G[i] = Edge(s, t, d)

    c = bellman_ford(r)

    if c:
        print("NEGATIVE CYCLE")
    else:
        for i in range(V):
            if dist[i] == INF:
                print("INF")
            else:
                print(dist[i])


if __name__ == '__main__':
    main()



Measured memory_bytes: 6208
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int h,w;
    cin>>h>>w;
    string c[h];
    for (int i=0;i<h;i++){
        cin>>c[i];
    }
    for (auto ci:c){
        cout<<ci<<endl;
        cout<<ci<<endl;
    }
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll n,d;
ll x[200005],y[200005];
ll ans;
int main(void){
    cin>>n>>d;
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i];
        if(x[i]*x[i]+y[i]*y[i]<=d*d) ans++;
    }
    cout<<ans<<endl;


}



Measured memory_bytes: 6716
#include<stdio.h>
#include<math.h>
int call(int n)
{
	int result=1;
	for(int i=1;i<=n;i++)
		result*=i;
	return result;
}
int main()
{
	int n;
	scanf("%d",&n);
	int a[n+1],b[n+1];
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	for(int i=0;i<n;i++)
		scanf("%d",&b[i]);
	int p=1,count1=0;
	for(int i=0;i<n;i++)
	{
		int o=0;
		//if(a[i]==p);
		//else
		//{
		for(int j=0;j<i;j++)
		{if(a[j]<a[i])
			o++;}
			count1+=(a[i]-p-o)*call(n-i-1);
	//	}
	}
	 p=1;int count2=0;
	for(int i=0;i<n;i++)
	{
//		if(b[i]==p)
//			p++;
//		else
		int o=0;
		for(int j=0;j<i;j++)
		{if(b[j]<b[i])
			o++;}
			count2+=(b[i]-p-o)*call(n-i-1);
		
	}
	printf("%d\n",abs(count1-count2));
}




		




Measured memory_bytes: 128
ref=["abcde","fghij","klmno","pqrst","uvwxy","z.?! "]
while 1:
	try:
		inp=raw_input()
		if len(inp)%2==1:
			print "NA"
			continue
		msg=""
		for i in range(0,len(inp),2):
			r,c=map(int,inp[i:i+2])
			if 1<=r<=6 and 1<=c<=5:
				msg+=ref[r-1][c-1]
			else:
				msg="NA"
				break
		print msg
	except:
		break

Measured memory_bytes: 4216
#!/usr/bin/env python

label = list(map(int, input().split()))
command = list(input())

faces = [1, 2, 3, 4, 5, 6]


def dice(command):

    if command == "N":
        faces[0], faces[1], faces[4], faces[5] = faces[1], faces[5], faces[0], faces[4]

    elif command == "S":
        faces[0], faces[1], faces[4], faces[5] = faces[4], faces[0], faces[5], faces[1]

    elif command == "E":
        faces[0], faces[2], faces[3], faces[5] = faces[3], faces[0], faces[5], faces[2]

    else:  # command W
        faces[0], faces[2], faces[3], faces[5] = faces[2], faces[5], faces[0], faces[3]


for c in command:
    dice(c)

print(label[faces[0] - 1])



Measured memory_bytes: 5608
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
long long inf = 100000000000000;
typedef pair<int, int> P;
int main() { // 全探索できるか
	int n;
	cin >> n;
	int a[2100], i;
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}
	stable_sort(a, a + n);
	int j, k;
	int ans = 0;
	for (i = 0; i < n; i++) {
		for (j = i + 1; j < n; j++) {
			for (k = j + 1; k < n; k++) {
				if (a[i] < a[j] + a[k] && a[j]<a[i]+a[k] && a[k]<a[i]+a[j]) ans++;
				else break;
			}
		}
	}
	cout << ans;
	return(0);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <iterator>
#include <utility>
#include <iomanip>
#include <stack>
#include<bitset>
#include <cmath>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
priority_queue<pair<ll,ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> > >pq;
vector<ll>adj[1000005];
ll expo(ll b,ll n,ll m)
{
 ll r,p;
	p=1;
	 b=b%m;
	while(n>0)
	{ 
		r=n%2;
		if(r==1)
		   p=((p)*(b))%m;
		b=((b)*(b))%m; 
		n=n/2;		
	}
 return (p%m);
}
ll divide1(ll a,ll b,ll m)
	{ ll r,p,n;
			p=a%m;
				n=m-2;
				while(n>0){
						 r=n%2;
						if(r==1)
							p=((p%m)*(b%m))%m;
						b=((b%m)*(b%m))%m; 
						n=n/2;	
					}
	return (p%m); }
int main(int argc, char const *argv[])
{	ios_base::sync_with_stdio(false);
	cin.tie(NULL),cout.tie(NULL);
	ll a,b,c,k;
	cin>>a>>b>>c>>k;
	ll ans=0;
	ans+=min(a,k);
	k-=min(a,k);
	k-=min(b,k);
	ans-=min(c,k);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 27036
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val t = sc.nextInt()
    val a = sc.nextInt()
    println((1..n)
        .map {
            Pair(it, Math.abs(a - (t - sc.nextDouble() * 0.006)))
        }
        .minBy { it.second }!!
        .first)
}

Measured memory_bytes: 33452
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
#define MOD 1000000007

#define MAXN 100005

vector<pii> vect;
int a[MAXN];
int b[MAXN];
int a1=0, a2=0;


signed main(){
    fast;
    // #ifndef ONLINE_JUDGE
    //     freopen("/home/swapnil/Desktop/c++/input.txt","r",stdin);
    //     freopen("/home/swapnil/Desktop/c++/output.txt","w",stdout);
    // #endif
    int n;
    cin>>n;
    For(i, 0, n){
        cin>>a[i]>>b[i];
        vect.pb({a[i]+b[i], i});
    }
    sort(all(vect));
    reverse(all(vect));
    For(i, 0, n){
        int pp = vect[i].S;
        // cout<<a[pp]<<endl;
        if(i%2==0){
            // cout<<a[pp]<<endl;
            a1 = a1 + a[pp];
        }
        else{
            // cout<<b[pp]<<endl;
            a2 = a2 + b[pp];
        }
    }
    int ans = a1 - a2;
    cout<<ans;
}

Measured memory_bytes: 3568
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws Exception {
    try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
      int answer = accept(reader.readLine());
      System.out.println(answer);
    }
  }

  static int accept(String line) {
    final String[] tokens = line.split(" ");
    final int a = Integer.parseInt(tokens[0]);
    final int b = Integer.parseInt(tokens[1]);
    return eval(a, b);
  }

  static int eval(int a, int b) {
    if (a == b) return a * 2;
    int max = Math.max(a, b);
    return max * 2 - 1;
  }

}


Measured memory_bytes: 22356
#include <iostream>

int getClass(float e)
{
	if (e >= 1.1) return 0;
	else if (e >= 0.6) return 1;
	else if (e >= 0.2) return 2;
	else return 3;
}

int main()
{
	int L[4] = {0,0,0,0}, R[4] = {0,0,0,0};
	float l, r;
	while (std::cin >> l >> r) {
		L[getClass(l)]++; R[getClass(r)]++;
	}
	for (int i=0; i<4; i++) std::cout << L[i] << " " << R[i] << std::endl;
	return 0;
}



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

int main() {
  int n, m;
  cin >> n;
  vector<string> s(n);
  rep(i, n) cin >> s[i];
  cin >> m;
  vector<string> t(m);
  rep(i, m) cin >> t[i];
  int ans = 0;
  for(int i = 0; i < n; i++) {
    int scnt = 1;
    int tcnt = 0;
    for(int j = 0; j < n; j++) {
      if(i == j) continue;
      if(s[i] == s[j]) scnt++;
    }
    for(int j = 0; j < m; j++) {
      if(s[i] == t[j]) tcnt--;
    }
    ans = max(ans, scnt+tcnt);
  }
  
  cout << ans << endl;
  return 0;
} 
  

Measured memory_bytes: 3636
# list(map(int, input().split()))
# int(input())
from math import cos, pi

def main(A, B, H, M):
    theta_b = M / 60 * (2 * pi)
    theta_a = 1 / 12 * (H + M / 60) * (2 * pi)
    AB = (A ** 2 + B ** 2 - 2 * A * B * cos(theta_a - theta_b)) ** 0.5
    print(AB)

if __name__ == '__main__':
    A, B, H, M = map(int, input().split())
    main(A, B, H, M)


Measured memory_bytes: 9500
#include<iostream>

using namespace std;

int main(int argc,char* argv[])
{
  int height,width;
  while(1)
  {
    cin >> height >> width;
    if(height==0 and width==0) break;
    for(int i=0;i<height;i++)
    {
      for(int j=0;j<width;j++)
      {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

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

    string s;
    cin >> s;
    if (s=="ABC")
    {
        cout << "ARC" << endl;
    }
    else
    {
        cout << "ABC" << endl;
    }

    return 0;
}

Measured memory_bytes: 3604
# -*- coding: utf-8 -*-
A,B,C = map(int, input().split())
l = sorted([A,B,C])

cnt = 0
#1 低２を同じ値にする
if l[0] != l[1]:
    if (l[1]-l[0])%2 == 0:
        cnt += (l[1]-l[0])//2
        l[0] = l[1]
    else:
        cnt += (l[1]-l[0]+1)//2
        l[0] = l[1] + 1
        cnt += 1
        l[1] += 1
        l[2] += 1

#2 低２を高１まで増やす
cnt += l[2] - l[1]
l[0] += l[2] - l[1]
l[1] += l[2] - l[1]

print(cnt)
# print(l)


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

const int MAXCOM = 1000000;
const int MOD = 1000000007;

// 階乗, 階乗の逆元, 逆元
int64_t fac[MAXCOM], finv[MAXCOM], inv[MAXCOM];
// 前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAXCOM; 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;
    }
}
// 二項係数計算
int64_t COM(int n, int k) {
    if (n < k)
        return 0;
    else if (n < 0 || k < 0)
        return 0;
    else
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

struct Point {
    int x, y;
};

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

    COMinit();

    int X, Y;
    cin >> X >> Y;
    if ((X + Y) % 3 != 0) {
        cout << 0 << endl;
    } else {
        cout << COM((X + Y) / 3, X - (X + Y) / 3) << endl;
    }

    return 0;
}


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

using namespace std;

int const MOD = 1e9 + 7;
int const HMAX = 1000;
int const WMAX = 1000;
int h, w;
char grid[1 + HMAX][1 + WMAX];
int dp[1 + HMAX][1 + WMAX];

int main() {
  cin >> h >> w;
  for(int i = 1; i <= h; i++) {
    for(int j = 1; j <= w; j++) {
      cin >> grid[i][j];
    }
  }
  dp[1][1] = 1;
  for(int i = 1; i <= h; i++) {
    for(int j = 1; j <= w; j++) {
      if(grid[i][j] == '.') {
        if(i - 1 > 0 && grid[i-1][j] == '.') {
          dp[i][j] += dp[i-1][j];
        }
        if(j - 1 > 0 && grid[i][j-1] == '.') {
          dp[i][j] += dp[i][j-1];
        }
      }
      dp[i][j] %= MOD;
    }
  }
  cout << dp[h][w];
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
const int D = 80*160+10;
const int D2 = D*2;
typedef bitset<D2> bs;
bs dp[90][90];
int a[100][100];
signed main(){
    int h,w;cin >> h >> w;
    rep(i,h)rep(j,w){
        int x;cin >> x;
        a[i][j] = x;

    }
    rep(i,h)rep(j,w){
        int x;cin >> x;
        a[i][j] = abs(a[i][j] - x);
    }
    dp[1][0][D] = 1;
    dp[0][1][D] = 1;
    
    rep(i,h)rep(j,w){
        dp[i+1][j+1] |= dp[i+1][j] << a[i][j];
        dp[i+1][j+1] |= dp[i+1][j] >> a[i][j];
        dp[i+1][j+1] |= dp[i][j+1] << a[i][j];
        dp[i+1][j+1] |= dp[i][j+1] >> a[i][j];
    }
    int ans = D2;
    rep(i,D2){
        if(dp[h][w][i]){
            ans = min(ans,abs(i-D));
        }

    }
    cout << ans << endl;


    return 0;
}

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

int main(){
  int R,G,B,N; cin>>R>>G>>B>>N;
  int ma=max({R,G,B}), mi=min({R,G,B});
  G=R+G+B-ma-mi;
  R=ma, B=mi;
  int ans=0;
  for(int i=0;i*R<=N;i++){
    for(int j=0;i*R+j*G<=N;j++){
      int x=N-i*R-j*G;
      if(x%B==0) ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int n;
int main()
{
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='+')
			n++;
		else
			n--;
	}
	cout<<n; 
	return 0;
}

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

int main()
{
     int s, w;
     cin >> s >> w;
     if (w >= s)
        cout << "unsafe" << endl;
    else
        cout << "safe" << endl;

    return 0;
}

Measured memory_bytes: 3636
#ABC133 C

L,R = map(int,input().split())
A = []
if R - L > 2019:
    print(0)
elif 2 <= R - L and R - L <= 2019:
    for i in range(L,R):
        for j in range(i+1,R+1):
            A.append((i*j)%2019)
    print(min(A))
elif R - L == 1:
    print((R*L)%2019)

Measured memory_bytes: 81172
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

int main(){
  int n; cin >> n;
  vi a(n); rep(i,n) cin >> a[i];
  sort(all(a));

  int plus = lower_bound(all(a), 0) - a.begin();
  if(plus == 0) plus++;
  if(plus == n) plus--;
  int minus = plus-1;

  vi x, y;
  int i = 0, j = n-1;
  int m;
  while(true){
    int tmp = a[plus];
    while(i < minus){
      x.pb(tmp); y.pb(a[i]);
      tmp -= a[i];
      i++;
    }
    int tmp2 = a[minus];
    while(j > plus){
      x.pb(tmp2); y.pb(a[j]);
      tmp2 -= a[j];
      j--;
    }
    x.pb(tmp); y.pb(tmp2);
    m = tmp - tmp2;
    break;
  }

  cout << m << endl;
  rep(i,n-1) {
    printf("%d %d\n", x[i], y[i]);
  }
}

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T,T MOD = 1000000007>
struct Mint{
  T v;
  Mint():v(0){}
  Mint(signed v):v(v){}
  Mint(long long t){v=t%MOD;if(v<0) v+=MOD;}

  Mint pow(int k){
    Mint res(1),tmp(v);
    while(k){
      if(k&1) res*=tmp;
      tmp*=tmp;
      k>>=1;
    }
    return res;
  }
  
  Mint inv(){return pow(MOD-2);}
  
  Mint& operator+=(Mint a){v+=a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator-=(Mint a){v+=MOD-a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator*=(Mint a){v=1LL*v*a.v%MOD;return *this;}
  Mint& operator/=(Mint a){return (*this)*=a.inv();}
  
  Mint operator+(Mint a) const{return Mint(v)+=a;};
  Mint operator-(Mint a) const{return Mint(v)-=a;};
  Mint operator*(Mint a) const{return Mint(v)*=a;};
  Mint operator/(Mint a) const{return Mint(v)/=a;};

  Mint operator-(){return v?MOD-v:v;}

  bool operator==(const Mint a)const{return v==a.v;}
  bool operator!=(const Mint a)const{return v!=a.v;}
  
};

//INSERT ABOVE HERE

using M = Mint<int>;
const int MAX = 606;
int cnt[MAX][MAX];
int mi[MAX][MAX];
int ma[MAX][MAX];
M dp[MAX][MAX];

signed main(){
  int n,k;
  cin>>n>>k;
  vector<int> a(k),b(k);
  for(int i=0;i<k;i++) cin>>a[i]>>b[i];
  
  vector<int> c(n*2,-1);
  for(int i=0;i<k;i++){
    a[i]--;b[i]--;
    if(a[i]>b[i]) swap(a[i],b[i]);
    
    c[a[i]]=b[i];
    c[b[i]]=a[i];
  }
  
  for(int i=0;i<n*2;i++){
    for(int j=i;j<n*2;j++){
      cnt[i][j]=0;
      mi[i][j]=n*2+1;
      ma[i][j]=-1;
      for(int k=i;k<=j;k++){
        if(~c[k]){
          chmin(mi[i][j],c[k]);
          chmax(ma[i][j],c[k]);
        }else{
          cnt[i][j]++;
        }
      }
    }
  }
  
  vector<M> pa(n*2+1,0);
  pa[0]=1;
  for(int i=2;i<=n*2;i++) pa[i]=pa[i-2]*M(i-1);

  M ans(0);
  for(int l=1;l<=n*2;l++){
    for(int i=0;i+l<=n*2;i++){
      int j=i+l-1;
      if(mi[i][j]<i||ma[i][j]>j) continue;
      dp[i][j]=pa[cnt[i][j]];
      for(int k=i;k<j;k++) dp[i][j]-=dp[i][k]*pa[cnt[k+1][j]];
      ans+=dp[i][j]*pa[(n-k)*2-cnt[i][j]];
    }    
  }

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


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

int main()
{
    int n;
    cin>>n;
    int count = log(n)/log(2);
    cout<<pow(2,count)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <functional>
#include <math.h>
using namespace std;

const int N_MAX = 100000;

int main(){
    double n, k;
    int A[N_MAX];
    
    cin >> n >> k;

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

    int ans = ceil((n - k) / (k - 1)) + 1;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nl "\n"
#define rep(i,n) for(ll i=0; i<(n); i++)
typedef vector<ll> vl;

bool bit(ll subset, ll Rsift){return ((subset)>>(Rsift))&1; }

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

    // solution comes here
    ll N, M, k, x;
    cin >> N >> M;

    vl p(M);
    vector<vl> s(M, vl(N));
    rep(i, M){
        cin >> k;
        rep(_, k) {
            cin >> x;
            s[i][--x]++;
        }
    }
    rep(i, M) cin >> p[i];

    ll pow2_N=(1<<N), ans=0;
    rep(sub, pow2_N) {
        bool all_on=true;
        rep(i, M) {
            ll cnt=0;
            rep(j, N){
                cnt += bit(sub, j) and s[i][j];
            }
            if(cnt%2 != p[i]) all_on=false;
        }
        if(all_on) ans++;
    }

    cout << ans << nl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n,k;
  cin>>n>>k;
  vector<Int> hs(n);
  for(Int i=0;i<n;i++) cin>>hs[i];
  sort(hs.rbegin(),hs.rend());

  Int ans=0;
  for(Int i=k;i<n;i++) ans+=hs[i];
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1792
# Nはプラス、Mはマイナス
n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
# setはindexが使えないためlist化している。
l=list(set(n))
# 右側のmaxをしておかないとintとlistでmaxを使うことによるエラーとなる。
# []は無くても良い。
print(max(0, max([n.count(l[i])-m.count(l[i]) for i in range(len(l))])))


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

int main()
{
  int a, b;
  cin >> a >> b;
  if (a >= 13)
  {
    cout << b << endl;
  }
  else if (a >= 6)
  {
    cout << b / 2 << endl;
  }
  else
  {
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = ((B)-1); I >= (A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define pri(a) cout << (a) << endl


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	vector<ll> Yes(200001,0);
	ll xx = 1;
	while(1){
		ll x = xx*(xx-1);
		if(x>200000)break;
		Yes[x/2]=xx;
		xx++;
	}
	ll N;
	cin >> N;
	if(Yes[N]==0){
		cout << "No" << endl;
		return 0;
	}
	ll K = Yes[N];
	// tyouten -> K
	// hen -> N
	bool same[K+1][K+1]={false};
	vector< vector<ll> > Si;
	Si.resize(K+1);
	ll num=1;
	FOR(i,1,K+1){
		FOR(j,1,K+1){
			if(j==i)continue;
			if(not same[i][j]){
				same[i][j] = same[j][i] = true;
				Si[i].push_back(num);
				Si[j].push_back(num);
				num++;
			}
		}
	}
	cout << "Yes" << endl;
	cout << K << endl;
	FOR(i,1,K+1){
		cout << Si[i].size() << " ";
		FOR(j,0,Si[i].size()){
			cout << Si[i][j] << " ";
		}
		cout << endl;
	}
}


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

int main() {
  int n, a, cur;
  int A[100010];

  cin >> n >> cur;
  A[0] = cur;
  int length = 1;
  for (int i = 1; i < n; ++i) {
    cin >> a;
    if (cur != a) {
      A[length++] = a;
      cur = a;
    }
  }

  for (int i = 0; i < length; ++i) {
    if (i != 0) cout << ' ';
    cout << A[i];
  }
  cout << endl;

  return 0;
}



Measured memory_bytes: 3484
#include <iostream>
#include <algorithm>
using namespace std;
#define MAXN 2000000

int H, A[MAXN];

void maxHeap(int i){
	int l, r, largest;
	l = 2 * i;
	r = 2 * i + 1;
	
	if (l <= H && A[l] > A[i]) {
		largest = l;
	}else {
		largest = i;
	}
	if (r <= H && A[r] > A[largest]) {
		largest = r;
	}
	
	if (largest != i) {
		swap(A[i], A[largest]);
		maxHeap(largest);
	}
}


int main(int argc, char *argv[]) {
	cin >> H;
	
	for (int i = 1; i <= H ; i++) {
		cin >> A[i];
	}
	
	for (int i = H/2; i >= 1; i--) {
		maxHeap(i);
	}
	
	for (int i = 1; i <= H; i++) {
		cout << " " << A[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 5032
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    s = input()
    n = len(s)

    A = [0] * (n + 1)
    cnt = 0
    for i in range(n):
        if s[i] == "<":
            cnt += 1
            A[i + 1] = cnt
        else:
            cnt = 0

    B = [0] * (n + 1)
    cnt = 0
    for i in reversed(range(n)):
        if s[i] == ">":
            cnt += 1
            B[i] = cnt
        else:
            cnt = 0

    res = 0
    for i in range(n + 1):
        res += max(A[i], B[i])

    print(res)


if __name__ == '__main__':
    resolve()


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

typedef long long ll;
 
using namespace std;

const ll mod = 998244353; 
ll n; 
ll a, b; 
ll k, g, f, x, y, bruh;
ll fakt[300001];
ll mul(ll x, ll y) {
	x *= y;
	return x%mod;
}


ll pot(ll z, ll u) {
	if(u == 0) return 1;
	if(u == 1) return z;
	if(u%2 == 0) {
		ll x = pot(z, u/2);
		return mul(x, x);
	}
	return mul(pot(z, u - 1), z);
}

ll dvd(ll z, ll u) {
	u = pot(u, mod - 2);
	z *= u;
	return z%mod;
}

ll pov(ll z) {
	return dvd(fakt[n], mul(fakt[z], fakt[n - z]))%mod;
}

int main() {
	cin >> n >> a >> b >> k;
	fakt[0] = 1;
	for(int  i = 1; i < 300001; i++) {
		fakt[i] = mul(fakt[i - 1], i);
	}
	for(int i = 0; i <= n; i++) {
		if((k - (a * i))%b == 0 && (k - (a * i))/b <= n) {
			bruh = (k - (a * i))/b;
				if(bruh >= 0) {
					g += mul(pov(i), pov(bruh));
				}
		}
	}
	cout << g%mod;
}


Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pop pop_back
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int n){
	par= vector<int>(n, -1);
  }
  int find(int x){
    if(par[x]<0)
      return x;
    else
      return par[x]=find(par[x]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
signed main(){
	int a;
	cin>>a;
	if(a==25)
		cout<<"Christmas"<<endl;
	else if(a==24)
		cout<<"Christmas Eve"<<endl;
	else if(a==23)
		cout<<"Christmas Eve Eve"<<endl;
	else if(a==22)
		cout<<"Christmas Eve Eve Eve"<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int sum1 = a * x + b * y;
		int sum2 = 0;
		if (x < y) {
			sum2 = c * 2 * x + b * (y - x);
		} else {
			sum2 = c * 2 * y + a * (x - y);
		}

		int sum3 = 0;
		if (c * 2 <= a) {
			if (c * 2 <= b) {
				sum3 = c * 2 * (x >= y ? x : y);
			} else {
				if (x >= y) {
					sum3 = c * 2 * x;
				} else {
					sum3 = c * 2 * x + b * (y - x);
				}
			}

		} else {
			if (c * 2 <= b) {// acb
				if (x >= y) {
					sum3 = c * 2 * y + a * (x - y);
				} else {
					sum3 = c * 2 * y;
				}

			} else {
				sum3 = a * x + y * b;
			}

		}

		int sum = sum1 < sum2 ? sum1 : sum2;
		System.out.println(sum <= sum3 ? sum : sum3);

	}

}


Measured memory_bytes: 23636
s = list(input())
ans = [0 for _ in range(len(s))]

counter = 0
index = 0
is_R = True
l_index = 0
while(index < len(s)):
    # Rが続く場合
    if is_R:
        if s[index] == 'R':
            counter += 1
            index += 1
        else:
            l_index = index
            ans[l_index] += (counter)//2
            ans[l_index-1] += (counter-1)//2+1
            counter = 1
            is_R = False
            index += 1
    else:
        if s[index] == 'L':
            counter += 1
            index += 1
        else:
            ans[l_index] += (counter-1)//2+1
            ans[l_index-1] += (counter)//2
            l_index = index-1
            counter = 1
            is_R = True
            index += 1
ans[l_index] += (counter-1)//2+1
ans[l_index-1] += (counter)//2
print(' '.join(map(str, ans)))


Measured memory_bytes: 11176
<?php
$n = trim(fgets(STDIN));
for($i = 0; $i < $n; $i++){
    $a[] = trim(fgets(STDIN));
}
printf("%d", lcmAll($a));

//最大公約数
function gcd($m, $n){
    if(!$n)return $m;
    return gcd($n, $m % $n);
}

//配列の最小公倍数
function lcmAll($array){
    $lcm = $array[0];
    for($i = 1; $i < count($array); $i++){
        $lcm = lcm($lcm, $array[$i]);
    }
    return $lcm;
}

//最小公倍数
function lcm($a, $b) {
    return $a / gcd($a, $b) * $b;
}


Measured memory_bytes: 4604
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
bool f[100001];
vector<int> prime;
int N;
unordered_map<LL, LL> mp1;
unordered_map<LL, int> mp2;
set<LL> st;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    f[0] = f[1] = true;
    for (int i = 2; i <= 100000; i++) {
        if (f[i]) continue;
        prime.push_back(i);
        for (int j = i + i; j <= 100000; j += i) {
            f[j] = true;
        }
    }
    cin >> N;
    int ans = 0;
    for (int i = 1; i <= N; i++) {
        LL v, w = 1;
        cin >> v;
        LL complement = 1;
        for (int p : prime) {
            LL p3 = (LL)p * p * p;
            if (p3 > 10'000'000'000LL) break;
            int c = 0;
            while (v % p == 0) v /= p, c++;
            c %= 3;
            if (c == 1) complement *= (LL)p * p, w *= p;
            else if (c == 2) complement *= p, w *= (LL)p * p;
        }
        //v = 1, p, p^2, pq
        if (v != 1) {
            LL p = sqrt(v);
            while (p * p < v) p++;
            while (p * p > v) p--;
            if (p * p == v) complement *= p, w *= p * p, v = 1;
        }
        if (v <= 100000 && !f[v]) complement *= v * v, w *= v, v = 1;
        //v = 1, pq
        if (v > 1) {
            ans++;
            continue;
        }
        mp1[w] = complement;
        mp2[w]++;
        st.insert(w);
    }
    if (st.count(1)) ans += 1, mp2.erase(1);
    for (LL w : st) {
        ans += max(mp2[w], mp2[mp1[w]]);
        mp2[w] = mp2[mp1[w]] = 0;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 17968
//---JQM---//
//#pragma GCC optimize(3)
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

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

    return 0;
}

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

kill = 0

if A[0] >= B[0]:
  kill += B[0]
  B[0] = 0
else:
  kill += A[0]
  B[0] -= A[0]

for i in range(N-1):
  if A[i+1] <= B[i]:
    kill += A[i+1]
  else:
    A[i+1] -= B[i]
    kill += B[i]
    if A[i+1] >= B[i+1]:
      kill += B[i+1]
      B[i+1] = 0
    else:
      kill += A[i+1]
      B[i+1] -= A[i+1]

if A[N] <= B[N-1]:
  kill += A[N]
else:
  kill += B[N-1]

print(kill)

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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
#define mem(a,b) memset(a,b,sizeof(a))
#define shutdown ios::sync_with_stdio(false)
#define MAX 10e18+1000
#define INF 0x3f3f3f3f
#define FOR(x,k) for(int x=1;x<=k;x++)

const int mm=1000100;
int math[mm];

int main() {
    shutdown;
    double a,b;
    cin>>a>>b;
    cout<<2*b-a<<endl;
    return 0;
}


Measured memory_bytes: 256
from collections import Counter

N, C = [int(_) for _ in input().split()]

D = [[int(_) for _ in input().split()] for _ in range(C)]

cnt = [Counter() for _ in range(3)]
for i in range(N):
    tmp = [int(_) for _ in input().split()]
    for j in range(N):
        idx = (i + 1 + j + 1) % 3
        cnt[idx][tmp[j] - 1] += 1

vals = [[0] * C for _ in range(3)]
for i in range(3):
    for j in range(C):
        a = cnt[i][j]
        if a <= 0: continue
        for k in range(C):  # k 色に揃えるコスト
            vals[i][k] += D[j][k] * a
    # print(vals[i])

ans = 1e12
for x in range(C):
    for y in range(C):
        if x == y: continue
        for z in range(C):
            if x == z or y == z: continue
            ans = min(ans, vals[0][x] + vals[1][y] + vals[2][z])
print(ans)


Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
const int maxn = 1e5 + 5;
int dp[maxn][21] , a[maxn] , n , L;
void solve ()
{
    for (int i = 1 ; i <= n ; i++) {
        int l = 1 , r = n , mid;
        while (l <= r){
            mid = l + r >> 1;
            if (a[mid] <= a[i] + L) l = mid + 1;
            else r = mid - 1;
        }
        dp[i][0] = r;
    }
    for (int i = 1 ; i <= 20 ; i++)
        for (int j = 1 ; j <= n; j++)
            dp[j][i] = dp[dp[j][i - 1]][i - 1];
}
int ask (int x , int y)
{
    if (x == y) return 0;
    int ans = 0;
    for (int i = 20 ; i >= 0 ; i--)
        if (dp[x][i] < y) x = dp[x][i] , ans += (1 << i);
    ans++;
    return ans;
}
int main()
{
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i = 1 ; i <= n ; i++) cin >> a[i];
    cin >> L;
    solve ();
    int q;cin >> q;
    while (q--){
        int x , y; cin >> x >> y;
        if (x > y) swap(x , y);
        cout << ask(x , y) << endl;
    }
    return 0;
}


Measured memory_bytes: 12128
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

const int mod = 1e9 + 7;

LL RS(LL n, LL p) {
  if (p == 0) return 1;
  else if (p % 2 == 0) {
    LL t = RS(n, p / 2);
    return t * t % mod;
  } else {
    return n * RS(n, p - 1) % mod;
  }
}

int nck(int n, int k) {
  LL top = 1;
  LL sum = 1;
  for (int i = 0; i < k; i ++) {
    top *= (n - i);
    top %= mod;

    sum *= (i + 1);
    sum %= mod;
  }

  return top * RS(sum, mod - 2) % mod;
}

int main() {
  int x, y;
  cin >> x >> y;

  if ((2 * x - y) % 3 != 0 || (2 * y - x) % 3 != 0) {
    cout << 0 << endl;
    return 0;
  }

  int a = (2 * x - y) / 3;
  int b = (2 * y - x) / 3;
  if (a < 0 || b < 0) {
    cout << 0 << endl;
  } else {
    cout << nck(a + b, a) << endl;
  }
}


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

int main() {
  int n,k;
  cin >> n >> k;
  vector<int> h(n);
  for(int i=0;i<n;i++){
    cin >> h.at(i);
  }
  sort(h.begin(),h.end());
  reverse(h.begin(),h.end());
  ll ans=0;
  for(int i=k;i<n;i++){
    ans += h.at(i);
  }
  
  cout << ans << endl;
  
  return(0);
}

Measured memory_bytes: 3976