akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
// #include "ane.cpp"

const int INF  = 1e9;
const long long INFLL = 1e18;
const int NMAX = 105;
const int MMAX = 100005;
const int KMAX = 1005;
const int MOD  = 1e9 + 7;
using namespace std;

// comment to disable debug functions
#define DEBUG

// frequently used macros

#if __cplusplus >= 201103L
#define ALL(v) begin(v),end(v)
#define SORT(v) sort(begin(v), end(v))
#define FIND(v,x) find(begin(v), end(v), (x))
#else
#define ALL(v) (v).begin(),(v).end()
#define SORT(v) sort(v.begin(), v.end())
#define FIND(v,x) find(v.begin(), v.end(), (x))
#endif

#define MEMNEXT(from, to) do{ memmove((to), (from), sizeof(from)); \
memset((from), 0, sizeof(from)); } while(0)
#ifdef DEBUG
#define DUMP(x) do{ std::cerr << (#x) << ": " << x << std::endl; }while(0)
#else
#define DUMP(x) do{}while(0)
#endif

// frequent used aliases
typedef long long ll;
typedef pair<int, int> p;
typedef pair<ll, int> lp;
typedef pair<ll, ll> llp;
typedef vector<int> vec;
typedef vector<ll> vecll;
typedef vector<vec> mat;
typedef vector<vecll> matll;

// frequently used constants
static const int di[] = {-1, 0, 1, -1, 1, -1, 0, 1};
static const int dj[] = {-1, -1, -1, 0, 0, 1, 1, 1};

// frequently used structs
struct edge{
  int to,cost;
};

// printf for debug
#ifndef DEBUG
void debug(const char* format, ...){}
#else
void debug(const char* format, ...){
  va_list arg;
  va_start(arg, format);
  vprintf(format, arg);
  va_end(arg);
}
#endif

// dump vector
#ifdef DEBUG
#define DUMPV(v, c) do{       \
  printf("%s: ", #v);         \
  for (int i = 0; i < (c); ++i) \
  {                           \
  cout << (v)[i] << " ";      \
  }                           \
  cout << endl;               \
} while(0)
#else
#define DUMPV(v,c)
#endif

// std::fill of multi dimensions
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
  std::fill( (T*)array, (T*)(array+N), val );
}

// binary search
ll BSearch(ll _begin, ll _end, bool (*f)(int)){
  ll mid;
  while(_end - _begin > 1LL) {
  mid = (_begin + _end) / 2LL;
  if(f(mid)) {
    debug("BSearch: f(%d) == true\n", mid);
    _end = mid;
  }
  else
  {
    debug("BSearch: f(%d) == false\n", mid);
    _begin = mid;
  }
  }
  return _end;
}


int N,M,K,A[NMAX],B=0,C=0,D,E;
bool dp[9] = {};

string S;
vec v;

ll ans = 0;

int F(int rate){
  if(rate >= 3200) return 0;
  else if(rate >= 2800) return 1;
  else if(rate >= 2400) return 2;
  else if(rate >= 2000) return 3;
  else if(rate >= 1600) return 4;
  else if(rate >= 1200) return 5;
  else if(rate >= 800) return 6;
  else if(rate >= 400) return 7;
  else return 8;
}
void solve(){
  // main algorithm
  for (int i = 0; i < N; ++i)
  {
    if (F(A[i]))
    {
      if(!dp[F(A[i])]) C++;
      dp[F(A[i])] = true;
    }else{
      B++;
    }
  }
}
void debug(){
  // output debug information

}
void answer(){
  // output answer
  cout << (C == 0 && B > 0 ? 1 : C) << " " << C+B << endl;
}
int main(int argc, char const *argv[])
{
  // operate inputs

  // Fill(dp, -1);
  cin >> N;
  for (int i = 0; i < N ; ++i)
  {
    cin >> A[i];
  }
  solve();
  #ifdef DEBUG
  debug();
  #endif
  answer();

  return 0;
}

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

int findACGT(char c){
  if (c=='A'||c=='C'||c=='T'||c=='G') return 1;
  else return 0;
}

int main() {
  string S;
  cin >> S;
  int data[S.size()+10];
  for (int i=0;i<S.size();i++){
    data[i]=findACGT(S.at(i));
  }
  string counter;
  string current;
  for (int i=0;i<S.size();i++){
    counter="";
    if (data[i]==0) continue;
    else {
      counter.push_back(S.at(i));
      for (int j=i;j<S.size();j++){
        if (j+1==S.size()) break;
        else {
          if(data[j+1]==1) counter.push_back(S.at(j+1));
          else break;
        }
      }
    }
    if (current.size() < counter.size()) current = counter;
  }
  cout << current.size() << endl;
}



Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#define N 1003
#define MAX 20000

using namespace std;
typedef long long llong;
struct card{
    int loc;
    int d;
};
int n;
int mmin;
bool B[N];

void QuickSort(card A[],int head,int tail){
    card x=A[tail];
    int i=head-1,j=head;
    card temp;
    if(head>=tail) return;  //!(tail-head>1) 改了  就是这里的问题！！！
    for(j=head;j<tail;j++){
        if(A[j].d<=x.d){
            i++;
            temp=A[j]; A[j]=A[i]; A[i]=temp;
        }
    }
    A[tail]=A[i+1]; A[i+1]=x;
    QuickSort(A,head,i);
    QuickSort(A,i+2,tail);
}

llong deal(card A[],int n){
    llong ans=0;
    llong tempans=0;
    int origin_loc=0;
    for(int i=0;i<n;i++){
        if(B[i]) continue;
        origin_loc=i;
        vector<int> temp;
        int loc_min=MAX;
        int num=0;
        while(!B[origin_loc]){
            num+=1;
            temp.push_back(A[origin_loc].d);
            tempans+=A[origin_loc].d;
            loc_min=min(loc_min,A[origin_loc].d);
            B[origin_loc]=true;
            origin_loc=A[origin_loc].loc;
        }

        ans+=min(tempans+(num-2)*loc_min,loc_min+tempans+(num+1)*mmin);

        temp.clear();
        num=0;
        loc_min=MAX;
        tempans=0;
    }
    return ans;
}

int main(){
    int td;
    card A[N];
    mmin=MAX;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>td;
        mmin=min(mmin,td);
        A[i].d=td;
        A[i].loc=i;
        B[i]=false;
    }

    QuickSort(A,0,n-1);

    cout<<deal(A,n)<<endl;

    return 0;
}



Measured memory_bytes: 3188
from collections import deque
S=input()
Q=int(input())

d=deque(S)
rev=False
for q in range(Q):
  q=input()
  if q=="1":
    rev=not rev
  else:
    qlist=q.split()
    if qlist[1]=="1":
      if not rev:
        d.appendleft(qlist[2])
      else:
        d.append(qlist[2])
    elif qlist[1]=="2":
      if not rev:
        d.append(qlist[2])
      else:
        d.appendleft(qlist[2])

d2=deque()
if not rev:
  d2=deque(d)
else:
  d2=deque(reversed(d))
  
print("".join(d2))

Measured memory_bytes: 11124
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define dfor(i,a,b) for(ll i=(a);i>=(b);i--)
#define mem(u, vis) memset(u, vis, sizeof(u))
#define ll long long
#define ull unsigned long long
#define MOD  1000000007
#define MAX  1e9
#define pb   push_back
#define F    first
#define S    second


int main() {
	string s;
	cin>>s;
	if(s[2]==s[3] && s[4]==s[5]){
		cout<<"Yes";
	}
	else cout<<"No";
	
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    int i,j,n,m,t=0,h=0;
    string T,H;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>T>>H;
        if(T==H){
            t++;
            h++;
        }else if(T<H){
            h+=3;
        }else if(T>H){
            t+=3;
        }
    }
    cout<<t<<" "<<h<<endl;
}



Measured memory_bytes: 3160
#include <iostream>

void displayDate(int index) {
  int i = (7 + index - 1) % 7 ;

  if (i == 0) {
    std::cout << "Sunday" << std::endl;
  } else if (i == 1) {
    std::cout << "Monday" << std::endl;
  } else if (i == 2) {
    std::cout << "Tuesday" << std::endl;
  } else if (i == 3) {
    std::cout << "Wednesday" << std::endl;
  } else if (i == 4) {
    std::cout << "Thursday" << std::endl;
  } else if (i == 5) {
    std::cout << "Friday" << std::endl;
  } else if (i == 6) {
    std::cout << "Saturday" << std::endl;
  }
}

int main() {
  while (true) {
    int m, d;
    std::cin >> m;
    std::cin >> d;

    if (m == 0 && d == 0) {
      break;
    } else if (m == 1) {
      displayDate(d + 4);
    } else if (m == 2) {
      displayDate(d + 0);
    } else if (m == 3) {
      displayDate(d + 1);
    } else if (m == 4) {      
      displayDate(d + 4);
    } else if (m == 5) {
      displayDate(d + 6);
    } else if (m == 6) {
      displayDate(d + 2);
    } else if (m == 7) {
      displayDate(d + 4);
    } else if (m == 8) {
      displayDate(d + 0);
    } else if (m == 9) {
      displayDate(d + 3);
    } else if (m == 10) {
      displayDate(d + 5);
    } else if (m == 11) {
      displayDate(d + 1);
    } else if (m == 12) {
      displayDate(d + 3);
    }
  }

  return 0;
}



Measured memory_bytes: 3064
/**
 *  Author : Coda
 *  Title : OSU!
 *  Date : 2019-08-20
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define fs first
#define sd second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b,ll c){ll t=1;while(b){if(b&1)t=t*a%c;a=a*a%c;b>>=1;}return t;}
ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

int n,k ;
ll h[maxn],dp[maxn] ;

//#define TEST
int main(){
#ifdef TEST
    freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins
        scanf("%d%d",&n,&k) ;
        for(int i=1 ; i<=n ; i++){
            scanf("%lld",&h[i]) ;
            dp[i] = LLINF ;
        }
        dp[1] = 0 ;
        ll ans = LLINF ;
        for(int i=2 ; i<=n ; i++){
            for(int j=1 ; j<=k && i-j>=1 ; j++){
                dp[i] = min(dp[i],dp[i-j]+abs(h[i]-h[i-j])) ;
            }
        }
        printf("%lld\n",dp[n]) ;
    }
#ifdef TEST
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


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

#define __m int mid=(l+r)>>1
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1

template<class T>
inline bool rd(T &num) {
    char in;
    bool IsN = false;
    while(in = getchar(), in != '-' && (in < '0' || in > '9'))if(in == EOF)return false;
    in == '-' ? (IsN = true, num = 0) : num = in - '0';
    while(in = getchar(), in >= '0' && in <= '9')num = num * 10 + in - '0';
    return IsN ? num = -num : num, true;
}

#define rep(i,a,b) for(register int i = (a); i< (b); i++)
#define per(i,a,b) for(register int i = (a); i> (b); i--)
#define clr(a) memset(a,0,sizeof(a))
#define inf(a) memset(a,0x3f,sizeof(a))
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define rd2(a,b) rd(a)&&rd(b)
#define rd3(a,b,c) rd(a)&&rd(b)&&rd(c)
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))

string nico;
#ifdef LOCAL
#define bug(x) cout<<#x<<" : "<<x<<endl
#define infile(x) freopen(x,"r",stdin)
#define outfile(x) freopen(x,"w",stdout)
#else
#define bug(x)
#define infile(x)
#define outfile(x)
#endif

const int maxn = 4e6 + 7;
const int inf  = 0x3f3f3f3f;
const LL linf  = (LL)inf << 32 | inf;
const int mod  = 1e9 + 7;

int main(){
    string s,t;
    cin>>s>>t;
    bool fi=false;
    rep(i,0,s.length()){
        if(s==t)
            fi=true;
        s = s.substr(1,s.length()-1) + s[0];
    }
    if(fi)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static void Main(string[] args) {
        int A, B;
        Input(out A);
        Input(out B);
        Console.WriteLine(6 - A - B);
    }
    static T ChangeT<T>(string s) => (T)Convert.ChangeType(s, typeof(T));
    static void Input<A>(out A a) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
    }
    static void Input<A, B>(out A a, out B b) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
    }
    static void Input<A, B, C>(out A a, out B b, out C c) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
    }
    static void Input<A, B, C, D>(out A a, out B b, out C c, out D d) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
    }
    static void Input<A, B, C, D, E>(out A a, out B b, out C c, out D d, out E e) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
    }
    static void Input<A, B, C, D, E, F>(out A a, out B b, out C c, out D d, out E e, out F f) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
        f = ChangeT<F>(words[5]);
    }
    static void InputArray<T>(out T[] array) {
        array = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries).Select(s => ChangeT<T>(s)).ToArray();
    }
}

Measured memory_bytes: 11348
read -a c0
read -a c1
read -a c2
y=(${c0[@]})
x=(0 $((c1[0]-y[0])) $((c2[0]-y[0])))
((x[1]+y[1]==c1[1]&&x[1]+y[2]==c1[2]&&x[2]+y[1]==c2[1]&&x[2]+y[2]==c2[2])) && echo Yes || echo No


Measured memory_bytes: 3796
#include<bits/stdc++.h>
#define ll long long int
#define trace(x) cerr<<#x<<" : "<<x<<endl;
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

bool visited[21][21];
char arr[21][21];
int dis[21][21];
int n,m,ans;
int nwx[] = {1,-1,0,0};
int nwy[] = {0,0,1,-1}; 
void bfs(int x,int y)
{
    queue<pair<int,int>> q;
    dis[x][y]=0;
    q.push({x,y});
    visited[x][y]=true;
    while(!q.empty())
    {
        pair<int,int> p = q.front();
        q.pop();
        for(int i=0;i<4;i++)
        {
            int nx,ny;
            nx = p.first + nwx[i];
            ny = p.second + nwy[i];
            if(nx>0 && nx<=n && ny>0 && ny<=m && !visited[nx][ny] && arr[nx][ny]=='.' )
            {
                q.push({nx,ny});
                visited[nx][ny]=true;
                dis[nx][ny]=dis[p.first][p.second]+1;
                //cout<<nx<<" "<<ny<<" "<<dis[nx][ny]<<endl;
                ans=max(ans,dis[nx][ny]);
            }
        }
    }
}
int main()
{
    jaldi
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++) cin>>arr[i][j];
    int fans=-1;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(arr[i][j]=='.')
            {
                ans=-1;
                //cout<<"i & j : "<<i<<" "<<j<<endl;
                memset(visited,false,sizeof visited);
                memset(dis,0,sizeof dis);
                bfs(i,j);
                fans = max(fans,ans);
                //cout<<endl<<endl;
            }
        }
    }
    cout<<fans;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void)
{
    double a, b, c, d, e, f;
    double x, y;
     
    while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF){
        y = (c * d - a * f) / (b * d - a * e);
        x = (c - b * y) / a;
         
        printf("%.3lf %.3lf\n", x, y);
    }
     
    return (0);
}

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

int main(void){
  int l,ans=0;
  string s;
  
  cin >> s;
  l=s.size();
  for (int i=0; i<l-i-1; i++){
    if (s[i]!=s[l-i-1])ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<math.h>
#include<string>
#include<queue>
#include<set>
using namespace std;
#define int long long
#define ll long long
#define vel vector<ll>
#define vvel vector<vel>
#define V vector
#define sor(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define rep(i,n) for(ll i=0;i<n;i++)
#define upperbound(v,val) upper_bound(v.begin(),v.end(),val)
#define lowerbound(v,val) lower_bound(v.begin(),v.end(),val)
#define mkp make_pair
#define pin pair<ll,ll>
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
int ze = 0;
vel rui(63, 1);
void make_rui() {
	for (int i = 1; i < 63; i++) {
		rui[i] = rui[i - 1] * 2;
	}
}
signed main() {
	make_rui();
	int h, w; cin >> h >> w;
	queue<pin> q;
	V<V<bool>> is_wall(h+2, V<bool>(w+2,false));
	vvel dist(h + 2, vel(w + 2, 0));
	int ans = 0;
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			char c; cin >> c;
			is_wall[i][j] = (c == '#');
			if (is_wall[i][j]) {
				q.push(mkp(i, j));
			}
		}
	}
	while (!q.empty()) {
		pin a = q.front(); q.pop();
		int x = a.second, y = a.first;
		if (1 <= x and x <= w and 1 <= y and y <= h) {
			mmax(ans, dist[y][x]); int ndi = dist[y][x];
			x--;
			if (!is_wall[y][x]) { 
				q.push(make_pair(y, x)); is_wall[y][x] = true; dist[y][x] = ndi + 1;
			}
			x += 2;
			if (!is_wall[y][x]) {
				q.push(make_pair(y,x)); is_wall[y][x] = true; dist[y][x] = ndi + 1;
			}
			x--; y++;
			if (!is_wall[y][x]) {
				q.push(make_pair(y, x)); is_wall[y][x] = true; dist[y][x] = ndi + 1;
			}
			y -= 2;
			if (!is_wall[y][x]) {
				q.push(make_pair(y, x)); is_wall[y][x] = true; dist[y][x] = ndi + 1;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 24628
#include<iostream>

using namespace std;

int main(void) {
	int n;
	int a;
	int ans(0);
	cin >> n;
	for (int i(0); i < n; i++) {
		cin >> a;
		while (a % 2 == 0) {
			a /= 2;
			ans++;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
//https://atcoder.jp/contests/abc131/tasks/abc131_c
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var (
	A, B, C, D int
	answer     int
)

func readVariables() {
	A, B, C, D = nextInt(), nextInt(), nextInt(), nextInt()
}

func main() {
	readVariables()
	if countMultiples(3, 9, 4) != 2 {
		fmt.Println(countMultiples(3, 9, 4))
	}
	total := B - A + 1
	cMultiple := countMultiples(A, B, C)
	dMultiple := countMultiples(A, B, D)
	cdMultiple := countMultiples(A, B, lcm(C, D))
	answer = total - cMultiple - dMultiple + cdMultiple
	// fmt.Println(total, cMultiple, dMultiple, cdMultiple, answer)
	fmt.Println(answer)
}

func countMultiples(left, right, divider int) int {
	var first, last int
	if left%divider != 0 {
		first = left + divider - left%divider
	} else {
		first = left
	}
	if right%divider != 0 {
		last = right - right%divider
	} else {
		last = right
	}
	if first > right {
		return 0
	}
	return (last-first)/divider + 1
}

/* 以下、テンプレート*/

var scanner *bufio.Scanner

func init() {
	Max := 1001001
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 0, Max), Max)
	scanner.Split(bufio.ScanWords)
}

//nextInt converts next token from stdin and returns integer value.
//nextInt panics when conversion into an integer fails.
func nextInt() int {
	if !scanner.Scan() {
		panic("No more token.")
	}
	num, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic("nextInt(): cannot convert to int: " + scanner.Text())
	}
	return num
}

func nextStr() string {
	if !scanner.Scan() {
		panic("No more token.")
	}
	return scanner.Text()
}

// MinInt は、2つの整数を受け取り、最小値を返します。
func MinInt(x, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

//MaxInt は、2つの整数を受け取り、最大値を返します。
func MaxInt(x, y int) int {
	if x < y {
		return y
	} else {
		return x
	}
}

//AbsInt は、整数の絶対値を返します。
func AbsInt(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//ModPow は整数の累乗関数で、剰余もサポートします。
//base^exponentの値をmoduleで割った余りを返します。
//moduloが1以下の場合には、剰余演算をしません。
//baseが負の値である場合には、返す値が負になることがあります。
func ModPow(base, exponent, modulo int) (result int) {
	result = 1
	for exponent > 0 {
		if exponent%2 == 1 {
			result *= base
			if modulo > 1 {
				result %= modulo
			}
		}
		base *= base
		if modulo > 1 {
			base %= modulo
		}
		exponent /= 2
	}
	return
}

//Gcd は、引数の整数全ての最大公約数を返します。
func Gcd(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = gcd(result, vals[i])
	}
	return
}

func gcd(x, y int) int {
	x, y = AbsInt(x), AbsInt(y)
	for y > 0 {
		x, y = y, x%y
	}
	return x
}

//Lcm は、与えられた整数の最小公倍数を返します。
func Lcm(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = lcm(result, vals[i])
	}
	return
}

func lcm(x, y int) int {
	return x * y / gcd(x, y)
}


Measured memory_bytes: 640
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        MyScanner scan = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        long w = scan.nextInt();
        long h = scan.nextInt();
        long x = scan.nextInt();
        long y = scan.nextInt();

        out.print(((w * h) / 2.0) + " ");
        if (x == w / 2.0 && y == h / 2.0) {
            out.println(1);
        } else {
            out.println(0);
        }


        out.close();
    }


    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;

    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
    //--------------------------------------------------------

}

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

int main()
{
	int a, b; cin >> a >> b;

	int ans;

	if (13 <= a) {
		ans = b;
	}
	else if (6 <= a && a < 13) {
		ans = b / 2;
	}
	else {
		ans = 0;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
  int t[24][60]={0};
  int h,m,count=0;
  int a,b;
  for(int k=0;k<=1;k++){
  scanf("%d",&a);
  for(int i=0;i<=a-1;i++){
    scanf("%d %d",&h,&m);
    t[h][m]=1;
  }
}
  for(h=0;h<=23;h++){
    for(m=0;m<=59;m++){
       if(t[h][m]!=0) {
         if(count!=0) printf(" ");
          count++;
         printf("%d:%02d",h,m);
       }
    }
  }
   printf("\n");
  return 0;
}

Measured memory_bytes: 1052
/*
author: orthodoxparadox
27-Aug-2018
00:09:49
*/

#include <bits/stdc++.h>

using namespace std;
#define dbl long double
#define int ll
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define fup(i, a, n) for (ll i = a; i < n; i++)
#define fdw(i, a, n) for (ll i = n-1; i >= a; i--)
#define fnu for(ll i = 0; i < n; i++)
#define fnd for(ll i = n-1; i >= 0; i--)
#define fau(i, v) for(auto i:v)
#define rev(s) reverse(all(s))
#define oill ostream_iterator<ll>(cout, " ")
#define oiint ostream_iterator<int>(cout, " ") 
#define pb emplace_back
#define push_back emplace_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'
#define all(a) a.begin(), a.end()
#define zero(a) memset(a, 0, sizeof(a))
#define onlyunique(v) v.erase(unique(all(v)), v.end()); //only for sorted vector
// #define x real()
// #define y imag()
typedef complex<double> point;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("O2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#ifdef __APPLE__
#define dbg(...) __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1)
{
	cerr << name << " : " << arg1 << endl;
}

template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);
}
#else
#define dbg(...)
#endif

int __gcd(int a, int b)
{
	return b ? __gcd(b, a%b) : a;
}

// for set of pairs
struct pair_hash {
    inline std::size_t operator()(const std::pair<int,int> & v) const {
        return v.first*31+v.second;
    }
};

const int mod = 1e9 + 7;

vector<int> binarycut(int x){
	vector<int> v;
	while(x){
		if(x&1) v.pb(1);
		else v.pb(0);
		x>>=1;
	}
	reverse(all(v));
	return v;
}

int takemod(int a){
	return ((a%mod)+mod)%mod;
}

int fast_exp(int base, int expo) {
	int res=1;
	while(expo>0) {
		if(expo&1) res=(res*base)%mod;
		base=(base*base)%mod;
		expo>>=1;
	}
	return res;
}

int modinv(int a){
	return takemod(fast_exp(takemod(a), mod-2));
}

// void siev(int n)
// {
// 	sieve[0]=false;
// 	sieve[1]=false;
// 	for(int i=2; i<=sqrtl(n); i++)
// 	{
// 		if(sieve[i])
// 		{
// 			for(int j=i; i*j<=n; j++)
// 			{
// 			sieve[i*j]=false;
// 			}
// 		}
// 	}
// }

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	#ifdef __APPLE__
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
	#endif
	time_t t1, t2;
	t1 = clock();

	int n;
	cin >> n;
	cout << (2*n)/(__gcd(2, n));

	t2 = clock();
	cerr << "time taken: " << t2-t1;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;

#include<cstring>
struct edge {
	int to, cap, rev;
};
const int mn = 300;
vector<edge> G[mn];
bool used[mn];
void add_edge(int from, int to, int cap) {
	G[from].push_back(edge{ to,cap,(int)G[to].size() });
	G[to].push_back(edge{ from,0,(int)G[from].size() - 1 });
}
int dfs(int v, int t, int f) {
	if (v == t)return f;
	used[v] = true;
	rep(i, (int)G[v].size()) {
		edge &e = G[v][i];
		if (!used[e.to] && e.cap > 0) {
			int d = dfs(e.to, t, min(f, e.cap));
			if (d > 0) {
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}
int max_flow(int s, int t) {
	int flow = 0;
	for (;;) {
		memset(used, 0, sizeof(used));
		int f = dfs(s, t, mod);
		if (f == 0)return flow;
		flow += f;
	}
}
vector<P> v;
int n, m;
bool update(int l,int r) {
	rep(i, 2 * n + 2) {
		G[i].clear();
	}
	int s = 2 * n; int t = s + 1;
	rep(i, n) {
		add_edge(i, n + i, 1);
	}
	add_edge(s, l, 1); add_edge(s, r, 1);
	add_edge(0, t, 2);
	rep(i, v.size()) {
		int le = v[i].first, ri = v[i].second;
		add_edge(le + n, ri, 1);
		add_edge(ri + n, le, 1);
	}
	int f = max_flow(s, t);
	if (f == 2)return true;
	else return false;
}

void solve() {
	cin >> n >> m;
	rep(i, m) {
		int a, b; cin >> a >> b; a--; b--;
		if (update(a,b)) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
		v.push_back({ a,b });
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 3416
fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(' ').map { it.toInt() }
    val a = readLine()!!.split(' ').map { it.toInt() }.sortedDescending()
    val s = a.sum()

    var ans = "Yes"

    for (i in 0 until m) {
        if (a[i] * 4 * m < s) {
            ans = "No"
            break
        }
    }

    println(ans)
}


Measured memory_bytes: 38308
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for(int (i) = (a); (i) < (b); ++(i))
#define sz(x) ( (int) (x).size() )
 
using vi  = vector<int>;
using ll  = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using vvi = vector<vi>;
 
namespace std { 
    template<> struct hash<pair<int, int> > { 
        size_t operator() (const pair<int, int>& key) const {
            return hash<int>()(key.first) + hash<int>()(key.second);
        }
    };
}
 
inline int mulmod(int a, int b, int p) {
    ll x = a, y = b, z = p;
    return (x * y) % z;
}
 
constexpr array<int, 2> primes = {1000000007, 1000000023};
array<int, 4001> alphaSize[2];

struct rollingHash {
    int alpha;
    array<int, 2> val;
    rollingHash(int alphaSz = 26) {
        alpha = alphaSz;
        rep(i,0,2) {
            alphaSize[i][0] = 1;
            rep(j,1,alpha) alphaSize[i][j] = mulmod(alphaSize[i][j-1], alpha, primes[i]);
            val[i] = 0;
        }
    }
    void addC(char& c) {
        int idx = c - 'a';
        rep(i,0,2) val[i] = ( val[i] + alphaSize[i][idx] ) % primes[i];
    }
    void clear() {
        val[0] = 0ll;
        val[1] = 0ll;
    }
};
 

constexpr int ms = 4013;

string a, b;
unordered_set<pii> memoA; // O(n) de memoria com overhead escroto de unordered_set
vector<rollingHash> hashA(ms, rollingHash(26) );
vector<rollingHash> hashB(ms, rollingHash(26) );

int main() 
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> a >> b;
    int ans = 0;    
    int lenA = sz(a), lenB = sz(b);
    int minLen = min(lenA, lenB);
    
    for(int len = 1; len <= minLen; ++len) 
    {
        if(!memoA.empty()) memoA.clear();

        for(int i = len - 1; i < lenA; ++i) 
        {
            hashA[i - len + 1].addC(a[i]);
            memoA.insert(make_pair(hashA[i - len + 1].val[0], hashA[i - len + 1].val[1]) );
        }
        for(int i = len - 1; i < lenB; ++i)
        {
            hashB[i - len + 1].addC(b[i]);
            if(memoA.find(make_pair(hashB[i - len + 1].val[0], hashB[i - len + 1].val[1])) != memoA.end()) ans = len;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3460
#include <bits/stdc++.h>
#define int long long
#define zmrl(x) (int)((x).size())
#define pb push_back
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
const int mod = 1e9+7;

int dp[1001000][3], pw8[1001000];
signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n; cin>>n;
    dp[1][1] = dp[1][2] = 1;
    pw8[1] = 8;
    for (int i=2; i<=n; i++) {
        dp[i][0] = ((dp[i-1][0]*10%mod + dp[i-1][1])%mod + dp[i-1][2]) % mod;
        dp[i][1] = (dp[i-1][1]*9%mod + pw8[i-1])%mod;
        dp[i][2] = (dp[i-1][2]*9%mod + pw8[i-1])%mod;
        pw8[i] = pw8[i-1]*8%mod;
    }
    cout << dp[n][0] << '\n';
    return 0;
}

Measured memory_bytes: 34764
parseInt(x) = parse(Int,x)

function main()
  N = parseInt(readline())
  p = map(parseInt, split(readline()))
  l = 0
  for i = 1:N
    if p[i] != i
      l = l+1
    end
  end
  if l <= 2
    println("YES")
   else 
    println("NO")
  end
end

main()

Measured memory_bytes: 110348
E=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")

N=int(input())

S=list(input())

while(N>=26):
    N-=26


for i in range(len(S)):
    if N+E.index(S[i])<=25:
        S[i]=E[N+E.index(S[i])]
    elif N+E.index(S[i])>=26:
        S[i]=E[N+E.index(S[i])-26]

print("".join(S))


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef vector<pll> vpll;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
  cout << "\n";
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  ll A, B;
  IN(A,B);
  ll ans = max(A-2*B, (ll)0);
  OUT(ans);

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

using P = pair<ll, int>;

int main() {
  int N;
  while (cin >> N) {
    vector<ll> A(N), B(N);
    for (int i = 0; i < N; i++) cin >> A[i] >> B[i];
    vector<P> C;
    for (int i = 0; i < N; i++) {
      C.emplace_back(A[i], 2 * i + 0);
      C.emplace_back(B[i], 2 * i + 1);
    }
    sort(C.begin(), C.end());
    vector<int> Q(2 * N);
    for (int i = 0; i < 2 * N; i++) Q[C[i].snd] = i;
    ll res = min(accumulate(A.begin(), A.end(), 0ll),
                 accumulate(B.begin(), B.end(), 0ll));
    ll sum = 0;
    for (int i = 0; i < N; i++) sum += C[i].fst;
    for (int i = 0; i < N; i++) {
      int a = Q[2 * i + 0];
      int b = Q[2 * i + 1];
      if (a > b) swap(a, b);
      if (N <= a) {
        res = min(res, sum);
      } else if (N <= b) {
        res = min(res, sum - C[a].fst + (b == N ? C[N + 1].fst : C[N].fst));
      } else {
        res = min(res, sum - C[a].fst - C[b].fst + C[N].fst + C[N + 1].fst);
      }
    }
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 7792
#include <stdio.h>
int main(void){
    int p, q, r, ans = 0;
    
    scanf("%d %d %d", &p, &q, &r);
    
    if(p+q <= (p+r) && p+q <= (q+r)){
        ans = p + q;
    }else if(p + r <= (p+q) && p + r <= (q+r)){
        ans = p + r;
    }else if(q + r <= (p+q) && q + r <= (p+r)){
        ans = q + r;
    }
    
    printf("%d\n", ans);
}


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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  string s;cin>>s;
  if(s[2]==s[3]&&s[4]==s[5])cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


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

typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 999999999

int main(){
    int q;
    while(cin>>q){
        if(q==-1)break;
        
        double a,b;
        b=q/2.0;
        while(1){
            a=b-( (b*b*b-q)/(3*b*b) );
//            cout<<a<<endl;
            if(abs(a*a*a-q)<0.00001*q)break;
            swap(a,b);
        }
        printf("%.10lf\n",a);
    }
}

Measured memory_bytes: 1188
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		StringBuilder soto=new StringBuilder("");
		StringBuilder naka=new StringBuilder("");
		int H=sc.nextInt(),W=sc.nextInt();
	while(H!=0||W!=0){
			soto.append("##");
		naka.append("#");
		for(int n=1;n<=W-2;n++){
			naka.append(".");
			soto.append("#");}
		naka.append("#");
		System.out.println(soto);
		for(int n=1;n<=H-2;n++){
			System.out.println(naka);}
		System.out.println(soto+"\n");
		soto.delete(0,W);naka.delete(0,W);
		H=sc.nextInt();W=sc.nextInt();
			}
	}}

Measured memory_bytes: 20996
#include<stdio.h>
#include<math.h>

int max(int a,int b){
    if(a <= b) return b;
    else return a;
}

int min(int a,int b){
    if(a <= b) return a;
    else return b;
}

int main(){
    int n,i,minv;
    int maxv = -2147483648;
    int Rt[200000];
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d",&Rt[i]);
    
    minv = Rt[0];
    
    for(i=1;i<n;i++){
        maxv = max(maxv,Rt[i]-minv);
        minv = min(minv,Rt[i]);
    }
    printf("%d\n",maxv);
}


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

static const int MAX=21;
static const int MOD=1e9+7;

int dp[MAX+1][1<<(MAX)];

int main(){
    int N; cin >> N;
    int a[N][N];
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            cin >> a[i][j];
        }
    }
    dp[0][0]=1;
    for(int i=0;i<N;i++){
        for(int j=0;j<(1<<N);j++){
            if(i!=__builtin_popcount(j)) continue;
            for(int k=0;k<N;k++){
                if(!a[i][k]) continue;
                if(j&(1<<k)) continue;
                dp[i+1][j|(1<<k)]+=dp[i][j];
                dp[i+1][j|(1<<k)]%=MOD;
            }
        }
    }
    cout << dp[N][(1<<N)-1] << endl;
}

Measured memory_bytes: 162048
#include <stdio.h>

#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define STR(i,str) for(int i=0;(str)[i];i++)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX3(a,b,c) ((a)>(b)?(a)>(c)?(a):(c):(b)>(c)?(b):(c))
#define MIN3(a,b,c) ((a)<(b)?(a)<(c)?(a):(c):(b)<(c)?(b):(c))
#define RNG(a,b) ((a)>(b)?(a)-(b):(b)-(a))
#define RNG3(a,b,c) ((a)>(b)?(b)>(c)?(a)-(c):(c)>(a)?(c)-(b):(a)-(b):(b)>(c)?(c)>(a)?(b)-(a):(b)-(c):(c)-(a))
#define MAXS(a,b) {if((a)<(b))(a)=(b);}
#define MINS(a,b) {if((a)>(b))(a)=(b);}

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

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;


int main(){
    int N, M, A, B, C;
    string s1, s2;
    cin >> N >> M;
    vector<int> x(M);
    rep(i, M) cin >> x[i];
    if(M == 1){
        cout << 0 << endl;
        return 0;
    }
    sort(all(x));
    vector<pair<int, int>> dist(M - 1);
    rep(i, M - 1)dist[i] = make_pair(abs(x[i] - x[i + 1]), i);
    sort(all(dist), greater<pair<int, int>>());
    vector<bool> n(M, false);
    n[0] = true;
    rep(i, N - 1){
        if(i == M) break;
        n[dist[i].second + 1] = true;
    }

    ll ans = 0;
    int cnt = 0;
    int index = 0;
    rep(i, M){
        if(cnt == N) break;
        if(n[i] == true){
            cnt++;
            i++;
            while(n[i] == false && i < M){
                i++;
            }
            ans += x[i - 1] - x[index];
            index = i;
            i--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

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


	vector<long long> a(x),b(y),c(z);

	for(int i=0;i<x;i++)
		cin >> a[i];
	for(int i=0;i<y;i++)
		cin >> b[i];
	for(int i=0;i<z;i++)
		cin >> c[i];

	vector<long long> ab;

	for(int i=0;i<x;i++)
		for(int j=0;j<y;j++)
			ab.push_back(a[i]+b[j]);
	
	sort(ab.begin(),ab.end());
	reverse(ab.begin(),ab.end());

	vector<long long> abc;

	for(int i=0;i<(k<ab.size() ? k:ab.size());i++)
		for(int j=0;j<z;j++)
			abc.push_back(ab[i]+c[j]);
	
	sort(abc.begin(),abc.end());
	reverse(abc.begin(),abc.end());

	for(int i=0;i<k;i++)
		cout << abc[i] << endl;







}

Measured memory_bytes: 42600
H, W, K = map(int, input().split())
c = [input() for _ in range(H)]

ans = 0
for i in range(2**H):
  for j in range(2**W):
    a = bin(i)[2:].zfill(H)
    b = bin(j)[2:].zfill(W)
    cnt = sum([
      (x + y == '00') and (c[k][l] == '#')
      for k, x in enumerate(a) for l, y in enumerate(b)
    ])
    if cnt == K:
      ans += 1 
print(ans)

Measured memory_bytes: 9212
#include<iostream>
using namespace std;
int main(){
  int n;
  double a[100], ans=0;
  cin >> n;
  for(int i=0; i<n; i++){
    cin >> a[i];
  }
  for(int i=0; i<n; i++){
    ans += 1/a[i];
  }
  cout << 1/ans;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
struct tp
{
    long long value, weight;
};
tp a[101];
long long n, f[101][100001], lim_weight, res;
int sum;
int main()
{
    //freopen("test.inp","r",stdin);
    //freopen("test.out","w",stdout);
    cin>>n>>lim_weight;
    for(int i=1;i<=n;i++) {cin>>a[i].weight>>a[i].value;sum+=a[i].value;}
    res=-1e9+7;
    for(int i=0;i<=n;i++)
        for(int j=1;j<=100000;j++) f[i][j]=INT_MAX;
    f[0][0]=0;
    for(int i=1;i<=n;i++)
    {
        for(long long j=1;j<=100000;j++)
        {
            f[i][j]=f[i-1][j];
            //if(f[i][j]<=lim_weight) f[i][j]=min(f[i][j], f[i-1][j-a[i].value]+a[i].weight);
            if(f[i][j]<=lim_weight) res=max(res, j);
            if(j<a[i].value) continue;
            f[i][j]=min(f[i][j], f[i-1][j-a[i].value]+a[i].weight);
            if(f[i][j]<=lim_weight) res=max(res, j);
        }
    }
    cout<<res;
    return 0;
}


Measured memory_bytes: 79104
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

S = str(input())
n = len(S)

count1 = 0
count2 = 0

for i in range(n):
    if i%2==0:
        if S[i]=='0':
            count1 += 1
        else:
            count2 += 1
    else:
        if S[i]=='1':
            count1 += 1
        else:
            count2 += 1

print(min(count1,count2))

Measured memory_bytes: 39536
a, b, c, d, e, f = map(int, input().split())
m_dens = e/(100+e)

water = 0
sugar = 0
density = 0

for i in range(31):
    for j in range(31):
        w = 100 * a * i + 100 * b * j
        for k in range(101):
            for l in range(101):
                s = c * k + d * l
                if w == 0:
                    break
                elif w + s > f:
                    break
                else:
                    if water == 0:
                        water = w + s
                        sugar = s
                        density = s/(w+s)
                    
                    if density < s/(w+s) <= m_dens:
                        water = w + s
                        sugar = s
                        density = s/(w+s)

print(water, sugar)
#print(density)
#print(m_dens)


Measured memory_bytes: 41584
from heapq import heappush, heappop
from collections import deque
import itertools
from itertools import permutations
import sys
import bisect
sys.setrecursionlimit(10**6)
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
YN=['Yes','No']
YNeos='YNeos'
mo=10**9+7
imp='IMPOSSIBLE'


n=I()
a=LI()[::-1]
b=LI()[::-1]
ans=0
for i in range(n):
    d=min(a[i],b[i])
    ans+=d
    d2=min(a[i+1],b[i]-d)
    a[i+1]-=d2
    ans+=d2


print(ans)


Measured memory_bytes: 82788
#include <stdio.h>
 
#define MAX1 20
#define MAX2 2000

int main()
{
  int i,j,a,b,c;
  int max[MAX2+1] = {0};

  scanf("%d", &a);
  
  for (i = 0; i < a; i++){
    scanf("%d", &c);
    for(j = MAX2-c; 0 < j; j--){
      if(max[j]){
        max[j+c] = 1;
      }
    }
    max[c] = 1;
  }

  scanf("%d", &b);
  
  for(i = 0; i < b; i++){
    scanf("%d", &c);
    if(max[c]){
      printf("yes\n");
    }
    else printf("no\n");
  }

  return 0;
}



Measured memory_bytes: 2108
/*"You can do anything you set your mind to,man" - Eminem*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define llpow(a,b) (ll)(pow(a,b)+0.5)
#define l_b(a,val) min((int)a.size()-1, (int)(lower_bound(a.begin(),a.end(),val)-a.begin()))
#define f first
#define up(a,b) max(a,b)
#define s second
#define INF 9223372036854775807
const  int mod = 1000000007;
template <typename T> T add(T& a, T b){a+=b;while(a>=mod)a-=mod;while(a<0)a+=mod;}
template <typename T> T mul(T& a, T b){a*=b;while(a>=mod)a-=mod;while(a<0)a+=mod;}
template <typename T> T up_self(T& a, T b){a = up(a,b);}
template <typename T> T min_self(T& a, T b){a = min(a,b);}
ll binexpomodulo(ll x, ll y){ll res =1;x%=mod;if(!x)return 0;while(y){if(y&1){mul(res, x);}mul(x,x);y>>=1;}return res;}
ll nCrInOr(ll n, ll r){ll res = 1;if(r>n-r)r = n-r;ll rin = 1;for(ll i = 1; i <=r ; i++)rin = (rin*i)%mod;rin = binexpomodulo(rin,mod-2);for(ll i = 1; i <= r; i++)res = (res*(n-i+1))%mod;res = (res*rin)%mod;return res;}
int msb(ll n){int ans;for(int i = 0 ; i < 64;  i++)if(n&(1LL<<i))ans = i+1;return ans;}
bool at_border(pair<int,int> p){
	return (!(p.f>0&&p.s>0));
}
int main()
{
	string a,b; cin>>a>>b;
	int n = a.size(), m = b.size();
	vector<vector<pair<int, pair<int,int>>>> dp(n+1, vector<pair<int,pair<int,int>>> (m+1, {INT_MIN, {0,0}}));
	dp[0][0] = {0,{0,0}};
	for(int i = 0 ; i <n; i++){
		for(int j = 0 ; j <m; j++){
			if(a[i]==b[j])
				up_self(dp[i+1][j+1], {dp[i][j].first+1,{i,j}});
			else
			{
				up_self(dp[i+1][j], {dp[i][j].first,{i,j}});
				up_self(dp[i][j+1], {dp[i][j].first,{i,j}});
			}
		}
	}
	auto curr = make_pair(0,make_pair(0,0));
	for(int i  = 0 ; i <=n; i++)
		for(int j = 0 ; j <=m; j++)
			up_self(curr, {dp[i][j].first,{i,j}});

	string ans = "";
	auto cur = curr.s;
	while(!at_border(cur)){
		int i = cur.f;
		int j = cur.s;
		pair<int,int> prev = dp[i][j].s;
		if(prev == make_pair(i-1,j-1))
			ans+=a[i-1];
		cur = prev;
	}
	reverse(ans.begin(), ans.end());
	cout<<ans<<endl;
  	return 0;
}

Measured memory_bytes: 105984