akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
struct multi {
  ll first;
  ll second;
  ll third;
};
bool multicomp(const multi &a, const multi &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string S;
  cin >> S;
  if (S[0] != S[S.size() - 1]) {
    if ((S.size() - 2) % 2 == 1)
      cout << "First" << endl;
    else
      cout << "Second" << endl;
  } else {
    if ((S.size() - 3) % 2 == 1)
      cout << "First" << endl;
    else
      cout << "Second" << endl;
  }
  return 0;
}


Measured memory_bytes: 888
/**
 * Created by kaki on 2017/04/17.
 */

import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        int W = Integer.parseInt(scan.next());
        int H = Integer.parseInt(scan.next());
        int x = Integer.parseInt(scan.next());
        int y = Integer.parseInt(scan.next());
        int r = Integer.parseInt(scan.next());
        if (x + r > W || y + r > H || x - r < 0 || y - r < 0) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
    }
}

Measured memory_bytes: 26188
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#define WMAX 10000
#define HMAX 10000

//コメントアウトするとdebug()を実行しない
#define DEBUG

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

typedef long long ll;
typedef pair<ll ,ll > P;

ll A,B,C,N,W,H,ans,dp[HMAX][WMAX];
string S;
static const ll dx[8] = {0,1,1,1,0,-1,-1,-1},
					dy[8] = {1,1,0,-1,-1,-1,0,1};

void solve(){
	if(A > B){
		ans = 0;
	}else if(N == 1){
		if(A != B){
			ans = 0;
		}else{
			ans = 1;
		}
	}else{
		ans = (B - A) * (N - 2) + 1;
	}
}

void debug(){

}

void answer(){
	cout << ans << "\n";
}

int main(){
	cin >> N >> A >> B;
	solve();
	#ifdef DEBUG
	debug();
	#endif
	answer();

	return 0;
}

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

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

    long long N, a, b;
    cin >> N >> a >> b;

    N %= 12;
    for (int i = 0; i < N; ++i) {
        if (i % 2 == 0) a = a - b;
        else b = a + b;
    }

    cout << a << ' ' << b << endl;

    return 0;
}



Measured memory_bytes: 3212
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            final String[] sl = s.split(" ");
            int a = Integer.parseInt(sl[0]);
            int b = Integer.parseInt(sl[1]);

            int dif = b - a;

            int sm = 0;
            for (int i = 1; i < dif; i++) sm += i;

            System.out.println(sm - a);
        }
    }
}


Measured memory_bytes: 22356
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fi first
#define se second
int main(){
	ll a,b,c,k,ans=0,x; cin>>a>>b>>c>>k;
	x=min(k,a);
	ans+=x;
	k-=x;
	x=min(k,b);
	k-=x;
	x=min(k,c);
	ans-=x;
	cout<<ans;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    char a[n];
    char ch;
    for(int i=0;i<n;i++)
     {cin>>a[i];}
    int i=0,j=n-1,c=0;
    while(i<j)
    {
        if(a[i]=='W' && a[j]=='R')
        {
            swap(a[i],a[j]);
            i++;j--;
            c++;
        }
       else if(a[j]=='W')
        j--;
       else if(a[i]=='R')
        i++;
       
        
    }
    if(i==j && n%2!=0 && i==n/2+1 && a[i]=='W')
     c++;
    cout<<c<<endl;

}

Measured memory_bytes: 3780
#include <stdio.h>
#include <stdlib.h>

#define NIL -1

// translate 1-origin into 0-origin
int i0O(int index1Origin) {
    return index1Origin-1;
}


#include <stdio.h>
#include <stdlib.h>

#define MAX_NUM_STACK_VALUES 100
#define STR_MAX_LENGTH 100

typedef enum {
    WHITE,
    GRAY,
    BLACK
} Color;

// TRICKY Implementation
typedef struct {
    int * * adjacencyLists;
    Color * colors;
    int * discoverTimes;
    int * finishingTimes;
    int * p_time;
} GlobalVariablesPackage;

void visit(int vertexFrom, GlobalVariablesPackage gvp) {
//    printf("visiting index%d (1origin)\n", vertexFrom);
    gvp.colors[i0O(vertexFrom)] = GRAY;
    gvp.discoverTimes[i0O(vertexFrom)] = ++(*(gvp.p_time));
//    printf("discover index %d at time %d \n", vertexFrom, *(gvp.p_time));
    
    for (int j = 1, vertexTo; (vertexTo = gvp.adjacencyLists[i0O(vertexFrom)][i0O(j)]) != NIL; j++) {
        if (gvp.colors[i0O( vertexTo )] == WHITE)
            visit(vertexTo, gvp);
    }
    gvp.colors[i0O(vertexFrom)] = BLACK;
    gvp.finishingTimes[i0O(vertexFrom)] = ++(*(gvp.p_time));
//    printf("finish index %d at time %d \n", vertexFrom, *(gvp.p_time));
}

void dfs(int * (adjacencyLists[]), int nVertices) {
    Color colors[nVertices];
    int discoverTimes[nVertices], finishingTimes[nVertices];
    int time = 0;
    
    // GVP
    GlobalVariablesPackage gvp;
    gvp.adjacencyLists = adjacencyLists;
    gvp.colors = colors;
    gvp.discoverTimes = discoverTimes;
    gvp.finishingTimes = finishingTimes;
    gvp.p_time = &time;
    // GVP
    
    int i;
    
    for (i = 1; i <= nVertices; i++) 
        gvp.colors[i0O(i)] = WHITE;
    
    
    for (i = 1; i <= nVertices; i++)
        if (gvp.colors[i0O(i)] == WHITE)
            visit(i, gvp);
    
    
    
    // printing
    for (i = 1; i <= nVertices; i++)
        printf("%d %d %d\n", i, gvp.discoverTimes[i0O(i)], gvp.finishingTimes[i0O(i)]);
}

int main(int argc, char** argv) {
    int nVertices;
    
    // scan number of already existed events
    scanf("%d", &nVertices); 
    
    int *(adjacencyLists[nVertices]);
    int vertexFrom, vertexTo;
    int nEdges;
    int i,j;
    
    for (i = 1; i <= nVertices; i++) {
        scanf("%d", &vertexFrom); 
        scanf("%d", &nEdges); 
        
        // create adjacency list
        adjacencyLists[i0O(vertexFrom)] = (int *) malloc((nEdges+1) * sizeof(int));
        
        // write adjacency list
        for (j = 1; j <= nEdges; j++) {
            scanf("%d", &vertexTo); 
            adjacencyLists[i0O(vertexFrom)][i0O(j)] = vertexTo;
        }
        
        // terminal of adjacency list
        adjacencyLists[i0O(vertexFrom)][i0O(nEdges+1)] = NIL;
    }
    
//    // print result
//    printf("Scan result: \n");
//    for (i = 1; i <= nVertices; i++) {
//        for (j = 1; adjacencyLists[i0O(i)][i0O(j)] != NIL; j++) {
//            if (j > 1) printf(" ");
//            printf("%d", adjacencyLists[i0O(i)][i0O(j)]);
//        }
//        printf("\n");
//    }
    
    dfs(adjacencyLists, nVertices);
    

    return (EXIT_SUCCESS);
}




Measured memory_bytes: 2052
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <bitset>
using namespace std;

#define int long long


signed main() { 
    int x, y;
    cin >> x >> y;

    for(int i = 0; i <= 100; i++) {
        for(int j = 0; j <= 100; j++) {
            if(i + j == x && 2 * i + 4 * j == y) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define mod 1000000007

using namespace std;
typedef pair<llint, llint> P;

llint n;
llint l[200005], r[200005];
vector<P> vec;
multiset<llint> S;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> l[i] >> r[i];
		if(l[i] > r[i]) swap(l[i], r[i]);
		vec.push_back(P(l[i], r[i]));
	}
	sort(vec.begin(), vec.end());
	
	for(int i = 1; i <= n; i++) S.insert(r[i]);
	
	llint lmax = vec.back().first, rmax = *S.rbegin();
	llint lmin = vec.front().first, rmin = *S.begin();
	llint ans = (rmax-rmin) * (lmax-lmin);
	
	llint Rmax = -inf;
	for(int i = 0; i < vec.size(); i++){
		if(vec[i].first > rmin) break;
		if(i > 0){
			llint lmax = vec.back().first;
			ans = min(ans, (max(Rmax,lmax)-vec[i].first)*(rmax-lmin));
		}
		Rmax = max(Rmax, vec[i].second);
		S.erase(S.lower_bound(vec[i].second));
	}
	lmax = vec.back().first;
	ans = min(ans, (max(Rmax,lmax)-rmin)*(rmax-lmin));
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 16876
#include <iostream>
#include <string>
#define Max 50
using namespace std;

int main() {
    int N,flg = 0;
    cin >> N;
    for(int a = 0; a < N; a++){
        for(int b = 0; b < N; b++){
            if(a * 4 + b * 7 == N) {
                flg = 1;
                break;
            }else{
                flg = 0;
            }
        }
        if(flg == 1)break;
    }
    
    if(flg == 1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 5100000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> X >> Y >> A >> B >> C;
  Vec(R,lli,A,0);rep(i,0,A)cin >> R[i];
  Vec(G,lli,B,0);rep(i,0,B)cin >> G[i];
  Vec(Nu,lli,C,0);rep(i,0,C)cin >> Nu[i];
  priority_queue<pint>que;
  rep(i,0,A)que.push(pint(R[i],0));
  rep(i,0,B)que.push(pint(G[i],1));
  rep(i,0,C)que.push(pint(Nu[i],2));
  N=0;
  while(num+sum+flag<X+Y){
    auto v=que.top();que.pop();
    if(num<X&&v.second==0){
      N+=v.first;
      num++;
    }
    else if(sum<Y&&v.second==1){
      N+=v.first;
      sum++;
    }
    else if(v.second==2){
      N+=v.first;
      flag++;
    }
  }
  Out(N);
}


Measured memory_bytes: 12780
#include <iostream>
#include <map>
#include <functional>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>

int n;

std::vector<std::string> split(std::string str) {
    std::stringstream ss(str);
    std::vector<std::string> vec;

    std::string tmp;
    while(ss >> tmp) {
        vec.push_back(tmp);
    }

    return vec;
}

int main() {
    while(std::cin >> n, n) {
        std::string tmp;
        std::map<char, std::map<std::string, int> > m;
        std::cin.ignore();
        for(int i = 0; i < n; ++i) {
            std::getline(std::cin, tmp);

            std::vector<std::string> v = split(tmp);

            for(int i = 0; i < v.size(); ++i) {
                if(v[i].size()) {
                    ++m[v[i][0]][v[i]];
                }
            }
        }
        {
            char c;

            std::cin >> c;

            if(m[c].size() == 0) {
                std::cout << "NA" << std::endl;

                continue;
            }

            std::vector<std::pair<int, std::string> > vec(m[c].size());

            int i = 0;
            for(std::map<std::string, int>::iterator it = m[c].begin(); it != m[c].end(); ++it) {
                vec[i] = std::make_pair(-it->second, it->first);
                ++i;
            }

            std::sort(vec.begin(), vec.end());

            for(int i = 0; i < std::min<unsigned int>(5, vec.size()); ++i) {
                if(i != 0) {
                    std::cout << " ";
                }

                std::cout << vec[i].second;
            }
            std::cout << std::endl;
        }
    }

}

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

int main() {
  string S;
  cin >> S;
  
  string ans = "Sunny";
  if (S=="Sunny") ans = "Cloudy";
  else if (S=="Cloudy") ans = "Rainy";
  else if (S=="Rainy") ans = "Sunny";
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <cassert>
#include <queue>
#include <ctime>
#include <string>
#include <cstring>
#include <random>
#define mp make_pair
#define pb push_back
#define NAME ""
#define y1 y1_423
#define list lista

using namespace std;

typedef long long ll;
typedef long double ld;

template<typename T>
ostream& operator << (ostream& cout, const vector<T> &a) {
	if ((int)a.size() == 0) {
		return (cout << "()");
	}
	cout << "(" << a[0];
	for (int i = 1; i < (int)a.size(); i++) {
		cout << "; " << a[i];
	}
	return (cout << ")");
}

template<typename T>
ostream& operator << (ostream& cout, const set<T> &a) {
	if ((int)a.size() == 0) {
		return (cout << "{}");
	}
	auto it = a.begin();
	cout << "{" << *it;
	++it;
	for (; it != a.end(); ++it) {
		cout << "; " << *it;
	}
	return (cout << "}");
}

template<typename T>
ostream& operator << (ostream& cout, const multiset<T> &a) {
	if ((int)a.size() == 0) {
		return (cout << "{}");
	}
	auto it = a.begin();
	cout << "{" << *it;
	++it;
	for (; it != a.end(); ++it) {
		cout << "; " << *it;
	}
	return (cout << "}");
}

template<typename T1, typename T2>
ostream& operator << (ostream& cout, const pair<T1, T2> &a) {
	return cout << "(" << a.first << "; " << a.second << ")";
}

random_device gen;
mt19937 rnd(gen());

const int nmax = 2000 * 1000;
const int inf = 2000 * 1000 * 1000;
const ll infl = 1000ll * 1000ll * 1000ll * 1000ll * 1000ll * 1000ll;
const int mod = 1000 * 1000 * 1000 + 7;
const ld pi = acos(-1.0);

int main() {
	//freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
	//freopen(NAME".in", "r", stdin);freopen(NAME".out", "w", stdout);
    string s;
    getline(cin, s);
    cout << (s.length() >= 4 && s[0] == 'Y' && s[1] == 'A' && s[2] == 'K' && s[3] == 'I' ? "Yes\n" : "No\n");
	return 0;
}



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

int main()
{
    int A, B, C;
    cin >> A >> B >> C;

    if (A <= C && C <= B)
        cout << "Yes" << endl;
    else if (B <= C && C <= A)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
a, b, k = gets.chomp.split.map(&:to_i)
low = []
high = []

if k * 2 < b - a + 1
  k.times do |i|
    low << a + i
    high << b - i
  end
  puts low.join("\n")
  puts high.reverse.join("\n")
else
  (b - a + 1).times do |i|
    puts a + i
  end
end


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

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int n;
  string s;
  cin >> n >> s;
  ll mod = 1e9+7;

  vector<ll> dp(n,0);
  dp[0] = 1;
  for (int i = n-2; i >= 0; i--) {
    vector<ll> ndp(n,0);
    if (s[i] == '>') {
      ll acc = 0;
      for (int j = 0; j < n-i; j++) {
	ndp[j] = acc;
	(acc += dp[j]) %= mod;
      }
    } else {
      ll acc = 0;
      for (int j = n-1; j >= 0; j--) {
	(acc += dp[j]) %= mod;
	ndp[j] = acc;
      }
    }
    swap(ndp,dp);
  }
  ll ans = 0;
  for (int i = 0; i < n; i++)
    (ans += dp[i]) %= mod;
  cout << ans << endl;
}


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

using namespace std;

void cldflm()
{
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w" , stdout);
#endif
}

int main()
{

	cldflm();

	int n;
	cin >> n;

	n = n % 1000;

	if (n == 0)
		cout << 0;
	else
		cout << (1000 - n);


	return 0;
}



Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int main() {
	long long a,b,c,mx;
	cin>>a>>b>>c;
	mx=max(a,b);
	mx=max(c,mx);
	if(mx%2==0){
		cout<<0;
	}
	else{
		if(mx==a){
			cout<<b*c<<endl;
		}
		else if(mx==b){
			cout<<c*a<<endl;
		}
		else if(mx==c){
			cout<<a*b<<endl;
		}
	}
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int N;
    scanf("%d",&N);
    char a[N+1];
    scanf("%s",a);
    for(int i=N;i>0;i--){
        if(a[i]==a[i-1]){
        N--;
        }
    }
    printf("%d\n",N);
    return 0;
}

Measured memory_bytes: 256
/*
Author: Babin Dutta
*/
 
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(i,n) for(int i=0;i<n;i++)
#define ff(i,a,b) for(int i=a;i<=b;i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
//#define endl "\n"
#define mm 998244353
 
ll power(ll x, ll y, ll p)
{
    ll res = 1;  
    x = x % p;  
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1; 
        x = (x*x) % p;  
    }
    return res;
}
ll modInverse(ll A,ll M)
{
    return power(A,M-2,M);
}

void solve(){
	int n; cin>>n;
	ll a[n], b[n];
	f(i,n) cin>>a[i];
	b[n-1] = a[n-1];
	for(int i=n-2;i>=0;i--) b[i] = (a[i] + b[i+1])%mod;
	ll ans = 0;
	for(int i=0;i<n-1;i++){
		ll tmp = (a[i] * b[i+1])%mod;
		ans = (ans+tmp)%mod;
	}
	cout<<ans<<endl;
}
 
int main(){
	#ifdef JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
    #endif
	boost;
	int t=1; //cin>>t;
	for(int i=1;i<=t;i++) solve();
	return 0;
}

Measured memory_bytes: 6760
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
//typedef __int64 LL;
//typedef long long int LL;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef pair<int,int> P;
//typedef pair<LL,LL> PL;

const int MOD=1000000007;

int dpf[3010][3010];
int dpl[3010][3010];
int a[3010],b[3010];
int main(){
	int n,t;cin>>n>>t;
	for(int i=0;i<n;i++)cin>>a[i+1]>>b[i+1];
	
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<=t;j++)
		{
			if(j<a[i])dpf[i][j]=dpf[i-1][j];
			else dpf[i][j]=max(dpf[i-1][j],dpf[i-1][j-a[i]]+b[i]);
		}
		
	}
	
	for(int i=n;i>=1;i--)
	{
		for(int j=0;j<=t;j++)
		{
			if(j<a[i])dpl[i][j]=dpl[i+1][j];
			else dpl[i][j]=max(dpl[i+1][j],dpl[i+1][j-a[i]]+b[i]);
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		for(int s=0;s<=t-1;s++)
		{
			
			ans=max(ans,dpf[i-1][s]+dpl[i+1][t-1-s]+b[i]);
		}
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 70912
import sys
input = sys.stdin.readline

def BIT_query(BIT,idx):
  res_sum=0
  if idx==0:
    return 0
  while idx>0:
    res_sum+=BIT[idx]
    idx-=idx&(-idx)
  return res_sum

def BIT_update(BIT,idx,x,n):
  while idx<=n:
    BIT[idx]+=x
    idx+=idx&(-idx)
  return

def main():
  N,Q=map( int, input().split())
  C=list( map( int, input().split()))
  LRI=[]
  for i in range(Q):
    l,r=map( int, input().split())
    LRI.append((r,l,i))
  LRI.sort(key=lambda x:x[0])
  lastAppend=[-1]*(N+1)
  BIT=[0]*(N+1)
  ANS=[0]*Q
  now=1
  for r,l,i in LRI:
    while now <= r:
      c=C[now-1]
      if lastAppend[c]== -1:
        BIT_update(BIT,now,1,N)
      else:
        BIT_update(BIT,now,1,N)
        BIT_update(BIT,lastAppend[c],-1,N)
      lastAppend[c]=now                
      now+=1
    ANS[i] = BIT_query(BIT,r) - BIT_query(BIT,l-1)
  for ans in ANS:
    print(ans)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 226008
#include <iostream>
#include <iomanip>
#include <ios>
#include <sstream>
#include <cstdio>

#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <regex>
#include <utility>

#include <cstddef>
#include <cstdint>
#include <cfloat>
#include <limits>

#include <array>
#include <bitset>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <valarray>
#include <vector>
#include <deque>
#include <forward_list>

#define FOR(i, a, b) for(itr i{a}; i < (b); ++i)
#define RFOR(i, a, b) for(itr i{(b)-1};i >= (a); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) std::begin(a), std::end(a)
#define TYPE(t) decltype(t)
#define _IT ::iterator
#define UN unsigned
#define SC(t, a) static_cast<type>(a)

template<typename T>
inline bool in_range(T const &lower, T const &a, T const &upper){ return lower < a && a < upper;}

constexpr double inf = std::numeric_limits<double>::infinity();

using i8 = std::int_fast8_t;  using i16 = std::int_fast16_t;
using i32 = std::int_fast32_t;  using i64 = std::int_fast64_t;
using u8 = std::uint_fast8_t; using u16 = std::uint_fast16_t;
using u32 = std::uint_fast32_t; using u64 = std::uint_fast64_t;

using namespace std;

using itr = i32;


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

  i32 a, b, h;

  cin >> a >> b >> h;

  cout << (a + b) * h / 2 << endl;

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int N;

int main() {
    cin >> N;

    vi A(N);
    ll S = 0, T = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];

        S += A[i];
        if (i % 2 == 0) T += A[i];
    }
    S /= 2;

    int ans = (T - S) * 2;
    for (int i = 1; i < N; i++) {
        cout << ans << ' ';
        ans = (A[i - 1] - ans/2) * 2;
    }

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


Measured memory_bytes: 1664
#include<stdio.h>

static int rect(int a, int b){
  return a * 2 + b * 2;
}

static int area(int a, int b){
  return a * b;
}

int main(){
  int a = 0;
  int b = 0;

  scanf("%d %d", &a, &b);

  printf("%d %d\n", area(a, b), rect(a, b));

  return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <iomanip>
#include <stack>
#include <bitset>
#include <map>

using namespace std;
typedef long long ll;
const ll INF = 1LL << 50;

int solve();

int main(void) {
//	FILE *fpin = freopen("data.txt", "r", stdin);
	while (solve()) {}
//	while (1) {}
	return 0;
}

int solve() {

	vector< int > hist(10, 0);

	int N;
	cin >> N;
	int ex = 0;

	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		if (a < 3200) {
			hist[a / 400] ++;
		}
		else {
			ex++;
		}
	}

	int cnt = 0;

	for (int i = 0; i < hist.size(); i++) {
		if (hist[i] > 0)
			cnt ++;
	}

	// 最小値
	int amin = cnt;
	if( ex > 0 && cnt == 0 )
		amin = 1;

	int amax = cnt + ex;

	std::cout << amin << " " << amax << endl;

	return 0;
}

Measured memory_bytes: 256
from scipy.spatial.distance import euclidean as e

n, d = [ int(_) for _ in input().split() ]
l = [[int(x) for x in input().split()] for x in range(n)] 

ans = 0

for i in range(n):
    for j in range (i+1, n):
        if e( l[i], l[j] ).is_integer(): 
            ans += 1
        
print(ans)

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

using namespace std;
int main()
{
    string str;

    cin >> str;

    bool contain {};

    for (const char c : str)
    {
        if (c == '9')
            contain = true;
    }

    cout << (contain ? "Yes" : "No") << endl;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define all(x) (x).begin(),(x).end()
const int INF=1e9+5;
const int N=2e5+5;
const int mod=1e9+7;

int n,k,c;
string s;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n>>k>>c>>s;
	auto getpos=[&](){
		vector<int> res;
		for(int i=0;i<n&&(int)res.size()<k;){
			if(s[i]=='o'){
				res.push_back(i);
				i+=c+1;
			}
			else{
				++i;
			}
		}
		return res;
	};
	vector<int> l,r;
	l=getpos();
	reverse(all(s));
	r=getpos();
	for(int i=0;i<k;++i) r[i]=n-1-r[i];
	reverse(all(s));
	vector<int> left(n+1,-1),right(n+1,-1);
	for(int i=0;i<k;++i) left[l[i]+1]=i;
	for(int i=0;i<n;++i){
		if(left[i+1]==-1) left[i+1]=left[i];
	}
	for(int i=0;i<k;++i) right[r[i]]=i;
	for(int i=n-1;i>=0;--i){
		if(right[i]==-1) right[i]=right[i+1];
	}
	vector<int> ret;
	//~ for(int i=0;i<(int)left.size();++i) cout<<left[i]<<" ";cout<<endl;
	//~ for(int i=0;i<(int)right.size();++i) cout<<right[i]<<" ";cout<<endl;
	for(int i=0;i<n;++i){
		if(s[i]=='x') continue;
		int a=left[i];
		int b=right[i+1];
		int ans=0;
		if(a!=-1) ans+=a+1;
		if(b!=-1) ans+=b+1;
		if(a!=-1&&b!=-1&&r[b]-l[a]<=c) --ans;
		if(ans<k) ret.push_back(i+1);
	}
	for(int x:ret) cout<<x<<endl;
	return 0;
}


Measured memory_bytes: 5772
# -*- coding: utf-8 -*-
"""
Created on Mon Jun  1 16:47:45 2020

@author: NEC-PCuser
"""

N = int(input())
S = input()
count = 0
for i in range(0, 1000):
    j = 0
    a = str(i).zfill(3)
    b = S.find(a[0])
    if b == -1:
        continue
    c = S[b+1:].find(a[1])
    if c == -1:
        continue
    d= S[b+c+2:].find(a[2])
    if d != -1:
        count += 1
    
            
print(count)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;

char str[100005];

int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);
    scanf("%s", str);

    int cnt=0;
    int i;
    for(i=0; i<n; i++) {
        if(i>0 && str[i-1]==str[i]) {
            ;
        }
        else {
            cnt++;
        }
    }
    printf("%d\n", cnt);

    return 0;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
S = input()

S1 = S[:N]
# 左右同じものを目指す形にしたいので、片方はリバースしておく
S2 = S[N:][::-1]

d1 = Counter()
d2 = Counter()
# 半分に分けた両方を組み合わせ全列挙
for i in range(1<<N):
    s1_1, s1_2 = '', ''
    s2_1, s2_2 = '', ''
    for j in range(N):
        if i>>j & 1:
            s1_1 += S1[j]
            s2_1 += S2[j]
        else:
            s1_2 += S1[j]
            s2_2 += S2[j]
    # 文字列ペアをキーとして、その通り数を数えておく
    d1[(s1_1, s1_2)] += 1
    d2[(s2_1, s2_2)] += 1

ans = 0
for k, v in d1.items():
    # 左文字列ペア = 右文字列ペア になるような通り数を数え上げる
    ans += v * d2[k]
print(ans)


Measured memory_bytes: 174460
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main() {
  int n, ans=0;
  cin >> n;
  REP(i, 5){
    if(pow(10,i) > n){
      if(i % 2 == 1) ans += n - pow(10, i-1) + 1;
      break;
    }
    if(i % 2 == 1) ans += 9 * pow(10, i-1);
  }
  cout << ans;
}

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

int main()
{
  int a;
  cin>>a;
  if(a<=9)
  {
    cout<<a<<endl;
  }
  else if(a<=99)
  {
    cout<<9<<endl;
  }
  else if(a<999)
  {
    cout<<a-90<<endl;
  }
  else if(a<9999)
  {
    cout<<909<<endl;
  }
  else if(a<99999)
  {
    cout<<a-9090<<endl;
  }
  else if(a=100000)
  {
    cout<<90909<<endl;
  }
}
 
    
  
  

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<deque>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

    COMinit();
    for(int i=1;i<=k;i++){
        ll ans = COM(n-k+1,i)*COM(k-1,i-1)%MOD;
        cout << ans << endl;
    }
}

Measured memory_bytes: 12160
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> z(n);
    for (int i = 0; i < n; i++) {
        cin >> z[i];
    }
    sort(z.begin(), z.end());
    ll ok = 2000000000000000001;
    ll ng = -2000000000000000001;
    while ((ok-ng) > 1) {
        ll mid = (ok + ng) / 2;
        ll count = 0;
        for (int i = 0; i < n; i++) {
            if (z[i] < 0) {
                ll okok = n;
                ll ngng = -1;
                while (abs(okok - ngng) > 1) {
                    ll midmid = (okok + ngng) / 2;
                    if (z[i] * z[midmid] <= mid)okok = midmid;
                    else ngng = midmid;
                }
                count += (n-okok);
                if (z[i] * z[i] <= mid)count--;
            }
            else {
                ll okok = -1;
                ll ngng = n;
                while (abs(okok - ngng) > 1) {
                    ll midmid = (okok + ngng) / 2;
                    if (z[i] * z[midmid] <= mid)okok = midmid;
                    else ngng = midmid;
                }
                count += okok;
                if (z[i] * z[i] > mid)count++;
            }
        }
        count /= 2;
        if (count >= k)ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
}

Measured memory_bytes: 4844
#include <iostream>
#include <vector>
#include <stack>
#include <string>
constexpr int MaxOrderCount = 8000;
class Robot_position {
	bool position[MaxOrderCount * 2 + 1];
public:
	Robot_position() { for (auto &p : position) p = false; position[MaxOrderCount] = true; }
	void move(int move_count) {
		std::stack<int> stack;
		for (auto i = 0; i < MaxOrderCount * 2 + 1; ++i) {
			if (position[i]) {
				position[i] = false;
				stack.push(i);
			}
		}
		for (auto s = stack.top(); stack.size() != 0;) {
			s = stack.top();
			stack.pop();
			if (move_count <= s) {
				position[s - move_count] = true;
			}
			if (s + move_count <= MaxOrderCount * 2) {
				position[s + move_count] = true;
			}
		}
	}
	bool operator()(int pos) const {
		return position[pos + MaxOrderCount];
	}
};
enum class Axis : char{
	X, Y
};
void switch_axis(Axis &axis) {
	switch (axis) {
	case Axis::X:axis = Axis::Y; break;
	case Axis::Y:axis = Axis::X; break;
	}
}
int main() {
	std::string s;
	std::cin >> s;
	int x, y;
	std::cin >> x >> y;
	Robot_position x_pos, y_pos;
	Axis axis = Axis::X;
	int move_count = 0;
	int bias = 0;
	for (; bias < s.length() && s[bias] == 'F'; ++bias) --x;
	for (; bias < s.length(); ++bias) {
		switch (s[bias]) {
		case 'T':
			switch (axis) {
			case Axis::X:
				x_pos.move(move_count);
				break;
			case Axis::Y:
				y_pos.move(move_count);
				break;
			}
			move_count = 0;
			switch_axis(axis); break;
		case 'F': ++move_count; break;
		}
	}
	switch (axis) {
	case Axis::X:
		x_pos.move(move_count);
		break;
	case Axis::Y:
		y_pos.move(move_count);
		break;
	}
	if (x_pos(x) && y_pos(y)) {
		std::cout << "Yes" << std::endl;
	}
	else {
		std::cout << "No" << std::endl;
	}
}

Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define repi(i,a,b) for(int i = (a);i < (b); i++)
#define rep(i,a) repi(i,0,a)
#define repd(i,a,b) for(int i = (a); i >= (b); i--)
#define repit(i,a) for(__typeof((a).begin()) i = (a).begin(); i != (a).end(); i++)

#define all(u) (u).begin(),(u).end()
#define rall(u) (u).rbegin(),(u).rend()
#define UNIQUE(u) (u).erase(unique(all(u)),(u).end())

#define pb push_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef vector<int> vi;

typedef complex<double> P;

inline bool eq(double a, double b){ return fabs(a-b) < EPS;}
inline bool ps(double a){ return a > EPS;}
inline bool ng(double a){ return ps(-a);}
inline bool gr(double a, double b){ return ps(a-b);}

double cross(P a, P b){return imag(conj(a)*b);}
double dot(P a, P b){return real(conj(a)*b);}

struct L{
  P a, b;
  L(P a, P b) : a(a), b(b){}
};

int ccw(P a, P b, P c){
  b -= a; c -= a;
  if(ps(cross(b, c))) return 1;
  if(ng(cross(b, c))) return -1;
  if(ng(dot(b, c))) return 2;
  if(gr(norm(c), norm(b))) return -2;
  return 0;
}

bool intersectLL(L l, L m){ return !eq(cross(l.b-l.a, m.b-m.a), 0.0) || eq(cross(l.b-l.a,m.a-l.a), 0.0);}
P crosspointLL(L l, L m){
  double A = cross(l.b-l.a,m.b-m.a);
  double B = cross(l.b-l.a,l.b-m.a);
  if(eq(A,0.0) && eq(B, 0.0)) return m.a;
  if(eq(A,0.0)) return P(INF, INF);
  return m.a + B / A * (m.b - m.a);
}

P projection(L l, P p){
  double t = dot(p-l.a,l.a-l.b) / norm(l.a-l.b);
  return l.a + t*(l.a-l.b);
}

double distanceLP(L l, P p){
  return abs(p - projection(l,p));
}

int n; 
double w, h, r;
bool inrange(P p) {
  return p.real() > r - EPS && p.real() < w - r + EPS
    && p.imag() > r - EPS && p.imag() < h - r + EPS;
}
int main(){
  while(cin >> w >> h >> n >> r, w||h||n||r) {
    vector<L> lines;
    vector<int> t(n);
    rep(i, n) {
      P p1, p2;
      cin >> p1.real() >> p1.imag() >> p2.real() >> p2.imag() >> t[i];
      lines.pb(L(p1, p2));
    }

    vector<L> tl;
    tl.pb(L(P(0.0, r), P(w, r)));
    tl.pb(L(P(r, 0.0), P(r, h)));
    tl.pb(L(P(0.0, h-r), P(w, h-r)));
    tl.pb(L(P(w-r, 0.0), P(w-r, h)));
    rep(i, n) {
      P dir = (lines[i].b - lines[i].a) * P(0.0, 1.0);
      dir = (t[i]+r) * dir/abs(dir);
      tl.pb(L(lines[i].a + dir, lines[i].b + dir));
      tl.pb(L(lines[i].a - dir, lines[i].b - dir));
    }
	
    bool ans = false;
    rep(i, tl.size()) repi(j, i+1, tl.size()) {
      P cp;
      if(intersectLL(tl[i], tl[j]) && inrange(cp = crosspointLL(tl[i], tl[j]))) {
	bool ok = true;
	rep(k, lines.size()) 
	  if(distanceLP(lines[k], cp) < t[k] + r - EPS) ok = false;
	if(ok) ans = true;
      }
    }
    if(ans) cout << "Yes\n";
    else cout << "No\n";
  }
  return 0;
}

Measured memory_bytes: 1236
n, m = map(int, input().split())
x = [0]*n
y = [0]*n
for i in range(n):
    a, b = map(int, input().split())
    x[i] = a
    y[i] = b

ans = 10**30
for i in range(n):
    for j in range(i):
        for k in range(n):
            for l in range(k):

                left = min(x[i], x[j])
                right = max(x[i], x[j])
                down = min(y[k], y[l])
                up = max(y[k], y[l])

                if left == right or up == down:
                    continue

                cnt = 0
                for r in range(n):
                    if left <= x[r] and x[r] <= right and down <= y[r] and y[r] <= up:
                        cnt += 1
                if cnt >= m:
                    ans = min(ans, (right - left) * (up - down))
print(ans)


Measured memory_bytes: 56284
#include <stdio.h>

int main()
{
  int n,q;
  int count=0,i,j;
  int S[10000],T[500];

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

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

  for(i=0; i<q; i++){
    for(j=0; j<n; j++){
      if(T[i]==S[j]){
        count++;
        break;
      }
    }
  }
  printf("%d\n",count);

  return 0;
}


Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
#define fi(a) scanf("%d",&a);
#define fli(a) scanf("%ld",&a);
#define fll(a) scanf("%lld",&a);
#define pi(a) printf("%d\n",a);
#define ppi(i,a) printf("Case %d: %d\n",i,a);
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
void FI()
{
#ifndef ONLINE_JUDGE
    freopen("C:\\Users\\SHIHAB\\Desktop\\input.in","r",stdin);
#endif // ONLINE_JUDGE
}

int main()
{
    fast
   // FI(); /// skip this line for compile
    int n,k;
    string s;
    cin >> n;
    cout << n+n*n+n*n*n << endl;
    return 0;
}



Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)


const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int h, n; cin >> h >> n;
	VE a(n); rep(i, n)cin >> a[i];
	rep(i, n)h -= a[i];
	if (h <= 0)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main()
{
    double n; cin >> n;
    cout << fixed << setprecision(5);
    cout << n * 2 * 3.14159 << endl;

}

/*
Ctrl+@ でコンソールを開け、以下で実行。
g++ a.cpp
./a.out

サンプルのダウンロードは oj d URL
テストは oj t
コード変えたらコンパイルする
不正解ならWAが出る
*/


Measured memory_bytes: 3776
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __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...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

const int N = 1e5 + 10;
char s[N];

int main() {
  scanf("%s", s);
  int n = strlen(s);
  bool found = false;
  for (int k = 0; k < 26; ++k) {
    vector<int> a;
    for (int i = 0; i < n; ++i) {
      if (s[i] == 'a' + k) {
        a.push_back(i);
      }
    }
    int m = a.size(), i;
    for (i = 1; i < m; ++i) {
      if (a[i - 1] - 2 * (i - 1) >= a[i] - 2 * i) break;
    }
    if (i < m) {
      printf("%d %d\n", a[i - 1] + 1, a[i] + 1);
      found = true;
      break;
    }
  }
  if (!found) puts("-1 -1");
  return 0;
}


Measured memory_bytes: 768
n = gets.to_i
s = gets.chomp.chars.map(&:to_s)

result = []

s.each do |alphabet|
  alphabet_ord = alphabet.ord + n
  if 90 < alphabet_ord
    result.push (alphabet_ord - 26).chr
  else
    result.push alphabet_ord.chr
  end
end

print "#{result.join}"

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


int main(){
    int N;
    cin>>N;
    vector<string>S(N);
    for(int i=0;i<N;i++)
    {cin>>S[i];}
     sort(S.begin(), S.end());
    int answer=1;
    for(int i=0;i<N-1;i++)
    {if(S[i]!=S[i+1]){answer++;}}
    cout<<answer<<endl;
}



Measured memory_bytes: 9600
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using ll = long long int;

int main() {
  string s;
  cin >> s;

  // 移動のステップ
  vector<int> ans(s.size(), 0);

  for (int i = 0; i < s.size(); i++) {
    // L が出てくるまで進む
    int l = 0;
    while (s[i + l] != 'L') {
      l++;
    }
    if (l == 0) {
      continue;
    }

    for (int j = 0; j < l; j++) {
      if (abs(l - j) % 2 == 0) {
        ans[i + l]++;
      } else {
        ans[i + l - 1]++;
      }
    }
    i += l;
  }

  for (int i = s.size() - 1; i >= 0; i--) {
    // R が出てくるまで進む
    int r = 0;
    while (s[i - r] != 'R') {
      r++;
    }
    if (r == 0) {
      continue;
    }

    for (int j = 0; j < r; j++) {
      if (abs(r - j) % 2 == 0) {
        ans[i - r]++;
      } else {
        ans[i - r + 1]++;
      }
    }
    i -= r;    
  }

  for (size_t i = 0; i < s.size(); i++) {
    cout << ans[i];
    if (i == s.size() - 1) {
      cout << endl;
    } else {
      cout << " ";
    }
  }
}

Measured memory_bytes: 1024