akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

template <class T>
T mod(T a,T b,T c){
    if(a<b){
        if(c<a) return a;
        else if(c<b) return c;
        else return b;
    }
    else{
        if(c<b) return b;
        else if(c<a) return c;
        else return a;
    }
}

template <class T>
void qs(T *a,int left,int right){
    if(left<right){
        int i=left,j=right;
        T pivot=mod(a[i],a[i+(j-i)/2],a[j]);
        T tmp;
        while(1){
            while(a[i]<pivot)i++;
            while(a[j]>pivot)j--;
            if(i>=j) break;
            tmp=a[i];
            a[i]=a[j];
            a[j]=tmp;
            i++; j--;
        }
        qs(a,left,i-1);
        qs(a,j+1,right);
    }
    return;
}

int main(){
    int n,x[200000],cp[200000];
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> x[i];
        cp[i]=x[i];
    }

    qs(x,0,n-1);
    int left=x[n/2-1],right=x[n/2];

    for(int i=0; i<n; i++){
        if(cp[i]<=left)
        cout << right << endl;
        else if(right<=cp[i])
        cout << left << endl;
    }

    return 0;
}

Measured memory_bytes: 3712
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  vector<int> v[N];
  REP(i,N-1){
    int a,b;
    cin>>a>>b;
    a--;b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  int d[N];
  REP(i,N)d[i]=-1;
  queue<int> q;
  d[0]=0;
  q.push(0);
  int p=0;
  while(!q.empty()){
    p=q.front();
    q.pop();
    for(auto e:v[p]){
      if(d[e]>=0)continue;
      d[e]=d[p]+1;
      q.push(e);
    }
  }
  // cerr<<p<<endl;

  REP(i,N)d[i]=-1;
  q.push(p);
  d[p]=0;
  while(!q.empty()){
    p=q.front();
    q.pop();
    for(auto e:v[p]){
      if(d[e]>=0)continue;
      d[e]=d[p]+1;
      q.push(e);
    }
  }
  // cerr<<p<<endl;
  // cerr<<d[p]<<endl;
  cout<<(d[p]%3==1?"Second":"First")<<endl;
  return 0;
}


Measured memory_bytes: 13556
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<long,long>
#define INF 1000000000000000000
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long MOD = 1000000007;
using namespace std;
typedef long long ll;
map<int, int> mp;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
class Union_Find {
private:
	vector<int> par;
	vector<int> rank;
public:
	Union_Find(int n) {
		rep(i, n) {
			par.push_back(i);
			rank.push_back(0);
		}
	}
	int find(int x) {
		if (par.at(x) == x) return x;
		else return par.at(x) = find(par.at(x));
	}
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		if (rank.at(x) < rank.at(y)) {
			par.at(x) = y;
		}
		else {
			par.at(y) = x;
			if (rank.at(x) == rank.at(y)) rank.at(x)++;
		}
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	vector<int>a(n); rep(i, n) { cin >> a[i]; if (i == n - 1)cout << a[i] << endl; else cout << a[i] << " "; }
	for (int i = 1; i < n; i++) {
		int v = a[i];
		int j = i - 1;
		while (j >= 0 && a[j] > v) {
			a[j + 1] = a[j];
			j--;
		}
		a[j + 1] = v;
		for (int k = 0; k < n; k++) {
			if (k == n - 1) cout << a[k] << endl;
			else cout << a[k] << " ";
		}
	}
	return 0;
}


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

int main()
{
  int  K,A,B;
  cin>>K>>A>>B;
    
  int OK=0;
    
  for(int i=A;i<=B;++i)
  {
    if(i%K==0)
    {
      OK=1;
    }
  }
  
  if(OK==1)
  {
    cout<<"OK"<<endl;
  }
  else
  {
    cout<<"NG"<<endl;
  }
 
  return 0;
}

Measured memory_bytes: 3512
#include <iostream>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define vec vector
#define ll long long

ll p[51], s[51];

ll solve(ll i, ll x)
{
  if (!i) return x;
  else if (x <= 1) return 0;
  else if (x <= s[i - 1] + 1) return solve(i - 1, x - 1);
  else if (x <= s[i] - 1) return p[i - 1] + 1 + solve(i - 1, x - s[i - 1] - 2);
  else return p[i];
}

int main(void)
{
  ll n, x;
  cin >> n >> x;

  p[0] = 1;
  s[0] = 1;
  rep(i, 50) {
    p[i + 1] = p[i] * 2 + 1;
    s[i + 1] = s[i] * 2 + 3;
  }

  cout << solve(n, x) << endl;

  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
char s[200];
int main(){
	int n;scanf("%d%s",&n,s);
	if(n&1)return puts("No"),0;
	n/=2;
	for(int i=0;i<n;i++)if(s[i]!=s[i+n])return puts("No"),0;
	puts("Yes");
	return 0;
}

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

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define vi vector<int>

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cerr << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define debug(...) CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) (__VA_ARGS__)

using namespace std;
using ll = long long;
using P = pair<int, int>;

void Main() {
  int N, X;
  cin >> N >> X;
  vi x(N+1); x[0] = X;
  rep(i, N) cin >>  x[i+1];
  sort(x.begin(), x.end());
  vi diff(N);
  rep(i, N) diff[i] = x[i+1] - x[i];
  int ans = diff[0];
  rep(i, N-1) ans = __gcd(ans, diff[i+1]);
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+7;
const int inf=2e9+7;
pair<int,int> a[maxn];
int b[maxn];
int main()
{
    int n,t;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d%d",&a[i].first,&a[i].second);
        t=a[i].first-a[i].second;
        a[i].second=a[i].first+a[i].second;
        a[i].first=t;
        swap(a[i].first,a[i].second);
    }
    sort(a,a+n);
    int s=-inf,sum=0;
    for(int i=0;i<n;i++){
        if(a[i].second>=s) s=a[i].first,sum++;
    }
    printf("%d\n",sum);
}


Measured memory_bytes: 1024
parseInt(x::String) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    s = chomp(readline())
    k = parseInt(readline())
    n = min(k, length(s))
    ans = 1
    for i = 1:n
        if s[i] != '1'
            ans = parseInt(s[i])
            break
        end
    end
    println(ans)
end
main()

Measured memory_bytes: 111448
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <bitset>
#include <sstream>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <climits>
#include <ctype.h>
using namespace std;

#define PI acos(-1.0)
#define EPS 1e-8
#define MOD 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define fi first
#define se second

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

template <class L, class R> ostream &operator <<(ostream &os, pair<L, R> P){
    return os << "(" << P.fi << "," << P.se << ")";
}
template <class T> ostream &operator <<(ostream &os, vector<T> V){
    os << "["; for (auto vv: V) os << vv << ","; return os << "]";
}

struct Matrix {
    vvi data;
    int r, c;
    Matrix(int row, int col, bool identity = false) : r(row), c(col) {
        data.assign(row, vector<int>(col, 0));
        if (identity) {
            for (int i = 0; i < r; ++i) {
                data[i][i] = 1;
            }
        }
    }
    Matrix operator * (Matrix& other) {
        int m = r, n = c, p = other.c;
        Matrix res(m, p);
        for (int i = 0; i < m; ++i) {
            for (int j = 0; j < p; ++j) {
                for (int k = 0; k < n; ++k) {
                    res.data[i][j] += data[i][k] * other.data[k][j];
                }
            }
        }
        return res;
    }
};

// 扩展欧几里得算法 res[1] * a + res[2] * b = res[0] = gcd(a, b)
vector<int> extendGcd(int a, int b) {
    if (b == 0) {
        return {a, 1, 0};
    } else {
        vector<int> tmp = extendGcd(b, a % b);
        return {tmp[0], tmp[2], tmp[1] - (a / b) * tmp[2]};
    }
}

// 矩阵快速幂
Matrix matrix_power(Matrix base, ll exp) {
    int n = base.r;
    Matrix res(n, n, true);
    while (exp) {
        if (exp & 1) {
            res = res * base;
        }
        base = base * base;
        exp >>= 1;
    }
    return res;
}

// 带模快速幂
template <typename T>
T power_mod(T base, int exp, int mod = MOD) {
    T res = 1;
    while (exp) {
        if (exp & 1) res = res * base % mod;
        base = base * base % mod;
        exp >>= 1;
    }
    return res;
}

// 快速幂
template <typename T>
T power(T base, int exp) {
    T res = 1;
    while (exp) {
        if (exp & 1) res *= base;
        base *= base;
        exp >>= 1;
    }
    return res;
}

// 求逆元
ll inv(ll a) {
    return power_mod(a, MOD - 2);
}

/******************************** template ********************************/
#define N 2010
int n;

int main() {
    cin >> n;
    int t, x, y;
    for (int i = 0; i < n; ++i) {
        scanf("%d%d%d", &t, &x, &y);
        int tmp = t - x - y;
        if (tmp < 0 || tmp % 2 != 0) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ll A, B, C, K, chosenA =0 , chosenB =0 , chosenC=0;
	cin>>A>>B>>C>>K;
	if(A-K<=0)
		chosenA = A;
	else
		chosenA = K;
//	cout<<chosenA<<"\n";
	if(chosenA<K)
	{
			K = K-chosenA;
			if(B-K<=0)
				chosenB = B;
			else
				chosenB = K;
//			cout<<chosenB<<"\n";
			K = K - chosenB;
			if(K>0)
			{
				chosenC = K;
//				cout<<chosenC<<"\n";
			}
	}
	ll sum = chosenA-chosenC;
	cout<<sum<<"\n";
}

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

using namespace std;

#define EPS (1e-5)
#define equals(a, b) (fabs(a - b) < EPS)

struct Point {
    double x, y;

    Point(){}
    Point(double x, double y) : x(x), y(y) {}

    Point operator + (const Point &p) const {
        return Point(x + p.x, y + p.y);
    }

    Point operator - (const Point &p) const {
        return Point(x - p.x, y - p.y);
    }
    
    Point operator * (const double &k) const {
        return Point(x * k, y * k);
    }
};

typedef Point Vector;

double dot(const Point &a, const Point &b)
{
    return a.x * b.x + a.y * b.y;
}

double cross(const Point &a, const Point &b)
{
    return a.x * b.y - b.x * a.y;
}

double norm(const Point &p)
{
    return dot(p, p);
} 

double abs(const Point &p)
{
    return sqrt(norm(p));
}

struct Line {
    Point s, t;
    Line(){}
    Line(Point s, Point t) : s(s), t(t) {}
};

Line getPerpendicularBisector(const Point &a, const Point &b)
{
    double cx = (a.x + b.x) / 2.0;
    double cy = (a.y + b.y) / 2.0;
    Point p = Point(cx + (a.y - b.y), cy + (b.x - a.x));
    return Line(Point(cx, cy),p);
}

Point crosspointLL(const Line &a, const Line &b)
{
    Vector va = a.t - a.s, vb = b.t - b.s;
    double d = cross(vb, va);
    if (abs(d) < EPS) return b.s;
    return a.s+va*cross(vb, b.t - a.s) * (1.0 / d);
}

int main()
{
    Point p[3];
    int N;
    cin >> N;
    while (N--) {
        for (int i = 0; i < 3; i++) {
            cin >> p[i].x >> p[i].y;
        }
        Line l[2];
        for (int i = 0; i < 2; i++) {
            l[i] = getPerpendicularBisector(p[i], p[i+1]);
        }
        Point c = crosspointLL(l[0], l[1]);
        double r = abs(c - p[0]);
        printf("%.3f %.3f %.3f\n", c.x, c.y, r);
    }
    return 0;
}

Measured memory_bytes: 3172
#include <iostream>
using namespace std;
int main()
{
	int time, S, M;
	
	cin >> time;
	
	S = time % 60;
	time /= 60;
	M = time % 60;
	time /= 60;
	
	cout << time << ':' << M <<  ':' << S << endl;
} 

Measured memory_bytes: 3072
n = int(input())
words = set()
lastWord = None
for _ in range(n):
  word = input()
  if word in words:
    print('No')
    break
  words.add(word)
  
  if lastWord and lastWord[-1] != word[0]:
    print('No')
    break
  lastWord = word
else:
  print('Yes')

Measured memory_bytes: 3060
#pragma GCC optimize("O3")
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <deque>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define eb emplace_back
#define ep emplace
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2 vector<vec>
#define vecll2 vector<vecll>
#define vec3 vector<vec2d>
#define vecll3 vector<vecll2d>
#define fi first
#define se second
#define endl "\n"
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline void print(vector<T> v){for(T e:v)cout<<e<<" ";cout<<endl;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
void print(vector<vec> v){for(auto e:v){for(auto ee:e)cout<<ee<<" ";cout<<endl;}}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}


vector<vec> G;
bool dfs(int x,int p,int a,int b){
    if(x==a)return false;
    else if(x==b)return true;
    else{
        if(G[x][0]==p)return dfs(G[x][1],x,a,b);
        else return dfs(G[x][0],x,a,b);
    }
}
main(){
    int n=in();
    G.resize(n);
    int m=in();
    rep(i,m){
        int a=in(),b=in();
        G[a-1].pb(b-1);
        G[b-1].pb(a-1);
    }
    int four=0;
    bool flag=true,f2=0;
    int x,y;
    rep(i,n){
        if(G[i].size()&1)flag=0;
        else if(G[i].size()>4)f2=1;
        else if(G[i].size()==4){
            four++;
            y=x;
            x=i;
        }
    }
    if(!flag){
        cout<<"No";
    }
    else if(four>2 || f2)cout<<"Yes";
    else if(four<2)cout<<"No";
    else{
        int cnt=0;
        rep(i,4){
            cnt+=dfs(G[x][i],x,x,y);
        }
        if(cnt==0||cnt==4)cout<<"No";
        else cout<<"Yes";
    }
}

Measured memory_bytes: 5760
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        long h = scan.nextLong();
        long w = scan.nextLong();
        long a = h * w;
        if(h == 1 || w == 1){
            System.out.println("1");
        }else if(a % 2 == 0){
            System.out.println(a / 2);
        }else{
            System.out.println(a / 2 + 1);
        }
    }
}

Measured memory_bytes: 23636
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())
#define vout(v) for (auto z: v) cout << z << " "; cout << endl;

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 2e5 + 5;

long double Cos(long double t){
	return cos ( t * Pi / 180.0 );
}

double calcAngle(double h, double m)  
{   
    if (h <0 || m < 0 || h >12 || m > 60)  
        printf("Wrong input");  
  
    if (h == 12) h = 0;  
    if (m == 60) m = 0;  
   	double hour_angle = 0.5 * (h * 60 + m);  
    double minute_angle = 6 * m;  
    double angle = abs(hour_angle - minute_angle);   
    angle = min(360 - angle, angle);  
  
    return angle;  
}

int solve() 
{
	//happy coding

	double a,b,c,d;
	cin>>a>>b>>c>>d;

	double x=  calcAngle(c,d);
	//cout<<x<<endl;

	cout<<point(30)<<sqrt((a*a)+(b*b)-2*a*b*Cos(x))<<endl;
	
	return 0;
}
int main(){
	int test = 1;
	//scanf("%d", &test);
	while (test--)solve();return 0;
}

Measured memory_bytes: 4156
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class BCutAndCount {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int n;
	    string s;
	    in >> n >> s;

	    int res = 0;
	    for(int i=1; i<n-1; i++){
	        map<char, int> cnt;
            for(int j=0; j<i; j++){
                cnt[s[j]] = 1;
            }
            for(int j=i; j<n; j++){
                if(cnt[s[j]]) cnt[s[j]] = 2;
            }

            int mx = 0;
            for(auto const& e : cnt){
                if(e.second == 2) mx++;
            }

            chmax(res, mx);
	    }

	    out << res << endl;
	}
};


int main() {
	BCutAndCount solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
using namespace std;
typedef long long ll;
int main(){
  int x,y,a,b,c;
  cin >> x >> y >> a >> b >> c;
  vector<int> red(a);
  vector<int> green(b);
  vector<int> white(c);
  for(int i = 0;i <= a - 1;i++)cin >> red[i];
  for(int i = 0;i <= b - 1;i++)cin >> green[i];
  for(int i = 0;i <= c - 1;i++)cin >> white[i];
  sort(red.begin(),red.end());
  sort(green.begin(),green.end());
  sort(white.begin(),white.end());
  vector<int> eat;
  for(int i = a - 1;i >= a - x;i--)eat.push_back(red[i]);
  for(int i = b - 1;i >= b - y;i--)eat.push_back(green[i]);
  eat.insert(eat.end(),white.begin(),white.end());
  sort(eat.begin(),eat.end());
  ll res = 0;
  for(int i = eat.size() - 1;i >= eat.size() - x - y;i--)res += eat[i];
  cout << res << endl;
  //for(int i = 0;i <= eat.size() - 1;i++)cout << eat[i] << endl;
  return 0;
}

Measured memory_bytes: 3316
N, Y = map(int, input().split())
ans = "-1 -1 -1"
for i in range(N+1):
  for j in range(i,N+1):
    if 10000*i + 5000*(j-i) + 1000*(N-j) == Y:
      ans = " ".join(list(map(str,[i,j-i,N-j])))
      
print(ans)

Measured memory_bytes: 3060
n, m = (int(i) for i in input().split())
e = [[int(i) for i in input().split()] for i in range(n)]
dic = {}
for hobbies in e:
    for i in range(1,len(hobbies)):
        if hobbies[i] in dic:
            dic[hobbies[i]] +=1
        else:
            dic[hobbies[i]] = 1
everyoneLike = []
for key,num in dic.items():
    if num == n:
        everyoneLike.append(key)
print(len(everyoneLike))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long int LL;
using namespace std;
#define INF (1e9)
#define LINF (1LL << 60)
#define ALL(x) (x).begin(),(x).end()
#define FOR(i,k,n) for(int i=(k);(i)<(n);(i)++)
#define REP(i,n) for(int i = 0;(i)<(n);(i)++)
#define REPR(i,n) for(int i = n; i >= 0; i--)
#define F first
#define S second
#define MOD (1e9 + 7)

LL n;

LL dfs(LL x) {
	if (x > n) return 0;
	bool exist[3] = { false, false, false };
	LL tmp = x;
	while(tmp > 0) {
		if (tmp % 10 == 3) exist[0] = true;
		if (tmp % 10 == 5) exist[1] = true;
		if (tmp % 10 == 7) exist[2] = true;
		tmp /= 10;
	}
	int ok = exist[0] == true && exist[1] == true && exist[2] == true ? 1 : 0;
	return dfs(10 * x + 3) + dfs(10 * x + 5) + dfs(10 * x + 7) + ok;
}

int main() {
	cin >> n;
	cout << dfs(0) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

struct Card {
    char suit[2];
    int rank;
};

int n;
Card cards[100000];
map<int,int> hashing, hashing2;

inline void swap(Card& a, Card& b) {
    Card tmp = a;
    a = b;
    b = tmp;
}

inline int partition(int p, int r) {
    int i = p - 1;
    for (int j = p, x = cards[r].rank; j < r; ++j) {
        if (cards[j].rank <= x) {
            swap(cards[j], cards[++i]);
        }
    }
    swap(cards[r], cards[++i]);
    return i;
}

void quicksort(int p, int r) {
    if (p < r) {
        int q = partition(p, r);
        quicksort(p, q - 1);
        quicksort(q + 1, r);
    }
}

int main(void) {

    scanf("%d", &n);

    for (int i = 0; i < n; ++i) {
        scanf("%s", cards[i].suit);
        scanf("%d", &cards[i].rank);
        hashing[cards[i].rank] = hashing[cards[i].rank] * 31
                            + (cards[i].suit[0] - 'A');
    }

    quicksort(0, n - 1);

    for (int i = 0; i < n; ++i) {
        hashing2[cards[i].rank] = hashing2[cards[i].rank] * 31
                             + (cards[i].suit[0] - 'A');
    }

    bool stable = true;
    for (int i = 0; i < n; ++i) {
        if (hashing[cards[i].rank] != hashing2[cards[i].rank]) {
            stable = false;
            break;
        }
    }

    printf("%s\n", stable ? "Stable" : "Not stable");
    for (int i = 0; i < n; ++i) {
        printf("%c %d\n", cards[i].suit[0], cards[i].rank);
    }

    return 0;
}

Measured memory_bytes: 4324
#include<iostream>
using namespace std;
int main()
{
    int i,j,n,flag=0;
    cin>>n;
    for(i=1;i<=9;i++)
    {
        for(j=i;j<=9;j++)
        {
            if((i*j)==n)
            {
                flag=1;
            }
        }
        if(flag==1)
        {
            cout<<"Yes";
            break;
        }
    }
    if(flag==0)
    {
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

func init() {
	sc.Split(bufio.ScanWords)
}

func max(x ...int) int {
	mv := x[0]
	for _, v := range x[1:] {
		if v > mv {
			mv = v
		}
	}
	return mv
}

func main() {
	n := readInt()
	m := make(map[int]int, n)
	ans := 0
	for i := 0; i < n; i++ {
		a := readInt()
		m[a-1]++
		m[a]++
		m[a+1]++
		ans = max(ans, m[a-1], m[a], m[a+1])
	}
	fmt.Println(ans)
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "first";
const string NO  = "second";

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

void solve() {

}

int main() {
  int n;
  cin >> n;
  bool hasOdd = false;
  rep(i,n) {
    ll v;
    cin >> v;
    if( v % 2 == 1 ) hasOdd = true;
  }
  puts(hasOdd?YES.c_str():NO.c_str());
  return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define int long long
#define INF 1000000000000000000
using namespace std;

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
template<typename T>
void debug(vector<vector<T>> m){ REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;} }



signed main(){

    int N, K; cin >> N >> K;
    Ans((N + 1) / 2 >= K, "YES", "NO");

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll n,m;
  cin >> n >> m;
  vvl a(n,vl(m,0));
  vl x(n);
  rep(i,n){
    cin >> x[i];
    rep(j,x[i]){
      cin >> a[i][j];
    }
  }
  vl cnt(m+1,0);
  cnt[0]=INF;
  rep(i,n){
    rep(j,m){
      cnt[a[i][j]]++;
    }
  }
  ll ans=0;
  rep(i,m+1){
    if(cnt[i]==n){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
from collections import defaultdict

n=int(input())
v=list(map(int,input().split()))

result=0

dic_a=defaultdict(int)
dic_b=defaultdict(int)

for i in range(n//2):
    dic_a[v[i*2]]+=1
    dic_b[v[i*2+1]]+=1


#それぞれの最大値を取得
max_a=max(dic_a.items(),key=lambda x:x[1])
max_b=max(dic_b.items(),key=lambda x:x[1])

if max_a[0] != max_b[0]:
    result=n-max_a[1]-max_b[1]

elif len(dic_a)==1 and len(dic_b)==1:
    result=n//2

else:
    dic_a.pop(max_a[0])
    max_a2=max(dic_a.items(),key=lambda x:x[1])

    dic_b.pop(max_b[0])
    max_b2=max(dic_b.items(),key=lambda x:x[1])

    result=min(n-max_a2[1]-max_b[1],n-max_a[1]-max_b2[1])

print(int(result))

Measured memory_bytes: 17312
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int maxn = 1e5 + 20;
ll res = 0;
int main()
{
	int n , p;
	cin >> n >> p;
	int x;
	cin >> x;
	if((x & 1) == p)
		res = 1;
	if(!p)
		res++;
	for(int i = 1; i < n; i++)
	{
		int a;
		cin >> a;
		if(a & 1)
			res += (1LL << (i)) - res;
		else
			res *= 2;
	}
	cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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


int main() {

  int N;
  cin >> N;

  vector<int> A(N + 1), B(N + 1, 0), C;
  REP(i, N) cin >> A[i + 1];

  for(int i = N; i >= 1; i--){
    int tmp = 0;
    for(int j = 1; j <= N && i * j <= N; j++){
      tmp += B[i * j];
    }
    if (tmp % 2 != A[i]) {
      C.push_back(i);
      B[i] = 1;
    }
  }

  cout << C.size() << endl;
  if (C.size()){
    REP(i, C.size()) cout << C[i] << " ";
    cout << endl;
  }


  return 0;
}


Measured memory_bytes: 3064
/*
    ex9_1
    takaoga
 */
#include<stdio.h>
#include<stdlib.h>
#define SIZE 10
typedef struct{
    int size;
    int count;
    char data[SIZE];
    char *top;
    char *bottom;
} stack;

void initialize_text(stack *text){
    text->count = 0;
    text->size = SIZE;
    text->top = &(text->data[SIZE]);//topはpushやpopをする毎に変動する。
    text->bottom = &(text->data[SIZE]);//data[10]を底と見なす。これは動かない。
}

void push(stack *text, char textcharacter){
    *(text->top) = textcharacter;
    text->top--;
    text->count++;
}

void pop(stack *text){
    text->top++;
    text->count--;
}

void print_text(stack *text){
    char *textbottom;
    textbottom = text->bottom;
    for(int i = 0 ; i < text->count ; i++){
        printf("%c", *textbottom--);//botomから遡って出力することで、最初に入力した文字の順番で出力される
    }
    printf("\n");
}

stack text;

int main(void){
    char inputtext[10],*nowtext;
    initialize_text(&text);//初期化
    scanf("%s",inputtext);
    nowtext = &(inputtext[0]);
    while(*nowtext != '\0'){
        if(*nowtext == '0' || *nowtext == '1'){
            push(&text, *nowtext);//もし現在のもじが1か0であればpush
        }else if(*nowtext == 'B'){
            if(text.top != text.bottom){
                pop(&text);//もし現在の文字がBでありかつ文字列が空でなければpop
            }
        }
        nowtext++;
    }
    print_text(&text);
    return 0;
}



Measured memory_bytes: 1624
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>

#define MOD 1000000007
#define INF INT_MAX
#define NINF INT_MIN
#define LLINF LLONG_MAX
using ll = long long;
using namespace std;

int main() {
    int N, cnt = 0;
    cin >> N;
    bool side = false;
    vector<int> p(N);
    for (int i = 0; i < N; i++)
    {
        cin >> p[i];
        if (p[i] == i + 1) {
            if (side) {
                side = false;
            }
            else {
                side = true;
                cnt++;
            }
        }
        else {
            side = false;
        }
    }
    cout << cnt << endl;
    getchar(); getchar();
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  
  int A[N];
  vector<bool> vec(N, true);
  
  rep(i,N){
    cin >> A[i];
  }
  
  int count = 0;
  rep(i,N){
    if(vec[i] == true){
      for(int j = i+1; j<N; j++){
        if(A[j] == A[i]) vec[j] = false;
      }
      count++;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 256
def dot(a,b):return a[0]*b[0] + a[1]*b[1]
def cross(a,b):return a[0]*b[1] - a[1]*b[0]
def Order(a,b):
    crs = cross(a,b)
    if crs > 0 : return "COUNTER_CLOCKWISE"
    elif crs < 0 : return "CLOCKWISE"
    else:
        if dot(a,b) < 0 : return "ONLINE_BACK"
        elif dot(a,a) < dot(b,b) : return "ONLINE_FRONT"
        else : return "ON_SEGMENT"

x0,y0,x1,y1 = [int(i) for i in input().split()] 
a = [x1-x0,y1-y0]

q = int(input())
for i in range(q):
    x2,y2 = [int(i) for i in input().split()]
    b = [x2-x0,y2-y0]
    print(Order(a,b))

Measured memory_bytes: 7756
while True:
    a,b,c = map(str,input().split())
    if b == "?":
        break
    elif b == "+":
        print(int(a)+int(c))
    elif b == "-":
        print(int(a)-int(c))
    elif b == "/":
        print(int(a)//int(c))
    elif b == "*":
        print(int(a)*int(c))



Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
using namespace std;
using Int = long long;
using ll = long long;
using Double = long double;
using P = pair<Int,Int>;
using T = tuple<Int,Int,Int>;
const Int INF = 1LL<<55;
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
ostream& operator<<(ostream& o,T t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){Int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){Int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}


Int n, K, M;

Int Add(Int &a,Int b){return a = (a + b)%M;}

void DP2(Int dp[310][310]){

  // dp[i][j] := 長さiで残り(j+1)箇所にinsertできる時の通り数。
  for(Int i=0;i<=n;i++) //長さ
    for(Int j=n; j >= 0; j--){ //カーソル
      if(j) Add(dp[i][j-1],dp[i][j]); //カーソルを左に動かす
      if(i < n) Add(dp[i+1][j], dp[i][j] * (j + 1));  //現在のカーソルの左側のどこかにinsert
    }
}

Int DP(){
  // dp[i][j] := iまでの数を使って長さjの数列を作る。
  vector<vector<Int> > dp(K+2, vector<Int>(n+1,0));
  dp[0][0] = 1;

  Int dp2[310][310];
  for(Int i=1;i<=K;i++){ // 使う数

    memset(dp2,0,sizeof(dp2));
    for(Int x=0;x<=n;x++) dp2[x][x] = dp[i-1][x]; //今ままでに作った長さxの物をカーソルxで初期化
    DP2(dp2);
    
    for(Int j=0;j<=n;j++) dp[i][j] = dp2[j][0];
  }
  return dp[K][n];
}

signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  cin>>n>>K>>M;

  Int ans = DP();
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

int main() {
    int n;
    cin >> n;
    vector<int> nums;
    int ans = 0;
    for(int i = 0;i < n;i++){
        int z;
        cin >> z;
        nums.push_back(z);
        ans += nums[i];
    }
    
    sort(nums.begin(),nums.end());
    if(ans % 10 == 0){
        for(int i = 0;i < n;i++){
            if(nums[i] % 10 != 0){
                ans -= nums[i];
                break;
            }
        }
        if(ans % 10 == 0){
            ans = 0;
        }
    }
    cout << ans << endl;
}




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

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

using namespace std;

#define dbg(S) { int f=1; for(auto x:S) cerr<<(f?"[":", ")<<x, f=0; cerr<<"]\n"; }

int main(){
	map<string,int> f;
	int n; cin>>n;
	rep(i,n){ string s; cin>>s; ++f[s]; }
	int m; cin>>m;
	rep(i,m){ string s; cin>>s; --f[s]; }

	int ans=0;
	for(auto x:f) ans=max(ans,x.second);
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] x = new int[3];
		for(int i = 0; i < 3; i++) {
			x[i] = sc.nextInt();
		}
		Arrays.sort(x);
		
		System.out.println(x[0] + x[1]);

	}

}


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

using namespace std;

const int maxn=2e5+5;

typedef long long ll;

const ll mod=1e9+7;

int a[maxn];

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",a+i);
	}
	int ans=0;int mn=0x3f3f3f3f;
	for(int i=0;i<n;i++){
		if(mn<a[i]) continue;
		mn=min(mn,a[i]);
		ans++;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 1024
def main():
    N = int(input())
    P = list(map(int, input().split()))
    for i in range(N - 1):
        if P[i] > P[i + 1]:
            break
    for j in range(i + 1, N - 1):
        if P[j] > P[j + 1]:
            t = P[i]
            P[i] = P[j + 1]
            P[j + 1] = t
            break
    PP = P[::]
    P.sort()
    if P == PP:
        print('YES')
    else:
        print('NO')


main()


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<deque>
#include<climits>
using namespace std;

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

  vector<long long> h(N);
  for(auto& hh: h){
    cin >> hh;
  }
  
  // dp[i] := the minimum cost from 0 to i
  // dp[i] = min{dp[j] + (h[i] - h[j]) ^ 2 + C| j < i}
  vector<long long> dp(N, LLONG_MAX);
  // Convex Hull Trick (cf. "Ari-Hon", 2nd Ed., p.304)
  
  deque<pair<long long, long long>> lines;
  dp[0] = 0;
  lines.push_back(make_pair(-2 * h[0], h[0] * h[0] + dp[0]));
  for(int i = 1; i < N; i++){
    while(lines.size() > 1){
      long long line_value_front = lines[0].first * h[i] + lines[0].second;
      long long line_value_next = lines[1].first * h[i] + lines[1].second;
      if(line_value_front >= line_value_next){
        lines.pop_front();
      }else{
        break;
      }
    }
    long long minimum_line_value = lines[0].first * h[i] + lines[0].second;
    dp[i] = h[i] * h[i] + C + minimum_line_value;
    while(lines.size() >= 2){
      long long a1 = prev(lines.end(), 2)->first, b1 = prev(lines.end(), 2)->second;
      long long a2 = prev(lines.end(), 1)->first, b2 = prev(lines.end(), 1)->second;
      long long a3 = -2 * h[i], b3 = h[i] * h[i] + dp[i];
      if((a1 - a2) * (b1 - b3) > (b1 - b2) * (a1 - a3)){
        lines.pop_back();
      }else{
        break;
      }
    }
    lines.push_back(make_pair(-2 * h[i], h[i] * h[i] + dp[i]));
  }
  cout << dp[N - 1] << endl;
}


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

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

    return gcd_ori(b, a % b);
}

int main() {
    ll n, X; cin >> n >> X;
    vector<ll> x;
    rep(i, n) {
        int t; cin >> t;
        x.push_back(t);
    }
    x.push_back(X);
    sort(x.begin(), x.end());

    vector<ll> subx(n);
    for(int i=0; i<n; i++){
        subx.at(i) = (ll)abs(x.at(i) - x.at(i+1));
    }

    sort(subx.begin(), subx.end());
    //rep(i,n) cout << subx.at(i) << endl;

    ll res = subx.at(n-1);
    for(int i=n-1; i>=1; i--){
        if(res>subx.at(i-1)) res = gcd_ori(res, subx.at(i-1));
        else res = gcd_ori(subx.at(i-1), res);
    }

    cout << res << endl;

}

Measured memory_bytes: 1908
#include <iostream>

using namespace std;

int main()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	
	int ans = 0;
	for(int i = 0; i <= 100; i++)
	{
		if(a < i && b >= i && c < i && d >= i)
		{
			ans++;
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/dp/tasks/dp_a
# include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e9) + 1;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, n) for(int i = 1; i <= (int)(n); i++)
#define scn(n) scanf("%d", &n)
#define pri(n) printf("%d",n)
#define priln(n) printf("%d\n",n)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b) { return b ? gcd(b,a%b) : a; }

int main()
{
  int n, k;
  scn(n);
  scn(k);

  int a[n];
  rep(i, n) scn(a[i]);

  int dp[n];
  rep(i, n) dp[i] = INF;
  dp[0] = 0;

  rep(i, n - 1) {
    reps(j, k) {
      if (i + j < n) {
        chmin(dp[i+j], dp[i] + abs(a[i+j] - a[i]));
      }
    }
  }

  pri(dp[n - 1]);
  return 0;
}


Measured memory_bytes: 1024
N = int(input())

count = 0
words_dict = {}
top_words = []

for i in range(N):
    word = input()

    if word in words_dict:
        words_dict[word] += 1
    else:
        words_dict[word] = 1

    if words_dict[word] == count:
        top_words.append(word)
    if words_dict[word] > count:
        top_words = [word]
        count += 1

for word in sorted(top_words):
    print(word)


Measured memory_bytes: 33416
N, M = list(map(int, input().split()))
L = []
R = []
for i in range(M):
    l, r = list(map(int, input().split()))
    L.append(l)
    R.append(r)
max_L = max(L)
min_R = min(R)
if max_L <= min_R:
    print(min_R - max_L + 1)
else:
    print(0)


Measured memory_bytes: 11028
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e14;
const int ZERO = 0;
const int MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

signed main() {
    int N;
    cin >> N;
    if(N % 2 == 0) {
        cout << (N * (N - 1) - N) / 2 << endl;
        for(int i = 1;i <= N;i++) {
            for(int j = 1;j <= N;j++) {
                if(i < j && j != N - (i - 1)) {
                    cout << i << " " << j << endl;
                }
            }
        }
    }
    else {
        cout << (N * (N - 1) - (N - 1)) / 2 << endl;
        for(int i = 1;i <= N;i++) {
            for(int j = 1;j <= N;j++) {
                if(i < j && j != N - i) {
                    cout << i << " " << j << endl;
                }
            }
        }
    }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const double EPS = 1e-10;

int main() {
    int N;
    cin >> N;
    vector<lint> L(N);
    rep(i, N) cin >> L[i];

    int cnt = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            for (int k = j + 1; k < N; k++) {
                if (L[i] == L[j] || L[j] == L[k] || L[i] == L[k]) { continue; }

                if (L[i] + L[j] > L[k] && L[k] + L[j] > L[i] &&
                    L[k] + L[i] > L[j])
                    cnt++;
            }
        }
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3576
#include<cstdio>
#include<algorithm>
#include<queue>
#define int long long
using namespace std;
const int N=1000010;
int n,m,x,y,z,tot,pool,cnt,ans,A[N],B[N],s[N],f[N],rt[N],first[N],a[N<<1][2];
struct tjm{int node,val;} now;
struct tree{int lc,rc,node,val;} t[N<<1];
struct cmp{
	bool operator () (tjm p,tjm q) {
		return p.val>q.val;
	}
};
priority_queue<tjm,vector<tjm>,cmp> h,hh;
inline int read() {
	int tmp=0, fh=1; char c=getchar();
	while (c<'0'||c>'9') {if (c=='-') fh=-1; c=getchar();}
	while (c>='0'&&c<='9') tmp=tmp*10+c-48, c=getchar();
	return tmp*fh;
}
inline void ins_ed(int x,int y) {
	a[++tot][1]=y;
	a[tot][0]=first[x];
	first[x]=tot;
}
int gf(int x) {return x==f[x]?x:f[x]=gf(f[x]);}
inline int newnode(int x) {
	t[++pool]=(tree){0,0,x,A[x]-B[x]};
	return pool;
}
int merge(int x,int y) {
	if ((!x)||(!y)) return x+y;
	//printf("merge %lld %lld\n",x,y);
	if (t[x].val>t[y].val) swap(x,y);
	t[x].rc=merge(t[x].rc,y);
	swap(t[x].lc,t[x].rc);
	return x;
}
inline void gather(int x,int y) {
	f[y]=x; s[x]+=s[y];
	rt[x]=merge(rt[x],rt[y]);
}
inline void update(int x) {
	while (gf(t[rt[x]].node)==x) rt[x]=merge(t[rt[x]].lc,t[rt[x]].rc);
}
signed main() {
	n=read(); m=read();
	for (int i=1;i<=n;i++) A[i]=read(), B[i]=read();
	for (int i=1;i<=m;i++) {
		x=read(); y=read();
		ins_ed(x,y); ins_ed(y,x);
	}
	for (int i=1;i<=n;i++) hh.push((tjm){i,A[i]-B[i]});
//	for (int i=1;i<=n;i++) if (A[i]<=B[i]) f[i]=i, s[i]=B[i], cnt++;
//	for (int i=1;i<=n;i++) if (f[i]) {
//		x=gf(i);
//		for (int j=first[i];j;j=a[j][0]) {
//			y=a[j][1];
//			if (!f[y]) rt[x]=merge(rt[x],newnode(y));
//			else if (gf(y)!=x) gather(x,gf(y));
//		}
//	}
//	for (int i=1;i<=n;i++) if (f[i]==i) {
//		update(i);
//		h.push((tjm){i,t[rt[i]].val-s[i]});
//	}
	ans=0;
	while (cnt<n) {
		//printf("! %d %d\n",hh.top().node,hh.top().val);
		if (h.empty()||(hh.top().val<=h.top().val)) {
			now=hh.top(); hh.pop();
			x=now.node; if (f[x]) continue;
			//printf(" %d %d\n",x,now.val);
			ans=max(ans,now.val);
			f[x]=x; s[x]=B[x], cnt++;
			for (int i=first[x];i;i=a[i][0]) {
				y=a[i][1];
				if (!f[y]) rt[x]=merge(rt[x],newnode(y));
				else if (gf(y)!=x) gather(x,gf(y));
			}
			if (rt[x]) {
				update(x); h.push((tjm){x,t[rt[x]].val-s[x]});
			}
			continue;
		}
		now=h.top(); h.pop();
		x=now.node; if (f[x]!=x) continue;
		y=t[rt[x]].node; ans=max(ans,now.val);
		//printf("%d %d %d\n",x,y,now.val);
		rt[x]=merge(t[rt[x]].lc,t[rt[x]].rc);
		f[y]=x; s[x]+=B[y]; cnt++;
		for (int i=first[y];i;i=a[i][0]) {
			z=a[i][1];
			if (!f[z]) rt[x]=merge(rt[x],newnode(z));
			else if (gf(z)!=x) gather(x,gf(z));
		}
		if (rt[x]) {
			update(x);
			h.push((tjm){x,t[rt[x]].val-s[x]});
		}
	}
	for (int i=1;i<=n;i++) ans+=B[i];
	printf("%lld\n",ans);
	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 87;
ll a[N];
int n;

int main() {
    a[0] = 2;
    a[1] = 1;
    for (int i = 2; i <= N; ++i) {
        a[i] = a[i - 1] + a[i - 2];
    }
    cin >> n;
    cout << a[n] << endl;
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long int
#define ld long double
using namespace std;
const int N = 1e6 + 5;
const int MOD = 1e9 + 7;



int main(){
	fast;
	char ch;
	cin >> ch;
	if(isupper(ch)) cout << "A";
	else cout << "a";
	
	
	return 0;
}


Measured memory_bytes: 3620