akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  long long int h,w,m;
  cin>>h>>w>>m;
  vector<long long int> gridh(h,0);
  vector<long long int> gridw(w,0);
  vector<pair<long long int,long long int>> hoge(m);
  for(long long int i=0; i<m; i++){
    long long int h1,w1;
    cin>>h1>>w1;
    hoge.at(i)=make_pair(h1-1,w1-1);
    gridh.at(h1-1)++;
    gridw.at(w1-1)++;
  }
  long long int ans=0;
  long long int ansh,answ;
  long long int high=0;
  long long int maxh=0;
  for(long long int i=0; i<gridh.size(); i++){
    if(high<gridh.at(i)){
      ansh=i;
      high=gridh.at(i);
      maxh=1;
    }else if(high==gridh.at(i)){
      maxh++;
    }
  }
  high=0;
  long long int maxw=0;
  for(long long int i=0; i<gridw.size(); i++){
    if(high<gridw.at(i)){
      answ=i;
      high=gridw.at(i);
      maxw=1;
    }else if(high==gridw.at(i)){
      maxw++;
    }
  }
  ans=gridh.at(ansh)+gridw.at(answ);
  bool ok=false;
  long long int dup=0;
  for(long long int i=0; i<m; i++){
    long long int H=hoge.at(i).first;
    long long int W=hoge.at(i).second;
    if(gridh.at(H)+gridw.at(W)==ans){
      dup++;
    }
  }
  if(dup==maxh*maxw) ans--;
  cout<<ans<<endl;
}

Measured memory_bytes: 12740
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

ll dp[100];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,P;
    cin>>N>>P;
    
    mem(dp,0);
    dp[0]=1;
    rep(j,N){
        int a; cin>>a;
        a%=2;
        for(int i=50;i-a>=0;i--){
            if(dp[i-a]) dp[i]+=dp[i-a];
        }
    }
    
    ll ans=0;
    rep(i,51){
        if((i%2)==P) ans+=dp[i];
    }
    
    cout1(ans)
}

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

int n;
vector<int> a, memo;
void dfs(int i, int wa) {
    if (i == n) {
        memo[wa] = true;
        return;
    }
    dfs(i + 1, wa + a[i]);
    dfs(i + 1, wa);
}

int main() {
    cin >> n;
    a.resize(n);
    for (int &ai: a) cin >> ai;
    memo.resize(20 * 2000 + 1);
    dfs(0, 0);
    int q; cin >> q;
    while (q--) {
        int m; cin >> m;
        cout << (memo[m] ? "yes" : "no") << endl;
    }
    return 0;
}


Measured memory_bytes: 3120
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<stack>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;

int main()
{
	int a, b, k;
	scanf("%d %d %d", &a, &b, &k);
	for(int i = 1; i <= k; i++) {
		if(i % 2 == 1) {
			if(a % 2 == 1) a--;
			a = a / 2;
			b = b + a;
		}
		else {
			if(i % 2 == 1) b--;
			b = b / 2;
			a = a + b;
		}
	}
	printf("%d %d\n", a, b);
	return 0;
}

Measured memory_bytes: 256
/***  بسم الله الرحمن ا لرحيم   ***/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl                         '\n'
#define Ceil(x,y)             ((x+y-1)/y)
#define sz(s)               (int)s.size()
#define RT(x)           return cout<<x,0;
#define mem(x,y)    memset(x,y,sizeof(x))
#define all(v) ((v).begin()), ((v).end())
#define watch(x) cout<<#x<<" = { "<<x<<" }\n"
#define test int t;cin>>t;while(t--)
const int dx[] = { 0, 1, 0, -1, 1, 1, -1, -1 };
const int dy[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
const double PI = acos(-1), EPS = 1e-7;
const int OO = 0x3f3f3f3f, N = 2e5 + 5, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll x, ll y) { return (!y) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return ((x / gcd(x, y)) * y); }
void file() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif  !ONLINEJUDGE
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

int n;
int a[N], b[N], c[N];
int memo[N][4];
int dp(int i,int lst) {
	if (i == n)return 0;

	int& ret = memo[i][lst];
	if (~ret)return ret;

	if (lst != 1) {
		ret = max(ret, dp(i + 1, 1) + a[i]);
	}
	if (lst != 2) {
		ret = max(ret, dp(i + 1, 2) + b[i]);
	}if (lst != 3) {
		ret = max(ret, dp(i + 1, 3) + c[i]);
	}
	return ret;

}
void solve() {
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i] >> b[i] >> c[i];
	mem(memo, -1);
	cout << dp(0, 0) << endl;

}
int main() {
	file();
	
	solve();
	
	return 0;
}


Measured memory_bytes: 14180
N=int(input())
A=list(map(int, input().split()))
print(*A)
for i in range(1,N):
  v=A[i]
  j=i-1
  while j >= 0 and A[j] > v:
    A[j+1]=A[j]
    j-=1
  A[j+1]=v
  print(*A)


Measured memory_bytes: 5976
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List
import Data.Function (on)

main :: IO ()
main = do
  [n,m] <- getl $ wrds toInt
  solve <$> replicateM n (getl toInt) <*> replicateM m (getl toInt) >>= print

solve :: [Int] -> [Int] -> Int
solve ns = head . head . sortBy (flip compare `on` length) . group . sort . map f
  where
    ls = zip [1..] ns
    f x = fst . head $ dropWhile (\y -> snd y > x) ls

toInt :: String -> Int
toInt = read

wrds :: (String -> a) -> String -> [a]
wrds f = map f . words

getl :: (String -> a) -> IO a
getl f = f <$> getLine

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n)cin >> a[i];
  rep(i,n){
    int tmp = a[i]%2;
    if(tmp==0){
      if(a[i]%5==0||a[i]%3==0){
      }
      else{
	cout << "DENIED" << endl;
	return 0;
      }
    }
  }
  cout << "APPROVED" << endl;
  return 0;
}


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

using namespace std;
using ll = long long;

int main() {
    int n; cin >> n;
    map <string, int> cnt;
    while (n--) {
        string s; cin >> s;
        cnt[s]++;
    }

    cout << "AC x " << cnt["AC"] << endl;
    cout << "WA x " << cnt["WA"] << endl;
    cout << "TLE x " << cnt["TLE"] << endl;
    cout << "RE x " << cnt["RE"] << endl;
}


Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main(){
    int x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;

    int y = y2 - y1;
    int x = x2 - x1;
    if(x < 0 && y > 0){
        cout << x2 - y << " " << y2 + x << " " << x2 - y - x << " " << y2 + x - y << endl;
    } else if(x < 0 && y < 0){
        cout << x2 - y << " " << y2 + x << " " << x2 - y - x << " " << y2 + x - y << endl;
    } else if(x > 0 && y < 0){
        cout << x2 - y << " " << y2 + x << " " << x2 - y - x << " " << y2 + x - y << endl;
    }else{
        cout << x2 - y << " " << y2 + x << " " << x2 - y - x << " " << y2 + x - y << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define F first
#define S second
using ll = long long;
#define ull unsigned ll
#define endl "\n"
#define vi vector<int>
#define vl vector<ll>
#define all(v) (v).begin(),(v).end()
#define mst(a,b) memset(a,b,sizeof(a))
#define pi pair<int,int>
#define pl pair<ll,ll>
#define ppi pair<int, pii>
#define mt make_tuple
#define eb emplace_back
using namespace std;

const ll N = 1e5 + 5, mod = 1e9 + 7;
const ll inf = 1e9;

bool P(const pair<ll, ll> &a, const pair<ll, ll> &b){
    if(a.F == b.F) return a.S < b.S;
    return a.F > b.F;
}

void solve(){
    ll n;
    cin >> n;
    vl a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(all(a));
    ll ans = 0, t = 0, j = n - 2;
    for(int i = n - 2; i >= 0; i--){
        if(i == n - 2) ans += a[i + 1];
        else{
            ans += a[j];
            t++;
            if(t == 2){
                j--;
                t = 0;
            }
        }
    }
    cout << ans << endl;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);//cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ll t,p;
    t=1;
    //cin>>t;
    for(p=1;p<=t;p++){
        solve();
    }
    return 0;
}


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

#define ll long long
#define ull unsigned long long 
#define endl '\n'
//const int MOD = 1e9+7;


int main(){
    string s;
    cin >> s;
    stack<char> st;
    st.push(s[0]);

    int ans = 0;
    for(int i=1; i<(int)s.length(); ++i){
        if(st.size() && ((st.top() == '1' && s[i]=='0') || (st.top() == '0' && s[i]=='1'))){
            st.pop();
            ans+=2;
        }
        else{
            st.push(s[i]);
        }
    }
    cout << ans;
}


Measured memory_bytes: 3848
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b[100],c=1,m=0;
    cin >> a;
    cin >> b[0];
    m = b[0];
    for(int i=1;i<a;i++){
        cin >> b[i];
        if( m <= b[i] ){
            c++;
            m = b[i];
        }
    }
    cout << c;
}


Measured memory_bytes: 256
import numpy as np
N,D=map(int, input().split())
dis = []
for i in range(N):
  dis.append([int(x) for x in input().split()])
array = np.asarray(dis)

ans = 0
for i in range(N):
  for j in range(i+1,N):
    distance = np.sqrt(sum((array[j]-array[i])**2))
    if distance%1==0:
      ans += 1
print(ans)

Measured memory_bytes: 21612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef priority_queue<int> pqi;
#define ttttyyyy ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fo(i,n,m) for(int i=n,i<m;i++)
#define endll "\n"
#define ci(x) int x;cin>>x
#define pb(x) push_back(a)
#define mk(a,b) make_pair(a,b)
int main(){
    ttttyyyy
    ci(n);
    ll sum=0;
    for(int i=1;i<=n;i++){
        if(i%3&&i%5)sum+=i;
    }
    cout<<sum<<endl;
    return 0;
}



Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using st=string;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
st abc="abcdefghijklmnopqrstuvwxyz";
st ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  vl a(3);
  cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(),a.end());
  ll k;
  cin >> k;
  rep(i,k){
    a[2]*=2;
  }
  cout << a[0]+a[1]+a[2] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
  }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
string substr(const string &str, int S1, int S2 = -1){
  if(S2 == -1)return str.substr(S1);
  return str.substr(S1, S2-S1);
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);


signed main(){
  int n;cin >> n;
  vector<int> a(n);
  rep(i,n)cin >> a[i];
  int h = a[0], ans = 1;
  repi(i,1,n)if(h <= a[i]){
    ans++;h = a[i];
  }
  cout << ans << endl;
  return 0;
}






Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
const ll INF=1000000000000005;
const ll maxn=5e5+5;
const int mod=1e9+7;
ll n,m,p;
struct node{
    ll s,e;
    bool friend operator<(node a,node b)
    {
        return a.e<b.e;
    }
}num[maxn];
inline bool read(ll &num)
{
        char in;bool IsN=false;
        in=getchar();
        if(in==EOF) return false;
        while(in!='-'&&(in<'0'||in>'9')) in=getchar();
        if(in=='-'){ IsN=true;num=0;}
        else num=in-'0';
        while(in=getchar(),in>='0'&&in<='9'){
                num*=10,num+=in-'0';
        }
        if(IsN) num=-num;
        return true;
}

int main()
{
    scanf("%lld",&n);
    for(int i=1;i<=n;i++)
    {
        ll x,y;scanf("%lld%lld",&x,&y);
        num[i].s=x-y;
        num[i].e=x+y;
    }
    sort(num+1,num+1+n);
    ll e=-INF,cnt=0;
    for(int i=1;i<=n;i++)
    {
       // printf("%lld%lld\n",num[i].s,num[i].e);
        if(num[i].s>=e)
        {
            cnt++;
            e=num[i].e;
        }
    }
    printf("%lld\n",cnt);
    return 0;
}
/***
***/


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

#define ll long long

using namespace std;

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

const int maxn = 1e6 + 7;
int a[maxn];

int main() {
//    scan();
    string ss;
    cin >> ss;
    int vis[1000];
    memset(vis, 0, sizeof(vis));
    ll k;
    cin >> k;

    int sz = ss.size();
    if (k == 1) {
        ll ans = 0;
        for (int i = 1; i < sz;) {
            if (ss[i] == ss[i - 1]) ans++, i += 2;
            else i++;
        }
        cout << ans << endl;
        return 0;
    } else if (sz == 1) {

        cout << k / 2 << endl;
        return 0;
    } else {
        int cnt = 0, mm = 0;
        int r = sz - 1;
        for (; r >= 0 && ss[r] == ss[sz - 1]; r--, cnt++, mm++);

        int l = 0;
        int nn = 0;
        for (; l <= sz - 1 && ss[l] == ss[0]; l++, cnt++, nn++);

        if (l == sz) {
            cout << sz * k / 2 << endl;
            return 0;
        }

        ll cc = 0;
        for (int i = l; i < r; i++) {
            if (ss[i] == ss[i + 1]) cc++, i++;
        }
        cc *= k;
//        cout << cc << endl;
        if (ss[0] == ss[sz - 1]) {
            cc += cnt / 2 * (k - 1);
            cc += mm / 2 + nn / 2;
        } else {
            ll now = 0;
            for (int i = 0; i < sz - 1; i++) {
                if (ss[i] == ss[i + 1]) now++, i++;
            }
            cout << now * k << endl;
            return 0;
        }
        cout << cc << endl;
    }
    return 0;
}


Measured memory_bytes: 256
PROGRAM ATCODER

implicit none
integer :: n,count=0,i,ans
character(len=2*10**5) ::  s

read*, n,s

!! 全部黒にした時
do i = 1, n, 1
  if ( s(i:i) == '.' ) then
    count = count + 1
  end if
end do

ans = count

!! 左から1〜i個目までを白にする
do i = 1, n, 1
  if ( s(i:i) == '#' ) then
    count = count + 1
  else
    count = count - 1
  end if
  call chmin(ans,count)
end do

print'(i0)', ans


contains
  
  subroutine chmin(dp,x)
  implicit none
  integer :: dp, x

  if (dp > x) then
  	dp = x
  	return
  end if
  
  end subroutine


END PROGRAM ATCODER

Measured memory_bytes: 1468
import math
import numpy as np
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN


def main():
    a = list( map( float, input().split()))
    a1 = int(a[0])
    a2 = Decimal(str(a[1])).quantize(Decimal('0.01'), rounding=ROUND_HALF_EVEN)
    s = a1*a2
    print(math.floor(s))
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 27172
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define print(v) cout<<v<<endl
#define printyes cout<<"Yes"<<endl
#define printno cout<<"No"<<endl
#define printYES cout<<"YES"<<endl
#define printNO cout<<"NO"<<endl
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-15;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}
struct Point{double x,y;};
double dis(Point a,Point b){
  return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
Point tri(Point a, Point b, Point c){
  double a1,a2,b1,b2,c1,c2;
  a1=2*(b.x-a.x);
  b1=2*(b.y-a.y);
  c1=a.x*a.x-b.x*b.x+a.y*a.y-b.y*b.y;
  a2=2*(c.x-a.x);
  b2=2*(c.y-a.y);
  c2=a.x*a.x-c.x*c.x+a.y*a.y-c.y*c.y;
  Point p;
  p.x=(b1*c2-b2*c1)/(a1*b2-a2*b1);
  p.y=(c1*a2-c2*a1)/(a1*b2-a2*b1);
  return p;
}
int main(){
  startupcpp();
  // ll test;cin>>test;while(test--){
  ll i,j,k,l,N;
  cin>>N;
  double ans=inf,fir;
  vector<Point> v(N);
  Point x;
  rep(i,N)cin>>v[i].x>>v[i].y;
  sort(all(v),[](auto const& a,auto const& b){if(a.x!=b.x){return a.x>b.x;}else if(a.y!=b.y){return a.y<b.y;}else{return true;}});
  rep(i,N)For(j,i+1,N){
    double res=dis(v[i],v[j])*0.5;
    fir=res;
    x.x=(v[i].x+v[j].x)/2;
    x.y=(v[i].y+v[j].y)/2;
    rep(k,N){
      if(i==k||j==k)continue;
      if(dis(x,v[k])>fir+eps){
        res=inf;
        break;
      }
    }
    chmin(ans,res);
  }
  rep(i,N)For(j,i+1,N)For(k,j+1,N){
    if((v[i].x-v[k].x)*(v[j].y-v[k].y)!=(v[i].y-v[k].y)*(v[j].x-v[k].x)){
      x=tri(v[i],v[j],v[k]);
      fir=dis(x,v[i]);
      rep(l,N){
        if(dis(x,v[l])>fir+eps){
        fir=inf;
        break;
        }
      }
      chmin(ans,fir);
    }
  }
  print(ans);
  return 0;
}


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

using namespace std;
#define mx 200000
#define ll long long
ll res[mx+2];
int main()
{


    int n;
    cin>>n;



    ll p= n/100;
    ll k= p*100;
    ll k1= k+p*5;

    if(n>=k&&n<=k1)cout<<1<<endl;
    else cout<<0<<endl;

   // for(int i=1;i<=1000;i++)if(res[i])cout<<i<<" "<<res[i]<<endl;

    return 0;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9

typedef long long ll;


int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
ll Max(ll a, ll b) {
	return (a) > (b) ? (a) : (b);
}
void Swap(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}
void hSwap(int x[], int i, int j)
{
	int temp;

	temp = x[i];
	x[i] = x[j];
	x[j] = temp;
}
void ShowData(int x[], int left, int right)
{
	int i;
	for (i = left; i <= right; i++)printf("%d  ", x[i]);
	printf("\n");
}

void QSort(int x[], int left, int right, int n) {
	int i, j;	//左端,右端
	int pivot;	//軸

	i = left;
	j = right;
	pivot = x[(left + right) / 2];

	while (1) {
		if (n > 0) {				//n>0なら昇順、n<=0なら降順
			while ((x[i] < pivot) && (i <= right))i++;	//軸値より大きい要素
			while ((pivot < x[j]) && (i <= right))j--;	//軸値より小さい要素
		}
		else {
			while ((x[i] > pivot) && (i <= right))i++;	//軸値より小さい要素
			while ((pivot > x[j]) && (i <= right))j--;	//軸値より大きい要素
		}
		if (i >= j)	break;
		hSwap(x, i, j);
		i++; j--;
	}
	//ShowData(x, left, right);

	if (left < i - 1)QSort(x, left, i - 1, n);
	if (j + 1 <  right)QSort(x, j + 1, right, n);
}

int main() {
	int n;
	scanf("%d", &n);
	int a[200000];

	ll sum = 0;
	REP(i, n) {
		//*
		scanf("%d", &a[i]);
		/*/
		a[i] = i+1;
		if (i == n - 1)a[i] = 1e9;
		//*/
		a[i] -= (i + 1);
		sum += abs(a[i]);
	}
	//printf("ans=%lld\n",sum);
	QSort(a, 0, n - 1, 1);
	//ShowData(a, 0, n - 1);
	int b = 0;
	ll sumtmp = sum;
	ll ans = sum;
	REP(i, n) {
		if (b >= a[i])continue;
		sumtmp += (ll)i*(a[i] - b);
		sumtmp -= (ll)(n - i)*(a[i] - b);
		if (ans > sumtmp)ans = sumtmp;
		//printf("+%d=%lld\n",i,sumtmp);
		b = a[i];
	}
	b = 0;
	sumtmp = sum;
	RREP(i, n) {
		if (b <= a[i])continue;
		sumtmp += (ll)(n - (i+1) )*abs(b-a[i]);
		sumtmp -= (ll)(i+1)*abs(b - a[i]);
		if (ans > sumtmp)ans = sumtmp;
		//printf("-%d=%lld\n", i, sumtmp);
		b = a[i];
	}
	PRINTL(ans);
}

Measured memory_bytes: 896
#include <stdio.h>
#include <string.h>

int main(void)
{
    int h;
    char cards[201];

    while(scanf("%s", &cards))
    {
        if(cards[0] == '-')
        {
            return 0;
        }

        scanf("%d", &h);

        int i, temp, sum = 0;
        for(i = 0; i < h; ++i)
        {
            scanf("%d", &temp);
            sum += temp;
        }

        int r = sum % strlen(cards);

        for(i = r; i < strlen(cards); ++i)
        {
            printf("%c", cards[i]);
        }

        for(i = 0; i < r; ++i)
        {
            printf("%c", cards[i]);
        }

        printf("\n");
    }
}

Measured memory_bytes: 568
n = int(input())
list1 =[int(i) for i in input().split()]
count=0
for i in range(n):
	for j in range(n-1,i,-1):
		if list1[j] < list1[j-1]:
			list1[j],list1[j-1]=list1[j-1],list1[j]
			count+=1
print(' '.join(list(map(str,list1))))
print(count)


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


# ひとつ入力
n = int(input())
# リストに入れる
b = [int(i) for i in input().split()] 

for i in range(n):
    if b[i]>i+1:
        print("-1")
        exit()

a =[]
for i in range(n):
    a.append(i+1-b[i])
answer=[]
for i in range(n-1,-1,-1):
    for j in range(i,-1,-1):
        if a[j] == 0:
            answer.insert(0,j+1)
            a.pop(j)
            break
        else:
            a[j] -= 1

#print(answer)
for i in range(n):
    print(answer[i])
    

Measured memory_bytes: 22184
#include<bits/stdc++.h>
#define int long long
#define fi first
#define sc second
#define pii pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define msi map<string,int>
#define si set<int>
#define all(v) v.begin(),v.end()
#define sz(v)  int((v).size())
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define dep(i,a,b)    for(int i=a;i>=b;i--)
#define isinarr(i,n) ((i>=0)?((i<n)?1:0):0)
#define fastio  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define ppb pop_back
#define present(container, element) (container.find(element) != container.end())      //set,map etc.
#define cpresent(container, element) (find(all(container),element) != container.end())    //vector
#define hell 1000000007
#define PI 3.14159265
#define mp make_pair
#define inparr(a,n) rep(i,0,n)cin>>a[i];
#define strwspaces(s) getline(cin,s)
#define give(x,y) cout<<x<<" "<<y<<endl;
#define setp(n) cout<<fixed<<setprecision(n);
#define    endl '\n'
#define inp(n) int n;cin>>n;

using namespace std;

int i,j,k,l;

void solve()
{
    inp(k);
    int a,b;
    cin>>a>>b;
    if(a%k==0 || b%k==0)
    {
        cout<<"OK\n";
        return;
    }
    if(a/k == b/k)
    {
        cout<<"NG\n";
    }
    else
        cout<<"OK\n";
} 



signed main()
{
    fastio
    int t=1;
    //cin>>t;
    while(t--)
        solve();
    return 0;
}

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

int main(){
  ll n, m, k;
  cin >> n >> m >> k;
  vl a(n), b(m);
  rep(i,n) cin >> a[i];
  rep(i,m) cin >> b[i];
  
  //ーーーー累積和ーーーー//
  
  vl A(n), B(m);
  A[0] = a[0], B[0] = b[0];
  ll ans = 0;
  rep(i,n-1) A[i+1] = A[i] + a[i+1];
  rep(i,m-1) B[i+1] = B[i] + b[i+1];
  
  rep(i,m) if (B[i] <= k) ans = max(ans,i+1);
  
  //ーーーー二分探索ーーーー//
  //kからaのi番目までの累積和A[i]を引くことで残りの時間数keyが分かる。
  //keyがbの累積和Bではどこに当てはまるのかを二分探索で求める。
  //読んだ本の数は(i+1)と、二分探索で求めた(l+1)の和で与えられる。
  //これと、Bのみ貪欲に読んでいったときの本の数(ans)とで、大きい方を答にする。
  
  rep(i,n) {
    ll key = k - A[i];
    ll l = -1, r = m;
    if (key < 0) continue;
    if (key < A[0]) {
      ans = max(ans,i+1);
      continue;
    }
    while (r-l>1) {
      ll mid = (l+r)/2;
      if (key >= B[mid])
        l = mid;
      else r = mid;
    }
    
    ans = max(i+1+l+1,ans);
  }
  cout << ans << endl;
}


Measured memory_bytes: 9496
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
using namespace std;
int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int ans = 0;
    if(abs(a-b) <= d and abs(b-c) <= d) ans = 1;
    if(abs(a-c) <= d ) ans = 1;

    if(ans == 1) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll;
template<class T>using vv = vector<vector<T>>; template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T1, class T2>bool chmax(T1& a, const T2& b) { return a < b ? a = b, 1 : 0; }
template<class T1, class T2>bool chmin(T1& a, const T2& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    ll N;
    cin >> N;
    vi a(N + 1);
    rep(i, 1, N + 1) cin >> a[i];

    vi ans_table(N + 1);
    vi ans;

    for (ll i = N; i > 0; --i) {
        int a_sum = 0;

        for (ll j = 2; i * j <= N; ++j) {
            a_sum ^= ans_table[i * j];
        }

        if (a_sum ^ a[i]) {
            ans_table[i] = 1;
            ans.push_back(i);
        }
        else {
            ans_table[i] = 0;
        }
    }

    write(ans.size());
    for (int i = 0; i < ans.size(); ++i) {
        cout << ans[i] << (i == ans.size() - 1 ? "\n" : " ");
    }
}

Measured memory_bytes: 3192
// Problem : C - Tax Increase
// Contest : AtCoder Beginner Contest 158
// URL : https://atcoder.jp/contests/abc158/tasks/abc158_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cp-editor)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb emplace_back
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
using namespace std;
using namespace __gnu_pbds;
template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
double pi=acos(-1.0);
int md=1000000007;
int abst(int a)
{return a<0?-a:a;}
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
struct HASH{
  size_t operator()(const pii &x)const{
    return (size_t) x.first * 37U + (size_t) x.second;}};

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int Pow(int n,int x){int ans=1;
 while(x>0)
 {if(x&1)ans=(ans*n)%md;n=(n*n)%md;x=x>>1;}
 return ans;}

 vi fact,inv;
void inverse(int n)
{inv.resize(n+1);inv[0]=1;
for(int i=1;i<=n;i++)inv[i]=Pow(fact[i],md-2);}
void factorial(int n)
{fact.resize(n+1);fact[0]=1;
for(int i=1;i<=n;i++)fact[i]=(fact[i-1]*i)%md;}

int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;}
//create(tree,node,a,start,end)
//query(tree,node,start,end,l,r)
//update(tree,node,start,end,index,value)
void solve()
{
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
double a,b;cin>>a>>b;
double x1=a/0.08,x2=b/0.1;
int d1=ceil(x1),d2=ceil(x2);
int ans=max(d1,d2);
//cout<<ans<<" ";
if((int)(ans*0.08)==a and (int)(ans*0.1)==b)
cout<<ans;
else
cout<<-1;
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
while(t--)
{
    solve();
}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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; }
const int MAX = 2e3;

vector<int> G[MAX];
vector<int> d(MAX, -1);

void bfs() {
  queue<pair<int, int>> q;
  q.push({0, 0});
  while (!q.empty()) {
    int v = q.front().first, u = q.front().second;
    q.pop();
    if (d[u] != -1) continue;
    d[u] = d[v] + 1;
    for (int w: G[u]) {
      q.push({u, w});
    }
  }
}


int main() {
  int n, x, y;
  cin >> n >> x >> y;
  
  x--, y--;
  vector<vector<ll>> d(n, vector<ll>(n));
  rep(i, n) {
    rep(j, n) {
      d[i][j] = abs(i - j);
    }
  }
  d[x][y] = 1, d[y][x] = 1;
  rep(i, n) {
    rep(j, n) {
      chmin(d[i][j], d[i][x] + d[x][y] + d[y][j]);
      chmin(d[i][j], d[i][y] + d[y][x] + d[x][j]);
      chmin(d[j][i], d[j][x] + d[x][y] + d[y][i]);
      chmin(d[j][i], d[j][y] + d[y][x] + d[x][i]);
    }
  }
  vector<int> ans(n, 0);
  rep(i, n) {
    rep(j, i) {
      ans[d[i][j]]++;
    }
  }
  FOR(k, 1, n) cout << ans[k] << endl;





  
  return 0;
}

Measured memory_bytes: 33664
N = int(input())
mydict = {}
max = 0
for i in range(N):
    S = input()
    if S in mydict.keys():
        mydict[S] = mydict[S] + 1
    else:
        mydict[S] = 1
        
    if max < mydict[S]:
        max = mydict[S]

keys = [k for k, v in mydict.items() if v == max]
keys.sort()
for key in keys:
    print(key)


Measured memory_bytes: 32096
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int s, w;
    cin >> s >> w;
    if (s <= w)
        cout << "unsafe"
             << "\n";
    else
        cout << "safe"
             << "\n";
    return 0;
}

Measured memory_bytes: 3652
using System;
using System.Collections;
using System.Linq;

class prog
{
    public static void Main(string[] args)
    {	bool Out = false;
        int output = 0;
     
        string[] in1 = Console.ReadLine().Split(' ');
        int N = int.Parse(in1[0]);
        int M = int.Parse(in1[1]);
		
     
        int[] Ss = new int[M];
        int[] Cs = new int[M];

        
        int[] changed = new int[N];
        for (int i = 0; i < N; i++) { changed[i] = -100; }

        for (int i = 0; i < M; i++)
        {
            string[] input = Console.ReadLine().Split(' ');
            Ss[i] = int.Parse(input[0]);
            Cs[i] = int.Parse(input[1]);

           	if (Ss[i] == 1 && Cs[i] == 0 && N != 1)
            {
                Out = true;
            }
        }

        for (int i = 0; i < M; i++)
        {
            if (changed[Ss[i] - 1] > 0 && changed[Ss[i] - 1] != Cs[i]) { Out = true; break; }
            else if (changed[Ss[i] - 1] > 0) break;
            else if (Ss[i] == 1)
            {
                output = (int)(Cs[i] * Math.Pow(10, N - 1) + output);
                changed[Ss[i] - 1] = Cs[i];
            }
            else if (Ss[i] == 2)
            {
                output = (int)(Cs[i] * Math.Pow(10, N - 2) + output);
                changed[Ss[i] - 1] = Cs[i];
            }
            else if (Ss[i] == 3)
            {
                output = (int)(Cs[i] * Math.Pow(10, N - 3) + output);
                changed[Ss[i] - 1] = Cs[i];
            }
        }

        for(int i = 0;i < N;i++)
        {
            if(changed[i] < 0 && N != 1)
            {
                if (i == 0) output = output + (int)(1 * Math.Pow(10, N - 1));
            }
        }

        if (!Out) Console.WriteLine(output);
        else Console.WriteLine("-1");
    }
}

Measured memory_bytes: 11092
#include <stdio.h>

int main(void){
	int a,b;
	int i,j;
	while(scanf("%d%d",&a,&b),a,b){
		int n,x,y;
		int road[20][20]={0};
		
		for(i=1;i<=a;i++){
			for(j=1;j<=b;j++){
				road[i][j]=1;
			}
		}
		
		scanf("%d",&n);
		
		for(i=0;i<n;i++){
			scanf("%d%d",&x,&y);
			road[x][y]=0;
		}
		
		road[0][1]=1;
		for(i=1;i<=a;i++){
			for(j=1;j<=b;j++){
				if(road[i][j]!=0){
					road[i][j]=road[i-1][j]+road[i][j-1];
				}
			}
		}
		
		printf("%d\n",road[a][b]);
	}
	return 0;
}

Measured memory_bytes: 0
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(ALL(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    string s, t;
    cin >> s >> t;
    if(s == t.substr(0, SZ(t) - 1)){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

Measured memory_bytes: 3640
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define mod ((ll)(1e9)+7)

#define MAX 2000

vector<ll> v(2000, 0), v_inv(2000, 0);

ll pmod(ll n, ll p){
	ll m=n%mod;
	if(p==1) return m;
	ll ans=pmod((m*m)%mod, p/2)%mod;
	if(p%2==1) ans=ans*m%mod;
	return ans;
}

void factorial(ll n){
	v[0]=1;
	for(ll i=1; i<=n; i++){
		v[i]=v[i-1]*i%mod;
	}
	return;
}

void factorial_inv(ll n){
	for(ll i=0; i<=n; i++){
		v_inv[i]=pmod(v[i],mod-2);
	}
}

ll binom(ll n, ll k){
	ll tmp=v_inv[k]*v_inv[n-k]%mod;
	return v[n]*tmp%mod;
}

int main(){
	int n, k;
	cin >> n >> k;
	factorial(n);
	factorial_inv(n);
	for(ll i=1; i<=k; i++){
		if(i-1>n-k) cout << 0 << endl;
		else cout << binom(k-1, i-1)*binom(n-k+1, i)%mod << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
 
typedef long long ll;
typedef vector<int> vi;
typedef unsigned long ul;
typedef vector<ll> vl;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef set<int> si;
typedef multiset<int> mi;
 
const ll INF = 1e18;
const int MOD = 1e9+7;

int main() {
	
	ll N,M,K;
	cin>>N>>M>>K;
	
	vl A(N+1), B(M+1);
	A[0]=B[0]=0;
	
	for(int i=1; i<=N; ++i) {
		cin>>A[i];
		A[i]+=A[i-1];
	}
	
	for(int i=1; i<=M; ++i) {
		cin>>B[i];
		B[i]+=B[i-1];
	}
	
	int ans=0;
	
	if(N<M) {
		for(int i=0; i<=N; ++i) {
			if(K-A[i]<0) continue;
			auto it = upper_bound(B.begin(),B.end(),K-A[i]);
			--it;
			ans=max(ans, int(it-B.begin())+i);
		}
	}
	
	else {
		for(int i=0; i<=M; ++i) {
			if(K-B[i]<0) continue;
			auto it = upper_bound(A.begin(),A.end(),K-B[i]);
			--it;
			ans=max(ans, int(it-A.begin())+i);
		}
	}
	
	cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 6380
s = [input() for i in range(3)]
dex = 0
next = 'a'
while True:
    if next == 'a': dex = 0
    elif next == 'b': dex = 1
    else: dex = 2
    if s[dex] == "":
        print(chr(ord(next) - (ord('a')-ord('A'))))
        exit()
    next = s[dex][0]
    s[dex] = s[dex][1:]

Measured memory_bytes: 9128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
class Program
{   
    public void Slove()
    {
        int x = int.Parse(Console.ReadLine());
        int result = (int)Math.Ceiling(Math.Sqrt(1.0 / 4 + x * 2) - 1.0 / 2);
        System.Console.WriteLine(result);
    }
    
    static void Main(string[] args)
    {
        new Program().Slove();
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = ll(1e18) + 5;

int main() {
    ll N, K;
    cin >> N >> K;
    vector<P> td(N);
    rep(i, N) {
        cin >> td[i].second >> td[i].first;
    }

    sort(td.rbegin(), td.rend());

    vector<ll> first, second;
    unordered_map<ll, ll> mp;
    rep(i, N) {
        if (mp.find(td[i].second) == mp.end()) {
            mp[td[i].second]++;
            first.push_back(td[i].first);
        } else {
            second.push_back(td[i].first);
        }
    }
    vector<ll> fSum(K + 1, 0), sSum(K + 1, 0);
    rep(i, K) {
        fSum[i + 1] = fSum[i];
        if (i < first.size()) {
            fSum[i + 1] += first[i];
        }
        sSum[i + 1] = sSum[i];
        if (i < second.size()) {
            sSum[i + 1] += second[i];
        }
    }
    ll ans = 0;
    ll e = min(K, (ll)first.size());
    for (ll i = 1ll; i <= e; i++) {
        // cerr << "i= " << i << "i * i + fSum[i] + sSum[K - i]" << i * i + fSum[i] + sSum[K - i] << endl;
        ans = max(ans, i * i + fSum[i] + sSum[K - i]);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 10644
#include <bits/stdc++.h>
#include <math.h>
#include <bitset>
using namespace std;
using ll = long long;
 
int main(){
  string s; cin >> s;
  vector<int> v(4);
  for(int i = 0; i < 4; i++){
    v[i] = s[i] - 48;
  }
  
  int sum = 0;
  for(int bit = 0; bit < (1<<3); bit++){  
    int sum = v[0];    
    for(int i = 0; i < 3; i++){
      if(bit & (1<<i)) sum += v[i+1];
      else sum -= v[i+1];
    }

    if(sum == 7){
      vector<char> w(3);
      for(int i = 0; i < 3; i++){
        if(bit & (1<<i)) w[i] = '+';
        else w[i] = '-';
      }
      cout << s[0] << w[0] << s[1] << w[1] << s[2] << w[2] << s[3] << "=7" << endl;
      break;
      }
  } 
  //sum += s[s.size()-1] * pow(2, s.size()-1);
  //cout << sum << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var a = new int[] { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
            var id = IO.RInt - 1;
            WriteLine(a[id]);

        }

        public class IO
        {
            #region Input
            public static int RInt => int.Parse(ReadLine());
            public static long RLong => long.Parse(ReadLine());
            public static double RDouble => double.Parse(ReadLine());

            public static string[] RSString => ReadLine().Split();
            public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
            public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
            public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
            #endregion

            #region Output
            public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
            public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
            public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
            #endregion
        }

        public class Mod
        {
            #region
            private readonly static long M = 1000000007;

            public static long Add(long a, long b) => (a * b) % M;
            public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
            public static long Multi(long a, long b) => (a * b) % M;
            #endregion
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e9
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

int a[60],b[60],c[60];
signed main(){
    int n;
    cin>>n;
    REP(i,n) cin>>a[i];
    REP(i,n) cin>>b[i];
    REP(i,n-1) cin>>c[i];
   ll sum=0;
   for (int i = 0; i < n; i++)
   {
       sum+=b[a[i]-1];
       if(a[i]+1==a[i+1] && i<n-1) sum+=c[a[i]-1];
   }
   cout<<sum<<endl;
   
    return 0;
}

Measured memory_bytes: 256
#! usr/bin/perl

use strict;
use warnings;

my %cards;

sub add_cards{
  my $weight = $_[0];
  chomp(my $N = <STDIN>);
  foreach (0..$N-1)
  {
    chomp (my $card = <STDIN>);
    $weight == 1 ? ++$cards{$card} : --$cards{$card};
  }
}

&add_cards(1);
&add_cards(0);

my @result = sort{
$cards{$b} <=> $cards{$a};
} keys %cards;

$cards{$result[0]}<0 ? print "0\n" :
print "$cards{$result[0]}\n";


Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

int N;

int main() {

	cin >> N;



	printf("%.12lf\n", 2 * N * 3.14159265358979);

	return 0;
}


Measured memory_bytes: 3720