akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//定数
#define INF 1000000000 //10^9:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

int main(){
    int n,x,t;
    cin>>n>>x>>t;
    int ans=n/x;
    if(n%x>0) ans++;
    ans*=t;
    cout<<ans<<endl;
    return 0;
}

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


int main() {
  int n;
  cin >> n;
  int a[110];
  rep(i,n) cin >> a[i];
  sort(a,a+n);
  reverse(a,a+n);
  int Alice = 0;
  int Bob = 0;
  rep(i,n){
    if(i%2 == 0){
      Alice += a[i];
    }
    else Bob += a[i];
  }
  cout << Alice-Bob << endl;
  return 0;
}

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

const int mod = 1e9 + 7;

int mul(int x, int y) {
	return 1LL * x  * y % mod;
}

int add(int x, int y) {
	return (x += y) >= mod ? x - mod : x;
}

void upd(int &x, int y) {
	if ((x += y) >= mod) x -= mod;
}

int dp[333][333][333]; // use, count1, c

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

	dp[0][1][0] = 1;
	for (int i = 0; i < m; i++) {
		for (int j = 1; j <= n; j++) {
			for (int k = 0; k <= n; k++) {
				if (j + k <= n) upd(dp[i + 1][j + k][0], mul(dp[i][j][k], j));

				// extend
				upd(dp[i + 1][j][k + 1], mul(dp[i][j][k], n - j - k));

				// same
				upd(dp[i + 1][j][k], mul(dp[i][j][k], k));
			}
		}
	}
	cout << dp[m][n][0] << endl;
}


Measured memory_bytes: 118528
def resolve():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    lena = len(a)
    if (lena-k) % (k-1) == 0:
        print(((lena-k) // (k-1))+1)
    else :
        print(((lena-k) // (k-1))+2)
resolve()

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

using namespace std;

bool is_strong_palindrom (string s){
    int n = s.size();
    for(int i=0,j=n-1;i<n/2;i++,j--) if(s[i] != s[j]) return false;
    for(int i=0,j=(n-1)/2-1;i<(n-1)/4;i++,j--) if(s[i] != s[j]) return false;
    for(int i=(n+3)/2-1,j=n-1;i<n;i++,j--) if(s[i] != s[j]) return false;
    return true;
}
int main()
{
   string s;
   cin >> s;
   if(is_strong_palindrom(s)) cout << "Yes" << endl;
   else cout << "No" << endl;
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll tmp1,tmp2,tmp3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y){
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}
int main(){
  ll n;
  cin >> n;
  vector<vector<ll>> vec(n,vector<ll>(n,0));
  ll u,k,v;
  rep(i,n){
    cin >> u >> k;
    rep(j,k){
      cin >> v;
      vec[u-1][v-1] = 1;
    }
  }

  rep(i,n){
    rep(j,n){
      cout << vec[i][j];
      if(j != n-1){
        cout << " ";
      }
    }
    cout << endl;
  }
}



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

#define sz(x) (int)x.size()
#define pb push_back
#define eb emplace_back
#define rep(a, b, i) for(int i = a; i < b; i++)
#define repi(a, b, i) for(int i = a; i > b; i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define __ ios_base::sync_with_stdio(cin.tie(0) && 0);

typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
typedef double ld;

const ld pi = 3.141592653589793;
const ll inf = 1e18 + 5;
const int MOD = 1e9 + 7;
const int maxn = 2e5 + 5;
const int mxn = 1e5 + 5;
const int mx = 1000;

int main() {
  __;

  int n; cin >> n;
  int a[n];
  rep(0, n, i) cin >> a[i];

  ll ans = 0;
  ll sum = 0;
  rep(0, n, i) {
    (ans += (sum * a[i]) % MOD) %= MOD;
    (sum += a[i]) %= MOD;
  }

  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 4328
using System;
using System.Collections.Generic;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var o = Console.ReadLine().ToCharArray();
            var e = Console.ReadLine().ToCharArray();
            
            var temp = new List<char>();
            for (int i = 0; i < o.Length; i++)
            {
                if (o.Length > i) temp.Add(o[i]);
                if (e.Length > i) temp.Add(e[i]);
            }
            var result = String.Join("", temp);

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const  ll INF = 1e18;
const  ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i,n,init) for(ll i=init;i<(n);i++)
#define repd(i,n,init) for(ll i=(n);i>=init;i--)
#define repm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define repb(bit,n,init) for(ll bit=init;bit<(1<<n);++bit)

int main()
{
    ll X,A;
    cin >> X >> A;
    cout << (X<A?0:10) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int tot,n,m,s,t,mx,cnt,ru[200010],e[200010],nt[200010],hd[200010];
void build(int x,int y){
	tot++;
	e[tot]=y;
	nt[tot]=hd[x];hd[x]=tot;
}
void dfs(int x,int fa){
	int i;
	if(x==s&&fa){
		puts("Yes");exit(0);
	}
	if(x==t)return;
	for(i=hd[x];i;i=nt[i])if(e[i]!=fa)dfs(e[i],x);
}
int main(){
	int i,x,y;
	scanf("%d%d",&n,&m);
	for(i=1;i<=m;i++){
		scanf("%d%d",&x,&y);
		build(x,y);build(y,x);
		ru[x]++;ru[y]++;
	}
	for(i=1;i<=n;i++)if(ru[i]%2)return puts("No"),0;
	for(i=1;i<=n;i++)if(ru[i]>mx){
	 mx=ru[i],cnt=1;s=i;
}
	 else if(ru[i]==mx)cnt++,t=i;
	//mx=max(mx,ru[i]);
	if(mx>4)return puts("Yes"),0;
	if(mx<4||(mx==4&&cnt==1))return puts("No"),0;
	if(mx==4&&cnt>2)return puts("Yes"),0;
	dfs(s,0);
	puts("No");
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];
    
    map<ll, ll> countNum;
    REP(i, N) countNum[A[i]]++;
    ll sumAll = 0;
    REPV(it, countNum)
    {
        ll count = it->second;
        if (count >= 2) sumAll += count * (count - 1) / 2;
    }
    REP(i, N)
    {
        ll ans = sumAll;
        if (countNum.find(A[i]) != countNum.end())
        {
            ll count = countNum[A[i]];
            if (count >= 2)
            {
                ans -= count * (count - 1) / 2;
                count--;
                ans += count * (count - 1) / 2;
            }
        }
        cout << ans << endl;
    }
}


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

int main() {
  //入力値取得
  int N, M;	cin >> N >> M;
  vector<int> vec_from(M);
  vector<int> vec_to(M);
  for(int i=0; i<M; i++){
    cin >> vec_from.at(i) >> vec_to.at(i);
  }
  
  //確認
  //cout << N << M << endl;
  ///for(int i=0; i<M; i++){
  //  cout << vec_from.at(i) << ' ' << vec_to.at(i) << endl;
  //}
  
  //カウント
  vector<int> vec_count(N+1, 0);	//添え字各島番号に対応（0は使用しない）
  //確認
  //for(int i=0; i<N; i++)
  //  cout << vec_count.at(i) << ' ' << endl;
  for(int i=0; i<M; i++){
    //for(int j=0; j<i; j++){
      //if(vec_from.at(j) == vec_from.at(i)
      //  	&& vec_to.at(j) == vec_to.at(i)){
      //  break;
      //}        
    //}
      vec_count.at(vec_from.at(i))++;
      vec_count.at(vec_to.at(i))++;
  }
  
  //出力
  for(int i=1; i<N+1; i++)
  	cout << vec_count.at(i) << endl;
  
   
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, q; cin>>n>>q;
    string s; cin>>s;
    int sl=s.size();
    int ans[sl];
    ans[0]=0;
    int cnt=0;
    for(int i=1; i<sl; i++){
        if (s[i-1]=='A'&& s[i]=='C'){
            cnt++;
        }
        ans[i]=cnt;
    }

    for(int i=0; i<q; i++){
        int l,r; cin>>l>>r;
        l--; r--;
        cout<<ans[r]-ans[l]<<endl;
    }
    return 0;
}

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

int main(){
  int a,b,c;
  bool flag=false;
  cin >> a >> b >> c;
  
  // a*x/b = p...c
  //a*x+c = b*p
  
  for(int i=1; i<=b; i++){
    if(a*i%b == c){
      flag = true;
    }
  }
  
  if(flag){
    cout << "YES" << endl;
  }else{
    cout<< "NO" << endl;
  }
}

Measured memory_bytes: 256
#
import sys
import math
import numpy as np
import itertools


# いくつか入力
w,h,x,y = (int(i) for i in input().split())  

if x > w//2:
    x = w - x
if y > h//2:
    y = h - y

if x * 2 == w and y * 2 == h :
    print(h * w / 2,1)
else:
    print(h * w / 2,0)




Measured memory_bytes: 21516
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define rando mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ld long double
#define ll long long
#define int ll
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 1000000000
#define pb push_back
#define EPS 1e-9
const int MOD = 1000000007; // 998244353
int ans[2005],dist[2005];
int32_t main(){
	boost;
	//freopen(".in","r",stdin);
	int n,x,y;
	cin>>n>>x>>y;x--,y--;
	vv vec(n);
	for (int i = 0; i < n-1; ++i)
		vec[i].pb(i+1),vec[i+1].pb(i);
	vec[x].pb(y),vec[y].pb(x);
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < n; ++j)dist[j]=INF;
		priority_queue<ii,vii,greater<ii> > pq;
		pq.push({0,i});
		dist[i]=0;
		while(!pq.empty()){
			ii front=pq.top();
			pq.pop();
			if(dist[front.se]<front.fi)
				continue;
			for(auto it:vec[front.se])
				if((1+front.fi)<dist[it]){
					dist[it]=1+front.fi;
					pq.push({dist[it],it});
				}
		} 
		for (int j = 0; j < n; ++j)
			ans[dist[j]]++;
	}
	for (int i = 1; i < n; ++i)
		cout<<(ans[i]>>1LL)<<"\n";
	return 0;
}
//long long
//array bounds
//special cases
//binary search

Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#pragma warning(disable:4996)
using namespace std;

long long dp[2005][2005];
const long long MOD = 1e9 + 7;


long long combi(int i, int j)
{
	long long &ret = dp[i][j];
	if (j > i)return 0;
	else if (j == 0)return 1;
	else if (ret != -1)return ret;
	
	
	
	return ret = (combi(i - 1, j - 1) + combi(i - 1, j)) % MOD;
	
}

int main()
{
	int N, K;
	scanf("%d %d", &N, &K);
	int blue = K;
	int red = N - K;
	memset(dp, -1, sizeof(dp));
	for (int i = 1; i <= K; i++) 
		cout << (combi(blue - 1, i - 1)*combi(red + 1, i)) %MOD<< '\n';
	
}


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

int main(void){
    int n,k,q;
    cin >> n >> k >> q;
    int num[100005] = {};
    for(int i = 0;i < q;i++){
        int a;
        cin >> a;
        num[a]++;
    }
    for(int i = 1;i <= n;i++){
        if(q - num[i] < k)cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

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

int main() {
    int n,k;
    cin >> n >> k;
    vector<double> kitai(n);
    double ans = 0;
    rep(i,n){
        double p;
        cin >> p;
        double a = (p+1)/2;
        kitai[i]=a;
    }
    double now = 0;
    rep(i,k) now+=kitai[i];
    ans = now;
    rep(i,n-k){
        now-=kitai[i];
        now+=kitai[k+i];
        ans = max(ans,now);
    }    
    cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 4752
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,m; cin >> n >> m;
    priority_queue<ll> pq;
    rep(i,0,n){
        ll a; cin >> a;
        pq.emplace(a);
    }
    rep(i,0,m){
        ll t = pq.top();pq.pop();
        t /= 2;
        pq.emplace(t);
    }

    ll ans = 0;
    while(!pq.empty()){
        ll t = pq.top();pq.pop();
        ans += t;
    }

    cout << ans << "\n";
}

Measured memory_bytes: 4288
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            continue
        else:
            print("DENIED")
            exit()
print("APPROVED")

Measured memory_bytes: 3064
#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>
#define rr register
#define int long long
#define f_for(i,a,b) for(rr int i=a;i<=b;i++)
using namespace std;
const int maxx=1e4;
int n,m;
string a,b;
signed main(){
	cin>>a;
	b=a;
	bool t=true;
	int len=a.length()-1;
/*	f_for(i,0,len)
		a[len-i]=a[i];
	f_for(i,0,len)
		cout<<a[i];*/
	for(rr int i=0; i<=len; i++)
		switch(a[i]){
			
			case 'q': a[i]='p';break;
			case 'p': a[i]='q';break;
			case 'b': a[i]='d';break;
			case 'd': a[i]='b';break;
		}
	for(rr int i=0;i<=len;i++)
		if(a[i]!=b[len-i])
			t=false;
	if(t)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
}


Measured memory_bytes: 512
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif


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

    int N; cin >> N;
    string S; cin >> S;

    vi sw(N, 0);
    sw[0] = S[0] == 'W' ? 1 : 0;
    FOR(i,1,N) {
        int w = S[i] == 'W' ? 1 : 0;
        sw[i] = sw[i - 1] + w;
    }

    vi se(N, 0);
    se[0] = S[0] == 'E' ? 1 : 0;
    FOR(i,1,N) {
        int e = S[i] == 'E' ? 1 : 0;
        se[i] = se[i - 1] + e;
    }

    int ans = se[N - 1] - se[0];
    FOR(i,1,N) {
        int cost = sw[i - 1] + (se[N - 1] - se[i]);
        ans = min(ans, cost);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2964
#pragma region include
#include "bits/stdc++.h"
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++)
#define MOD (int)(1e9+7)
#define INF (int)(1e9)
#define LLINF (int)(4e18)
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
void input() {}
template<typename... R> void input(int& f, R&... r) { scanf("%d", &f); input(r...); }
template<typename... R> void input(double& f, R&... r) { scanf("%lf", &f); input(r...); }
template<typename... R> void input(ll& f, R&... r) { scanf("%lld", &f); input(r...); }
template<typename... R> void input(char& f, R&... r) { scanf("%c", &f); input(r...); }
template<typename T, typename... R> void input(vector<T>& f, R&... r) { REP(i, f.size())input(f[i]); input(r...); }
#pragma endregion

int main() {
    int N; input(N);
    vector<int> d(N); input(d);
    sort(ALL(d));
    cout << d[N / 2] - d[N / 2 - 1] << endl;
    getchar(); getchar();
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;

bool comp(P a, P b) {
	return a.second < b.second;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	ll d, g;
	cin >> d >> g;

	vector<ll> p(d), c(d);
	rep(i, d) {
		cin >> p[i] >> c[i];
	}

	ll res = inf;
	for (int bit = 0; bit < (1 << d); bit++) {
		ll sum = 0;
		ll num = 0;
		for (int i = 0; i < d; i++) {
			if (bit & (1 << i)) {
				sum += c[i] + p[i] * 100 * (i + 1);
				num += p[i];
			}
		}
		if (sum >= g) chmin(res, num);
		else {
			for (int i = d - 1; i >= 0; i--) {
				if (bit & (1 << i)) continue;
				for (int j = 0; j < p[i]; j++) {
					if (sum >= g) break;
					sum += 100 * (i + 1);
					num++;
				}
			}
			chmin(res, num);
		}
	}

	out(res);

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        string[] s1 = Console.ReadLine().Split(' ');
        int n = int.Parse(s1[0]);
        int m = int.Parse(s1[1]);
        int sum = 0;
        int one = 0;

        one += 100 * (n - m);
        one += 1900 * m;

        sum = one * (int)Math.Pow(2, m);

        Console.WriteLine(sum);
    }
}

Measured memory_bytes: 13140
D = int(input()) #365
c = list(map(int, input().split()))
s_matrix = [list(map(int, input().split())) for _ in range(D)]
last = [0] * 26
satis = 0

for i in range(D):
    satis2 = satis
    last2 = last.copy()
    for k in range(26):
        satis3 = satis2
        last3 = last2.copy()

        satis2 += s_matrix[i][k]
        last2[k] = i + 1
        for j in range(26):
            satis2 -= c[j] * (i+1 - last2[j])
        
        if satis2 > satis:
            satis = satis2
            ans = k + 1
            last = last2.copy()
        satis2 = satis3
        last2 =last3.copy()
    
    print(ans)


Measured memory_bytes: 69208
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [a, b] = input[0].map(Number);

  return (a * b) % 2 === 0 ? "Even" : "Odd";
};

console.log(main(read()));


Measured memory_bytes: 29616
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cmath>

using namespace std;

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

    int64_t ans, cnt;
    cnt = n/(a+b);
    ans += cnt*a;
    if (n%(a+b) != 0) {
        if (n%(a+b) <= a) {
            ans += n-(a+b)*cnt;
        } else {
            ans += a;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int n;
string s;
main(){
	cin>>n>>s;
	r(i,n-1){
		if(s[i]=='x'&&s[i+1]=='x'){
			cout<<i+1<<endl;
			exit(0);
		}
	}
	cout<<n<<endl;
}

Measured memory_bytes: 3316
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(M)]

ab.sort(key=lambda x: x[1])  # Sort the list of (a, b) by b

ans = 0
cur = -1
for i in range(M):
    a, b = ab[i]
    if a < cur:
        continue
    ans += 1
    cur = b

print(ans)


Measured memory_bytes: 28708
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD=1000000000000000000;
const long double PI=3.14159265358979;
const ll MAX=100010;

int main() {
  ll N,x;
  cin>>N>>x;
  if(N!=2&&min(x,N*2-x)<2){
    cout<<"No";
  }
  else if(N==2&&(x==1||x==3)){
    cout<<"No";
  }
  else{
    cout<<"Yes"<<endl;
    if(N==2){
      for(int i=1;i<N*2;i++){
        cout<<i<<endl;
      }
    }
    else{
      ll A[2*N];
      for(int i=1;i<N*2;i++){
        A[i]=i;
      }
      if(x==2){
        swap(A[1],A[N]);
        swap(A[x],A[N+1]);
      }
      else if(x==N*2-2){
        swap(A[N*2-1],A[N]);
        swap(A[x],A[N+1]);
      }
      else{
        swap(A[N],A[x]);
        swap(A[2],A[N-2]);
        swap(A[1],A[N+1]);
        swap(A[2*N-1],A[N-1]);
        swap(A[2*N-2],A[N+2]);
      }
      for(int i=1;i<N*2;i++){
        cout<<A[i]<<endl;
      }
    }
  }
  
    
  
}


Measured memory_bytes: 3072
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
#include <stack>
typedef std::stack<int> IntStack;
typedef std::stack<char> charStack;

using namespace std;
using ll = long long;
typedef pair <int, int> pii;
int main()
{
	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	ll n;
	char tmp;
	ll x[100005] = {};
	ll y[100005] = {};
	ll z[100005] = {};
	string s;
	//IntStack yStack;
	//charStack Stack;
	cin >> a;
	for (int i = 0; i < a; i++)
	{
		cin >> x[i];
	}
	for (int i = 0; i < a; i++)
	{
		cin >> y[i];
	}
	for (int i = 0; i < a; i++)
	{
		if (x[i] < y[i])
		{
			b += x[i] - y[i];
			ans++;
		}
		z[i] = -x[i] + y[i];
	}
	sort(z, z + a);
	for (int i = 0; i < a; i++)
	{
		if (b < 0 && z[i] < 0)
		{
			b += -z[i];
			ans++;
		}
	}
	if (b >= 0)
	{
		cout << ans << endl;
	}
	else
	{
		cout << -1 << endl;
	}
	//cout << ans << endl;

	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//char型の文字数字は、-'0'で数値に変換できる
//accumulate(x, x + a, 0);//int型までの配列の合計
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;
//cout << char(z - 'a');
//log10(i) + 1 //10進数の桁数を取得

//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}

//最小公倍数
//ll x = a * b;
//ll tmp;
///* 自然数 a > b を確認・入替 */
//if (a<b) {
//	tmp = a;
//	a = b;
//	b = tmp;
//}
///* ユークリッドの互除法 */
//ll r = a % b;
//while (r != 0) {
//	a = b;
//	b = r;
//	r = a % b;
//}
//a = x / b;//答え

Measured memory_bytes: 2560
//
// Created on 2020/08/22.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
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; }
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;



int main() {
    int h,w,m;
    cin>>h>>w>>m;
    vector<int>grid(h,0);
    vector<int>grid_2(w,0);
    map<pair<int,int>,int>bom_list;
    for (int i = 0; i < m; ++i) {
        int b_h,b_w;
        cin>>b_h>>b_w;
        b_h --;
        b_w --;
        grid[b_h] ++;
        grid_2[b_w] ++;
        bom_list[{b_h,b_w}] ++;
    }
    map<int,vector<int>>h_que;
    map<int,vector<int>>w_que;
    for (int i = 0; i < h; ++i) {
        h_que[grid[i]].push_back(i);
    }
    for (int i = 0; i < w; ++i) {
        w_que[grid_2[i]].push_back(i);
    }
    int max_v = 0;
    int h_max = h_que.rbegin()->first;
    int w_max = w_que.rbegin()->first;
    bool find = false;
    for(auto th : h_que[h_max]){
        for (auto tw : w_que[w_max]) {
            if(bom_list[{th,tw}] == 0){
                chmax(max_v,h_max + w_max - bom_list[{th,tw}]);
                find = true;
            }else{
                chmax(max_v,h_max + w_max - bom_list[{th,tw}]);
            }
        }
        if(find)break;
    }
    cout<<max_v<<endl;
    return 0;
}


Measured memory_bytes: 45540
// abc156_c
#include <iostream>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>

#define US unsigned short
#define UI unsigned int
#define UC unsigned char
#define UL unsigned long
#define ULL unsigned long long
using namespace std;

int main(int argc, char const *argv[])
{
    US n;
    cin >> n;
    US x[n];
    UI sum = 0, outl = 0, outh = 0;
    for (size_t i = 0; i < n; i++)
    {
        cin >> x[i];
        sum += x[i];
    }
    float p = sum / float(n);
    for (size_t i = 0; i < n; i++)
    {
        outl += pow(x[i] - floor(p), 2);
        outh += pow(x[i] - ceil(p), 2);
    }
    cout << min(outl, outh) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <tuple>
#include <algorithm>
#include <array>
#include <cmath>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(decltype(n) i=0; i<n; ++i)
inline constexpr ll Inf = (1ULL << 62) -1;

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

int main() {
    ull ans=1;
    ll N;
    cin >> N;
    vector<ull> a(N);
    rep(i,N) cin >> a[i];
    if (find(begin(a), end(a), 0) != end(a)) {
        ans = 0;
    } else {
        double log10 = log(10);
        rep(i,N) {
            ull p = ans;
            ans *= a[i];
            if ((log(p)+log(a[i]))/log10 > 18.000001 || ans > 1000000000000000000 || ans < p) {
                cout << -1 << endl;
                return 0;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3996
#include <bits/stdc++.h>
using namespace std;
const int N = 100005, H = 100005, W = 100005;
int n, h, w;
long long a[N], ans = 0ll;
int r[N], c[N];
struct node {
    int u, v;
    long long w;
    bool operator < (node rhs) const {
        return w > rhs.w;
    }
} e[N];
int fa[H + W];
bool mark[H + W];
int findroot (int x) {
    return fa[x] == x ? x : fa[x] = findroot(fa[x]);
}
int main () {
    scanf("%d%d%d", &n, &h, &w);
    for (int i = 1; i <= n; i++) scanf("%d%d%lld", &r[i], &c[i], &a[i]);
    for (int i = 1; i <= n; i++) {
        e[i].u = r[i], e[i].v = h + c[i];
        e[i].w = a[i];
    }
    sort(e + 1, e + n + 1);
    for (int i = 1; i <= h + w; i++) fa[i] = i, mark[i] = false;
    for (int i = 1; i <= n; i++) {
        int ru = findroot(e[i].u), rv = findroot(e[i].v);
        if (ru == rv) {
            if (!mark[ru]) ans += e[i].w, mark[ru] = true;
        }
        else {
            if (!mark[ru] || !mark[rv]) {
                fa[ru] = rv, mark[rv] |= mark[ru];
                ans += e[i].w;
            }
        }
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 4608
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <fstream>

using namespace std;
using ll = long long;

#define PRI(n) cout << n << " "<<endl;
#define PRI2(n,m) cout << n << " " << m << " "<<endl;

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

const char alphabet[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
                           's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
const ll MOD = 1e9 + 7;

struct edge;
struct UnionFind;

bool isPrime(ll x);

ll GCD(ll a, ll b);

ll LCM(ll a, ll b);

ll nCr(int n, int r);

ll N, K, L;
string S;
vector<edge> X[100010];
bool B[100010];
int D[100010];


struct UnionFind {
    vector<int> par;
    vector<int> rank;

    UnionFind(int N) {
        for (int i = 0; i < N; ++i) {
            par.push_back(i);
            rank.push_back(0);
        }
    }

    int find(int x) {
        if (par[x] == x)return x;
        else return par[x] = find(par[x]);
    }

    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y)return;
        if (rank[x] < rank[y])par[x] = y;
        else {
            par[y] = x;
            if (rank[x] == rank[y])rank[x]++;
        }
    }

    bool same(int x, int y) {
        return find(x) == find(y);
    }
};

int main() {
    cin >> N >> K >> L;
    UnionFind road(N);
    UnionFind rail(N);
    int a, b;
    REP(i, K) {
        cin >> a >> b;
        road.unite(--a, --b);
    }
    REP(i, L) {
        cin >> a >> b;
        rail.unite(--a, --b);
    }
    map<pair<int, int>, int> ans;
    REP(i, N) {
        ans[make_pair(road.find(i), rail.find(i))]++;
    }
    REP(i, N) {
        cout << ans[make_pair(road.find(i), rail.find(i))] << " ";
    }
    cout << endl;
    return 0;
}

struct edge {
    int to, cost;
    bool flag = false;
};

bool isPrime(ll x) {
    if (x == 0)return 0;
    if (x == 1)return 0;
    if (x == 2)return 1;
    if (x % 2 == 0)return 0;
    FOR(i, 3, x - 1) {
        if (x % i == 0)return 0;
    }
    return 1;
}

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

ll LCM(ll a, ll b) {
    ll gcd = GCD(a, b);
    return a / gcd * b;
}

ll nCr(int n, int r) {
    vector<ll> C(r + 1);
    C[0] = 1;
    FOR(i, 1, n) for (int j = min(i, r); j < 1; --j)C[j] = (C[j] + C[j - 1]) % MOD;
    return C[r];
}


Measured memory_bytes: 17428
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
using namespace std;
long long d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
string a,b;
char c[200];
int main()
{
	cin>>a>>b;
	for(i=0;i<a.size()+b.size();i++)
	{
		if(i%2==0)
		{
			c[z++]=a[x++];
		}
		else
		{
			c[z++]=b[y++];
		}
	}
	puts(c);
	return 0;
}

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>
using namespace std;
typedef long long unsigned int ll;

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

int main() {
  int n,t;
  int c,ti;
  scanf("%d %d\n",&n, &t);
  int maxcost=1234;
  for (size_t i = 0; i < n; i++) {
    scanf("%d %d\n",&c, &ti);
    if (ti<=t){
      if(maxcost>c){
        maxcost=c;
      }
    }
  }
  if (maxcost==1234) {
    printf("TLE\n");
    return 0;
  }else{
    printf("%d\n",maxcost );
    return 0;
  }
}


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

int llasc(const void *a, const void *b) {
   long long *A = (long long *)a;
   long long *B = (long long *)b;
   if (*A > *B) return 1;
   if (*A < *B) return -1;
   return 0;
}

int main(void) {
   long long int array[100001][2];
   long long int N;
   long long int M;
   long long int ans = 0;
   long long int cnt = 0;
   cin >> N >> M;
   for (int i = 0; i < N; i++) {
      cin >> array[i][0] >> array[i][1];
   }
   qsort(array,N,sizeof (array[0]), llasc);
   for (int i = 0; i < N; i++) {
      if (M > cnt + array[i][1]) {
         ans += array[i][0] * array[i][1];
         cnt += array[i][1];
      } else {
         ans += (M - cnt) * array[i][0];
         break;
      }
   }
   cout << ans << endl;
}


Measured memory_bytes: 3324
def CountingSort(A, B, k):
    C = [0 for i in range(k+2)]
    
    for j in range(n):
        C[A[j]] += 1
        
    for i in range(k+1):
        C[i] += C[i-1]
        
    for j in range(n-1, -1, -1):
        B[C[A[j]]-1] = A[j]
        C[A[j]] -= 1

if __name__=="__main__":
    n = int(input())
    D = list(map(int, input().split()))
    l = max(D)
    E = D[:]
    CountingSort(D, E, l)
    print(" ".join(map(str, E)))

Measured memory_bytes: 246384
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int min(int x,int y){
    if(x>y) return y;
    else return x;
}
int main(void){
    int n,k,i,j;
    scanf("%d %d",&n,&k);
    int h[n],dp[n];
    for(i=0;i<n;i++) scanf("%d",&h[i]);
    dp[0] = 0;
    dp[1] = abs(h[1]-h[0]);
    for(i=2;i<n;i++){
        dp[i] = (int)INFINITY;
        for(j=1;j<k+1;j++){
            if(i-j<0) break;
            dp[i] = min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
        }
    }
    printf("%d",dp[n-1]);
}


Measured memory_bytes: 2480
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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; }
const long long INF = 10010010010010;
const long long MOD = 998244353;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}

int main() {
    long long N,P;cin >> N >> P;
    if(N == 1){
        cout << P << endl;
        return 0;
    }
    map<long long,long long> M;
    long long p = P;
    long long hozon;
    while(true){
        long long prv = P;
        for(long long i = 2;i<=(long long)sqrt(P);i++){
            if(P % i == 0){
                M[i]++;
                P /= i;
                break;
            }
        }
        if(prv == P){
            M[P]++;
            //hozon = P;
            break;
        }
    }
    for(auto V : M){
        //cout << V.first << " " << V.second << endl;
        M[V.first] = V.second/N;
    }
    long long ans = 1;
    for(auto V : M){
        /*if(V.first == hozon && ans == 1){
            ans *= V.first;
            break;
        }*/
        if(V.first != hozon && V.second != 0){
            ans *= pow(V.first,V.second);
        }
    }
    //if(ans == 1) ans = p;
    cout << ans << endl;
}


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

using namespace std;

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

    int pos = 0;
    while (h[pos] == 0) ++pos;
    for (int cx = 0; cx <= 100; ++cx) {
        for (int cy = 0; cy <= 100; ++cy) {
            int H = h[pos] + abs(x[pos] - cx) + abs(y[pos] - cy);
            bool ok = true;
            for (int i = 0; i < n; ++i) {
                if (h[i] != max(H - abs(x[i] - cx) - abs(y[i] - cy), 0))
                    ok = false;
            }
            if (ok) {
                cout << cx << ' ' << cy << ' ' << H << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 256
import java.awt.Point;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {

	private void solve() {
		Scanner in = new Scanner(System.in);
		int x1 = in.nextInt();
		int y1 = in.nextInt();
		int x2 = in.nextInt();
		int y2 = in.nextInt();
		
		if(y2<y1){
			int sp = y2;
			y2 = y1;
			y1 =sp;
			sp = x2;
			x2 = x1;
			x1 = sp;
		} // y1 < y2
		
		int N = in.nextInt();
		
		if(x1==x2){
			boolean exist = false;
			for (int i = 0; i < N; i++) {
				int x = in.nextInt();
				int y = in.nextInt();
				if(x==x1 && y1<y && y<y2) exist = true;
			}
			System.out.println(100L*(y2-y1)+((!exist)?0:10*Math.PI-20));
			
		}else if(y1==y2){
			boolean exist = false;
			if(x1>x2){
				int sp = x2; x2 = x1; x1 = sp;
			}
			for (int i = 0; i < N; i++) {
				int x = in.nextInt();
				int y = in.nextInt();
				if(y==y1 && x1<x && x<x2) exist = true;
			}
			System.out.println(100L*(x2-x1)+((!exist)?0:10*Math.PI-20));
			
		}else{
			LinkedList<Point> queue = new LinkedList<>();
			for (int i = 0; i < N; i++) {
				queue.offer(new Point(in.nextInt(),in.nextInt()));
			}
			Collections.sort(queue,
					(x1<x2)?
					(a,b)->((Point)a).x-((Point)b).x :
					(a,b)->((Point)b).x-((Point)a).x
			);
			
			BinaryPoints tree = new BinaryPoints();
			while(!queue.isEmpty()){
				Point p = queue.poll(); 
				if(between(p.x,x1,x2) && between(p.y,y1,y2))
					tree.add(p.y);
			}
			int max = tree.lis();
			double ans = 100L*(Math.abs(x2-x1)+(y2-y1));
			if(max==Math.min(Math.abs(x2-x1), y2-y1)+1){
				ans += (5*Math.PI-20)*(max-1) + 10*Math.PI-20;
			}else{
				ans += (5*Math.PI-20)*max;
			}
			System.out.println(ans);
			
		}
	}
	
	private boolean between(int target, int edge1, int edge2){
		return Math.min(edge1,edge2)<=target 
				&& target<= Math.max(edge1, edge2);
	}
	
	public static void main(String[] args) {
		new Main().solve();
	}
}


class BinaryPoints{
	ArrayList<Integer> dp;
	
	public BinaryPoints(){
		dp = new ArrayList<Integer>();
	}
	
	public void add(int y){
		int index = lowerBound(y,-1,dp.size());
		if(index>=dp.size()){
			dp.add(y);
		}else{
			dp.set(index, y);
		}
	}
	
	public int lis(){
		return dp.size();
	}
	
	public int lowerBound(int y, int left, int right){
		if(right-left<=1) return right;
		int index = left + (right-left+1)/2;
		if(dp.get(index)>=y){
			return lowerBound(y,left,index);
		}else{
			return lowerBound(y,index,right);
		}
	}
}

Measured memory_bytes: 122596
package main

import "fmt"

func main() {
	// Code for B - Sum of Three Integers
	var K, S int
	fmt.Scanf("%d %d", &K, &S)

	var count int = 0
	for i := 0; i <= K; i++ {
		for j := i; j <= K; j++ {
			for k := j; k <= K; k++ {
				if i+j+k == S {
					if i == j && j == k && k == i {
						count++
					} else if i != j && j != k && k != i {
						count = count + 6
					} else {
						count = count + 3
					}
				}

			}
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 1860
#include <stdio.h>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <unordered_map>

using namespace std;

void helper(vector<string>& strings)
{
    long long pairs = 0;

    unordered_map<string, long long> strFreq;

    sort(strings.begin(), strings.end());

    for (string s : strings)
    {
        if (strFreq.find(s) == strFreq.end())
        {
            strFreq[s] = 1;
        }
        else 
        {
            pairs += strFreq[s];
            strFreq[s]++;
        }
    }

    cout << pairs << endl;
}

int main()
{
    //ios::sync_with_stdio(false);

    int N;

    scanf("%d", &N);

    string S;

    vector<string> strings;

    for (int i = 0; i < N; i++)
    {
        cin >> S;
        sort(S.begin(), S.end());
        //cout << endl << S;
        strings.push_back(S);
    }
    
    helper(strings);

    return 0;
}

Measured memory_bytes: 11380
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	var n, m, tmp int
	n, m = nextInt(), nextInt()
	ans := n

	for i := 0; i < m; i++ {
		tmp = nextInt()
		ans -= tmp
	}

	if ans < 0 {
		ans = -1
	}

	fmt.Println(ans)

}


Measured memory_bytes: 1808
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <map>

using namespace std;

using ll = long long;


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

    int sofsize = s.size();
    int tofsize = t.size();

    string ans = "~";
    for(int i=0;i<=sofsize-tofsize;i++){
        bool ok = true;
        string s2 = s;
        for(int j = 0; j < tofsize; j++){
            if(s[i+j] != '?' && s[i+j] != t[j]){
                ok = false;
            }
            s2[i+j] = t[j];
        }
        if(ok){
            replace(s2.begin(), s2.end(), '?', 'a');
            ans = min(ans, s2);
        }
    }

    if(ans == "~") cout << "UNRESTORABLE" << endl;
    else cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
//d.c D-Islands War
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>

typedef struct{
    int a;
    int b;
}island;

int cmp(const void *b1,const void *b2){
    if(((island*)b1)->b > ((island*)b2)->b){
        return 1;
    }else if(((island*)b1)->b < ((island*)b2)->b){
        return -1;
    }else{
        return 0;
    }
}

int main(void){
    int n,m,x=-1,ans=0;
    scanf("%d %d",&n,&m);
    island war[m];
    for(int i=0;i<m;++i){
        scanf("%d %d",&(war[i].a),&(war[i].b));
    }

    qsort(war,m,sizeof(island),cmp);

    for(int i=0;i<m;++i){
        if(war[i].a<=x){
            //do nothing
        }else{
            x = war[i].b - 1;
            ans++;
        }
    }

    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  int N;
  int a[110];
  std::cin >> N;
  for (int i = 0; i <N; ++i) std::cin >> a[i];

  sort(a, a + N, std::greater<int>());
  int Alice = 0;
  int Bob = 0;
  for (int i = 0 ; i < N; ++i){
    if (i % 2 == 0){
      Alice += a[i];
    }
    else{
      Bob += a[i];
    }
  }
  std::cout << Alice - Bob << '\n';
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
const int mod = 1000000007;
typedef long long int ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define ALL(x) x.begin(),x.end();
#define pp pair<ll,ll>
const int INF = 1LL << 30;
const ll LLINF = 1LL << 60;
using namespace std;
int main() {
	int n, ct = 0, ch[8] = {}, free = 0;
	cin >> n;
	rep(i, n) {
		int nn; cin >> nn;
		bool b=1;
		rep(j, 8) {
			if (nn >= j * 400 && nn < (j + 1) * 400) { b = 0; if (ch[j] == 0) { ch[j] = 1; ++ct; } }
		}
		if (b)++free;
	}
	cout << max(ct,1) <<" "<< ct + free << endl;
	return 0;
}


Measured memory_bytes: 256
def main():

    def ispalindrome(str): return 1 if str == str[::-1] else 0

    str= input()
    n=len(str)
    N=int((n-1)/2)

    s_first, s_second, s_last = str[:N], str[N:N+1], str[N+1:]
    # print(s_first,s_second,s_last)
    if ispalindrome(str) and (n+1)%2==0:
        if ispalindrome(s_first) and ispalindrome(s_last):
            print("Yes")
            return
        else:
            print("No")
            return
    else:
        print("No")
        return
main()

Measured memory_bytes: 3064