akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std ;
#define int                 long long
#define ull                 unsigned long long int
#define ld                  long double
#define vi                  vector<int>
#define vii                 vector<pair<int,int>>
#define vvi                 vector<vector<int>>
#define pii                 pair<int,int>
#define prec(x)             fixed<<setprecision(15)<<x
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define rev(x)              reverse(x.begin(),x.end())
#define mset(a,b)           memset(a,b,sizeof(a))
#define mcpy(a,b)           memcpy(a,b,sizeof(a))
#define fo0(i,n)            for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n)            for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b)           for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)            for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)            for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define mk(arr,n,type)      type *arr=new type[n];
#define dbg(x) cerr << #x << " is " << x << endl;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
clock_t beg = clock();
const int inf=1e18;const int mod=1e9+7;const int N=2e5+9;
const double pi = 3.1415926535897932384626433;
void FILE_IO(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}

void JH(){
    int d=0,e=0,f=0,g=0,p=0,w=0,flag=0,ans=0,res=0,cnt=0,sum=0;double f1=0.0,f2=0.0,f3=0.0;
    int n;cin>>n;
    int a[n];
    fo0(i,n){
        cin>>a[i];
        d^=a[i];
    }
    fo0(i,n){
        cout<<(d^a[i])<<" ";
    }
}

int32_t main()
{
    FILE_IO();FAST_IO;int t=1;
    // cin>>t;
    while(t--){JH();}cerr<<(double)(clock()-beg)/1000<<"s ";
}

Measured memory_bytes: 5352
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	long long arr[100000];
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%lld",&arr[i]);
	 } 
	 sort(arr,arr+n);
	 long long sum=0;
	 if(n%2==0)
	 {
	 	for(int i=0;i<n/2-1;i++)
	 	{
	 		sum+=arr[n-i-1];
	 		sum-=arr[i];
		 }
		 sum=sum*2;
		 sum+=arr[n/2];
		 sum-=arr[n/2-1];
	 }
	 else
	 {
	 	for(int i=0;i<n/2-1;i++)
	 	{
	 		sum+=arr[n-i-1];
	 		sum-=arr[i];
		 }
		 sum=sum*2;
		 int a=arr[n/2+1]*2-arr[n/2]-arr[n/2-1];
		 int b=arr[n/2+1]+arr[n/2]-2*arr[n/2-1];
		if(a>b)
		sum+=a;
		else
		sum+=b;
	 }
	 cout<<sum;
 } 

Measured memory_bytes: 1024
n,k=map(int,input().split())
a=list(map(int,input().split()))
import collections
count=0
data=collections.Counter(a)
data=sorted(data.items(),key=lambda x:x[1])
if k<len(data):
    for i in range(len(data)-k):
        count+=data[i][1]
else:
    print(0)
    exit()
print(count)


Measured memory_bytes: 39348
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {


    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String line = in.readLine();
        int k = Integer.valueOf(line);
        String s = in.readLine();

        if (s.length() > k) {
            String temp = s.substring(0, k);
            System.out.println(temp + "...");
        }else{
            System.out.println(s);
        }
    }
}


Measured memory_bytes: 36320
n = int(input())
f = [0]*(n+1)
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            k = x*x + y*y + z*z + x*y + y*z + z*x
            if k <= n: f[k] += 1
for i in range(n): print(f[i+1])


Measured memory_bytes: 9324
#include<bits/stdc++.h>
using namespace std;
//define
#define str string
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
#define elif else if
//vectordefine
#define vint vector<int>
#define vc vector<char>
#define vtr vector<string>
#define pb(n) push_back(n)
//queuedefine
#define qint queue<int>
#define qc queue<char>
#define qstr queue<str>
//mapdefine
#define mint map<int>
#define mc map<char>
//pairdefine
#define pint pair<int,int>
#define pis pair<int,str>
#define pic pair<int,char>
#define pci pair<char,int>
#define mod 100000007
//main
signed main(){
  int D,N,M,O,P,count=0,count2=mod,count3=0,stack=0;
  str S,T;
  double l,s;
  cin>>N;
  vint a(N);
  cout<<3*(N*N)<<endl;
}


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

using ll = long long;
//print(fixed << setprecision(10));
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define repk(i,n,k) for(ll i = k; i < (n); i++)
#define all(n) n.begin(), n.end()
#define print(n) cout << n << endl
double PI = acos(-1.0);
int INF = 1e9;
ll LINF = 1e18;
ll MOD = 1e9+7;


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    ll n,m,k;
    cin >> n >> m >> k;

    vector<ll> a(n+1),b(m+1),asum,bsum;
    rep(i,n){
        cin >> a[i];
        if(i==0){
            asum.emplace_back(a[0]);
            continue;
        }
        if((ll)asum.size()!=i) continue;
        if(asum[i-1] + a[i] <= k) asum.emplace_back(a[i]+asum[i-1]);
    } 
    a[n] = LINF;
    rep(i,m){
        cin >> b[i];
        if(i==0){
            bsum.emplace_back(b[0]);
            continue;
        }
        if((ll)bsum.size()!=i) continue;
        if(bsum[i-1] + b[i] <= k) bsum.emplace_back(b[i]+bsum[i-1]);
    } 
    b[m] = LINF;

    auto itr = upper_bound(all(bsum),k);
    ll ans = itr-bsum.begin();
    rep(i,(ll)asum.size()){
        if(asum[i]>k) break;
        auto itr = upper_bound(all(bsum),k-asum[i]);
        ans = max(ans,i+1+(itr-bsum.begin()));
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 11088
def exchange(l, a, b):
    # change the order of 2 elements of l whose index are a and b
    w = l[a]
    l[a] = l[b]
    l[b] = w

l = list(map(int, input().split()))
exchange(l, 0, 1)
exchange(l, 0, 2)

print(l[0], l[1], l[2])
    
  

Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

// before your coding, you have to write a line "math_init()"
lint COM[52][52] = {};

void com_init() {
  COM[0][0] = 1;
  for (int i = 0; i <= 50; i++) {
    for (int j = 0; j <= 50; j++) {
      COM[i + 1][j] += COM[i][j];
      COM[i + 1][j + 1] += COM[i][j];
    }
  }
}

int main() {

  com_init();
  
  lint n, a, b; cin >> n >> a >> b;
  vector<lint> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }

  sort(RALL(v));
  double sum = 0.0;
  for (int i = 0; i < a; i++) {
    sum += v[i];
  }

  printf("%.10f\n", sum / a);
  lint num = v[a - 1];

  if (num != v[0]) {
    // 個数は a 個で固定
    lint all = 0;
    lint contain = 0;
    for (int i = 0; i < n; i++) {
      if (v[i] == num) {
        all++;
        if (i < a) contain++;
      }
    }
  
    cout << COM[all][contain] << endl;
  } else {
    lint all = 0;
    for (int i = 0; i < n; i++) {
      if (v[i] == num) all++;
    }
    lint ans = 0;
    for (int x = a; x <= min(all, b); x++) {
      ans += COM[all][x];
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

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

    vector<bool> zoro(n ,false);

    for(long long i = 0; i < n; i++){
        long long d1, d2;
        cin >> d1 >> d2;
        if(d1 == d2) zoro[i] = true;
    }

    for(long long i = 0; i < n; i++){
        if(i + 2 < n and zoro[i] == true and zoro[i+1] == true and zoro[i+2] == true){
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}

Measured memory_bytes: 3624
require 'pp'

n = gets.to_i
a_n = gets.split.map(&:to_i)

a_n.each do |a|
    if a % 2 == 0
        if a % 3 == 0 || a % 5 == 0
            next
        else
            puts "DENIED"
            exit 0
        end
    end 
end

puts "APPROVED"


Measured memory_bytes: 2172
# coding:utf-8


def main():
    N = int(input())
    A = list(map(int, input().split()))
    dp = []
    dp.append([0, -10**9-1])

    for i in range(0, N):
        temp_0 = max(dp[i][0]+A[i], dp[i][1]-A[i])
        temp_1 = max(dp[i][0]-A[i], dp[i][1]+A[i])
        dp.append([temp_0, temp_1])

    # print(dp)
    ans = dp[N][0]
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 25588
#include<bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define ll long long
#define d1(x)  cerr << #x << "--> " << x << endl
#define d2(x,y)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<endl
#define d3(x,y,z)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z<< endl
#define d4(x,y,z,w)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z << " | "<< #w << "--> " << w <<endl
#define vpll vector<pair<ll,ll>>
#define F first
#define S second
#define T ll tt; cin>>tt; while(tt--)
using namespace std;
ll mode=1e9+7;
const long long maxn=2e5+5;
const long long inf=99999999999;
ll __lcm(ll a, ll b){ return (a*b)/__gcd(a,b); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll getRand(ll l, ll r){ uniform_int_distribution<ll> uid(l, r); return uid(rng); }

ll power(ll x, ll y){  
	ll p=mode, res=1;
    x = x % p;
    while (y > 0) {  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1;
        x = (x*x) % p;  
    }  
    return res;  
}


void solve(){
	
	ll n;
	cin>>n;
	ll ans=1;
	ll lim=1000000000000000000;
	bool ok=false;
	bool zero=false;
	for (int i=1;i<=n;i++){
		ll x;
		cin>>x;
		if (x==0) zero=true;
		ans*=x;
		if (ans<=0 || ans>lim) ok=true;
	}
	if (zero){
		cout<<0<<endl;
		return;
	}
	
	if (ok || ans>lim){
		cout<<-1<<endl;
	}
	else{
		cout<<ans<<endl;
	}
	
	return;
}

 
int main(){ 
    
    #ifndef ONLINE_JUDGE
	//	freopen("input.txt", "r", stdin);
    #endif
    srand(time(0)); 
    
    ios::sync_with_stdio(0);
    cin.tie(0);
 	
	//T{ solve(); }
	solve();
	
	
	
	return 0;
	
}

Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 1000000007;

int main(){
    std::ios_base::sync_with_stdio(false);

    int a,b; cin >>a >> b;

    if(a>=13){
        cout  << b << endl;
        return 0;
    } else if (a>=6){
        cout << b/2 << endl;
        return 0;
    } else{
        cout << 0 << endl;
    }


    return 0;
}

Measured memory_bytes: 256
A, B, C, X, Y = map(int, input().split())

INF = float("inf")
b = 0
for a in range(X + 1):
    sum = A * a
    ab_a = (X - a) * 2
    ab_b = ab_a
    sum += C * ab_a
    if ab_b / 2 < Y:
        if B < C * 2:
            b = round(Y - ab_b / 2)
            sum += B * b
        else:
            sum += C * int(Y - (ab_b / 2)) * 2
    if sum < INF:
        INF = sum
print(INF)


Measured memory_bytes: 65552
#include <cstdio>
#include <algorithm>
using namespace std;
 
int n, w, a, b;
long long dp[100100];
 
int main() {
	scanf("%d %d",&n,&w);
  	for (int i = 0; i < n; i++) {
    	scanf("%d %d",&a,&b);
      	for (int j = w; j - a >= 0; j--)
          dp[j] = max(dp[j], (long long)dp[j - a] + b);
    }
  	printf("%lld\n",dp[w]);
  return 0;
}

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

const int DEPTH = 17;
const int INTMAX = (1LL << 31) - 1;

struct RUQ {
	int d[1 << (DEPTH + 1)];
	int t[1 << (DEPTH + 1)];
	
	RUQ() {
		int i;
		for (i = 0; i < (1 << (DEPTH + 1)); i++) {
			d[i] = INTMAX;
			t[i] = -1;
		}
	}
	
	//[l, r)
	void update(int l, int r, int x, int Time, int a = 0, int b = (1 << DEPTH), int id = 0) {
		if (a >= r || b <= l) return;
		if (l <= a && b <= r) {
			d[id] = x;
			t[id] = Time;
			return;
		}
		update(l, r, x, Time, a, (a + b) / 2, id * 2 + 1);
		update(l, r, x, Time, (a + b) / 2, b, id * 2 + 2);
	}
	
	int getValue(int pos) {
		pos += (1 << DEPTH) - 1;
		int retD = d[pos];
		int retT = t[pos];
		
		while (pos > 0) {
			pos = (pos - 1) / 2;
			if (retT < t[pos]) {
				retT = t[pos];
				retD = d[pos];
			}
		}
		return retD;
	}
};

RUQ ruq;

int main() {
	int n, q;
	
	cin >> n >> q;
	for (int i = 0; i < q; i++) {
		int type;
		cin >> type;
		if (type == 0) {
			int s, t, x;
			cin >> s >> t >> x;
			ruq.update(s, t + 1, x, i);
		}
		else {
			int pos;
			cin >> pos;
			cout << ruq.getValue(pos) << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 5164
#include <stdio.h>

int
main(void)
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    if ((a==b && b!=c) || (b==c && c!=a) || (c==a && a!=b))
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <stack>
#include <array>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
using namespace std;
typedef int64_t ll;
typedef uint64_t ull;
constexpr uint64_t L1 = 1ull;
constexpr ull bit(int n){ return 1ull << n;}

constexpr ll INF       = 1000000000;/* 1e+9a */

array<ll, 51> bag_size, pat;

ll eat(ll N, ll X){
    ll ans = 0;
    X -= 1;
    if(X <= 0){
        return 0;
    }
    if(X < bag_size[N-1]){
        return eat(N-1, X);
    }
    X -= bag_size[N-1];
    ans += pat[N-1];
    if(X == 0) return ans;
    ans++;
    X--;
    if(X < bag_size[N-1]){
        return eat(N-1, X) + ans;
    }
    return pat[N];
    
}


void solve(istream& cin) {
    bag_size[0] = 1;
    pat[0] = 1;
    for (int i = 1; i < bag_size.size(); ++i) {
        bag_size[i]  = 3 + 2*bag_size[i-1];
        pat[i] = 1 + 2 * pat[i-1];
    }// i
    ll N, X;
    while(cin >> N >> X){
        cout << eat(N, X) << endl;
        
    }
}

int main(int argc, char *argv[]) {
    string FileName("D"), Modifier("_MEPH");
    string ExecutionName = FileName + Modifier;
    string sub(argv[0]);
    // pass消去
    if(sub.size() > ExecutionName.size())
        sub = sub.substr(sub.size()-ExecutionName.size(), ExecutionName.size());

	// 数値計算もの用
    cout << setprecision(16) << scientific;
    if (sub != ExecutionName) {
        cin.tie(0);
        ios::sync_with_stdio(false);
        solve(cin);
    }
    else {    
	    cerr << sub << endl;
        string inFile = "D_sample.txt";
        auto fs = fstream(inFile, fstream::in);
        solve(fs);
    }
}


Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
 
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
typedef int64_t ll;
 
#define endl '\n'
#define int ll
ll mod=1e9+7;
ll mod1=1e9+5;
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power((((a%mod)*(a%mod))%mod),b/2)%mod;
    else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
}
int dp[100001][101][2];
int d;
string s;
int solve(int pos,int di,int f,int sum)
{
    if(di>d)
        return 0;
    if(pos==s.length())
    {
        //cout<<sum<<endl;
        if(di==0)
        return 1;
    else
        return 0;
    }
  //  cout<<pos<<" "<<di<<" "<<f<<" "<<sum<<endl;
    int &res=dp[pos][di][f];
    if(res!=-1)
        return dp[pos][di][f];
    res=0;
    int fin;
    if(f==0)
    {
        fin=s[pos]-'0';
    }
    else
        fin=9;
   // cout<<fin<<endl;
    for(int x=0;x<=fin;++x)
    {
        int k=f;
        if(f==0 and x<fin)
            k=1;
        
        
                res+=solve(pos+1,(sum+x)%d,k,sum+x);
                res=res%mod;
        
        
    }

    return res%mod;
}
int32_t main()
{
    IOS
     
    
    
    cin>>s;
    
    cin>>d;
    memset(dp,-1,sizeof(dp));
    int x=solve(0,0,0,0);
    int n=s.length();
    cout<<(x-1+mod)%mod<<endl;

}



Measured memory_bytes: 158976
#include<iostream>
#include<numeric>
using namespace std;
typedef long long ll;

int x[51]={};
ll dp[51][51][2501]={};

int main(){
	int n,a;
	cin >> n >> a;
	for(int i=1;i<=n;i++) cin >> x[i];
	dp[0][0][0]=1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=i;j++){
			for(int s=0;s<=accumulate(x+1,x+n+1,0);s++){
				if(i>=1 && s<x[i]) 
					dp[i][j][s]=dp[i-1][j][s];
				else if(i>=1 && j>=1 && s>=x[i]) 
					dp[i][j][s]=dp[i-1][j][s]+dp[i-1][j-1][s-x[i]];
				else dp[i][j][s]=0;
			}
		}
	}

	ll ans=0;
	for(int i=1;i<=n;i++) ans+=dp[n][i][i*a];
	cout << ans << endl;
}


Measured memory_bytes: 49152
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
	int n, q;
	cin >> n >> q;
	vector<vector<int>> edge(n);
	rep(i,n-1) {
		int a, b;
		cin >> a >> b;
		--a, --b;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}
	vector<int> cnt(n);
	rep(i,q) {
		int p, x;
		cin >> p >> x;
		--p;
		cnt[p] += x;
	}
	queue<P> Q;
	vector<bool> visited(n);
	Q.emplace(0, -1);
	while(!Q.empty()) {
		P now;
		now = Q.front();
		Q.pop();
		if (visited[now.first]) continue;
		visited[now.first] = true;
		if (now.second!=-1) cnt[now.first] += cnt[now.second];
		for (int next: edge[now.first]) {
			Q.emplace(next, now.first);
		}	
	}
	rep(i,n) cout << cnt[i] << ' ';
	cout << "\n";
	return 0;
}


Measured memory_bytes: 17224
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define here(x) cout << " #x = " << x << endl;
#define show(x) {for( auto ii : x) cout << ii << setw(4); cout << endl;}
#define shop(n,x) {for(int i = 0; i < n; i++) cout << x << setw(4); cout << endl;}
#define ff first
#define ss second
#define sq(x) (x*x)
#define endl '\n'
#define en " "
#define pb push_back
#define mpair make_pair
ll mod=1000000007;
double pi=3.1415926536;
int main()
{
	fastio();
	int tt = 1;
	//cin >> tt;
	while(tt--)
	{
		// go fast 		check		//		CHECK -> if()   else if()
		
		ll n, x=0, m=0, y=0, d=1, k=mod;
		string s, t, se;
		cin >> s >> t;
		n = s.length();
		m = t.length();
		ll dp[n + 1][m + 1] = {};
		for(int i = 1; i <= n; i++)
		{
			for(int j = 1; j <= m; j++)
			{
				if(s[i - 1] == t[j - 1])
					dp[i][j] = 1 + dp[i - 1][j - 1];
				else
					dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
			}
		}
		//for(int i = 1; i <= n; i++)
		//	show(dp[i]);
		int i = n, j = m;
		while(dp[i][j])
		{
			if(s[i - 1] == t[j - 1])
			{
				se += s[i - 1];
				i--, j--;
			}
			else if(dp[i][j] == dp[i - 1][j]) i--;
			else j--;
		}
		reverse(se.begin(), se.end());
		cout << se << endl;
	}
}

Measured memory_bytes: 70656
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  string s;
  cin >> s;
  rep(i, s.size()) {
    if(i%2 == 0) cout << s[i] << flush;
  }
  return 0;
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    i64 H1, M1, H2, M2, K; cin >> H1 >> M1 >> H2 >> M2 >> K;

    i64 t1 = H1 * 60 + M1;
    i64 t2 = H2 * 60 + M2;
    if (t1 > t2) t2 += 60 * 24;
    i64 ans = (t2 - K) - t1;
    cout << ans << endl;

    return 0;
}


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

int main() {
  int n;
  cin >>n;
  vector< tuple<string, int,int> > v(n);
  
  for(int i=0;i<n;i++){
    int a;
    cin >> get<0>(v.at(i)) >> a ;
    get<1>(v.at(i)) =-a;
    get<2>(v.at(i))= i+1;
  }
  
  sort(v.begin(), v.end());
  
  for(auto &it :v){
    cout << get<2>(it) << endl;
  }
  
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#define N 100005
#define F first
#define S second
using namespace std;

int n, m, mn = 1e9, c = 1;
pair<int, int> a[N];
int main()
{
	int i;
	cin >> n >> m;
	for (i = 0; i < m; i++) scanf("%d %d", &a[i].F, &a[i].S);
	sort(a, a + m);
	for (i = 0; i < m; i++) {
		if (a[i].S < mn) mn = a[i].S;
		else if (a[i].F >= mn) c++, mn = a[i].S;
	}
    cout << c << endl;
    return 0;
}

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

int main() {
    int N, Y;
    cin >> N >> Y;
    int res10000 = -1, res5000 = -1, res1000 = -1, total;
    for (int i_10000 = 0; i_10000 <= N; i_10000++) {
        if (res10000 != -1) break;
        for (int i_5000 = 0; i_5000 + i_10000 <= N; i_5000++) {
            int i_1000 = N - i_10000 - i_5000;
            total = 10000*i_10000 + 5000*i_5000 + 1000*i_1000;
            if (total == Y) {
                res10000 = i_10000;
                res5000 = i_5000;
                res1000 = i_1000;
                break;
            }
        }
    }
    cout << res10000 << " " << res5000 << " " << res1000 << endl;
    return 0;
}

Measured memory_bytes: 256
n,m,p=map(int,input().split())
E=[list(map(int,input().split())) for i in range(m)]
INF=float("inf")
dist=[INF]*n
dist[0]=0
prev=0
# 閉路の長さの最大はnなので2*n回ループさせれば閉路検出ができる
for i in range(2*n):
  for fr,to,cost in E:
    fr,to=fr-1,to-1
    cost*=-1
    cost+=p
    if dist[fr]!=INF and dist[to]>dist[fr]+cost:
      dist[to]=dist[fr]+cost
      if i>=n:
        dist[to]=-float("inf")
    if i==n-1:
      prev=dist[n-1]
if prev==dist[n-1]:
  print(max(-dist[n-1],0))
else:
  print(-1)


Measured memory_bytes: 53464
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
struct point{int x;int y;};
int i,j,k,count1=0,count2=0;

int main(){
    string s;
    int r=0,b=0,n;
    cin>>n>>s;
    rep(i,n){
        if(s[i]=='R')r++;
        else b++;
    }
    cout<<(r>b?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod_) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod_;
		}
		x = x * x % mod_;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}
/*--------Library Zone!--------*/


signed main() {
	int k;
	double n; cin >> n >> k;
	double ans = 0.;
	REP(i, n + 1) {
		double ka = 1. / n;
		int j = i;
		while (j < k) {
			ka /= 2.;
			j *= 2;
		}
		ans += ka;
	}
	printf("%.12lf\n", ans);
}

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

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

	int N;
	cin >> N;
	int a[4];
	for (int i = 0; i < 4; i++) {
		a[i] = N % 10;
		N /= 10;		
	}
	if (a[0] == a[1] && a[0] == a[2] && a[2] == a[1]) {
		cout << "Yes";
		return 0;
	}
	if (a[1] == a[2] && a[3] == a[2] && a[3] == a[1]) {
		cout << "Yes";
		return 0;
	}
	cout << "No";
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }


    Scanner cin;

    int C = 52;

    void calc()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        int[] A = cin.ArrayInt(N);
        int[] B = cin.ArrayInt(N);


        long result = (1L << C) - 1;
        for (int i = 0; i < N; i++)
        {
            if(!check(result, A[i], B[i]))
            {
                Console.WriteLine(-1);
                return;
            }
        }

        for (int i = C - 1; i >= 0; i--)
        {
            long next = result - (1L << i);
            bool flag = true;
            for (int j = 0; j < N; j++)
            {
                if (!check(next, A[j], B[j]))
                {
                    flag = false;
                    break;
                }
            }

            if (flag) result = next;
        }

        Console.WriteLine(result * 2);
    }

    bool check(long flag, int a, int b)
    {
        bool[] ok = new bool[C];
        ok[a] = true;
        for (int i = C - 1; i >= 0; i--)
        {
            if ((flag >> i) % 2 == 0) continue;
            for (int j = i; j < C; j++)
            {
                if(ok[j]) ok[j % (i + 1)] = true;
            }
            if (ok[b]) return true;
        }
        if (ok[b]) return true;
        return false;
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13268
#include <iostream>

using namespace std;

int main()
{
    int **A;
    int **M;
    A = new int*[3];
    M = new int*[3];
    for(int i=0;i<3;i++){
        A[i] = new int[3];
        M[i] = new int[3];
        cin >> A[i][0] >> A[i][1] >> A[i][2];
        M[i][0] = 0;
        M[i][1] = 0;
        M[i][2] = 0;
    }
    int N;
    cin >> N;
    int *b;
    b = new int[N];
    for(int i=0;i<N;i++){
        cin >> b[i];
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(b[i]==A[j][k]){
                    M[j][k] = 1;
                }
            }
        }
    }

    int flag=0;
    if(M[0][0]+M[1][1]+M[2][2]==3 || M[0][2]+M[1][1]+M[2][0]==3){
        flag = 1;
    }
    for(int i=0;i<3;i++){
        if(M[i][0]+M[i][1]+M[i][2]==3 || M[0][i]+M[1][i]+M[2][i]==3){
            flag = 1;
            break;
        }
    }

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


    return 0;
}

Measured memory_bytes: 256
N, M, K = map(int, input().split())

class UnionFind:
    def __init__(self, n):
        self.ps = [-1] * (n + 1)
 
    def find(self, x):
        if self.ps[x] < 0:
            return x
        else:
            self.ps[x] = self.find(self.ps[x])
            return self.ps[x]
 
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False
        if self.ps[x] > self.ps[y]:
            x, y = y, x
        self.ps[x] += self.ps[y]
        self.ps[y] = x
        return True
 
    def same(self, x, y):
        return self.find(x) == self.find(y)
 
    def size(self, x):
        x = self.find(x)
        return -self.ps[x]

uf = UnionFind(N)
friends = [0]*(N+1)
chain = [0]*(N+1)


for _ in range(M):
    A, B = map(int, input().split())
    friends[A] += 1
    friends[B] += 1
    uf.union(A, B)

for _ in range(K):
    C, D = map(int, input().split())
    if uf.same(C, D):
        friends[C] += 1
        friends[D] += 1

ans = []

for i in range(1, N+1):
    ans.append(uf.size(i) - friends[i] - 1)

print(*ans)

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

const int N = 59, M = 109;

typedef long long ll;

namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	
	template <class I>
	inline void read (I &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); 
		x = f == -1 ? -x : x;
	}
	
	template <class I>
	inline void print (I x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
	}
	
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io :: read;
using io :: putc;
using io :: print;

int n, m, s;
int Link[2009], tot = 0;
struct edge{
	int next, y, x, t;
}e[2009];

void add(int x, int y, int xx, ll t) {
	e[++ tot].next = Link[x];
	Link[x] = tot;
	e[tot].y = y;
	e[tot].x = xx;
	e[tot].t = t;
}

ll dis[N][10509];
int vis[N][10509];
priority_queue< pair<ll, pair<int, int> > > q;
void dij() {
	memset(dis, 30, sizeof(dis));
	dis[1][min(n * 50, s)] = 0;
	q.push(make_pair(0, make_pair(1, min(n * 50, s))));
	while(q.size()) {
		int x = q.top().second.first, y = q.top().second.second;
		q.pop();
		if (vis[x][y]) continue;
		vis[x][y] = 1;
		for (int i = Link[x]; i; i = e[i].next) {
			int to = e[i].y, w = e[i].x, t = e[i].t;
			if (w > y || y - w > n * 50) continue;
			if (dis[to][y - w] > dis[x][y] + t) {
				dis[to][y - w] = dis[x][y] + t;
				q.push(make_pair(-dis[to][y - w], make_pair(to, y - w)));
			}
		}
	} 
}

int main() {
	read(n), read(m), read(s); 
	for (int i = 1; i <= m; ++ i) {
		int _, __, ___, ____;
		read(_), read(__), read(___), read(____);
		add(_, __, ___, ____);
		add(__, _, ___, ____);
	}
	for (int i = 1; i <= n; ++ i) {
		int x, y;
		read(x), read(y);
		add(i, i, -x, y);
	}
	dij();
	for (int i = 2; i <= n; ++ i) {
		ll ans = dis[i][0];
		for (int j = 1; j <= n * 50; ++ j) 
			ans = min(ans, dis[i][j]);
		print(ans); putc('\n');
	}
	return 0;
}


Measured memory_bytes: 10692
#include <iostream>
#include <cmath>
#include <stdint.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
using namespace std;
 
#define int long long
#define INF (1e18)+1
 
int nChoosek( int n, int k )
{
    if (k > n) return 0;
    if (k * 2 > n) k = n-k;
    if (k == 0) return 1;

    int result = n;
    for( int i = 2; i <= k; ++i ) {
        result *= (n-i+1);
        result /= i; 
    }
    return result;
}

int choose2(int n){
	
	return n*(n-1)/2;
}

map<int ,int> m;

int32_t main() {
 
   
   	int N;
	   
	cin >> N;
	bool flag = true;
	for(int i=0; i<N; i++){
		
		int tmp;
		cin >> tmp;
		
		m[tmp]++;
		
		if(m[tmp] > 1){
			flag = false;
			break;
		}
		
	}	
   	
   if(flag){
   	cout << "YES" << endl;
   }
   else{
   	cout << "NO" << endl;
   }
   
   
   
   
 
}

Measured memory_bytes: 15524
#include<stdio.h>
int main(void)
{
	int N;

	scanf("%d", &N);
	int A;
	int B;
	A = N / 10;
	
	B = N % 10;
	if (A == 9 || B == 9) {
		printf("Yes");
	}
	else
		printf("No");

	return 0;
}

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

using namespace std;
#define rev(s) (string((s).rbegin(), (s).rend()))

int main(void){
	int n;
	cin>>n;
	while(n--){
		string str;
		cin>>str;
		set<string> a;
		for(int i=1;i<str.size();i++){
			string head=str.substr(0,i);
			string tail=str.substr(i);
			for(int j=0;j<2;j++){
				a.insert(head+tail);
				a.insert(head+rev(tail));
				a.insert(rev(head)+tail);
				a.insert(rev(head)+rev(tail));
				if(j==0)
					swap(head,tail);
			}
		}
		cout<<a.size()<<endl;
	}
	return 0;
}

Measured memory_bytes: 1000
#include <iostream>
#define INF 2000000001
using namespace std;

int heap[2000200];
int H;

void swap(int a, int b) {
  int c = heap[a];
  heap[a] = heap[b];
  heap[b] = c;
}

int left(int p) {
  p = p*2;
  if (1 <= p && p <= H) {
    return p;
  } else {
    return 0;
  }
}

int right(int p) {
  p = p*2+1;
  if (1 <= p && p <= H) {
    return p;
  } else {
    return 0;
  }
}

int parent(int p) {
  p = p/2;
  if (1 <= p && p <= H) {
    return p;
  } else {
    return 0;
  }
}

void heapify(int p) {
  int l = left(p);
  int r = right(p);
  int largest;
  if (heap[r] >= heap[l] && heap[r] >= heap[p]) {
    largest = r;
  } else if (heap[l] >= heap[r] && heap[l] >= heap[p]) {
    largest = l;
  } else {
    largest = p;
  }
  if (largest != p) {
    swap(p, largest);
    heapify(largest);
  }
}

void build() {
  for (int i = H/2; i > 0; i--) {
    heapify(i);
  }
}

void insert(int p) {
  H++;
  heap[H] = p;
  for (int i = H; i > 1 && heap[parent(i)] < heap[i]; i = parent(i)) {
    swap(parent(i), i);
  }
  
  #ifdef DEBUG
  cout<<"INS ";
  for (int i = 1; i <= H; i++) cout << heap[i] << " ";
  cout<<endl;
  #endif
}

int pop() {
  int max = heap[1];
  heap[1] = heap[H];
  H--;
  heapify(1);
 
  #ifdef DEBUG
  cout<<"POP "; 
  for (int i = 1; i <= H; i++) cout << heap[i] << " ";
  cout<<endl;
  #endif
  
  return max; 
}

int main() {
  heap[0] = -INF;
  
  string query; int p;
  while (cin >> query, query != "end") {
    if (query == "insert") {
      cin >> p;
      insert(p);
    } else if (query == "extract") {
      cout << pop() << endl;  
    }
  }
}





Measured memory_bytes: 7124
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(){
    char s[1002],t[10002];
    scanf("%s",s);
    scanf("%s",t);
    int ls=strlen(s);
    int lt=strlen(t);
    int min=100000;
    for(int i=0;i<=ls-lt;i++){
        int cnt=0;
        for(int j=0;j<lt;j++){
            if(s[i+j]!=t[j]){
                cnt++;
            }
        }
        min=min>cnt?cnt:min;
    }
    printf("%d",min);
    return 0;
}



Measured memory_bytes: 1724
while True:
    L = raw_input().split()
    m = int(L[0])
    f = int(L[1])
    r = int(L[2])
    if m == -1 and f == -1 and r == -1: break
    x = m + f

    if m == -1 or f == -1 or x < 30: print "F"
    
    elif x < 50:
        if r < 50: print "D"
        else: print "C"
        
    elif x < 65: print "C"

    elif x < 80: print "B"

    else: print "A"

    

Measured memory_bytes: 6368
package main

import (
	"fmt"
)

func main() {
	var N, K, R, S, P int
	var T string
	fmt.Scan(&N, &K, &R, &S, &P)
	fmt.Scan(&T)

	dict := map[string]int{"r": 0, "s": 0, "p": 0}
	char := ""
	s := make([]bool, N)
	for i := 0; i < N; i++ {
		s[i] = true
	}
	r := make([]bool, N)
	p := make([]bool, N)
	copy(r, s)
	copy(p, s)
	for i := 0; i < len(T); i++ {
		char = T[i : i+1]
		if i >= K {
			if char == T[i-K:i+1-K] {

				switch char {
				case "s":
					if s[i%K] {
						s[i%K] = false
						continue
					} else {
						s[i%K] = true
					}

				case "r":
					if r[i%K] {
						r[i%K] = false
						continue
					} else {
						r[i%K] = true

					}

				case "p":
					if p[i%K] {
						p[i%K] = false
						continue
					} else {
						p[i%K] = true

					}
				}
			} else {
				switch char {
				case "s":
					s[i%K] = true
				case "r":
					r[i%K] = true
				case "p":
					p[i%K] = true
				}

			}
		}
		switch char {
		case "s":
			dict["s"] = dict["s"] + 1
		case "r":
			dict["r"] = dict["r"] + 1
		case "p":
			dict["p"] = dict["p"] + 1
		}
	}

	res := P*dict["r"] + S*dict["p"] + R*dict["s"]
	fmt.Println(res)

}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
int ispal(string k)
{
    string r=k;
    reverse(r.begin(),r.end());
    if(r==k)
    return 1;
    else
    return 0;
}
int main()
{
   string s;
   cin>>s;
   ll n=s.size();
   string f;
   for(ll i=0;i<(n-1)/2;i++)
   f.push_back(s.at(i));
   string d;
   for(ll j=(n+3)/2-1;j<n;j++)
   d.push_back(s.at(j));
   if(ispal(d) && ispal(f) && ispal(s))
   cout<<"Yes"<<endl;
   else
   cout<<"No"<<endl;
   return 0;
}


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

using namespace std;


int main()
{
    string name,name2;

    int ans = 0;

    cin >> name >> name2;

    for(int i = 0; i < name.length() ; i++)
    {
        if(name[i] == name2[i])
            ans = 1;
        else
        {
            ans = 0;
            break;
        }
        
    }

    if(ans == 1)
        cout << "Yes";
    else
    {
        cout << "No";
    }
    
   
   

}



Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch IHateFactorization | diff IHateFactorization.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address IHateFactorization.cpp && ./a.out

/*
 
 5/3/2020
 
 5:11-
 
 */

LL X;

LL a,b;
bool ok(LL p, LL q) {
  for(LL x=1; x<=2e4; ++x) {
    LL y=x-p;
    if(x*x*x*x+x*x*x*y+x*x*y*y+x*y*y*y+y*y*y*y==q) {
      a=x,b=y;
      return true;
    }
  }
  return false;
}

void solve() {
  for(LL p=1; p*p<=X; ++p) if(X%p==0) {
    LL q=X/p;
    if(ok(p,q)) {
      cout<<a<<" "<<b<<endl;
      return;
    }
    if(ok(q,p)) {
      cout<<a<<" "<<b<<endl;
      return;
    }
  }
  assert(false);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>X;
  solve();
  
  return 0;
}


Measured memory_bytes: 3644
import java.util.*;
import java.math.BigInteger;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long a = sc.nextLong();
    long b = sc.nextLong();
    long c = sc.nextLong();
    long d = sc.nextLong();
    long ans = Math.max(a*c, a*d);
    ans = Math.max(ans, b*c);
    ans = Math.max(ans, b*d);
    System.out.println(ans);
  }
}


Measured memory_bytes: 35720
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  vector<long long> sum(N);
  int a;
  rep(i, N) {
    cin >> a;
    if (i > 0) sum[i] = sum[i - 1] + a;
    else sum[i] = a;
  }

  long long mn = -1;
  rep(i, N - 1) {
    long long diff = std::abs((sum[N-1] - sum[i]) - sum[i]);
    if (mn == -1 || mn > diff) mn = diff;
  }

  cout << mn << endl;

  return 0;
}


Measured memory_bytes: 1792
from collections import defaultdict


def factorize(n: int) -> dict:
    f = defaultdict(int)
    while n % 2 == 0:
        f[2] += 1
        n //= 2
    p = 3
    while p * p <= n:
        while n % p == 0:
            f[p] += 1
            n //= p
        p += 2
    if n != 1:
        f[n] += 1
    return f


n = int(input())
if n > 1:
    f = factorize(n)

    MAX = max(f.values())
    b = [0]
    while len(b) < MAX + 10:
        b.extend([b[-1] + 1] * (b[-1] + 2))

    # print(b)
    # print(f)
    ans = 0
    for v in f.values():
        ans += b[v]
else:
    ans = 0

print(ans)


Measured memory_bytes: 9468
//コンパイラ最適化用
//#pragma GCC optimize("O3")

#include<iostream>//入出力

using namespace std;
typedef unsigned int ll;

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define MOD 1000000007 //10^9+7:合同式の法


ll s[2001],t[2001],dp[2001][2001]={0};

signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n,m;cin>>n>>m;
    REP(i,n){cin>>s[i];}
    REP(i,m){cin>>t[i];}
    REP(i,n+1){dp[i][0]=1;}
    REP(i,m+1){dp[0][i]=1;}
    REP(i,n){
        REP(j,m){
            if(s[i]==t[j]){
                dp[i+1][j+1]+=(dp[i+1][j]+dp[i][j+1])%MOD;
            }else{
                dp[i+1][j+1]+=(dp[i+1][j]+dp[i][j+1]-dp[i][j]+MOD)%MOD;
            }
        }
    }
    cout<<dp[n][m]<<"\n";
}

Measured memory_bytes: 19188
#include <iostream>
#include <utility>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>
#include <math.h>
#include <numeric>
#include <sstream>
#include <queue>
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    if (n == 25) cout << "Christmas" << std::endl;
    else if (n == 24)
        cout << "Christmas Eve" << std::endl;
    else if (n == 23)
        cout << "Christmas Eve Eve" << std::endl;
    else if (n == 22)
        cout << "Christmas Eve Eve Eve" << std::endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# Input
list = []
n, a, b = map(int, input().split())

total = 0
for ii in range(1, n + 1):
    sum = 0
    tmp = ii
    while tmp > 0:
        sum += tmp % 10
        tmp = tmp // 10

    if sum >= a and sum <= b:
        total += ii
print(total)


Measured memory_bytes: 2940