akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>

using namespace std;

int main(){
    string S;
    cin >> S;
    if(S.compare("SUN") == 0){
        cout << "7";
    }else if(S.compare("MON") == 0){
        cout << "6";
    }else if(S.compare("TUE") == 0){
        cout << "5";
    }else if(S.compare("WED") == 0){
        cout << "4";
    }else if(S.compare("THU") == 0){
        cout << "3";
    }else if(S.compare("FRI") == 0){
        cout << "2";
    }else if(S.compare("SAT") == 0){
        cout << "1";
    }

    return 0;

}

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

#define pb push_back
#define ff first
#define ss second

typedef long long ll;
typedef pair<int, int> pii;

string s;
set<char> st;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> s;
	for (auto i : s)
		st.insert(i);
	if (st.size() != 2)
		cout << "No";
	else
		cout << "Yes";
	return 0;
}


Measured memory_bytes: 256
//#include<bits/stdc++.h>
#define ll long long
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mp make_pair
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<utility>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<stack>
ll z = 998244353 ;
ll gcd(ll a , ll b){ if(b > a) return gcd(b , a) ; if(b == 0) return a ; return gcd(b , a%b) ;}
ll power(ll a ,ll b){if(b == 0) return 1 ; ll c = power(a , b/2) ; if(b%2 == 0) return ((c*c)%z) ; else return ((((c*c)%z)*a)%z) ;}
ll inverse(ll a ,ll n){return power(a , n-2) ;}
ll max(ll a , ll b){if(a > b) return a ; return b ;}
//ios_base::sync_with_stdio(0);
//cin.tie(0); cout.tie(0);
using namespace std ;



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

   ll n , m , v , p ;
   cin >> n >> m >> v >> p ; // can increase by m , total = m*v
   ll arr[n] ;
   fo(i , n)
   {
       cin >> arr[i] ;
        arr[i] *= -1 ;
   }

   sort(arr , arr + n) ;
   fo(i , n)
    arr[i] *= -1 ;
   ll l = arr[p-1] , r = arr[0] + m ;
   ll ans = l;
   while(r >= l)
   {
	   ll used = 0  , mid = (l+r)/2;
	   for(ll i = 0 ; i < p-1 ; i++)
	   {
		   used += m ;
		   //cout << used << endl ;
	   }
	   for(ll i = p-1 ; i < n ; i++)
	   {
		   used += min(mid - arr[i] , m) ;
		   //cout << used << endl ;
	   }
	   if(used < m*v)
	   {
		   l = mid + 1 ;
	   }
	   else
	   {
		   ans = mid ;
		   r = mid -1;
	   }
	   //cout << mid << ' ' << used << endl ;
	   //break ;
   }
   //cout << ans << endl ;
   ll cnt = 0 ;
   fo(i , n)
   {
	   if(arr[i] + m >= ans)
		   cnt++ ;
   }
   cout << cnt << endl ;
    return 0 ;
}


Measured memory_bytes: 1024
import sys
input_first = input()
N= int(input_first)

worddic={}

for i in range(N):
    S = input()
    if S in worddic:
        worddic[S] +=1
    else:
        worddic[S] =1

# result=[keyval[0] for keyval in worddic.items() if keyval[1]==max(worddic.values())]

maxval = 0
for i in worddic.items():
    if i[1] > maxval :
        maxval = i[1]
        result=[]
        result.append(i[0])
    elif i[1] == maxval:
        result.append(i[0])
    else:
        pass

result.sort()
for i in result:
    print(i)

Measured memory_bytes: 32096
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define INF 1 << 30
#define LLINF 1LL << 60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define FORALL(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef valarray<int> Array;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cout<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}

int a[8][8];

void f(int x, int y)
{
  a[x][y]=0;
  for(int i=1;i<=3;i++)
  {
    if(x+i>7) break;
    if(a[x+i][y]) f(x+i,y);
  }
  for(int i=1;i<=3;i++)
  {
    if(x-i<0) break;
    if(a[x-i][y]) f(x-i,y);
  }
  for(int i=1;i<=3;i++)
  {
    if(y+i>7) break;
    if(a[x][y+i]) f(x,y+i);
  }
  for(int i=1;i<=3;i++)
  {
    if(y-i<0) break;
    if(a[x][y-i]) f(x,y-i);
  }
}

void solve(int x, int y)
{
  f(x,y);
  REP(i,8)REP(j,8) printf("%d%s",a[i][j],(j==7?"\n":""));
}

int main()
{
  int n; cin >> n;
  string s;
  FOR(c,1,n)
  {
    REP(i,8)
    {
      cin >> s;
      REP(j,8) a[i][j] = s[j]-'0';
    }
    int a,b; cin >> a >> b;
    printf("Data %d:\n",c);
    solve(--b,--a);
  }
  return 0;
}

Measured memory_bytes: 1196
import java.util.*;
     
    public class Main {
    	public static void main(String[] args) {
            Scanner scan = new Scanner(System.in);
            String[] str = scan.nextLine().split(" ");
    		String value = Integer.toString(new Integer(str[0]),new Integer(str[1]));
    		System.out.println(value.length()); //output = 1e
        }
    }

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define int long long
int abs(int a,int b){
  int c=max(a,b)-min(a,b);
  return c;
}
signed main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  string a,b,c;
  cin>>a>>b>>c;
  a[0]=a[0]-32;
  b[0]=b[0]-32;
  c[0]=c[0]-32;

  cout<<a[0]<<b[0]<<c[0]<<"\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define DIV int(1e9+7)
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const double PI = M_PI;  
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
 
/* Coding Space*/
unordered_map<int,bool> x_;
unordered_map<int,bool> y_;
int x_p = 0;
int y_p = 0;
int times = 0;
int main(){
  string s; cin >> s; s += 'T'; cerr << s << endl;
  int x,y; cin >> x >> y;
  x_[0] = 1,y_[0] = 1;
  bool vec = false;
  rep(q,s.size()){
    if(s[q] == 'F'){
      if(vec == false)
        x_p++;
      else
        y_p++;
    }else{
      if(vec == false){
        unordered_map<int,bool> x__;
        for(auto i:x_){
          if(x_[i.FST] == 1){
            x__[i.FST + x_p] = 1;
            if(times != 0)
              x__[i.FST - x_p] = 1;
            else
              times = 1;
          }
        }
        x_p = 0; y_p=0;
        x_.clear();
        x_ = x__;
        //cerr << x__.size() << endl;
      }else{
        unordered_map<int,bool> y__;
        for(auto i:y_){
          if(y_[i.FST] == 1){
            y__[i.FST + y_p] = 1;
            y__[i.FST - y_p] = 1;
          }
        }
        y_p = 0; x_p=0;
        y_.clear();
        y_ = y__;
      }
      vec = (vec == 1)?0:1;
    }
  }
  //for(auto i:x_) cerr << i.FST << endl;
  if(y_[y] == 1 && x_[x] == 1)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  vi A(n);
  ll ans =llINF;
  for(auto &a:A)cin>>a;
  for(ll i = -100;i <= 1000;i++){
    ll sum = 0;
    for(int j=0;j<n;j++){
      sum += (A[j]-i)*(A[j]-i);
    }
    ans= min(ans,sum);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 384
using System;
﻿using System.Globalization;
﻿using System.IO;
﻿using System.Linq;

namespace CF317
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var sr = new InputReader(Console.In);
            //var sr = new InputReader(new StreamReader("input.txt"));
            var task = new Task();
            using (var sw = Console.Out)
            //using (var sw = new StreamWriter("output.txt"))
            {
                task.Solve(sr, sw);
                //Console.ReadKey();
            }
        }
    }

    internal class Task
    {
        public void Solve(InputReader sr, TextWriter sw)
        {
            var n = 2*sr.NextInt32();
            var array = sr.ReadArray(Int32.Parse);
            Array.Sort(array);
            var count = 0;
            for (var i = 0; i < n; i+=2) {
                count += Math.Min(array[i], array[i + 1]);
            }

            sw.WriteLine(count);
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(NextString());
    }

    public long NextInt64()
    {
        return Int64.Parse(NextString());
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();
            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}

Measured memory_bytes: 3160
a = list(input())
b = list(input())
c = list(input())
next = 'a'
target = a
while(True):
    if next == 'a':
        target = a
    elif next == 'b':
        target = b
    else:
        target = c
    if len(target) == 0:
        print(next.upper())
        break
    next = target[0]
    target.pop(0)

Measured memory_bytes: 3064
import java.util.Random;
import java.util.Scanner;

public class Main {
	private static final int K = 26;
	private static Random rand = new Random(System.currentTimeMillis());

	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var d = sc.nextInt();
		var c = new int[K];
		var s = new int[d][K];
		for (var i = 0; i < K; i++) {
			c[i] = sc.nextInt();
		}
		for (var i = 0; i < d; i++) {
			for (var j = 0; j < K; j++) {
				s[i][j] = sc.nextInt();
			}
		}
		sc.close();

		var t = create(c, s, d);
		var max = score(c, s, t, d);
		for (var i = 0; i < 30000; i++) {
			var t2 = create(c, s, d);
			var sum = score(c, s, t2, d);
			//System.out.println(sum);
			if (max < sum) {
				t = t2;
				max = sum;
			}
		}

		for (var i = 0; i < d; i++) {
			System.out.println(t[i]);
		}
	}

	private static int score(int[] c, int[][] s, int[] t, int d) {
		var sum = 0;
		var last = new int[K];
		for (var i = 0; i < d; i++) {
			var ti = t[i] - 1;
			sum += s[i][ti];
			last[ti] = i + 1;
			for (var j = 0; j < K; j++) {
				sum -= ((i + 1) - last[j]) * c[j];
			}
		}

		return sum;
	}

	private static int[] create(int[] c, int[][] s, int d) {
		var t = new int[d];
		var last = new int[K];
		for (var i = 0; i < d; i++) {
			var v = new int[K];
			for (var j = 0; j < K; j++) {
				v[j] = s[i][j] - (((i + 1) - last[j]) * c[j]) + 36500;
			}
			t[i] = rand(v) + 1;
			last[t[i] - 1] = i + 1;
		}
		return t;
	}

	private static int rand(int[] v) {
		var sum = 0;
		for (var i = 0; i < v.length; i++) {
			sum += v[i];
		}
		var value = rand.nextInt(sum);
		var index = 0;
		sum = 0;
		for (var i = 0; i < v.length; i++) {
			sum += v[i];
			if (value < sum) {
				break;
			}
			index++;
		}
		//System.out.printf("%d %d %d\r\n", value, sum, index);
		return index;
	}
}


Measured memory_bytes: 56744
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
int main() {
    int n;
    cin>>n;
    vector<vector<int>> f(n,vector<int>(10));
    vector<vector<int>> p(n,vector<int>(11));
    for(int i=0; i<n; i++){
        for(int j=0; j<10; j++){
            cin>>f[i][j];
        }
    }for(int i=0; i<n; i++){
        for(int j=0; j<11; j++){
            cin>>p[i][j];
        }
    }
    ll ans=-1e9;
    for(int mask=1; mask<(1<<10); mask++){
        ll tmp=0;
        for(int i=0; i<n; i++){
            int cnt=0;
            for(int j=0; j<10; j++){
                if((1&(mask>>j)) && f[i][j]==1) cnt++;
            }
            tmp+=p[i][cnt];
        }
        ans = max(ans,tmp);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define se second
using namespace std;
int main(){
	ll d,t,s;
	cin>>d>>t>>s;
	ll T=ceil(d/((float)s));
	if(T<=t)cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 3628
//============================================================================
// Name        : AOJ.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cctype>
#include <string>
#include<algorithm>

using namespace std;
typedef long long ll;
int main(){


	ll n;
	cin>>n;

	if(n>=1000){
		cout<<"ABD"<<endl;
	}else{
		cout<<"ABC"<<endl;
	}




	return 0;
}


Measured memory_bytes: 256
#C
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

t = [a,b,c,d,e]
t.sort()

if n % t[0] == 0:
    p = n // t[0]
else:
    p = n // t[0] + 1
    
print(4+p)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    string ans;
    if ( a > b ) ans = ">";
    else if ( a == b ) ans = "==";
    else if ( a < b ) ans = "<";
    cout << "a " << ans << " b" << endl;
    return 0;
}


Measured memory_bytes: 3144
Module Program
  Sub Main
    Dim s = GetInts()
    Dim a=s(0),b=s(1)
    Dim ans=Math.Max(a+b,Math.Max(a*b,a-b))
    Console.WriteLine(ans)
  End Sub
  
  '/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  Function Gets() As String()
    Gets = Console.ReadLine().Split(" "c)
  End Function
  Function GetInts() As Integer()
    Dim s = Gets(), r(UBound(s)) As Integer
    For i As Integer=0 To UBound(s): r(i)=s(i): Next i
    GetInts = r
  End Function
End Module

Measured memory_bytes: 22352
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Info{
	Info(){
		x = y = 0;
	}
	Info(int arg_x,int arg_y){
		x = arg_x;
		y = arg_y;
	}
	bool operator<(const struct Info &arg) const{
			return x < arg.x;
	};
	int x,y;
};

int N;

bool compare_y(Info left,Info right){
	return left.y < right.y;
}

Info* info;

int closest_pair(Info* array,int tmp_N){
	if(tmp_N <= 1)return DBL_MAX;

	int mid = tmp_N/2;
	int x = array[mid].x;
	int dist = min(closest_pair(array,mid),closest_pair(array+mid,tmp_N-mid));
	inplace_merge(array,array+mid,array+tmp_N,compare_y);

	vector<Info> V;
	for(int i = 0; i < tmp_N; i++){
		if(fabs(array[i].x-x) >= dist)continue;

		for(int j = 0; j < V.size();j++){
			int dx = array[i].x - V[V.size()-j-1].x;
			int dy = array[i].y - V[V.size()-j-1].y;
			if(dy >= dist)break;
			dist = min(dist,dx*dx+dy*dy);
		}
		V.push_back(array[i]);
	}
	return dist;
}

int main(){

	scanf("%d",&N);
	info = (Info*)malloc(sizeof(Info)*N);

	for(int i = 0; i < N; i++){
		scanf("%d %d",&info[i].x,&info[i].y);
	}

	sort(info,info+N);

	printf("%d\n",closest_pair(info,N));

	return 0;
}

Measured memory_bytes: 12524
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define mid ((l+r)>>1)
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
using namespace std;
template<class T>il read(T &x){
	int f=1;char k=getchar();x=0;
	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;
	for(;k>='0'&&k<='9';k=getchar()) x=(x<<3)+(x<<1)+k-'0';
	x*=f;
}
template<class T>il _print(T x){
	if(x/10) _print(x/10);
	putchar(x%10+'0');
}
template<class T>il print(T x){
	if(x<0) putchar('-'),x=-x;
	_print(x);
}
ll mul(ll a,ll b,ll mod){long double c=1.;return (a*b-(ll)(c*a*b/mod)*mod)%mod;}
it qpow(int x,int m,int mod){
	int res=1,bas=x;
	while(m){
		if(m&1) res=(1ll*res*bas)%mod;
		bas=(1ll*bas*bas)%mod,m>>=1;
	}
	return res;
}
const int N = 10;
int n,s[N],a[N],b[N],x,y,cnt;
char vis[N];
il chk(){
	++cnt;
	char flag=1;
	for(ri i=1;i<=n;++i)
		flag&=a[i]==s[i];
	if(flag) x=cnt;
	flag=1;
	for(ri i=1;i<=n;++i)
		flag&=b[i]==s[i];
	if(flag) y=cnt;
}
il DFS(int pos){
	if(pos==n+1) return chk(),void();
	for(ri i=1;i<=n;++i)
		if(!vis[i])
			s[pos]=i,vis[i]=1,DFS(pos+1),vis[i]=0;
}
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n);
	for(ri i=1;i<=n;++i) read(a[i]);
	for(ri i=1;i<=n;++i) read(b[i]);
	DFS(1);
	print(abs(x-y));
	return 0;
}

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

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

  int count = 0;

  for(int i=0; i<N; i++){
      if(S.at(i) == 'R') count++; else count--;
  }

  cout << (count > 0 ? "Yes" : "No") << endl;
  return 0;
}

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

using namespace std;

const int M = 2e5 + 10;
int n;
long long arr[M];

int main() {
#ifndef ONLINE_JUDGE
    freopen("test.in", "r", stdin);
    freopen("test.out", "w", stdout);
#endif
    scanf("%d", &n);
    printf("%d", n + n * n + n * n * n);
    return 0;
}

Measured memory_bytes: 3816
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();

		System.out.println(b<=a?"delicious": b<=a+x?"safe":"dangerous");
	}
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int t;

int main(){
	cin>>t;
	if(t==1) cout<<"Hello World"<<endl;
	else{
		int A,B;
		cin>>A>>B;
		cout<<A+B<<endl;
	}
}

Measured memory_bytes: 256
N,M,Q=map(int,input().split())
A=[0 for _ in range(N)]
query=[]
for _ in range(Q):
    query.append(tuple(map(int,input().split())))
list=[]
def dfs(v):
    for i in range(int(v[-1]),M):
        nv=v+str(i)
        if len(nv)==N+1:
            list.append(nv)
        else:
            dfs(nv)
dfs("0")
ans=0
for a in list:
    t_ans=0
    for q in query:
        if int(a[q[1]])-int(a[q[0]])==q[2]:
            t_ans+=q[3]
    ans=max(ans,t_ans)
print(ans)

Measured memory_bytes: 79016
#include <iostream>
#include <vector>
#include <string>

using namespace std;
int main()
{
  int a,b,c;
  cin >> a >> b >> c;
  
  if (a < c && c < b) {
    cout << "Yes" << endl;
  } else if (b < c && c < a) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys

n = int(sys.stdin.readline())
for i in range(n):
    x1,y1,x2,y2,x3,y3 = list(map(float, sys.stdin.readline().split()))
    a = ((x3-x2)**2 + (y3-y2)**2)**0.5
    b = ((x1-x3)**2 + (y1-y3)**2)**0.5
    c = ((x2-x1)**2 + (y2-y1)**2)**0.5
    r = a*b*c / ((a+b+c) * (-a+b+c) * (a-b+c) * (a+b-c))**0.5
    a2,b2,c2 = a**2,b**2,c**2
    x = (a2*(b2+c2-a2)*x1 + b2*(c2+a2-b2)*x2 + c2*(a2+b2-c2)*x3) / \
        (a2*(b2+c2-a2) + b2*(c2+a2-b2) + c2*(a2+b2-c2))
    y = (a2*(b2+c2-a2)*y1 + b2*(c2+a2-b2)*y2 + c2*(a2+b2-c2)*y3) / \
        (a2*(b2+c2-a2) + b2*(c2+a2-b2) + c2*(a2+b2-c2))
    print("{:.3f} {:.3f} {:.3f}".format(x,y,r))

Measured memory_bytes: 7772
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[int(input())-1])




Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int k = Integer.parseInt(sc.next());
		String s = sc.next();
		StringBuilder sb = new StringBuilder();
		sb.append(s);
		
		if(s.length() <= k) {
			System.out.println(s);
		}
		else {
			sb.replace(k, s.length(), "...");
			s = sb.toString();
			System.out.println(s);
		}
	}

}


Measured memory_bytes: 35700
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>

// ===============================================================

using namespace std;
using ll = long long;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;

// ===============================================================

ll gcd(ll a, ll b) //最大公約数
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}

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

ll box(double a) //doubleの切り捨て
{
	ll b = a;
	return b;
}

ll fff(double a) //doubleの四捨五入
{
	ll b = a + 0.5;
	return b;
}

ll sum(ll n) { //整数sまでの合計
	if (n == 0) {
		return 0;
	}

	int s = sum(n - 1);
	return s + n;
}

bool prime(ll num)//素数判定、primeならtrue,違うならfalse
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	// 素数である
	return true;
}

// ===============================================================

int main() {
	ll a, b;
	cin >> a >> b;
	b += a * 3;
	cout << b / 2 << endl;
}//あーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<int,int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1LL<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1LL<<(i))))
#define setbit1(n,i) ((n)|(1LL<<(i)))
#define togglebit(n,i) ((n)^(1LL<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define fi first
#define se second
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define PI (acos(-1))
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD (1000000007)
#define asz 500005
#define pb push_back
#define ppf pop_front
#define ppb pop_back
#define pf push_front
vector<ll>v;
ll a[500005];
ll b[500005];
ll c[500005];
int main(){
    fastread;
    ll n,i,j,k,l,m,x,y,A,B,C;
    cin>>x>>y>>A>>B>>C;
    for(i=1;i<=A;i++)
        cin>>a[i];
    for(i=1;i<=B;i++)
        cin>>b[i];
    for(i=1;i<=C;i++)
        cin>>c[i];
    sort(a+1,a+A+1);
    sort(b+1,b+B+1);
    sort(c+1,c+C+1);
    for(i=1;i<=x;i++){
        v.pb(a[A-i+1]);
    }
    for(i=1;i<=y;i++)
        v.pb(b[B-i+1]);
    sort(v.begin(),v.end());
    ///for(i=0;i<v.size();i++)
   ////    /// cout<<v[i]<<" ";
    ///cout<<endl;
    ll sz=v.size();
    j=0;
    for(i=C;i>=1&&j<sz;i--){
       if(v[j]<c[i]){
           v[j]=c[i];
           j++;
       }
    }
    ll sum=0;
    for(i=0;i<sz;i++)
       /// cout<<v[i]<<" ";
        sum+=v[i];
    cout<<sum;
    return 0;
}

Measured memory_bytes: 11380
import math

a, b, x = map(float, input().split())

if a * a * b == x:
    print(0)
    exit(0)

if x * 2 <= a * a * b:
    P = (2 * x) / (a * b)
    Q = b
else:
    P = a
    Q = (2 * (a * a * b - x)) / (a * a)

R = math.sqrt(P * P + Q * Q)
cosp = (Q * Q + R * R - P * P) / (2 * Q * R)
print(90 - math.degrees(math.acos(cosp)))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
#define all(x) (x).begin(),(x).end()

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

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);std::cout<<std::fixed<<std::setprecision(10);
    ll N,K,Q;
    cin >> N >> K >> Q;
    vector<int> A(N);
    REP(i,Q){
        int tmp;
        cin >> tmp;
        A[tmp - 1]++;
    }
    REP(i,N){
        if(Q-K < A[i]){
            cout <<"Yes"<< "\n";
        }else{
            cout <<"No"<< "\n";
        }
    }
}

Measured memory_bytes: 1024
import os

def main():
	n = int(input())
	d_list = list(map(int, input().split()))
	score = 0
	for i in range(n-1):
		for j in range(i+1,n):
			if len(d_list) == i:
				continue
			score += d_list[i] * d_list[j]
	print(score)

if __name__ == "__main__":
	main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(int (i)=(n)-1; (i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	string s; cin >> s;
	deque<char>deq;
	int Q; cin >> Q;
	rep(i, s.size()) {
		deq.push_back(s[i]);
	}
	bool is = false;
	rep(i, Q) {
		int t; cin >> t;
		if (t == 1) {
			if (is)is = false;
			else is = true;
		}
		else {
			int f; cin >> f;
			char a; cin >> a;
			if (f == 1) {
				if (is && deq.size() != 1) {
					deq.push_back(a);
				}
				else deq.push_front(a);
			}
			else {
				if (is && deq.size() != 1) {
					deq.push_front(a);
				}
				else deq.push_back(a);
			}
		}
	}
	if (is) {
		rep(i, deq.size()) {
			cout << deq[deq.size() - 1 - i];
			if (i == deq.size() - 1)cout << "\n";
		}
	}
	else {
		rep(i, deq.size()) {
			cout << deq[i];
			if (i == deq.size() - 1)cout << "\n";
		}
	}


		
	return 0;
}

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

int main(int argc, char const *argv[])
{
	long long n;
	cin>>n;
	if (n%2LL==0LL)
	{
		cout<<n<<endl;
	}
	else
	{
		cout<<2LL*n<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
# coding: utf-8

h,w = list(map(int,input().split()))
m = []
for i in range(h):
    m.append(input())

for i in range(h):
    for j in range(w):
        t,r,l,b = [""]*4
        if m[i][j] == "#":
            if i-1 >= 0:
                t = m[i-1][j]
            if j+1 < w:
                r = m[i][j+1]
            if j-1 >= 0:
                l = m[i][j-1]
            if i+1 < h:
                b = m[i+1][j]
            if [t,r,l,b].count("#") == 0:
                print("No")
                exit()
print("Yes")

Measured memory_bytes: 40176
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    # R - L >= 2019のときは　答えが 0
    # それ以外の時は全探索できる
    l,r = readInts()
    if r-l > 3000:
        print(0)
    else:
        res = 2018
        for i in range(l,r):
            for j in range(i+1,r+1): # 一緒じゃだめやねん
                res = min(res,(i * j) % 2019)
        print(res)
if __name__ == '__main__':
  main()


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    int n;
    cin>>n;
    vector<int> xv;
    vector<int> yv;
    vector<int> hv;
    int si;
    for(int i=0;i<n;i++){
        int x,y,h;
        cin>>x>>y>>h;        
        xv.push_back(x);
        yv.push_back(y);
        hv.push_back(h);
        if(h>0) si=i;
    }
    int vnum=xv.size();
    ll ansh;
    int ansx;
    int ansy;
    for(int cx=0;cx<=100;cx++){
        for(int cy=0;cy<=100;cy++){
            bool flag=true;
            ll lasth=hv[si]+abs(xv[si]-cx)+abs(yv[si]-cy);;
            for(int i=0;i<vnum;i++){
                ll temph=hv[i]+abs(xv[i]-cx)+abs(yv[i]-cy);
                if(hv[i]>0){
                    if(lasth!=temph){
                    flag=false;
                    break;
                }
                }else{
                    if(temph-lasth<0){
                    flag=false;
                    break;
                    }
                }
                                
            }
            if(flag){
                ansh=lasth;
                ansx=cx;
                ansy=cy;
                cout<<ansx<<" "<<ansy<<" "<<ansh<<endl;
                return 0;
            }
        }
    }        
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
typedef long long LL;

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

	bool y = false;
	char ch;
	for (int i = 0; i < N; i++) {
		cin >> ch;
		if (ch == 'Y')
			y = true;
	}

	cout << (y ? "Four" : "Three") << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin >> n;

  map<int, int> m;
  for (int i = 0; i < n; i++)
  {
    int a;
    cin >> a;
    if (m.find(a) == m.end())
    {
      m[a] = 1;
    }
    else
    {
      m[a]++;
    }
  }

  int res = 0;
  for (auto it = m.begin(); it != m.end(); it++)
  {
    if (it->first <= it->second)
    {
      res += it->second - it->first;
    }
    else
    {
      res += it->second;
    }
  }

  cout << res << endl;
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
#define all(v) v.begin(),v.end()
#define endl "\n"
#define clr (n, r) memset(n,r,sizeof(n));

void fast() {
    cin.tie(0);
    cin.sync_with_stdio(0);
}

const ll MAX = 405;
ll n, arr[MAX], dp[MAX][MAX], pre[MAX];

ll ans(ll i = 0, ll j = n-1) {
    ll &ret=dp[i][j];
    if(~ret)return ret;
    if(i<0||j<0||i==n||j==n)return 0;
    if (i == j)return arr[i];
    if (i > j)return 0;
    ll solu = 1e15;
    ll res = 0;
    for (ll k = i; k < j; ++k) {
        res = ans(i, k) + ans(k + 1, j) + pre[j + 1] - pre[i];
       // cout<<i<<" "<<j<<endl;
        solu = min(solu, res);
    }
    return ret=solu;
}

int main() {
    fast();
    cin >> n;
    for (ll i = 0; i < n; ++i) {
        cin >> arr[i];
        pre[i + 1] = pre[i] + arr[i];
    }
    memset(dp,-1,sizeof(dp));
    cout << ans()-pre[n];
}

Measured memory_bytes: 1536
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
  int n = sc.nextInt();
  Map<Integer, Integer> map = new HashMap<>();
  for(int i = 0 ;i < n;i++){
    int a = sc.nextInt();
    if(map.containsKey(a)){
      map.put(a, map.get(a) + 1);
    }
    else{
      map.put(a, 1);
    }
  }
  int ans = 0;
  for(int key : map.keySet()){
    if(key <= map.get(key)){
      ans += map.get(key) - key;
    }
    else{
      ans += map.get(key);
    }
  }
  System.out.println(ans);
}}

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

ll abs(ll x,ll y){
    if(x>y) return x-y;
    else return y-x;
}

int main(){
    ll n,a,b;
    cin >> n >> a >> b;
    if(a%2==b%2){
    cout << (b-a)/2 << endl;
    return 0;
    }
    if((a-1)>(n-b)){
        cout << n-b+1+(b-a)/2 << endl;
        return 0;
    }
    else{
        cout << a + (b-a)/2 << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include <stdio.h>

#define N 44

int F[N];
int n;

int  fib(int n){
	if(n==0 || n == 1)
		return 1;

	if(F[n] != 0) return F[n];

	return F[n] = fib(n-1) + fib(n-2);
}

int main(){
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++){
		F[i] = 0;
	}
	fib(n);
	printf("%d\n",fib(n));
}

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

using namespace std;

#define fastio cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(0)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> matrix;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(c) c.begin(),c.end()
#define mp make_pair
#define pb push_back
#define f first
#define int ll
#define tcase int t; cin>> t; for( ; t; --t)
#define s second
#define endl '\n'
const int MAX = 1e6+1;
const int INF = 0x3f3f3f3f;

int n;

int32_t main(){
	fastio;
	cin>> n;
	vi a(n);
	vi b(n-1);

	for(int i = 0; i < n-1; ++i) cin>> b[i];

	a[0] = b[0];
    a[n-1] = b[n-2];
    for(int i = 1; i<n-1 ; ++i){
        a[i] = min(b[i-1], b[i]);
    }
    int sum = 0;
    for(int i = 0; i < n; ++i) sum += a[i];
	cout<< sum << endl;
	return 0;
}


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

int main(){
  string a,b;
  int f=1;
  cin>>a>>b;
  int u1[30]={},u2[30]={};
  int cnt=1;
  for(int i=0;i<a.size();i++){
    int t=a[i]-'a';
    int k=b[i]-'a';
    if(u1[t]!=u2[k])f=0;
    if(u1[t]==0){
      u1[t]=u2[k]=cnt++;
    }
  }
  cout<<(f?"Yes":"No")<<endl;
  return 0;
}


Measured memory_bytes: 776
#include <stdio.h>

int main(void) {
	int n,m,i,l[1024],c,z,p;
	while(scanf("%d%d",&n,&m) , n != 0){
		for(i = 0;i <= 1023;i++){l[i] = 1;}
		z = n;
		p = 1;
		c = 0;
		while(1){
			if(l[p]){c++;}
			if(c == m){
				l[p] = 0;
				z--;
				if(z == 1){break;}
				c = 0;
			}
			p++;
			if(p == n + 1){p = 1;}
		}
		for(i = 1;i <= n;i++){
			if(l[i]){printf("%d\n",i);}
		}
	}
	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair <ll,ll> P;
#define REP(i, n) for(ll i = 0LL; i < (ll)(n); i++)
#define REPR(i, n) for(ll i = n-1; i >= 0LL; i--)
#define FOR(i, n, m) for(ll i = n; i < (ll)(m); i++)
#define PRINT(x) cout << x << endl
#define ALL(v) v.begin(), v.end()
#define INF (ll)1e18
#define INFD 1e18
#define PI 3.14159265358979
#define MOD 1000000007
#define vl vector<ll>
#define Mat(T) vector<vector<T>>

vector<ll> dx = {-1, 1, 0, 0};
vector<ll> dy = {0, 0, 1, -1};

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

int main()
{
	string S, T;
	cin >> S >> T;
	if (S == T.substr(0, S.length())) {
		PRINT("Yes");
	} else {
		PRINT("No");
	}

	return 0;
}


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

using namespace std;

#define ll long long int
#define mod 1e9+7
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif

  int h , w; cin>> h >> w;

  char arr[h][w];

  for(int i =0; i<h ; i++){
    for( int j = 0; j < w ; j++){
      cin >> arr[i][j];
    }
  }

  vector<vector<int>> dp(h+1, vector<int>(w+1,0));
  // memset(dp, 0, (h+1)*(w+1)*sizeof(int)
  for( int i = 0 ; i<=h ; i++){
    if(arr[i][0] != '#'){
      dp[i][0] = 1;
    }else{
      break;
    }
  }
  for( int i = 0 ; i<=w ; i++){
    if(arr[0][i] != '#')
    {
       dp[0][i] = 1;
    }else{
       break;
    }
  }

  for(int i = 1; i<=h; i++){
    for(int j = 1; j <=w; j++){
      if(arr[i][j] != '#'){
        if(arr[i-1][j] != '#')
          dp[i][j] += dp[i-1][j] % (1000000007);
        if(arr[i][j-1] != '#')
          dp[i][j] += dp[i][j-1] % (1000000007);
      }
      dp[i][j] = dp[i][j]%(1000000007);
    }
  }

// for(int i = 0; i<=h; i++){
//   for(int j = 0; j <=w; j++){
//     cout<<dp[i][j]<<" ";
//   }
//   cout<<"\n";
// }

// for(int i = 0; i<h; i++){
//   for(int j = 0; j <w; j++){
//     cout<<arr[i][j]<<" ";
//   }
//   cout<<"\n";
// }
  cout<< dp[h-1][w-1];

  return 0;
}

Measured memory_bytes: 5248
#include<cstdio>
#include<vector>
using namespace std;
int g[100010];
vector<vector<int>> e;
int dfs(int p){
    int flag=1;
    for(int i=0;i<e[p].size();i++){
        if(g[e[p][i]]==0){
            g[e[p][i]]=g[p]*(-1);
            flag*=dfs(e[p][i]);
        }
        if(flag==0||g[e[p][i]]==g[p]){
            return 0;
        }
    }
    return flag;
}
int main(){
    int a,b;
    long n,m,x,y;
    scanf("%ld %ld",&n,&m);
    e.resize(n+1);
    for(long i=0;i<m;i++){
        scanf("%d %d",&a,&b);
        e[b].push_back(a);
        e[a].push_back(b);
    }
    g[1]=1;
    if(dfs(1)){
        x=y=0;
        for(long i=1;i<=n;i++){
            if(g[i]==1){
                x++;
            }
            else{
                y++;
            }
            
        }
        printf("%ld\n",x*y-m);
    }
    else{
        printf("%ld\n",(n-1)*n/2-m);
    }
}

Measured memory_bytes: 6656
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...) 0
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int m = 1 << n;
    vector<int> a(m);
    vector<pair<int, int>> dp(m);
    rep(i, 0, m) {
        cin >> a[i];
        dp[i].first = a[i];
    }
    rep(i, 0, n) {
        rep(b, 0, m) {
            if ((b >> i) & 1) {
                if (dp[b].first <= dp[b ^ (1 << i)].first) {
                    dp[b].second = max(dp[b].first, dp[b ^ (1 << i)].second);
                    dp[b].first = dp[b ^ (1 << i)].first;
                } else {
                    dp[b].second = max(dp[b].second, dp[b ^ (1 << i)].first);
                }
            }
        }
    }
    int ans = 0;
    rep(i, 0, m) {
        ans = max(ans, dp[i].first + dp[i].second);
        if (i) cout << ans << ' ';
    }
    cout << endl;
    //debug(dp);
    return 0;
}

Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;

int a[N];

int main(){
	int n, c, k;
	scanf("%d%d%d", &n, &c, &k);
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
	sort(a + 1, a + n + 1);
	int ans = 0, pos = 0, y = 0;
	for (int i = 1; i <= n; i++){
		if (pos == 0 || a[i] - y > k){
			y = a[i];
			pos = c - 1;
			ans ++;
		} else pos --;
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
// sort(a.begin(), a.end(), std::greater<int>());

/*
std::vector<std::string> split(const std::string &input, char delimiter)
{
    std::istringstream stream(input);

    std::string field;
    std::vector<std::string> result;
    while (std::getline(stream, field, delimiter))
    {
        result.push_back(field);
    }
    return result;
}
*/
/*
int dfs(int foo, int timer)
{
    //foo is node number
    if (finds[foo].first != -1)
        return timer;
    finds[foo].first = ++timer;
    int result = timer;
    if (data[foo].size() != 0)
    {
        rep(i, data[foo].size())
        {
            result = dfs(data[foo][i], result);
        }
    }
    finds[foo].second = ++result;
    return result;
}
*/
int main()
{
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    //first go

    rep(i, y2 - y1)
    {
        cout << 'U';
    }
    rep(i, x2 - x1)
    {
        cout << 'R';
    }
    if (DEBUG)
        cout << endl;
    //first back

    rep(i, y2 - y1)
    {
        cout << 'D';
    }
    rep(i, x2 - x1)
    {
        cout << 'L';
    }
    if (DEBUG)
        cout << endl;
    //second go
    cout << 'L';
    rep(i, y2 - y1 + 1)
    {
        cout << 'U';
    }
    rep(i, x2 - x1 + 1)
    {
        cout << 'R';
    }
    cout << 'D';
    if (DEBUG)
        cout << endl;
    //second back
    cout << 'R';
    rep(i, y2 - y1 + 1)
    {
        cout << 'D';
    }
    rep(i, x2 - x1 + 1)
    {
        cout << 'L';
    }

    cout << 'U';
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main(){
    string W,tex;
    int c = 0;
    cin >> W;
    while(true){
        cin >> tex;
        if(tex == "END_OF_TEXT") break;
        transform(tex.begin(),tex.end(),tex.begin(),::tolower);
        if(tex == W) c++;
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 3108
#include <stdio.h>

main(){
  int N, i, j, v;
  int A[100];
  
  scanf("%d", &N);
  
  for( i = 0; i < N; i++){
    scanf("%d", &A[i]);
  }

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

  for( i = 1; i <= N-1; i++){
    
    v = A[i];
    j = i - 1;
    
    while( j >= 0 && A[j] > v ){
      A[j+1] = A[j];
      j--;
      A[j+1] = v;
      
    }   

    for( j = 0; j < N; j++){
      if( j == N-1 ) printf("%d\n", A[j]);
      else printf("%d ", A[j]);
    }

  }
  
  return 0;
  
}

Measured memory_bytes: 600
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int top = 0, S[1000];

void push(int x) {
  S[++top] = x;
}

int pop(void) {
  top--;
  return S[top+1];
}

int main(void) {
  int a, b;
  top = 0;
  char s[100];
  while(scanf("%s",s) != EOF) {
    if(s[0] == '+') {
      a = pop();
      b = pop();
      push(a + b);
    } else if(s[0] == '-') {
      b = pop();
      a = pop();
      push(a - b);
    } else if(s[0] == '*') {
      a = pop();
      b = pop();
      push(a * b);
    } else {
      push(atoi(s));
    }
  }
  printf("%d\n",pop());

  return 0;
}


Measured memory_bytes: 2048
import std.stdio;
import std.conv;
import std.algorithm;
import std.range;
import std.string;
import std.typecons;
import std.math;
import std.random;
import std.range;
void main()
{
    auto a = readln().strip.split(" ").map!(to!int);
    auto c = 0;
    foreach (i; iota(a[0]))
    {
        auto k = readln.strip.to!int;
        if (k == 2)
        {
            c++;
            continue;
        }
        if (k < 2)
            continue;
        if (k % 2 == 0)
            continue;
        for (auto j = 3; j ^^ 2 <= k; j += 2)
        {
            if (k % j == 0)
                goto break_;
        }
        c++;
        break_:
    }
    writeln(c);
}


Measured memory_bytes: 2484
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL
#define PI 3.141592653589793
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N;
  cin >> N;
  vll dp(N, -INF);
  int ans = 1;
  for(int i = 0; i < N; i++){
    ll A;
    cin >> A;
    if(i == 0) dp.at(0) = A;
    else{
      int ok = N-1;
      int ng = -1;
      while(ok - ng > 1){
        int mid = (ok + ng) / 2;
        if(dp.at(mid) < A) ok = mid;
        else ng = mid;
      }
      dp.at(ok) = A;
      chmax(ans, ok+1);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pp pop_back
#define in insert
#define ff first
#define ss second
#define e endl
#define MAXN 200005
#define MOD 998244353
int bit[MAXN];
int v1[2020], v2[2020];
int main()
{
ll ans;
        ans = 0;
        string s;
        cin>>s;
        int n=s.size();
        int p=2019;
        for(int i = 1; i <= n; i++) {
            bit[i] = s[i-1]-'0';
        }
        for(int i = 1; i <= n; i++) {
            for(int j = 0; j < p; j++) {
                if(i&1) v1[j] = 0;
                else v2[j] = 0;
            }
            for(int j = 0; j < p; j++) {
                if(i&1)
                    v1[(j*10+bit[i])%p] += v2[j];
                else
                v2[(j*10+bit[i])%p] += v1[j];
            }
            if(i&1) {v1[bit[i]%p]++;
               ans += v1[0];}
            else {v2[bit[i]%p]++ ;
            ans += v2[0];}
        }
        cout<<ans<<e;
    }


Measured memory_bytes: 4548