akhauriyash/Code-Regression huggingface dataset:
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}

int main(void){
	int a, b;
	scanf("%d%d", &a, &b);
	int l=b*10, r=l+10;
	for(int i=l; i<r; i++){
		if(i*2/25==a){
			printf("%d\n", i);
			return 0;
		}
	}
	printf("%d\n", -1);
}


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

int a[105];

int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    double num=1.0,cnt=0;
    cin >> n;
    for(int i=1;i<=n;i++)
        cin >> a[i];
    for(int i=1;i<=n;i++)
        cnt+=(double)1/a[i];
    num/=cnt;
    cout << num;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from collections import Counter

N = int(input())

As = list(map(int, input().split()))

V = []
for a in As:
    V.append(a)
    V.append(a+1)
    V.append(a-1)

cnter = Counter(V)

#print(cnter.most_common(1))
key, ans = cnter.most_common(1)[0]

print(ans)


Measured memory_bytes: 27360
import math
a, b = map(int,input().split())

prca = math.ceil(a / 0.08)
prcb = math.ceil(b / 0.1)
base = max(prca, prcb)
while True:
    if int(base * 0.08) < a or int(base * 0.1) < b:
        ans = base + 1
        break
    base -= 1

if int(ans * 0.08) != a or int(ans * 0.1) != b:
    ans = -1
    
print(ans)

Measured memory_bytes: 38384
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <random>
#include <chrono>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

class UnionFind {
private:
	vector<int> data;
	int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }

public:
	UnionFind(int size) : data(size, -1) { }
	bool is_same(int x, int y) { return root(x) == root(y); }
	int size(int x) { return -data[root(x)]; }

	void unify(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
};

int main() {
  int N;
cin>>N;
vector <int> a(N);
for(int i=0;i<N;i++)cin>>a[i];
auto b=a;
sort(a.begin(),a.end());
if(a[N-1]==a[N-2]){
for(int i=0;i<N;i++) cout << a[N-1]<<endl;
}
else {
for(int i=0;i<N;i++){
if(b[i]!=a[N-1]) cout << a[N-1]<<endl;
else cout<<a[N-2]<<endl;
}}

}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) ((y)<0||(x)<0||(y)>=(h)||(x)>=(w))
#define dump(...)
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
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(a>b){a=b;return 1;}return 0;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct{template<class T> operator T(){T x;cin>>x;return x;}} IN;
struct before_main_function {
    before_main_function() {
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int H,W,K;
    cin>>H>>W>>K;
    vector<string> S(H+2,string(W+2,'#'));
    REP(i,H) {
        string t;
        cin>>t;
        t="#"+t+"#";
        S[i+1]=t;
    }
    H+=2;
    W+=2;
    pii st;
    REP(i,H) {
        REP(j,W) {
            if(S[i][j]=='S') st={i,j};
        }
    }
    vector<vector<int>> dist(H,vector<int>(W,INF));
    queue<pii> q;
    q.push(st);
    dist[st.first][st.second]=0;
    int ans=INF;
    while(!q.empty()) {
        int y=q.front().first;
        int x=q.front().second; q.pop();
        if(S[y][x]=='#') {
            int l1=dist[y][x]-1;
            int l2=min(min(y,x),min(H-y,W-x)-1);
            if(l1>=K) {
                chmin(ans,(l1+l2+K-1)/K);
            } else {
                chmin(ans,1+(l2+K-1)/K);
            }
            continue;
        }
        REP(dir,4) {
            int yy=y+DY[dir];
            int xx=x+DX[dir];
            if(OUTOFRANGE(yy,xx,H,W)) continue;
            if(chmin(dist[yy][xx],dist[y][x]+1)) {
                q.push({yy,xx});
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 6656
#include <iostream>
#include <algorithm>
#include <map>
#include <regex>
#include <string>
#include <cstdlib>
#include <math.h>
#include <vector>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;

  bool ac[N + 1];
  int wa[N + 1];
  for (int i = 0; i < N + 1; i++) {
    ac[i] = false;
    wa[i] = 0;
  }

  for (int i = 0; i < M; i++) {
    int p;
    cin >> p;
    string S;
    cin >> S;

    if (S == "AC" && !ac[p]) {
      ac[p] = true;
    }
    if (S == "WA" && !ac[p]) {
      wa[p]++;
    }
  }

  int sac = 0;
  int swa = 0;
  for (int i = 0; i < N + 1; i++) {
    if (ac[i]) {
      sac++;
      swa += wa[i];
    }
  }

  cout << sac << " " << swa << endl;

  return 0;
}


Measured memory_bytes: 768
#include<stdio.h>


int main()
{
  int n,i,j,u,k,v,A[100][100];

  scanf("%d",&n);

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

  for(i = 0;i < n;i++)
    {
      scanf("%d%d",&u,&k);
      u--;
      for(j = 0;j < k;j++)
	{
	  scanf("%d",&v);
	  v--;
	  A[u][v] = 1;
	}
    }

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


  return 0;
}



Measured memory_bytes: 2052
{$mode objfpc}
program C;
uses
  classes, math;

var
  S: AnsiString;
  k: Integer;
  i, j: Integer;
  AllSubStr: TStringList;

begin
  ReadLn(S);
  ReadLn(k);

  AllSubStr := TStringList.Create;

  for i := 1 to Length(S) do 
    for j := 1 to Min(k, Length(S) - i + 1) do
      AllSubStr.Add(Copy(S, i, j));
  AllSubStr.Sort;
 
  i := 0;
  for j := 0 to AllSubStr.Count - 1 do 
    if AllSubStr[i] <> AllSubStr[j] then
    begin
      Inc(i);
      AllSubStr[i] := AllSubStr[j];
    end;
  {
  for j := 0 to i do 
    WriteLn(AllSubStr[j]);
  }
  WriteLn(AllSubStr[k - 1]);
  
end.

Measured memory_bytes: 3296
import java.io.*;
import java.util.*;

public class Main{
    static MyReader in = new MyReader();
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args){
        int N = in.i();
        out.println((N-1)/2);
        out.flush();
    }

    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        String[] ss(){
            return s().split(" ");
        }

        int i(){
            return Integer.parseInt(s());
        }

        int[] ii(){
            String[] ss = ss();
            int[] ii = new int[ss.length];
            for(int j = 0; j < ss.length; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }

        ArrayList<Integer> li(){
            String[] ss = ss();
            ArrayList<Integer> li = new ArrayList<>();
            for(int j = 0; j < ss.length; j++) li.add(Integer.parseInt(ss[j]));
            return li;
        }

        long l(){
            return Long.parseLong(s());
        }

        long[] ll(){
            String[] ss = ss();
            long[] ll = new long[ss.length];
            for(int j = 0; j < ss.length; j++) ll[j] = Long.parseLong(ss[j]);
            return ll;
        }
    }
}


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

using namespace std;

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

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = (int)1e5 + 9;

int main(){
  fastIO;
  int n, m;
  cin >> n >> m;
  vector<int> ff;
  int a;
  ll ans = 0;
  for(int i = 1; i <= n; i ++ ){
    cin >> a;
    ff.push_back(a);
    ans += a;
  }
  sort(ff.begin(), ff.end());
  vector<pii> gg;
  int b;
  for(int i = 1; i <= m; i ++ ){
    cin >> b >> a;
    gg.push_back(mp(a,b));
  }
  sort(gg.begin(), gg.end());
  reverse(gg.begin(), gg.end());
  int p = 0;
  for(int i = 0 ; i < n; i ++ ){
    while(p < m && gg[p].se == 0) p ++ ;
    if(gg[p].fi < ff[i]) break;
    ans += gg[p].fi - ff[i];
    gg[p].se -- ;
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 1784
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <climits>
using namespace std;

int main()
{
    long long N;
    cin >> N;
    long long exp;
    
    exp = 1;
    string s = "";
    while(N > 0)
    {
        N--;
        int a = N % 26;
        //N++;
        s = (char)(97+a) + s;
        N/=26;
    }
    
    cout << s << "\n";
}

Measured memory_bytes: 3620
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N,K;
	cin>>N>>K;
	vector<int> X(N);
	int ans = 0;
	for(int i=0;i<N;++i){
		cin>>X[i];
		ans += min(2*abs(X[i]-0),2*abs(X[i]-K));
	}
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define ff first
#define ar array
#define ss second
#define ll long long int
#define mem(x) memset(x,0,sizeof(x))
#define setbits(x)  __builtin_popcount(x)
#define ull unsigned long long int
#define all(c) (c).begin(),(c).end()
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define db double
#define endl "\n"
#define  fbo(x) find_by_order(x)
#define  ook(x) order_of_key(x)
 
using namespace __gnu_pbds;
using namespace std;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair<ll,ll > iil;
typedef pair<ll,int> li;
typedef pair<int,int> ii;
typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    os1;
typedef tree<int, null_type, greater<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    os2;

inline void fast()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
const ll pi=31;
const ll MOD[2] = {1187278649, 1149736019};//for double hashing
const ll mod=(ll)(1e9)+7;
ll pmod(ll x,ll n){
  ll r=1;
  while(n>0)
  {
    if(n&1LL)
      r=(r*x)%mod;
    x=(x*x)%mod;
    n=n/2;
    n%=mod;
  }
  return r;
}
ll pMod(ll x,ll n,ll mod)
{ ll r=1;
  while(n>0)
  {
    if(n&1LL)
      r=(r*x)%mod;
    x=(x*x)%mod;
    n=n/2;
    n%=mod;
  }
  return r;
 
}
 
//think recursively also;

void solve()
{ 
 string s,t;
 cin>>s>>t;
 int m=0;
 int n=t.size();
 for(int i=0;i<s.size();i++)
 {  
  int k=i,c=0;
  if(k+n-1<s.size())
  {   
     for(int j=0;j<t.size();j++)
     {
      if(s[j+k]==t[j])
        c++;
     }
  }
  m=max(m,c);
 }
 cout<<max((int)(t.size())-m,0)<<endl;
}
int main()
{
  fast();
   // int t;
   // cin>>t;
   // for(int casee=1;casee<=t;casee++)
  {//cout<<"Case #"<<casee<<": ";
    solve();
  }
 
 
 
}

Measured memory_bytes: 3648
n = int(input())
s = sorted([int(input()) for i in range(n)])

ans = 0
if sum(s) % 10 != 0:
    print(sum(s))
else:
    for i in s:
        if i % 10 != 0:
            ans = sum(s) - i
            print(ans)
            break
    if ans == 0:
        print(ans)


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

long long Q, A, B;

long long solve(long long V, long long D) {
	long long L = 0, R = (1LL << 30), M, maxn = 0;
	for (int i = 0; i < 40; i++) {
		M = (L + R) / 2;
		if (M*M <= V) { L = M; maxn = max(maxn, M); }
		else { R = M; }
	}
	long long B = maxn, K = 0LL; if (B < D) K = 1LL;
	if (B == V / B) return (B - 1) * 2LL + K +  0LL;
	return (B - 1) * 2LL + K + 1LL;
}

int main() {
	cin >> Q;
	for (int i = 1; i <= Q; i++) {
		cin >> A >> B;
		if (A == 1 && B == 1) { cout << "0" << endl; }
		else cout << solve(A*B - 1LL, min(A, B)) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = (int)1e9+7;


int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,x;
	cin>>n;
	set<int> s;
	for(int i=0;i<n;i++){
		cin>>x;
		s.insert(x);
	}
	if(s.size()==n){
		cout<<"YES";
	} 
	else cout<<"NO";
	return 0;
}
	
	
	
	
	
	
	
	
	
	
	

























Measured memory_bytes: 9600
#include <iostream>
#include <string>

using namespace std;

int main(int argc, const char * argv[]) {
    int n;
    int i,j;
    char type;
    int number;
    cin >> n;
    int cards[4] [13];
    for (i=0; i<4; i++) {
        for (j=0; j<13; j++) {
            cards [i] [j]=1;
        }
    }
    for(i=0; i<n; i++){
        cin >> type >> number;
        switch (type) {
            case 'S':
                cards[0] [number-1]=0;
                break;
            case 'H':
                cards[1] [number-1]=0;
                break;
            case 'C':
                cards[2] [number-1]=0;
                break;
            case 'D':
                cards[3] [number-1]=0;
            default:
                break;
        }
    }
    for (i=0; i<4; i++) {
        for (j=0; j<13; j++) {
            if (cards[i][j]!=0) {
                switch (i){
                    case 0 : cout << "S " << j+1 << endl;
                        break;
                    case 1 : cout << "H " << j+1 << endl;
                        break;
                    case 2 : cout << "C " << j+1 << endl;
                        break;
                    case 3 : cout << "D " << j+1 << endl;
                        break;
                    default:
                        break;
                }
            }
        }
    }
    
    return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
int main(void)
{
    int N;
  
    scanf("%d",&N);
  
    if(N%2!=0) printf("%lf\n",(double)(N/2+1.0)/N);
    else printf("%lf\n",(double)(N/2)/N);
  
    return 0;
}

Measured memory_bytes: 1744
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int ss;
 
  cin >> ss;
  
  //(ss-ss%100)/100; //123 -> (123-23)/100=100/100=1
  //(ss%100-ss%10)/10; //123 -> (23-3)/10=20/10=2
  //ss%10; //123 -> 3

  cout << (ss-ss%100)/100 + (ss%100-ss%10)/10 + ss%10 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  
  sort(a, a+3);
  
  int ans = a[0] + a[1];
  cout << ans << endl;
  
  return 0;
}



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

int main(void) {
    char str[20];
    int size;
    
    cin >> str;
    size = strlen(str);
    for(int i = 1; i <= size; ++i) {
        cout << str[size - i];
    }
    cout << endl;
}


Measured memory_bytes: 2992
from collections import deque
from itertools import product


def bfs():
    while q:
        i, j = q.popleft()
        for di, dj in (1, 0), (-1, 0), (0, 1), (0, -1):
            ni, nj = i + di, j + dj
            if not (0 <= ni < H and 0 <= nj < W and dist[ni][nj] < 0):
                continue
            dist[ni][nj] = dist[i][j] + 1
            q.append((ni, nj))


H, W = map(int, input().split())
A = [input() for _ in range(H)]

q = deque()
dist = [[-1] * W for _ in range(H)]
for i, j in product(range(H), range(W)):
    if A[i][j] == ".":
        continue
    q.append((i, j))
    dist[i][j] = 0
bfs()
print(max(max(row) for row in dist))

Measured memory_bytes: 110044
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<cmath>

using std::cout;
using std::cin;
using std::setw;
using std::setfill;
using std::string;
using std::pair;
using std::make_pair;
using std::vector;
using std::queue;
using std::deque;
using std::priority_queue;
using std::next_permutation;
//using std::iota;
using std::sort;
using std::greater;
using std::max;
using std::min;
using std::log;

using lli = long long int;
using ulli = unsigned long long int;

#define INF 999999999;
#define MOD 1000000007;

//#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

/*
int N, K, t=1;
long double a=1.0;
long double c = 2.0;
*/

char S[5];
int FS[2];
int fs;

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

	cin >> S;
	for(int i = 0; i < 4; i++){
		if(S[i] == '0'){
			if(i%2 == 0) FS[i/2] += 0*10;
			else FS[i/2] += 0;
		}else if(S[i] == '1'){
			if(i%2 == 0) FS[i/2] += 10;
			else FS[i/2] += 1;
		}else if(S[i] == '2'){
			if(i%2 == 0) FS[i/2] += 20;
			else FS[i/2] += 2;
		}else if(S[i] == '3'){
			if(i%2 == 0) FS[i/2] += 30;
			else FS[i/2] += 3;
		}else if(S[i] == '4'){
			if(i%2 == 0) FS[i/2] += 40;
			else FS[i/2] += 4;
		}else if(S[i] == '5'){
			if(i%2 == 0) FS[i/2] += 50;
			else FS[i/2] += 5;
		}else if(S[i] == '6'){
			if(i%2 == 0) FS[i/2] += 60;
			else FS[i/2] += 6;
		}else if(S[i] == '7'){
			if(i%2 == 0) FS[i/2] += 70;
			else FS[i/2] += 7;
		}else if(S[i] == '8'){
			if(i%2 == 0) FS[i/2] += 80;
			else FS[i/2] += 8;
		}else if(S[i] == '9'){
			if(i%2 == 0) FS[i/2] += 90;
			else FS[i/2] += 9;
		}
	}
	if(FS[0] > 12 || FS[0]==0) fs += 10;
	if(FS[1] > 12 || FS[1]==0) fs += 1;

	if(fs == 0){
		cout << "AMBIGUOUS";
	}else if(fs == 1){
		cout << "MMYY";
	}else if(fs == 10){
		cout << "YYMM";
	}else if(fs == 11){
		cout << "NA";
	}

	/*
	cin >> N >> K;
	const long double kk = log((long double)K);
	dbug(kk)dbugln;
	double z;
	long double r = modf(kk/log((long double)2.0), &z);
	if(r != 0)z+=1.0;
	a -= (long double)(1-pow(0.5, z))/(long double)N;
	dbug(a)dbugln;
	for(long double i = min((long double)K-1.0, (long double)N); i > 1.0; i-=1.0){
		long double cm = kk / log(i);
		if(cm <= c)t++;
		else{
			a -= (1 - pow(0.5, c))*t/(long double)N;
			dbug(a)dbug(c)dbug(t)dbugln;
			t=1;
			c+=1.0;
		}
	}
	if(t > 1)a -= (1 - pow(0.5, c))*t/(long double)N;
	cout << a;
	*/
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>
#include <bitset>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll LNF = 1LL<<60;

constexpr int INF = 1e9+7;

const double PI=3.14159265358979323846;


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

/* template */

ll c_pow(ll x, ll n){
    ll res = 1;
    while(n>0){
        if(n&1) res = res *x;
        x = x*x;
        n>>=1;
    }
    return res;
}

map<ll,ll> m;
vector<ll> d;

void five_pow(){
    Rep(i,1,5000){
        ll x = c_pow(i,5ll);
        m[x] = i;
        m[-x] = -i;
        d.emplace_back(x);
    }
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll x; cin >> x;
    five_pow();
    rep(i,0,d.size()){
        ll y = d[i]-x;
        if(y==0){
            cout << i+1 << " " << 0 << endl;
            return 0;
        }
        if(m[y]!=0){
            cout << i+1 << " " << m[y] << endl;
            return 0;
        }
    }
} 

Measured memory_bytes: 4344
//#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <deque>
#include <numeric>

using namespace std;

typedef long long int lo;
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define inf (lo)1e9
#define N (lo)1e5 * 5
#define all(x) (x).begin(), (x).end()
#define ii pair<lo,lo>
#define iii pair<lo, pair<lo,lo> >
#define si pair<string,lo>
#define vi vector <lo> 
#define vii vector <ii> 

int main() {
    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(0);
    lo n,m;
    cin >> n >> m;
    vi h(n + 1);
    for(lo i = 1 ; i <= n ; i++){
	cin >> h[i];
    }
    vi v[n + 5];
    set <ii> s;
    for(lo i = 0 ; i < m ; i++){
	lo a,b;
	cin >> a >> b;
	s.insert(mp(a, b));
    }

    for(auto x : s){
	v[x.st].pb(x.nd);
	v[x.nd].pb(x.st);
    }
    
    lo ans = 0;
    for(lo i = 1 ; i <= n ; i++){
	bool flag = 0;
	for(lo j = 0 ; j < v[i].size() ; j++){
	    if(h[i] <= h[v[i][j]]){
		flag = 1;
		break;
	    }
	}

	if(!flag){
	    ans++;
	    //cout << i << endl;
	}
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 16108
#include<iostream>

using namespace std;

int ans = 0;
int N;
int dfs (long long int x,int a,int b, int c) {
    if(x > N) return 0;
    if((a>0&&b>0) && c > 0) ans++;
    dfs(x*10+3,a+1,b,c);
    dfs(x*10+5,a,b+1,c);
    dfs(x*10+7,a,b,c+1);
}

int main () {
    cin >> N;
    dfs(0,0,0,0);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 12

struct Info{

	ll P,C;
};

ll D,G;
int POW[SIZE];
Info info[SIZE];

int main(){

	POW[0] = 1;
	for(int i = 1; i < SIZE; i++){

		POW[i] = POW[i-1]*2;
	}

	scanf("%lld %lld",&D,&G);

	for(ll i = 0; i < D; i++){

		scanf("%lld %lld",&info[i].P,&info[i].C);
	}

	ll ans = BIG_NUM;

	for(int state = 0; state < POW[D]; state++){
		ll sum = 0;
		ll num = 0;

		//まずはコンプリートする問題を計上
		for(int loop = 0; loop < D; loop++){
			if(state&POW[loop]){
				sum += 100*(loop+1)*info[loop].P;
				sum += info[loop].C;
				num += info[loop].P;
			}
		}

		if(sum >= G){

			ans = min(ans,num);
			continue;
		}

		for(int loop = D; loop >= 0; loop--){ //得点の大きいものからやる
			if(state&POW[loop])continue;

			for(int i = 1; i <= info[loop].P-1; i++){ //コンプリートはしない
				sum += 100*(loop+1);
				num++;
				if(sum >= G)break;
			}
			if(sum >= G)break;
		}
		if(sum >= G){

			ans = min(ans,num);
		}
	}

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

	return 0;
}


Measured memory_bytes: 3812
#require 'prime'
#require 'openssl'
MOD=10**9+7;  cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.chomp.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def ar2(s1,s2,de=nil) Array.new(s1){Array.new(s2,de)} end
def ar3(s1,s2,s3,de=nil) Array.new(s1){Array.new(s2){Array.new(s3,de)}} end

def desc(ar) ar.sort!{|x,y| y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+).to_i end
def ceil(a,b) (a.to_f/b).ceil end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end
def rui(ar) s=[0]; ar.size.times{|i| s<<s[-1]+ar[i]}; s end
def rev_rui(ar) s=[0]; ar.size.times.reverse_each{|i| s<<s[-1]+ar[i]}; s end

def puts_yesno(b) puts(b ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def pu(h) begin; require './../nemi_lib/debug.rb'; puts_val(h); rescue LoadError; end; end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n,m,k=gsmi
a=gsmi
b=gsmi
rui_a=rui a
rui_b=rui b
max=0
#pu rui_a:rui_a.to_s
#pu rui_b:rui_b.to_s
(n+1).times do |i|
  a_sum=rui_a[i]
  c=0
  if k-a_sum>=0
    idx=rui_b.bsearch_index{|x|x>k-a_sum}
    if idx.nil?
      idx=rui_b.size
    end
    c=i+(idx-1)
    #pu idx:idx
    #pu c:c
  else
    break
  end

  max=c if max<c
end

puts max


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

/* nCk for small n
    n は 50 程度まで
    計算量: O(k)
*/
long long nCk(int n, int k) {
    long long ret = 1;
    for (int i = 0; i < k; i++) {
        ret = ret * (n - i) / (i + 1);
    }
    return ret;
}

int main() {
    int N, P;
    cin >> N >> P;
    vector<int> A(N);
    vector<long long> cnt(2, 0);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
        A.at(i) %= 2;
        cnt.at(A[i])++;
    }

    long long ans = 0;
    for (int i = P; i <= cnt[1]; i += 2) {
        ans += nCk(cnt[1], i) * (1LL << cnt[0]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
from fractions import gcd

A,B,C,D=map(int,input().split())

#count1=0
#count2=0
#for i in range(A,B+1):
#  if i%C!=0 and i%D!=0:
#    count+=1
#print(count)

e=B//C
f=B//D
g=(A-1)//C
h=(A-1)//D
i=e-g
j=f-h

P=gcd(C,D)
L=C*D//P
k=(A-1)//L
m=B//L
n=m-k

print(B-A+1-i-j+n)

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

using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const int inf = 1e9+7;
const int mod = 1e9+7;

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

    string s;
    cin>>s;

    int r=0,w=0;
    rep(i,n){
        if(s[i]=='R')r++;
        else w++;
    }

    string c="";
    rep(i,r)c+='R';
    rep(i,w)c+='W';

    int cnt=0;
    rep(i,n){
        if(s[i]!=c[i])cnt++;
    }

    cout<<cnt/2<<endl;
}


Measured memory_bytes: 3900
package main

import (
  "fmt"
  "strings"
  "strconv"
)

func main() {

  var n, a, b int

  fmt.Scan(&n, &a, &b)

  result := 0
  for i:=1; i<=n; i++ {
    s := strconv.Itoa(i)
    l := strings.Split(s, "")
    total := 0
    for j:=0; j<len(l); j++ {
      t, _ := strconv.Atoi(l[j])
      total += t
    }
    if total >= a && total <= b {
      result += i
    }
  }
  
  fmt.Println(result)
}

Measured memory_bytes: 1280
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define MAXN 15
typedef long long ll;
char s[MAXN];
int digit[MAXN];
ll ans, n;
void dfs(int pos, ll sum, ll last)
{
	if(pos > n)
	{
		ans = ans + sum + last;
		return ;
	}
	dfs(pos + 1, sum, last * 10 + digit[pos]);
	dfs(pos + 1, sum + last, digit[pos]);
}
int main()
{
	scanf("%s", s + 1);
	n = strlen(s + 1);
	for(int i = 1; i <= n; ++i)
		digit[i] = s[i] - '0';
	dfs(2, 0, digit[1]);
	printf("%lld\n", ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cctype>
using namespace std;

string expr;
int p,s,l;
char ans;

int parseInt()
{
	int ret=0;
	while(p<expr.size())
	{
		if(!isdigit(expr[p])) break;
		ret*=10;
		ret+=expr[p]-'0';
		p++;
	}
	
	return ret;
}

string parseStr()
{
	string ret;
	while(p<expr.size())
	{
		if(!isupper(expr[p])) break;
		ret+=expr[p];
		p++;
	}
	
	return ret;
}

bool parse()
{
	int lp=parseInt(), tp=p;
	string str;
	if(expr[p]=='(')
	{
		while(lp--)
		{
			p=tp;
			p++;
			if(parse()) return true;
		}
		p++;
	}
	else
	{
		if(lp==0) lp++;
		str=parseStr();
		
		if(s+str.size()*lp > l)
		{
			int ex=(l-s+str.size()*lp)%str.size();
			ans=str[ex];
			return true;
		}
		s+=str.size()*lp;
		
	}

	if(p<expr.size() && expr[p]!=')') return parse();
	return false;
}

int main()
{
	while(cin >> expr >> l, (expr!="0"||l))
	{
		p=0; s=0; ans='0';
		
		parse();
		printf("%c\n", ans);
	}
}

Measured memory_bytes: 932
//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)
 
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<int, ii> iii;
 
ll pwr(ll base, ll p, ll mod=MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}


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


ll h, n, w;

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

    ll N;
    cin>>N;

    for(ll h=1;h<=3500;h++)
    	for(ll n=1;n<=3500;n++){

    		ll temp = 4*h*n - N*n - N*h;
    		ll yo = N*n*h;
    		if(temp > 0 && yo % temp == 0){
    			yo /= temp;
    			if(yo >= 1 && yo <= 3500){
    				cout<<h<<" "<<n<<" "<<yo;
    				return 0;
    			}
    		}		
    	}
    

 

    return 0;
}








Measured memory_bytes: 384
n, m = map(int, input().split())

# ON/OFF全パターンの配列をつくる
switches = [[] for i in range(pow(2,n))]
for index in range(n):
    div =  pow(2,index)
    for i in range(pow(2,n)):
        term = i // div
        if term % 2 ==0:
            switches[i].append(0)
        else:
            switches[i].append(1)

# 電球につながったスイッチリスト読み込み
light_switch = []
for _ in range(m):
    tmp = list(map(int, input().split()))
    tmp.pop(0)
    light_switch.append(tmp)

# 条件読み込み
p = list(map(int, input().split()))

pattern_num = 0
for s in switches:
    all_on_flg = True
    # 電球ごとに点灯するかどうかチェック
    for num, light in enumerate(light_switch):
        on_num = 0
        for ls in light:
            if s[ls-1] == 1:
                on_num += 1
        if on_num % 2 != p[num]:
            # 条件に反したら、強制終了
            all_on_flg = False
            break
    if all_on_flg:
        pattern_num += 1
print(pattern_num)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define all(x) (x).begin(), (x).end()

using namespace __gnu_pbds;
using namespace std;

using ull = unsigned long long;
using ll = long long;
using ld = long double;
template <typename T> using ordered_set = tree<T, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;

const int mod = 1e9 + 7;
const int inf = INT_MAX;

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

    int n;
    cin >> n;

    ll sum = 0;
    for (int i = 1; i <= n; i++) {
        sum += i * (ll)(n - i + 1);
    }

    for (int i = 1; i < n; i++) {
        int u, v; cin >> u >> v;
        if (u > v) swap(u, v);
        sum -= u * (ll)(n - v + 1);
    }

    cout << sum << "\n";
    return 0;
}

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

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

int main(){
    int k;
    cin >> k;
    long long sum = 0;
    for(int i = 1;i <= k;i++){
        for(int j = 1;j <= k;j++){
            for(int l = 1;l <= k;l++){
                int x;
                x = gcd(i,j);
                int y;
                y = gcd(i,l);
                sum += gcd(x,y);
            }
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int N;
long long a[101010];

bool isPrime(int N)
{
  if(N<=1) return false;
  if(N==2) return true;
  if(N%2==0) return false;
  for(int i=3; i*i<=N; i+=2)
    if(N%i==0) return false;
  return true;
}

int main(){
  scanf("%d", &N);
  long long g = 0;
  for(int i=N; i>=0; --i)
  {
    scanf("%lld", a+i);
    g = __gcd(g, abs(a[i]));
  }
  int rg = g;
  vector<int> f;
  for(int i=1; i*i<=g; ++i)
  {
    if(g%i==0 && isPrime(i))
    {
      f.push_back(i);
      while(g%i==0) g /= i;
    }
  }
  if(g != 1) f.push_back(g);
  for(int i=0; i<=N; ++i) a[i] /= rg;
  for(int p=0; p<=N+1; ++p) if(isPrime(p) && a[0]%p == 0)
  {
    bool flag = true;
    for(int i=0; i<p-1; ++i)
    {
      long long s = 0;
      for(int j=i; j<=N; j += p-1)
        s += a[j];
      if(s%p != 0)
      {
        flag = false; break;
      }
    }
    if(flag) f.push_back(p);
  }
  sort(f.begin(), f.end());
  f.resize(unique(f.begin(), f.end())-f.begin());
  for(auto x: f) cout << x << endl;
  return 0;
    
  
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(0); cin.tie(0);
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
typedef long long ll;

int main(int argc, char const *argv[]) { 
    int n; cin >> n;
    if (n < 1000) cout << "ABC\n";
    else cout << "ABD\n";
    return 0;
}


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

int main(){
	int n,age,num[7],i;
	
	while(cin>>n,n){
		for(i=0;i<7;++i)num[i]=0;
		for(i=0;i<n;++i){
			cin>>age;
			if(age>=60)++num[6];
			else ++num[age/10];
		}
		for(i=0;i<7;++i)cout<<num[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
//BISMILLAHIR RAHMANIR RAHIM
#include <bits/stdc++.h>
#define mem(a, b) (memset(a, b, sizeof(a)))
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define INF 2147483647
#define MOD 1000000007
#define MAX 200005
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

int arr[MAX];

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int k, n;

    cin>>k>>n;

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

    int Min = arr[n-1] - arr[0];

    Min = min(Min, arr[0] + (k - arr[1]));

    for(int i = 1; i < n - 1; i++){
        Min = min(Min, arr[i] + (k - arr[i+1]));
    }

    cout<<Min<<endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
  char b; cin >> b;

  char ans;
  if (b == 'A') ans = 'T';
  else if (b == 'T') ans = 'A';
  else if (b == 'C') ans = 'G';
  else if (b == 'G') ans = 'C';

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


Measured memory_bytes: 256
n, m = map(int, input().split())
h = list( map(int, input().split()))

ab = [tuple(map(int,input().split())) for i in range(m)]
es = [[] for i in range(n)]
for i, (a,b) in enumerate(ab):
    a,b = a-1,b-1
    es[a].append(b)
    es[b].append(a) #無向グラフ

ans = 0
for i in range(n):
    ma = h[i]
    if es[i] == []:
        ans+=1
    else:
        for aa in set(es[i]):
            if ma <= h[aa]:
                break
        else:
            ans+=1

print(ans)

Measured memory_bytes: 109216
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<bool>    vecbool;
typedef vector<int>     vecint;
typedef vector<ll>      vecll;
typedef vector<string>  vecstr;
typedef vector<vecint>  vec2int;
typedef vector<vecbool> vec2bool;
int dx[4] {-1,+1, 0, 0};
int dy[4] { 0, 0,-1,+1};
int main()
{
  int n; cin >> n;
  vecll a(3*n,0);
  REP(i,3*n){
    cin >> a[i];
  }
  sort(all(a));
  ll ans = 0;
  REP(i,n){
    ans += a[3*n - 2*i - 2];
  }
  cout << ans << endl;
}


Measured memory_bytes: 2560
#include<stdio.h>

int main(){

  int n,q;
  int i,j;
  int s[100000],t,c=0;
  int left=0,mid=0,right=0;
  scanf("%d",&n);

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

  right=n;
  scanf("%d",&q);

for(j=0; j < q; j++){
    scanf("%d",&t);
    while(left < right){
    mid=(left+right)/2;
    if(t==s[mid]){
      c++;
      break;
    }
    else if(t > s[mid]){
      left=mid+1;
    }
    else if(t < s[mid]){
      right=mid;
    }
    }
    left=0;
    right=n;
    mid=0;
}

 printf("%d\n",c);

 return 0;
}

Measured memory_bytes: 988
N, M = gets.split.map { |e| e.to_i }
PY = []

M.times {|i|
    pTemp, yTemp = gets.split.map { |e| e.to_i }
    PY.push([pTemp, yTemp, i])
}

PY.sort! {|a, b| a[1] <=> b[1]}

index = []
N.times {
    index.push(0)
}

M.times {|i|
    index[PY[i][0] - 1] += 1
    PY[i][1] = index[PY[i][0] - 1]
}

PY.sort! {|a, b| a[2] <=> b[2]}

M.times {|i|
    puts format('%06d%06d', PY[i][0], PY[i][1])
}

Measured memory_bytes: 12648
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <limits>
#include <cmath>
#include <numeric>
#include <string>

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
#define rep(i, a, b) for(int i = (a); i < (b); ++i )
#define rrep(i, a, b) for(int i = (a); i > (b); --i )
#define REP(i, a, b) for(int i = (a); i <= (b); ++i )
#define RREP(i, a, b) for(int i = (a); i >= (b); --i )
#define ullrep(i, a, b) for(ull i = (a); i < (b); ++i )
#define ullrrep(i, a, b) for(ull i = (a); i > (b); --i )
#define ullREP(i, a, b) for(ull i = (a); i <= (b); ++i )
#define ullRREP(i, a, b) for(ull i = (a); i >= (b); --i )
ull a[3];
int k;
int main() {
    cin >> a[0] >> a[1] >> a[2];
    cin >> k;
    std::sort(a, a+3);
    rep(i, 0, k) {
        a[2] *= 2;
    }
    cout << a[0] + a[1] + a[2] << endl;
}

Measured memory_bytes: 256
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
#include <vector>
#define rep(i,n) for (int i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll A;
ll B;
ll C;
ll N;
ll M;
ll K;

int main(){

    
    string S;
    string T;
    
    cin >> S;
    cin >> T;

    if(S.length()==T.length()-1&&T.substr(0,S.length())==S){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    

}

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

int main() {
  int N;
  cin >> N;
  double A[N];
  
  for (int i = 0; i < N; i++) cin >> A[i];
  
  double ans = 0;
  
  for (int i = 0; i < N; i++) ans += 1 / A[i];
  
  cout << fixed << setprecision(10) << 1/ans << endl;
}

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

cost = 0
maxcost = 0

# print(A)

for i in range(len(A)):
    if i == 0:
        cost += A[i]
        # print(cost)
        continue
    elif i == len(A)-1:
        tm = A[i] - A[i - 1]
        maxcost = max(maxcost, tm)
        cost += tm

        tm = KN[0] - A[i]
        maxcost = max(maxcost,tm+A[0])
        # print(maxcost)
        cost += tm

    else:
        tm = A[i] - A[i-1]
        maxcost = max(maxcost, tm)
        cost += tm
    # print(cost)

print(cost-maxcost)



Measured memory_bytes: 26444
#include<cmath>
#include<iostream>
using namespace std;
int main()
{
  int k,a,b,n1,n2;
  cin>>k>>a>>b;
  n1=(int)ceil(1.0*a/k);
  n2=(int)floor(1.0*b/k);
  if(n2>=n1) cout<<"OK"<<endl;
  else cout<<"NG"<<endl;
  return 0;
}

Measured memory_bytes: 3604
#include<iostream>
#include<queue>
using namespace std;
int N;
long ans;
int X[500][500];
bool vis[500][500];
int d[4]={1,0,-1,0};
main()
{
	cin>>N;
	for(int i=0;i<N;i++)
	{
		for(int j=0;j<N;j++)X[i][j]=min(min(i,N-1-i),min(j,N-1-j));
	}
	for(int i=0;i<N*N;i++)
	{
		int P;cin>>P;P--;
		int x=P/N,y=P%N;
		ans+=X[x][y];
		vis[x][y]=true;
		queue<pair<int,int> >Q;
		Q.push(make_pair(x,y));
		while(!Q.empty())
		{
			int nx=Q.front().first,ny=Q.front().second;
			Q.pop();
			int c=X[nx][ny];
			if(!vis[nx][ny])c++;
			for(int r=0;r<4;r++)
			{
				int tx=nx+d[r],ty=ny+d[r^1];
				if(0<=tx&&tx<N&&0<=ty&&ty<N&&X[tx][ty]>c)
				{
					X[tx][ty]=c;
					Q.push(make_pair(tx,ty));
				}
			}
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 4848
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mem(x,y) memset(x,y,sizeof(x))

ll num[1000005];

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

    ll i,j,k,s,d,r,m,n;
    cin>>n;
    for(i=1; i<=3*n; i++) cin>>num[i];
    sort(num+1, num+3*n+1);
    s=0;
    for(i=3*n-1, j=1; j<=n; i-=2, j++) s+=num[i];
    cout<<s<<endl;
}



Measured memory_bytes: 4352
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#ifdef rd
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
	const char *comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
#else
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef float f80;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
//const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int powm(int a, int b, int mod) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
int a[200005];
void solve() {
	int n;
	cin>>n;
	fr(i,1,n)
		cin>>a[i];
	multiset<int> lol;
	fr(i,1,n) {
		auto it=lol.lower_bound(a[i]);
		if(it!=lol.begin()) {
			it--;
			lol.erase(it);
		}
		lol.insert(a[i]);
	}
	cout<<sz(lol)<<endl;
}
 
signed main() {
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout<<fixed<<setprecision(10);
	int t=1;
//	cin>>t;
	fr(i,1,t) {
		solve();
	}
#ifdef rd
	cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}


Measured memory_bytes: 5760
#include <stdio.h>
#include <iostream>
using namespace std;

int main(void){
  int n;
  scanf("%d",&n);
  if(n == 1){
    printf("Hello World\n");
  }
  else if(n == 2){
    int a,b;
    scanf("%d",&a);
    scanf("%d",&b);
    printf("%d\n",a+b);
}
return 0;
}

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

#define ll long long
int main()
{
   string s;
   cin>>s;
   ll ans[s.length()]={0};
   for(ll i=0;i<s.length();)
   {
   	  ll c=0;
   	  ll k=0;
   	  while(s[i]=='R')
   	  {
   	  	 i++;
   	  	 c++;
	  }
	  ll j=i-1;
	  while(i<s.length() && s[i]=='L')
	  {
	  	i++;
	  	k++;
	  }
	  if((c+k)%2==0)
	  {
	  	ans[j]=(c+k)/2;
	  	ans[j+1]=ans[j];
	  }
	  else
	  {
	  	if(c%2==0)
	  	{
	  		ans[j]=(c+k)/2;
	  		ans[j+1]=(c+k)/2 +1;
		}
		else
		{
			ans[j]=(c+k)/2 +1;
			ans[j+1]=(c+k)/2;
		}
	  }
   }
   for(int i=0;i<s.length();i++)
   {
   	   cout<<ans[i]<<" ";
   }
   return 0;
}

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

int n, A[30];

// ????????????
bool solve(int i, int m) {
	// ???????????°?????°m???????????????
	if (m == 0)
		return true;
	// ???????????????A?????¨??¨????´????
	if (i >= n)
		return false;
	// ???????????? ??????A[i] ??? ??????A[i]?????????
	return solve(i + 1, m) || solve(i + 1, m - A[i]);
}
int main(){
	int t, M;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &A[i]);
	}
	scanf("%d", &t);
	for (int i = 0; i < t; i++) {
		scanf("%d", &M);
		if (solve(0, M))
			printf("yes\n");
		else
			printf("no\n");
	}
	return 0;
}

Measured memory_bytes: 3164