akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
const int INF = 1001001001;
typedef long long int ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define re0 return 0
#include<string.h>
int npr(int n , int r){//nPr
    r = n - r;
    int sum = 1;
    int i;
    for (i=n;i>=r+1;i--)sum*=i;
    return sum;
}
int gcd(int a, int b) {//最大公約数
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {//最小公倍数
    return a * b / gcd(a, b);
}
int digsum(int n) {//桁和
    int res = 0;
    while(n > 0) {
        //res += n%10;
        //　↑をres++;にすれば桁数
         res++;
        n /= 10;
    }
    return res;
}
bool isPrime(int x){//素数判定
    if(x==1)return 0;
    if(x==2)return 1;
    if(x%2==0)return 0;
    for(int i=3;i*i<=x;i++)if(x%i==0)return 0;
    return 1;
}
/*bit全探索
for (int bit = 0; bit < (1<<N); ++bit) {
}
if (bit & (1 << i)) {
}
*/


signed main(){ 
    int n,k;
    cin >> n >> k;
    vector<int>p(n);
    int ans=0;
    rep(i,n)cin >> p[i];
    sort(p.begin(),p.end());
    rep(i,k){
        ans += p[i];
    }
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 3624
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
4
0 1 2
1 2 1
1 3 3

output:
5
"""

import sys
from collections import deque
from math import isinf


def generate_adj_table(v_table):
    for each in v_table:
        v_from, v_to, edge_weight = map(int, each)
        init_adj_table[v_from][v_to] = edge_weight
        init_adj_table[v_to][v_from] = edge_weight

    return init_adj_table


def graph_bfs(v_init):
    global distance
    distance = [float('inf')] * vertices
    distance[v_init] = 0
    queue.appendleft(v_init)

    while queue:
        current = queue.popleft()
        adj_weight = adj_table[current]
        for adj in adj_weight.keys():
            if isinf(distance[adj]):
                distance[adj] = distance[current] + adj_weight[adj]
                queue.append(adj)
    return None


def solve():
    graph_bfs(init_v)
    max_v, bridge_v = 0, 0
    for i in range(vertices):
        if isinf(distance[i]):
            continue
        if max_v < distance[i]:
            max_v = distance[i]
            bridge_v = i

    graph_bfs(bridge_v)
    max_v = 0
    for j in range(vertices):
        if isinf(distance[j]):
            continue
        max_v = max(max_v, distance[j])

    return max_v


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    vertices = int(_input[0])
    v_info = map(lambda x: x.split(), _input[1:])

    queue = deque()
    distance = [float('inf')] * vertices

    init_adj_table = tuple(dict() for _ in range(vertices))
    adj_table = generate_adj_table(v_info)

    init_v = 0
    print(solve())

Measured memory_bytes: 59712
#include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;

int main()
{
  double a,b,c,h,S,C;

  cin>>a>>b>>C;
  S=(a*b*sin((C/180)*M_PI))/2;
  printf("%.8f\n",S);
  c=sqrt(a*a+b*b-2*a*b*cos((C/180)*M_PI));
  printf("%.8f\n",a+b+c);
  h=2*S/a;
  printf("%.8f\n",h);
  return 0;
}

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

using namespace std;

int main()
{
    int N;
    int ans;

    cin >> N;

    if (N == 1) {
        ans = 1;
    } else {
        ans = N * (N+1) / 2;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#define rep(i,x) for(int i = 0; i < x; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> ivec;
const ll N = 1e9+7;

string s;
int dfs(int i,int sum){
    if(i == s.size()+1) return sum;
    int d = s[i] - '0';
    

}

int main(){
    cin >> s;
    int len = s.size();
    int op2[3] = {};
    rep(i,(1 << (len-1))){
        int op[3] = {};
        int sum = 0;
        sum += s[0] - '0';
        // cout << "test" << endl;
        for(int j = len - 2;j >= 0; j--){
            if(1 & (i >> j)){
                op[2-j] = 1;
                sum += s[3-j] - '0';
                // cout << i << ' ' << j << endl;
            }
            else{
                op[2-j] = 0;
                sum -= s[3-j] - '0';
                // cout << i << ' ' << j << endl;
            }
        }
        if(sum == 7) {
            rep(i,3) op2[i] = op[i];
            break;
        }
    }
    string ans;
    rep(i,3){
        if(op2[i] == 1) ans.push_back('+');
        else ans.push_back('-');
    }
    rep(i,len-1){
        cout << s[i] << ans[i];
    }
    cout << s[3] << "=7" << endl;
    return 0;
}

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

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

    if(N%10==0 || N%10==1 || N%10==6 || N%10==8){
        cout << "pon" << endl;
    }else if(N%10 == 3){
        cout << "bon" << endl;
    }else{
        cout << "hon" << endl;
    }
}

Measured memory_bytes: 3100
#include "bits/stdc++.h"
using namespace std;
using     ll=long long;
using    vll=vector<   ll>;
using   vvll=vector<  vll>;
using  vvvll=vector< vvll>;
using vvvvll=vector<vvvll>;
constexpr ll INF = 1LL << 60;
struct Fast{ //cin,cout高速化のおまじない＋桁数指定
	Fast(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(std::numeric_limits<double>::max_digits10); }
} fast;
#define rep(i, S, E)  for (ll i = (S); i <= (E); i++)
#define dep(i, E, S)  for (ll i = (E); i >= (S); i--)
#define each(e, v) for (auto&& e : v)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; }return false; }
template<class T> inline T MaxE(vector<T>&v,ll S,ll E){ T m=v[S]; rep(i,S,E)chmax(m,v[i]); return m; }
template<class T> inline T MinE(vector<T>&v,ll S,ll E){ T m=v[S]; rep(i,S,E)chmin(m,v[i]); return m; }
template<class T> inline T MaxE(vector<T> &v) { return MaxE(v,0,(ll)v.size()-1); }
template<class T> inline T MinE(vector<T> &v) { return MinE(v,0,(ll)v.size()-1); }
template<class T> inline T Sum(vector<T> &v,ll S,ll E){ T s=T(); rep(i,S,E)s+=v[i]; return s; }
template<class T> inline T Sum(vector<T> &v) { return Sum(v,0,v.size()-1); }
template<class T> inline ll sz(T &v){ return (ll)v.size(); }
template<class T> inline T POW(T a, ll n){ T r=1; for (; n>0; n>>=1, a*=a){ if (n&1)r*=a; } return r; }
inline ll POW(int a, ll n){ return POW((ll)a, n); }
inline ll CEIL(ll a, ll b){ return (a+b-1)/b; }



void solve()
{
	ll n;  cin >> n;
	vector<ll> x(n);  rep(i,0,n-1){ ll x_; cin>>x_; x[i]=x_; }

	ll ans=INF;
	rep(p,1,100){
		ll sum=0;
		rep(i,0,n-1){
			sum+=(x[i]-p)*(x[i]-p);
		}
		chmin(ans,sum);
	}
	cout << ans << '\n';
}


int main(){
#if 1
	solve();
#else
	ll t;  cin >> t;
	rep(i, 0, t-1){
		solve();
	}
#endif
	return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>

int main(void){

  int n,m;
  scanf("%d %d", &n, &m);
  int k[n];
  int a[n][m];
  for (int i = 0; i < n; i++) {
    scanf("%d", &k[i]);
    for (int j = 0; j < k[i]; j++) {
      scanf("%d", &a[i][j]);
    }
  }

  int like[m];
  for (int i = 0; i < m; i++) {
    like[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < k[i]; j++) {
      like[a[i][j]-1]++;
    }
  }
  int count = 0;
  for (int i = 0; i < m; i++) {
    if (like[i] == n) {
      count++;
    }
  }
  printf("%d\n", count);

  return 0;
}

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

int main(){
    int n;
    int ac=0;
    int wa=0;
    int tle=0;
    int re=0;
    cin>>n;

    for(int i=0;i<n;i++){
        string str;
        cin>>str;
        if(str=="AC"){
            ac++;
        }
        if(str=="WA"){
            wa++;
        }
        if(str=="TLE"){
            tle++;
        }
        if(str=="RE"){
            re++;
        }
    }
    cout<<"AC x "<<ac<<endl;
      cout<<"WA x "<<wa<<endl;
        cout<<"TLE x "<<tle<<endl;
          cout<<"RE x "<<re<<endl;

}

Measured memory_bytes: 3596
#include<iostream>
#include<cstdlib>
#include<utility>
#include<tuple>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<queue>
#include<deque>
#include<bitset>
#include<cmath>
#include<map>
using namespace std;
using ll = long long int;
const ll mod = 1e9 + 7;

int main() {

	int n;
	string s;
	cin >> n >> s;

	if (n % 2 != 0) {
		cout << "No" << endl;
		return 0;
	}

	int m = n / 2;
	for (int i = 0; i < n / 2; i++) {
		if (s[i] != s[i + m]) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

	return 0;
}

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

long long dp[3][100010];

void Main() {
  int n, k, r, s, p;
  string t;
  cin >> n >> k >> r >> s >> p;
  cin >> t;

  memset(dp, 0, sizeof(dp));
  for (int i = 1; i <= k; i++) {
    for (int j = i; j <= n; j += k) {
      if (t[j - 1] == 'r') {
        dp[0][j] = max(dp[1][max(j - k, 0)], dp[2][max(j - k, 0)]);
        dp[1][j] = max(dp[0][max(j - k, 0)], dp[2][max(j - k, 0)]);
        dp[2][j] = max(dp[0][max(j - k, 0)] + p, dp[1][max(j - k, 0)] + p);
      }
      if (t[j - 1] == 's') {
        dp[0][j] = max(dp[1][max(j - k, 0)] + r, dp[2][max(j - k, 0)] + r);
        dp[1][j] = max(dp[0][max(j - k, 0)], dp[2][max(j - k, 0)]);
        dp[2][j] = max(dp[0][max(j - k, 0)], dp[1][max(j - k, 0)]);
      }
      if (t[j - 1] == 'p') {
        dp[0][j] = max(dp[1][max(j - k, 0)], dp[2][max(j - k, 0)]);
        dp[1][j] = max(dp[0][max(j - k, 0)] + s, dp[2][max(j - k, 0)] + s);
        dp[2][j] = max(dp[0][max(j - k, 0)], dp[1][max(j - k, 0)]);
      }
    }
  }

  long long ans = 0;
  for (int i = n; i > n - k; i--) {
    ans += max(dp[0][i], max(dp[1][i], dp[2][i]));
  }
  cout << ans << endl;
}

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


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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define mp make_pair
#define ll long long
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 100010
#define inf 1e9

int main()
{

    ll n, k;
    cin >> n >> k;
    vector<ll> v;
    ll vf=n,vs;
    while(1)
    {

        if(vf==0) break;
        vf=vf/k;
        vs=vf%k;
        v.pb(vs);
    }
    cout << v.size();
}


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

#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define INF 2000000000000000000
#define endl "\n"
#define _time_ 1.0 * clock() / CLOCKS_PER_SEC
#define popcount(x) __builtin_popcountll(x)
#define pll pair<ll,ll> 
#define ld long double

const int M=1000000007;
const int MM=998244353;
const long double PI = acos(-1);

ll power(ll b,ll e,ll m)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b%m,e/2,m)%m;
    return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b,e/2);
    return power(b*b,e/2);
}
template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }
template<typename T, typename U> ostream& operator<<(ostream &os, const pair<T, U> &p)
{ 
    return os<<'('<<p.F<< ","<<p.S<<')'; 
}

int _runtimeTerror_()
{
    ll n;
    cin>>n;
    vector<ll> a(n),b(n);
    for(int i=0;i<n;++i)
        cin>>a[i];
    for(int i=0;i<n;++i)
        cin>>b[i];
    vector<pll> v;
    map<int,int> cnt;
    int mx = -1;
    int el = -1;
    for(int i=0;i<n;++i)
    {
        if(a[i]==b[i])
        {
            ++cnt[a[i]];
            v.pb({a[i],i});
            if(cnt[a[i]]>mx)
                el = a[i];
            amax(mx,cnt[a[i]]);
        }
    }
    sort(all(v));
    int l = sz(v);
    if(2*mx<=l)
    {
        for(int i=0;i<l;++i)
        {
            b[v[i].S] = v[(i+l/2)%l].F;
        }
        cout<<"Yes\n";
        for(int i=0;i<n;++i)
            cout<<b[i]<<" ";
        return 0;
    }
    vector<pll> x,y;
    for(int i=0;i<l;++i)
    {
        if(v[i].F==el)
            x.pb(v[i]);
        else
            y.pb(v[i]);
    }
    assert(sz(y)==l-mx);
    for(int i=0;i<l-mx;++i)
    {
        b[x[i].S] = y[i].F;
        b[y[i].S] = x[i].F;
    }
    y.clear();
    reverse(all(x));
    for(int i=0;i<l-mx;++i)
        x.pop_back();
    for(int i=0;i<n;++i)
    {
        if(a[i]==b[i])
            continue;
        if(a[i]!=el && b[i]!=el)
            y.pb({b[i],i});
    }
    if(sz(y)<sz(x))
    {
        cout<<"No\n";
        return 0;
    }
    for(int i=0;i<sz(x);++i)
    {
        b[x[i].S] = y[i].F;
        b[y[i].S] = x[i].F;
    }
    cout<<"Yes\n";
    for(int i=0;i<n;++i)
        cout<<b[i]<<" ";
    return 0;
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #ifdef runSieve
        sieve();
    #endif
    #ifdef NCR
        initialize();
    #endif
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--)
        _runtimeTerror_();
    return 0;
}

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

using namespace std;

long long gcd(long long a, long long b)
{
  if(b==0) return a;
  a%=b;
  return gcd(b,a);
}

long long d(long long n)
{
    if(n==1) return 1;
    long long c=0;
    for(long long i=2;i*i<=n;++i)
    {
        if(n%i==0)
        {
            ++c;
            while(n%i==0){
                n/=i;
            }
        }
    }
    if(n>1)
    {
        c+=2;
    }
    if(n==1)
    {
        c+=1;
    }
return c;
}


int main()
{
  long long a,b;
  cin>>a>>b;
  cout<<d((gcd(a,b)))<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int n;
  cin >> n;
  int x=(n+1000-1)/1000;
  cout << x*1000-n << endl;
  return 0;
}


Measured memory_bytes: 3612
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ULL unsigned long long
#define LL long long
#define Max 1000005
#define mem(a,b) memset(a,b,sizeof(a));
#define pb push_back
#define mp make_pair
#define input ios::sync_with_stdio(false);cin.tie(0);
#define debug printf("debug!!!\n");
const LL mod=1e9+7;
const ULL base=131;
const LL LL_MAX=9223372036854775807;
using namespace std;
LL a[Max],b[Max];
int n;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=(n+1);i++)
        scanf("%lld",&a[i]);
    for(int i=1;i<=n;i++)
        scanf("%lld",&b[i]);
    LL ans=0;
    for(int i=1;i<=n;i++){
        if(a[i]>b[i])
            ans+=b[i];
        else{
            ans+=a[i];
            b[i]=b[i]-a[i];
            if(b[i]!=0){
                if(b[i]>=a[i+1]){
                    ans+=a[i+1];
                    a[i+1]=0;
                }else{
                    ans+=b[i];
                    a[i+1]-=b[i];
                }

            }

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


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

using namespace std;

char strr[101];
long long int k,i,c=0,m;

int main()
{
    cin >> strr >> k;;
    
    if (strr[0]!='1')
        cout << strr[0] << endl;
    else
    {
        for (i=0;i<k;i++)
        {
            if (strr[i]=='1')
            {
                c++;
            }
            else
            {
                m=i;
                break;
            }
        }
        if (k<(m+1))
            cout << 1 << endl;
        else
            cout << strr[m] << endl;
    }

}


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

int main() {
    int n;
    cin >> n;
    ll sum =0;
    vector<int> a(n+2);
    a[0]=0;
    a[n+1]=0;
    for(int i = 1; i <= n; i++) {
        cin >> a[i] ;
    }
    vector<int> b(n);
    for(int i = 0; i < n; i++) {
        sum += abs(a[i+1]-a[i]);
        b[i] = abs(a[i+2]-a[i+1])+abs(a[i+1]-a[i])-abs(a[i+2]-a[i]);
    }
    sum += abs(a[n]);

    for(int i = 0; i < n; i++) {
        cout << sum - b[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 4016
N,Y=map(int,input().split())
ans=0

nax=Y//1000

if N==nax:
    print(0,0,nax)
    exit()
elif N>nax:
    print(-1,-1,-1)
    exit()
else:
    for i in range(nax//10+1):
        for j in range(nax//5+1):
            if nax-10*i-5*j>=0 and nax-9*i-4*j==N:
                print(i,j,nax-10*i-5*j)
                exit()
print(-1,-1,-1)

Measured memory_bytes: 8916
//おまじない
#include <iostream>
#include<iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

const int maxn=100000;

int main(){
    
    ll n;
    ll city[maxn+1];
    ll can[maxn];
    ll ans=0;
    
    cin >> n;
    rep(i,n+1){
        cin >> city[i];
    }
    rep(i,n){
        cin >> can[i];
    }
    
    rep(i,n){
        if(city[i]<can[i]){
            ans+=city[i];
            ll rest = can[i]-city[i];//iの余力
            if(city[i+1]>rest){
                ans+=rest;
                city[i+1]-=rest;
            }else{
                ans+=city[i+1];
                city[i+1]=0;
            }
        }else{
            ans+=can[i];
        }
    }
    
    cout << ans<<endl;
    
    
    
    return 0;
}


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

int h,w,d,n;
string g[100];
int r[100], x, y, s;

bool vis[100][100];
bool exist[100][100];
const int dy[] = {-1,0,1,0}, dx[] = {0,1,0,-1};

void dfs(int a, int b){
  if(vis[a][b])return;
  vis[a][b] = true;

  for(int i=0;i<4;i++){
    int na = a+dy[i], nb = b+dx[i];
    if(na<0 || nb<0 || na>=h || nb>=w)continue;
    if(g[na][nb]!='#')dfs(na,nb);
  }
}

int main(){
  cin >> h >> w >> d >> n;
  for(int i=0;i<h;i++)cin >> g[i];

  memset(vis,0,sizeof(vis));
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(g[i][j] == 'D')dfs(i,j);
    }
  }

  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      exist[i][j] = (g[i][j]!='#');
    }
  }

  for(int i=0;i<d;i++)cin >> r[i];

  for(int t=0;t<n;t++){
    cin >> x >> y >> s;
    int a_out, b_out, a_in, b_in;
    int l_out, r_out, l_in, r_in;
    if(s==d){
      a_out = 0, b_out = h-1;
      l_out = 0, r_out = w-1;
    }else{
      a_out = max(0, y-r[s]), b_out = min(h-1,y+r[s]);
      l_out = max(0, x-r[s]), r_out = min(w-1,x+r[s]);
    }

    if(s==0){
      a_in = y+1, b_in = y-1;
      l_in = x+1, r_in = x-1;
    }else{
      a_in = y-r[s-1], b_in = y+r[s-1];
      l_in = x-r[s-1], r_in = x+r[s-1];
    }

    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	if(i<a_out || b_out<i || j<l_out || r_out<j)exist[i][j] = false;
	else if(a_in<=i && i<=b_in && l_in<=j && j<=r_in)exist[i][j] = false;
      }
    }
  }

  bool can = false, cannot = false;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(vis[i][j] && exist[i][j])can = true;
      if(!vis[i][j] && exist[i][j])cannot = true;
    }
  }

  if(can && cannot)cout << "Unknown" << endl;
  if(can && !cannot)cout << "Yes" << endl;
  if(!can && cannot)cout << "No" << endl;
  if(!can && !cannot)cout << "Broken" << endl;
}
  

Measured memory_bytes: 1360
import itertools
import sys

def delete(ya,xa,lis):
    lis[ya][xa] = 0
    move = [[-1,0],[0,-1],[1,0],[0,1]]
    for x,y in move:
        if 0<=xa+x<=11 and 0<=ya+y<=11 and lis[ya+y][xa+x]=='1':
            delete(ya+y,xa+x,lis)

def sol(a,b,lis):
    for i,j in itertools.product(xrange(12),repeat=2):
        if lis[i][j]=='1':
            m[i][j] = 1
            delete(i,j,lis)

while True:
    try:
        l = [[ 0 for i in xrange(12) ] for j in xrange(12) ]
        m = [[ 0 for i in xrange(12) ] for j in xrange(12) ]
        d = []
        for i in xrange(12):
            d.append(list(raw_input()))
        sol(0,0,d)
        print sum([1 for e in m for f in e if f])
        raw_input()
    except:
        break

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

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

  ll N; cin >> N;
  ll Q; cin >> Q;

  priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> u;
  priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> l;
  for (ll i = 0; i < Q; i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 1) {
      u.push({b, i});
    } else {
      l.push({b, i});
    }
  }

  ll black = (N - 2) * (N - 2);
  while(!u.empty()) {
    bool ng = false;
    pair<int, int> tu = u.top();
    while (!l.empty()) {
      pair<int, int> tl = l.top();
      if (tu.second < tl.second) {
        l.pop();
        black -= (tu.first - 2);
      } else {
        swap(u, l);
        ng = true;
        break;
      }
    }
    if (!ng) {
      black -= (N - 2);
      u.pop();
    }
  }

  black -= (N - 2) * l.size();

  ll ans = black;
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 5232
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
#define reverse(v) reverse(v.begin(),v.end())
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,0,n) cin >> a[i];

    rep(i,0,n-k){
        if(a[i] < a[k+i]){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 4024
#include <iostream>
#include <stdio.h>
using namespace std;

int main(void) {
	int a,b;
	char op;

	while(1){
		cin >> a >> op >> b;
		if(op == '?') break;
		if(op == '+') cout << a+b <<endl;
		if(op == '-') cout << a-b <<endl;
		if(op == '/') cout << a/b <<endl;
		if(op == '*') cout << a*b <<endl;
	}	
	return 0;
}


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

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  
  if (A * N < B) {
    cout << A * N << endl;
  }
  else if (A * N > B || A * N == B) {
    cout << B << endl;
  }
}

Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <iterator>
#include <bitset>
#include <random>
#include <assert.h>
#include <unordered_map>
#include <array>

#ifdef _MSC_VER
#include <agents.h>
#endif

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define X first
#define Y second
#define MP make_pair
#define umap unordered_map

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> P;
typedef unsigned int uint;

vector<string> v;

const ll MOD = 1e8 + 7;
ll dp[10][10][60000][3];
int R, C;

int thr[11];

inline int get(int x, int pos){
	return x / thr[pos] % 3;
}

inline int ins(int x, int pos, int val){
	return x + (val - get(x, pos))*thr[pos];
}

int rec(int r, int c, int x, int left){
	if (r == R) return !x;
	if (c == C) return left?0:rec(r + 1, 0, x, 0);

	ll &res = dp[r][c][x][left];
	if (res >= 0) return res;

	res = 0;
	if (v[r][c] == '.'){
		if (!(get(x, c) && left)) res = rec(r, c + 1, x, left);
	}
	else{
		int rest = v[r][c] - '0';
		rest -= get(x, c) + left;
		for (int right = 0; right < 3; ++right){
			for (int down = 0; down < 3; ++down){
				if (right + down != rest) continue;
				res += rec(r, c + 1, ins(x, c, down), right);
				res %= MOD;
			}
		}
	}

	return res;
}

int main(){
	thr[0] = 1;
	for (int i = 1; i < 11; ++i){
		thr[i] = thr[i - 1] * 3;
	}

	cin >> R >> C;
	v.resize(R);
	rep(i, R) cin >> v[i];

	MEMSET(dp, -1);
	cout << rec(0, 0, 0, 0) << endl;

	return 0;
}

Measured memory_bytes: 141852
#include <iostream>
#include <vector>
using namespace  std;
int main(){
    int N;
    int max = 0,cnt = 0;
    cin >> N;
    int H[N];
    for(int i=0;i<N;i++){
        cin >> H[i];
    }
    
    for(int i=0;i<N;i++){
        if(max <= H[i]){
            cnt++;
            max = H[i];
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
string s,t;
int check(int i,int j){
	int ans=0;
	for(int k=0;k<(int)t.size();k++)
		if(s[i+k]!=t[j+k])
			ans++;
	return ans;
}
int main() {
	cin>>s>>t;
	int mn=s.size();
	for(int i=0;i<=s.size()-t.size();i++){
		int now=check(i,0);
		mn=min(mn,now);
	}
	printf("%d\n",mn);
	return 0;
}


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

#define LL long long
#define db double
typedef pair<int, int> pii;
#define X first
#define Y second

template < typename T > inline void read(T & x) {
	int ch = getchar();
	bool fg = false;
	for(x = 0; !isdigit(ch); ch = getchar()) {
		if(ch == '-') {
			fg = true;
		}
	}
	for( ; isdigit(ch); ch = getchar()) {
		x = x * 10 + ch - '0';
	}
	if(fg) {
		x = -x;
	}
}

const int MAXN = 100100;
const int INF = 0x3f3f3f3f;
#define db double
#define eps 1e-8

db a[MAXN], ave, dif = 1e20;
int n;

signed main() {
	read(n);
	for(int i = 0; i < n; i++) read(a[i]), ave += a[i];
	ave /= (db) n;
	int ans = 0;
	for(int i = 0; i < n; i++) {
		if(fabs(a[i] - ave) < dif - eps) {
			ans = i;
			dif = fabs(a[i] - ave);
		}
	}
	printf("%d\n", ans);
	return 0;
} 

Measured memory_bytes: 256
import java.awt.*;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.util.List;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int N = nextInt();
        int[] A = new int[N];
        int[] B = new int[N];
        int[] C = new int[N];

        for(int i=0; i<N; i++){
            A[i] = nextInt();
        }
        for(int i=0; i<N; i++){
            B[i] = nextInt();
        }
        for(int i=0; i<N-1; i++){
            C[i] = nextInt();
        }

        int count = 0;
        for(int i=0; i<N; i++){
            count += B[A[i]-1];
            if(i != 0 && A[i]-A[i-1]==1){
                count += C[A[i-1]-1];
            }
        }

        println(count);
    }

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

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

    static String next() {
        return sc.next();
    }

    static String nextLine(){
        return sc.nextLine();
    }

    static void println(Object o) {
        out.println(o);
        out.flush();
    }

    static void print(Object o) {
        PrintWriter out = new PrintWriter(System.out);
        out.print(o);
        out.flush();
    }
}


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

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(g);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()


typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;

#ifdef TESTING
#define DEBUG fprintf(stderr,"====TESTING====\n")
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define DEBUG 
#define VALUE(x)
#define debug(...)
#endif
/*
inline string IntToString(ll a) {
	char x[100];
	sprintf_s(x, "%lld", a); string s = x;
	return s;
}

inline ll StringToInt(string a) {
	char x[100]; ll res;
	strcpy_s(x, a.c_str()); sscanf_s(x, "%lld", &res);
	return res;
}
*/

inline string uppercase(string s) {
	int n = SIZE(s);
	rep(i, n) if (s[i] >= 'a' && s[i] <= 'z') s[i] = s[i] - 'a' + 'A';
	return s;
}

inline string lowercase(string s) {
	int n = SIZE(s);
	rep(i, n) if (s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';
	return s;
}


int main()
{
	int a, b, ans = 0;
	cin >> a >> b;
	REP(i, a, b+1) {
		REP(j, 1, 10) {
			rep(k, 10) {
				rep(l, 10) {
					if (i == ((10001 * j) + (k * 100) + (1010 * l))) {
						ans++;
						//cout << i << endl;
					}
				}
				
			}
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  int n = 0;
  cin>>s;
  for(int i = 0;i<3;i++){
    if (s.at(i) == '1'){
      n++;
    }
  }
  cout<<n<<endl;
}


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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
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;
}
long long dp[100010][3];
  
int main()
{
  int N;
  cin >> N;
  vector<vector<int>> A(N,vector<int>(3));
  REP(i, N){
    REP(j, 3){
      cin >> A.at(i).at(j);
    }
  }
  
  REP(i,N){
    REP(j,3){
      REP(k,3){
        if(j==k){
          continue;
        }
        chmax(dp[i+1][k],A[i][k]+dp[i][j]);
      }
    }
  }

  ll MAX = 0;
  REP(i,3){
    MAX = max(MAX,dp[N][i]);
  }
  cout << MAX << endl;
}

Measured memory_bytes: 8064
#ifdef __GNUC__
#pragma GCC target("avx2")
#pragma GCC optimize ("O20")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC optimize("unroll-loops")
#define iss std::cin
#endif
#include "bits/stdc++.h"
#define rep(i, times) for(ll i = 0; i < (times); ++i)
#define p(x) (cout << x << "\n")
using ll = int_fast64_t; using namespace std;

#ifndef __GNUC__
string text =
R"X(1500 2000 500 90000 100000)X";
stringstream iss{text};
#endif

int main( ) {
	cin.tie(0);	ios::sync_with_stdio(0);
	ll A, B, C, X, Y; iss >> A >> B >> C >> X >> Y;
	ll bXY = max(X, Y) * 2 + 1;
	ll price{LLONG_MAX};
	rep(c, bXY) {
		ll a = max(X - c / 2, 0l);
		ll b = max(Y - c / 2, 0l);
		price = min(price, a * A + b * B + c * C);
	}
	p(price);
}

Measured memory_bytes: 3612
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize(4)
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pi acos(-1.0)
#define LL long long
//#define mp make_pair
#define pb push_back
#define ls rt<<1, l, m
#define rs rt<<1|1, m+1, r
#define ULL unsigned LL
#define pll pair<LL, LL>
#define pli pair<LL, int>
#define pii pair<int, int>
#define piii pair<pli, int>
#define mem(a, b) memset(a, b, sizeof(a))
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fopen freopen("in.txt", "r", stdin);freopen("out.txt", "w", stout);
//head

const int N = 1e5 + 10;
int a[N];
vector<int> co;
int main() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    sort(a, a+n);

    if(n&1) {
        co.pb(-1);
        co.pb(-1);
        for (int i = 2; i < n; i++) {
            if(i&1) co.pb(-2);
            else co.pb(2);
        }
        sort(co.begin(), co.end());
        LL ans = 0;
        for (int i = 0; i < n; i++) ans += co[i]*a[i];
        co.clear();
        co.pb(1);
        co.pb(1);
        for (int i = 2; i < n; i++) {
            if(i&1) co.pb(2);
            else co.pb(-2);
        }
        sort(co.begin(), co.end());
        LL tans = 0;
        for (int i = 0; i < n; i++) tans += co[i]*a[i];
        ans = max(tans, ans);
        printf("%lld\n", ans);
    }
    else {
        co.pb(1);
        co.pb(-1);
        for (int i = 2; i < n; i++) {
            if(i&1) co.pb(-2);
            else co.pb(2);
        }
        sort(co.begin(), co.end());
        LL ans = 0;
        for (int i = 0; i < n; i++) ans += co[i]*a[i];
        printf("%lld\n", ans);
    }


    return 0;
}


Measured memory_bytes: 1276
#include <bits/stdc++.h>
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define MP make_pair
#define PB push_back
#define int long long
using namespace std;

typedef long long ll;

class UnionFind
{
  public:
    vector<ll> parent, size;

    UnionFind(int length)
    {
        parent.resize(length);
        size.resize(length);
        for (ll i = 0; i < length; i++)
        {
            parent[i] = i;
            size[i] = 1;
        }
    }

    int root(int x)
    {
        if (x == parent[x])
            return x;
        else
            return parent[x] = root(parent[x]);
    }

    void unite(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x == y)
            return;

        if (size[x] >= size[y])
        {
            parent[y] = x;
        }
        else
        {
            parent[x] = y;
        }
        size[x] = size[y] = size[x] + size[y];
    }

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

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

signed main()
{
    int  n, m;
    int a[100000] = {}, b[100000] = {};
    ll res[100000] = {};
    cin >> n >> m;
    FOR(i, 0, m)
    {
        cin >> a[i] >> b[i];
    }
    UnionFind uf(n + 1);
    res[m-1] = (long long)(n * (n - 1) / 2);
    for (ll i = m-1; i >0; i--)
    {
        res[i-1] = uf.root(a[i]) != uf.root(b[i]) ?res[i] - (ll)(uf.siz(a[i]) * uf.siz(b[i])): res[i];
        uf.unite(a[i], b[i]);
    }
    
    FOR(i, 0, m)
    {
        // cout << uf.parent[i] << endl;
        cout << ((res[i] < 0) ? 0 : res[i]) << endl;
    }
    return 0;
}

Measured memory_bytes: 5248
/*
tags:[贪心][排序][预处理]
贪心地选取一些连续的夏日，在这些连续的夏日里使用冬胎。
a[i]: 第i个冬日，出现在第几天。
b[i] = a[i+1] - a[i] － 1表示两个相邻的冬日之间有多少个连续的夏日。
显然，我们希望连续的夏日时间越短越好，故对b从小到大排序。
*/
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector> 
using namespace std;
const int NICO = 200000 + 10;
vector<int> vec[100];int n, m;
int res = 0, a[10];
void dfs(int used[], int x)
{
    int ok = 1;used[x] = 1;
    for(int i=1;i<=n;i++)
    {
        if(!used[i]) ok = 0;
    }
    if(ok) {res ++;return;}
    for(int i=0;i<vec[x].size();i++)
    {
        int cur = vec[x][i];
        if(used[cur]) continue;
        int b[10];for(int j=1;j<=n;j++) b[j]=used[j];
        dfs(b, cur);
    }
}
int main()
{
    cin >> n >> m;
    for(int i=1;i<=m;i++)
    {
        int a, b;cin >> a >> b;
        vec[a].push_back(b);
        vec[b].push_back(a);
    }
    dfs(a, 1);
    cout << res << endl;
}

Measured memory_bytes: 256
import java.lang.*;
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		int[][] grid = new int[h][w];
		for(int i=0;i<h;++i){
			String s = sc.next();
			for(int j=0;j<w;++j){
				if (s.charAt(j) == '#')
					grid[i][j] = 1;
				else
					grid[i][j] = 0;
			}
		}

		int[][] dp = new int[h][w];
		dp[0][0] = 0;
		for(int i=0;i<h;++i){
			for(int j=0;j<w;++j){
				if (i==0 && j==0) continue;
				if (i==0){
					if (grid[i][j-1] == 1 && grid[i][j] == 0)
						dp[i][j] = dp[i][j-1]+1;
					else
						dp[i][j] = dp[i][j-1];
					continue;
				}
				if (j==0){
					if (grid[i-1][j] == 1 && grid[i][j] == 0)
						dp[i][j] = dp[i-1][j]+1;
					else
						dp[i][j] = dp[i-1][j];
					continue;
				}
				if (grid[i][j] == 0){
					if (grid[i-1][j] == 1 && grid[i][j-1] == 1){
						dp[i][j] = Math.min(dp[i-1][j],dp[i][j-1]) + 1;
					}
					else if (grid[i-1][j] == 1){
						dp[i][j] = Math.min(dp[i-1][j] + 1,dp[i][j-1]);
					}
					else if(grid[i][j-1] == 1){
						dp[i][j] = Math.min(dp[i-1][j],dp[i][j-1]+1);
					}
					else
						dp[i][j] = Math.min(dp[i-1][j],dp[i][j-1]);
				}
				else
					dp[i][j] = Math.min(dp[i-1][j],dp[i][j-1]);
			}
		}
		System.out.println(grid[h-1][w-1] == 0 ? dp[h-1][w-1] : dp[h-1][w-1]+1);
	}
}

Measured memory_bytes: 24020
gets
xy = gets.split.map(&:to_f).zip( gets.split.map(&:to_f) ).map{ | x, y | ( x - y ).abs }
( 1..3 ).each do | p |
  puts xy.map{ | xy | xy ** p }.inject(:+) ** ( 1.0 / p )
end
puts xy.max

Measured memory_bytes: 6204
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int INF = pow(2,29);
const int MOD = 1000000007;

int main() {
  int N, K; cin >> N >> K;
  double result = 0;
  for(int i=1; i<=N; i++) {
    int num=0; while (pow(2,num)*i<K) {num++;};
    result += pow(0.5,num)/N;
  }
  cout << fixed << setprecision(10) << result << endl;
  return 0;

}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll lcs[3005][3005];


string LCS(string s, string t){
	ll n = s.length(), m = t.length();
	
	for(ll i = 1;i<=n;i++)
	for(ll j = 1;j<=m;j++)
	lcs[i][j] = 1;
	lcs[0][0] = 0;
	for(ll i = 1;i<=n;i++){
		for(ll j = 1;j<=m;j++){
			if(s[i-1] == t[j-1]){
				lcs[i][j] = 1+lcs[i-1][j-1];				
			}
			else{
				lcs[i][j] = max(lcs[i-1][j], lcs[i][j-1]);
			}
		}
	}
			
	string ans ="";

	while(n>0 && m>0){
		if(s[n-1] == t[m-1]){
			ans+=s[n-1];
			n--;m--;
		}
		else if(lcs[n-1][m] > lcs[n][m-1])
			n--;
		else
			m--;
	}
	
	return string(ans.rbegin(), ans.rend());
}

int main(){
	string s,t;
	cin>>s>>t;
	cout<<LCS(s,t)<<endl;
}
	

Measured memory_bytes: 70656
#include<stdio.h>
int n,A[50];

int solve(int i,int m){
	if(m==0)return 1;
	if(i>=n)return 0;
	int res=solve(i+1,m)||solve(i+1,m-A[i]);
	return res;
	}

int main(){
	int q,M,i;
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&A[i]);
	scanf("%d",&q);
	for(int i=0;i<q;i++){
		scanf("%d",&M);
		if(solve(0,M))printf("yes\n");
		else printf("no\n");
		}
		return 0;
		}

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

# ans = 0
# for v in range(1, N + 1):
#     if v > N // 2:
#         ans += v
#     else:
#         ans += (v + (N // v) * v) * (N // v) // 2
# print(ans)

ans = 0
for v in range(1, N // 2 + 1):
    ans += (v + (N // v) * v) * (N // v) // 2
ans += (N // 2 + 1 + N) * (N - N // 2) // 2
print(ans)

Measured memory_bytes: 9104
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;

int main() {
    int64_t a; double b;  cin >> a >> b;
    int64_t bb = floor(100 * b+0.01);
    int64_t ans = (a * bb) / 100;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3828
X, Y, A, B, C = map(int, input().split())
P = sorted(list(map(int, input().split())), reverse=True)[:X]
Q = sorted(list(map(int, input().split())), reverse=True)[:Y]
R = sorted(list(map(int, input().split())), reverse=True)
print(sum(sorted(P+Q+R, reverse=True)[:X+Y]))

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

int main(){
    long long n;
    cin >> n;
    long long ans = 0,a[n];
    for(int i = 0;i < n;i++){
        cin >> a[i];
    }
    for(int i = 1;i < n;i++){
        if(a[i] < a[i - 1]){
            //cout << a[i - 1];
            ans += a[i - 1] - a[i];
            a[i] = a[i - 1];
        }
    }

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

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

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

char a[12][12];
bool searched[12][12];
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};

void dfs(int x,int y){
	// cout << x << " " << y << endl;
	searched[x][y] = true;
	REP(i,4){
		int nx = x + dx[i];
		int ny = y + dy[i];
		if(nx < 0 || ny < 0 || nx >= 12 || ny >= 12) continue;
		if(a[nx][ny] == '1' && searched[nx][ny] == false) dfs(nx,ny);
	}
}
int main(){
	while(1){
		REP(i,12) REP(j,12) searched[i][j] = false;
		REP(i,12){
			string s; 
			cin >> s;
			if(cin.eof()) return 0;
			REP(j,s.size()) a[i][j] = s[j];
		}
		int ans = 0;
		REP(i,12){
			REP(j,12){
				if(a[i][j] == '1' && searched[i][j] == false){
					ans++;
					dfs(i,j);
				} 
			}
		}
		cout << ans << endl;
	}

}

Measured memory_bytes: 1184
#include <stdio.h>
#include <math.h>
#include <string.h>

int gcd(int a,int b){
    if(a<b){
        int now=a;
        a=b;
        b=a;
    }

    int r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }

    return b;
}




int main(void){
    int n;
    scanf("%d",&n);
    int goal=0;
    int start=10000;



    int i;
    for(i=0;i<n;i++){
        int now;
        scanf("%d",&now);

        if(now<start){
            start=now;
        }
        if(goal<now){
            goal=now;
        }
    }

    printf("%d\n",goal-start);

    return 0;
}

Measured memory_bytes: 1716
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int x;
  cin>>x;
  string s;
  cin>>s;
  int n=s.length();
  int i=0,j=n-1,ans=0;
  while(i<j)
  {
    if(s[i]=='R')
      i++;
    if(s[j]=='W')
      j--;
    if(s[i]=='W'&&s[j]=='R')
    {
      s[i]='R';
      s[j]='W';
      ans++;
      i++;
      j--;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3680
x=int(input())

if 400<=x<=599:
  print(8)
if 600<=x<=799:
  print(7)
if 800<=x<=999:
  print(6)
if 1000<=x<=1199:
  print(5)
if 1200<=x<=1399:
  print(4)
if 1400<=x<=1599:
  print(3)
if 1600<=x<=1799:
  print(2)
if 1800<=x<=1999:
  print(1)

Measured memory_bytes: 9192
n = int(input())
t = [0] * (n+1)
x = [0] * (n+1)
y = [0] * (n+1)

for i in range(1,n+1):
    t[i], x[i], y[i] = map(int, input().split())

ans = 'Yes'
for i in range(1,n+1):
    time_diff = t[i] - t[i-1]
    x_diff = abs(x[i] - x[i-1])
    y_diff = abs(y[i] - y[i-1])
    if (time_diff < x_diff+y_diff or (time_diff-x_diff-y_diff)%2 != 0):
        ans = 'No'

print(ans)

Measured memory_bytes: 11636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
const int M = 1e7;
int si[] = {-1, 0, 1, 0};
int sj[] = {0, -1, 0, 1};

int main(){
  int n, a, b;
  cin >> n >> a >> b;
  int c = 0;

  bool flag = true;
  while(1){
    if(a == 1 && b == 2){
      if(flag){
        cout << "Borys" << endl;
        return 0;
      }
    }

    if(b == n && a == n-1){
      if(!flag){
        cout << "Alice" << endl;
        return 0;
      }
    }

    if(c >= 50000) {
      cout << "Draw" << endl;
      return 0;
    }

    if(flag){
      if(a+1 != b) a++;
      else a--;
    } else {
      if(b-1 != a) b--;
      else b++;
    }
    flag = !flag;
  }

  return 0;
}


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

bool is_prime(int x) {
    bool res = true;
    for (int i = 2; i <= sqrt(x); i++) if (x % i == 0) res = false;
    return res;
}

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

    for (int i = 0, j = 0; i < n; i++, j++) {
        while (!is_prime(j*5+2)) j++;
        cout << j*5+2 << " ";
    }
}


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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

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

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

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

int main() {
    int a,b;cin >> a >> b;
    int mi = min(a,b);
    int ma = max(a,b);
    for(int i=0;i<ma;i++){
        cout << mi;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e9
#define all(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define max(v) *max_element(v.begin(), v.end())
#define min(v) *min_element(v.begin(), v.end())
using namespace std;

void call(int n){
  int i = 1;
 CHECK_NUM:
  int x = i;
  if ( x % 3 == 0 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
 INCLUDE3:
  if ( x % 10 == 3 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
  x /= 10;
  if ( x ) goto INCLUDE3;
 END_CHECK_NUM:
  if ( ++i <= n ) goto CHECK_NUM;

  cout << endl;
}

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

    int n;
    cin>>n;
//    call(n);
    int cnt = 1;
    while(cnt <= n){
        int tmp = cnt;
        if(cnt%3 == 0){
            cout<<" "<<cnt;
        }
        else if(cnt %10 == 3){
            cout<<" "<<cnt;
        }
        else{
            while(tmp >= 10){
                tmp /= 10;
                if(tmp %10 == 3){
                    cout<<" "<<cnt;
                    break;
                }
            }
        }
        cnt += 1;
    }
    cout<<endl;

    return 0;
}


Measured memory_bytes: 3220
X, Y = map(int,input().split())
ans = 'No'
if 4*X < Y:
    print(ans)
else:
    for i in range(1,X+1):
        crane = i
        turtle = X - i
        crane2 = X - i
        turtle2 = i
        if 2*crane + 4*turtle == Y or 2*crane2 + 4*turtle2 == Y:
            ans = 'Yes'
            break
    print(ans)

Measured memory_bytes: 9192
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
int main(){
    vector<int> time(5);
    int lastIndex = -1;
    int last = 0;
    int min = 10;
    for(auto i = time.begin(); i < time.end(); i++){
        cin >> *i;
        int r =  *i % 10;
        if(r != 0 && min > r){
            min = r;
            lastIndex = distance(time.begin(), i);
            last = *i;
        }
    }
    int sum;
    if(lastIndex != -1){
        time.erase(time.begin() + lastIndex);
        for(auto i = time.begin(); i < time.end(); i++){
            if(*i % 10 != 0)
                *i += (10 - *i % 10);
        }
        sum = accumulate(time.begin(), time.end(), 0) + last;
    }else{
        sum = accumulate(time.begin(), time.end(), 0);
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256