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

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);

#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 ALL(a) (a).begin(), (a).end()
#define DEBUG(x) cout << #x << ": " << x << endl

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long K, std::vector<long long> A) {
  REP(i, N - K) {
    if (A[i] < A[i + K]) {
      cout << YES << endl;
    } else {
      cout << NO << endl;
    }
  }
}

int main() {
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, K, std::move(A));
  return 0;
}


Measured memory_bytes: 4840
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
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;}

int main() {
    int n;
    ll k;
    cin >> n >> k;
    vector<pair<int,int>>s;
    rep(i,n) {
        int a,b;
        cin >> a >> b;
        s.push_back(make_pair(a,b));
    }
    sort(s.begin(),s.end());
    ll sum = 0;
    int ans = 0;
    rep(i,n) {
        sum += s[i].second;
        if(sum >= k) {
            ans = s[i].first;
            break;
        }
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 4232
n = input()

x = len(n)-1


if n[x] == "2" or n[x] == "4" or n[x] == "5" or n[x] == "7" or n[x] == "9":
  print("hon")
  
elif n[x] == "0" or n[x] =="1" or n[x] == "6" or n[x] == "8":
  print("pon")
else:
  print("bon")

Measured memory_bytes: 9020
/* ex2_3
   L40S38*/

#include <stdio.h>

int main(void) {
  int N,A ;
  scanf("%d\n",&N);//N*Nのマス目
  scanf("%d",&A);//Aマスを白く塗る
  printf("%d",N*N-A); 
  return 0;
}


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

using namespace std;

typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);


void ask(int x, char res[]){
  dout(x);
  fflush(stdout);
  scanf("%s", res);
  if(res[0] == 'V')exit(0);
}

int main(){
  int n, st, en;
  char res[11], pivot;
  si(n);
  ask(0, res);
  pivot = res[0];
  st = 0;
  en = n - 1;
  while(st < en - 1){
    trace(st, en);
    int mid = (st + en)/2;
    ask(mid, res);
    if((res[0] == pivot) ^ ((mid-st)%2!=0)){
      st = mid;
      pivot = res[0];
    }
    else{
      en = mid;
    }
  }
  ask(st + 1, res);
  return 0;
}


Measured memory_bytes: 852
/********************************************************
  **░██████╗██╗░░░░░░█████╗░██╗░░░██╗██╗░█████╗░░██████╗░**
  **██╔════╝██║░░░░░██╔══██╗██║░░░██║██║██╔══██╗██╔════╝░**
  **╚█████╗░██║░░░░░███████║╚██╗░██╔╝██║██║░░╚═╝██║░░██╗░**
  **░╚═══██╗██║░░░░░██╔══██║░╚████╔╝░██║██║░░██╗██║░░╚██╗**
  **██████╔╝███████╗██║░░██║░░╚██╔╝░░██║╚█████╔╝╚██████╔╝**
  **╚═════╝░╚══════╝╚═╝░░╚═╝░░░╚═╝░░░╚═╝░╚════╝░░╚═════╝░**
  *********************************************************/

#include <bits/stdc++.h>
using namespace std;


#define ll                          long long
#define ld                          long double

#define forn(i,n)                   for(int i=0;i<n;++i)
#define all(v)                      v.begin(), v.end()
#define rall(v)                     v.rbegin(),v.rend();
#define isSubstring(s1,s2)          s1.find(s2) != std::string::npos
	
#define pb                          push_back
#define pf                          push_front
#define mp                          make_pair
#define fr                          first
#define sc                          second

#define vpi                         <vector<pair<int,int>>
#define vi                          vector<int>
#define sz(a)                       (int)a.size()

#define   endl                       "\n"
#define     nl                       cout<<"\n";
#define fastio                       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define MN                           INT_MIN
#define MX                           INT_MAX


bool isPrime(ll n){if(n<2)return false;for(ll x = 2;x*x <=n;x++){if(n%x == 0)return false;}return true;}
bool isPerfectSquare(long double x){long double sr=sqrt(x);return((sr-floor(sr))==0);}
int gcd(int a, int b){if(a==0)return b;if(b==0) return a;if(a==b)return a;if(a>b)return gcd(a-b,b);return gcd(a,b-a);}


int32_t main()
{
	int n;
	string a,b;
	cin >> n >> a >> b;
	string s = "";
	for(int i=  0;i<n;i++){
		s += a[i];
		s+= b[i];
	}
	cout << s << endl;
}

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

using namespace std;

int main() {
  int L;
  cin >> L;
  int sink = 0;
  vector< pair< pair<int, int>, int> > edge;
  for (int i = 1; i < 20; i++) {
    if (L > (1 << i) - 1) {
      sink = i;
      edge.emplace_back(make_pair(i - 1, i), 0);
      edge.emplace_back(make_pair(i - 1, i), 1 << (i - 1));
    }
  }

  int w = L;
  for (int i = 0; i < sink; i++) {
    if (1 << i & L) {
      w -= 1 << i;
      edge.emplace_back(make_pair(i, sink), w);
    }
  }

  cout << sink + 1 << " " << edge.size() << "\n";
  for (auto e : edge) {
    cout << e.first.first + 1 << " ";
    cout << e.first.second + 1 << " ";
    cout << e.second << "\n";
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int w,h,x,y,u,v,a,_[]={0,1,0,-1};
	string s;
	while(cin>>w>>h,w)
	{
		a=x=y=1;
		for(;;)
		{
			cin>>s;
			if(s=="STOP")break;
			else if(s=="RIGHT")a=(a+1)%4;
			else if(s=="LEFT")a=(a+3)%4;
			else
			{
				cin>>v;
				u=(s=="FORWARD"?0:2);
				x+=v*_[(a+u+3)%4];
				y+=v*_[(a+u)%4];
				if(x<1)x=1;if(x>w)x=w;if(y<1)y=1;if(y>h)y=h;
			}
		}
		cout<<x<<' '<<y<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

x,y,a,b,c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

pq = p[:x] + q[:y]
pq.sort()
i = 0
while i<x+y and i < c and pq[i]<r[i]:
    i += 1
ans = r[:i] + pq[i:]
s = sum(ans)
print(s)


Measured memory_bytes: 104676
#include <bits/stdc++.h>
using namespace std;
// for(long long i = 0;i < num; i++){}
int main() {
    //
    int num, que;
    int cnt = 0;
    int st, end;
    string str;

    cin >> num >> que >> str;

    vector<int> vec(num+1, 0);

    for (int i = 0; i < num; i++) {
        if (i < num-1 && str.at(i) == 'A' && str.at(i + 1) == 'C') vec.at(i+1)= vec.at(i) + 1;
        else vec.at(i+1)  = vec.at(i);
    }

    for (int i = 0; i < que; i++) {
        cin >> st >> end;
        st--;
        end--;

        cout << vec.at(end) - vec.at(st) << endl;
    }

    //
}


Measured memory_bytes: 3824
#include <iostream>

using namespace std;

long long count(long long n, long long x) {
    if (n == -1) {
        return 0;
    } else {
        return n / x + 1;
    }
}

int main() {
    long long a, b, x;
    cin >> a >> b >> x;
    long long res = count(b, x) - count(a - 1, x);
    cout << res << endl;
}

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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

int main()
{    
    

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li n;

    cin>>n;

    li ans=0;

    string s=to_string(n);

    if(s[0]=='7')
    ans=1;  

    if(s[1]=='7')
    ans=1;  

    if(s[2]=='7')
    ans=1; 

if(ans)
    cout<<"Yes";
else
    cout<<"No";

    return 0;
}

Measured memory_bytes: 3680
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define vii vector < pii >
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class P , class Q > ostream& operator<<(ostream& stream, pair < P , Q > v){ stream << "(" << v.fi << ',' << v.se << ")"; return stream;}
template < class T > ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream;}
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
const int N = 1e6 + 5;
vi g[N];
int d[N];
int color[N];
int main(void) {
    int n;
    cin>>n;
    for (int i = 1;i < n;++i) {
    	int u,v;
    	cin>>u>>v;
    	g[u].pb(v);
    	g[v].pb(u);
    	++d[u];++d[v];
    }
    multiset < pii > S;
    for (int i = 1;i <= n;++i)
    	S.insert(mp(d[i],i));
    vi c(n);
    for (auto & it : c)
    	cin>>it;
   	ll ans = 0;
    sort(all(c),greater < int > ());
    while (!S.empty()) {
    	int node = S.begin()->se;
    	S.erase(S.begin());
    	color[node] = c.back();
    	ans += 1ll * color[node] * d[node];
    	c.pop_back();
    	for (auto it : g[node]) {
    		--d[it];
    		if (!color[it]) {
    			S.erase(S.find(mp(d[it] + 1,it)));
    			S.insert(mp(d[it],it));
    		}
    	} 
    }
    cout << ans << '\n';
    for (int i = 1;i <= n;++i)
    	cout << color[i] << " \n"[i == n];
    return 0;
}

Measured memory_bytes: 28416
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
using PPI=pair<P,int>;
ll const mod=998244353;
const ll MAX=200000;
using vi=vector<int>;
using vl=vector<ll>;
using vc=vector<char>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using vb=vector<bool>;
using vvi =vector<vector<int>>;
using vvd=vector<vector<double>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
using vvb=vector<vector<bool>>;
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}


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

int main(){
    int n;
    cin>>n;
    vl t(n);
    rep(i,n)cin>>t[i];
    ll tmp=0;
    ll lcm=1;
    rep(i,n){
        tmp=gcd(t[i],lcm);
        lcm/=tmp;
        lcm*=t[i];   
    }
    cout<<lcm<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>

#define endl "\n"

using namespace std;

long long int l, r, i, j, a;

int main(){

    cin >> l >> r;
    int x = 2018;


    for(i = l; i <= r; i++){
        for(j = i+1; j<=r; j++){
            a = (i*j)%2019;
            if (a < x){
                x = a;
            }
            if(x == 0){
                cout << 0;
                return 0;
            }
        }
    }

    cout << x;

}

//g++ -std=c++14 comp.cpp; ./a.exe


Measured memory_bytes: 256
//============================================================================
// Name        : Test.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {

	int rooms[5][4][11];
	int b,f,r,v;
	int n;

	for (int i = 1; i <= 4;i++)
		for(int j = 1; j  <= 3; j++)
			for(int k = 1; k <= 10; k++)
				rooms[i][j][k] = 0;

	cin >> n;

	for(int i = 0; i < n ; i++){
		cin >> b >> f >> r >> v;
		rooms[b][f][r] += v;
	}

	for (int i = 1; i <= 4;i++){
		for(int j = 1; j  <= 3; j++){
			for(int k = 1; k <= 10; k++){
				cout << " " << rooms[i][j][k];
			}
			cout << endl;
		}
		if(i < 4)cout << "####################" << endl;
	}
		return 0;
}

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

void solve() {
  int n;
  cin >> n;
  vector<pair<int, int>> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first >> a[i].second;
  }
  for (int i = 2; i < n; ++i) {
    if (a[i].first == a[i].second && a[i - 1].first == a[i - 1].second && a[i - 2].first == a[i - 2].second) {
      cout << "Yes\n";
      return;
    }
  }
  cout << "No\n";
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int t = 1;
  // cin >> t;
  while (t--) solve();
  
  return 0;
}


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

using namespace std;

typedef long long int64;
const int64 INF = 1LL << 59;

int64 seg[1 << 20], sz;

int64 rmq(int a, int b, int k, int l, int r)
{
  if(a >= r || b <= l) return (INF);
  if(a <= l && r <= b) return (seg[k]);
  return (min(rmq(a, b, 2 * k + 1, l, (l + r) >> 1), rmq(a, b, 2 * k + 2, (l + r) >> 1, r)));
}

void Calculation()
{
  int N, x, a[4000];

  cin >> N >> x;
  for(int i = 0; i < N; i++) {
    cin >> a[i];
    a[i + N] = a[i];
  }

  sz = 1;
  while(sz < N + N) sz <<= 1;
  fill_n(seg, 2 * sz - 1, INF);
  for(int i = 0; i < N + N; i++) seg[i + sz - 1] = a[i];
  for(int i = sz - 2; i >= 0; i--) seg[i] = min(seg[2 * i + 1], seg[2 * i + 2]);


  int64 ret = INF;
  for(int i = 0; i <= N; i++) {
    int64 cost = 1LL * i * x;
    for(int j = N; j < N + N; j++) {
      cost += rmq(j - i, j + 1, 0, 0, sz);
    }
    ret = min(ret, cost);
  }

  cout << ret << endl;
}

int main()
{
  Calculation();
}

Measured memory_bytes: 384
from collections import Counter
n=int(input())
x=[]
y=[]
for i in range(n):
  a,b=map(int,input().split())
  x.append(a)
  y.append(b)
cost=n
list=[]
for i in range(n):
  for j in range(n):
    if i != j:
      list.append([x[i]-x[j],y[i]-y[j]])

if n ==1:
  print(cost)
else:
  c=Counter(map(tuple, list))
  mode=c.most_common(1)
  print(cost-mode[0][1])


Measured memory_bytes: 4084
#include <iostream>
#include <vector>
#include <deque>

using namespace std;

int main()
{
    long long n, m = 1LL << 40;
    cin >> n; ++n;
    while (n < m)
    m >>= 1;
    deque<int> que;
    // que.push_back(1);
    m >>= 1;
    int i = 0;
    while (m)
    {
        que.push_back(++i);
        if (n & m)
            que.push_front(++i);
        else
        ;
            // que.push_front(++i);
        m >>= 1;
    }
    cout << 2 * i << endl;
    for (auto i : que)
    cout << i << ' ';
    for (int j = 1; j <= i; ++j)
    cout << j << ' ';
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
  
typedef long long ll; 
typedef pair<ll, ll> pll;
typedef vector<ll> vl; 
typedef vector<vl> vvl; 
 
#define MOD 1000000007  
#define ffor(a, b, c) for (ll(a) = (b); (a) < (c); ++(a)) 
#define fforsq(a, b, c) for (ll(a) = (b); (a) * (a) <= (c); ++(a)) 
 
#define rep(i, n) ffor(i, 0, n) 
#define ff first 
#define ss second  
#define pb push_back 
#define ALL(v) v.begin(), v.end() 
#define ALLA(arr, sz) arr, arr + sz 
#define SIZE(v) (int)v.size() 
#define SORT(v) sort(ALL(v)) 
#define REVERSE(v) reverse(ALL(v)) 
#define SORTA(arr, sz) sort(ALLA(arr, sz)) 
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz)) 
#define TC(t) while (t--) 
#define N 200005
#define inf 1e18

int main(){
    ll i,j,k,m,n,a,b,c,q,t,r,sum,num,ans,ind;
    cin>>n>>k;
    vl v(n);
    vl dp(n,inf);
    rep(i,n){
        cin>>v[i];
    }
    dp[0] = 0; dp[1] = abs(v[1] - v[0]);
    ffor(i,2,n){
        ffor(j,1,k+1){
            if(i-j>=0){
                dp[i] = min(dp[i],abs(v[i]-v[i-j])+ dp[i-j]); 
            }
            else break;
        }
    }
    cout<<dp[n-1];
}

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

int main()
{
    int N;
    int red = 0, blue = 0;
    cin >> N;

    for (int i = 0; i < N; i++)
    {
        char s_i;
        cin >> s_i;
        if (s_i == 'R')
            red++;
        else
            blue++;
    }

    if (red > blue)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

	int m, f, r;
	
	while (1) {

		scanf("%d %d %d", &m, &f, &r);
		if (m == -1 && f == -1 && r == -1) {
			break;
		}

		if (m == -1 || f == -1 || m + f < 30) {
			puts("F");
		}
		else if (80 <= m + f) {
			puts("A");
		}
		else if (65 <= m + f && m + f < 80) {
			puts("B");
		}
		else if (50 <= m + f && m + f < 65 || 30 <= m + f && m + f < 50 && 50 <= r) {
			puts("C");
		}
		else if (30 <= m + f && m + f < 50) {
			puts("D");
		}
		
	}

	return 0;
}




Measured memory_bytes: 2036
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long long unsigned llu;
typedef pair<ll, ll> P;//change when necessary
typedef long double ld;
#define mp make_pair
#define N ll(1e5 + 5)//change it
#define M ll(0)
const ll OO = 1e18;
const ll md = 1e9 + 7;
ll X[] = { 0,0,1,-1 }, Y[] = { 1,-1,0,0 };
void fast()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}
vector<int>v[N];
ll a[N], n, res = 0, t[N], x, y, m, cnt = 1;
void dfs(int pos)
{
	t[pos] = cnt;
	for (auto u : v[pos])
		if (!t[u])
			dfs(u);
}
int main()
{
	scanf("%lld%lld", &n, &m);
	for (int i = 1; i <= n; i++)
		scanf("%lld", &a[i]);
	for (int i = 0; i < m; i++)
		scanf("%lld%lld", &x, &y),
		v[x].push_back(y),
		v[y].push_back(x);
	for (int i = 1; i <= n; i++)
		if (!t[i])
			dfs(i), cnt++;
	for (int i = 1; i <= n; i++)
		if (t[i] == t[a[i]] || a[i] == i)
			res++;
	printf("%lld\n", res);
	return 0;
}

Measured memory_bytes: 9344
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

vector<int> divisors(int n) {
    vector<int> res;
    for(int i = 1; i*i <= n; ++i) {
        if(n % i != 0) continue;
        res.push_back(i);
        if(n/i == i) continue; // 上の行で追加済み。
        res.push_back(n/i);
    }
    return res;
}

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	vector<int> b(n);
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
		b[i]=a[i];
	}

	vector<int> ans;
	
	for(int i=n-1;i>=0;i--)
	{
		if(b[i]==1)
		{
			ans.push_back(i+1);
			vector<int> nx=divisors(i+1);
			for(int j=0;j<nx.size();j++)
			{
				b[nx[j]-1]+=1;
				b[nx[j]-1]%=2;
			}
		}
	}
		

	cout << ans.size() << endl;
	for(int i=0;i<ans.size();i++)
		cout << ans[i] << endl;

	




}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 100100100100
#define inf 2001001001
#define MOD 1000000007
#define ALL(x) begin(x),end(x)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vii = vector<int>;
using vll = vector<ll>;
template<class T>using vv = vector<T>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
int dy[]={0, 1, -1, 0};
int dx[]={1, 0, 0, -1};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}
void show(const vector<ll> &a) {
  rep(i, 0, a.size()) {
    cout << a[i] << (i != a.size()-1 ? " " : "\n"); 
  }
}
ll xpowy(ll x, ll y) {
  ll res = 1LL;
  while (y > 0) {
    if ((y & 1))
      res = res * x % MOD;
    x = x * x % MOD;
    y >>= 1;
  }
  return res;
}
string s;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> s;
    int n = (int)s.size();
    vll a(n), c(n), l(n), r(n);
    rep(i, 1, n) {
      a[i] = a[i-1] + (s[i-1] == 'A');
      l[i] = l[i-1] + (s[i-1] == '?');
    }
    eper(i, n-2, 0) {
      c[i] = c[i+1] + (s[i+1] == 'C');
      r[i] = r[i+1] + (s[i+1] == '?');
    }
    ll ans = 0;
    rep(i, 1, n-1) {
      if (s[i] == '?' || s[i] == 'B') {
        ans = (ans + a[i] * c[i] % MOD * xpowy(3, l[i] + r[i]) % MOD) % MOD;
        ans = (ans + l[i] * c[i] % MOD * xpowy(3, l[i] + r[i] - 1) % MOD) % MOD;
        ans = (ans + a[i] * r[i] % MOD * xpowy(3, l[i] + r[i] - 1) % MOD) % MOD;
        ans = (ans + l[i] * r[i] % MOD * xpowy(3, l[i] + r[i] - 2) % MOD) % MOD;
      } 
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3664
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

const int N = 2010;
const int M = N * 5;
string a, b, c;
bool ab[M], ac[M], bc[M];

int match(char a, char b) {
	return a == b || a == '?' || b == '?';
}

int main() {
	cin >> a >> b >> c;
	int len_a = a.size(), len_b = b.size(), len_c = c.size();

	for (int i = 0; i < len_a; i++)
		for (int j = 0; j < len_b; j++)
			if (!match(a[i], b[j]))
				ab[i - j + 2 * N] = true;
	for (int i = 0; i < len_a; i++)
		for (int j = 0; j < len_c; j++)
			if (!match(a[i], c[j]))
				ac[i - j + 2 * N] = true;
	for (int i = 0; i < len_b; i++)
		for (int j = 0; j < len_c; j++)
			if (!match(b[i], c[j]))
				bc[i - j + 2 * N] = true;

	int res = M;
	for (int i = -(len_b + len_c); i <= len_a + max(len_b, len_c); i++)
		for (int j = -(len_b + len_c); j <= len_a + max(len_b, len_c); j++)
			if (!ab[i + 2 * N] && !ac[j + 2 * N] && !bc[j - i + 2 * N]) {
				int L = min(0, min(i, j));
				int R = max(len_a, max(len_b + i, len_c + j));
				res = min(res, R - L);
			}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
import itertools as I
from collections import Counter as C
n=int(input());s=input();l=s[:n];r=s[n:][::-1];a=C();b=C()
for i in I.product([0,1],repeat=n):
 t=u=v=w=''
 for j in range(n):
  if i[j]:t+=l[j];u+=r[j]
  else:v+=l[j];w+=r[j]
 a[t,v]+=1
 b[u,w]+=1
print(sum(a[i]*b[i]for i in a.keys()))

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

int main(){
  int N;
  cin >> N;
  map<string,int> A;
  for(int i=0;i<N;i++){
    string S;
    cin >> S;
    A[S]++;
  }
  cout << "AC x " << A["AC"] << endl;
  cout << "WA x " << A["WA"] << endl;
  cout << "TLE x " << A["TLE"] << endl;
  cout << "RE x " << A["RE"] << endl;
} 

Measured memory_bytes: 3596
using System;

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var s = Console.ReadLine().ToCharArray();
            var t = Console.ReadLine().ToCharArray();

            int cnt = 0;
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] != t[i])
                {
                    cnt++;
                }
            }

            Console.WriteLine(cnt);

            Console.Out.Flush();
        }
    }
}


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

int main(int argc, char *argv[])
{
    string map[10] = {"", ".,!? ", "abc", "def", "ghi", "jkl", "mno",
        "pqrs", "tuv", "wxyz"};
    string line;
    int n, cnt, num;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> line;
        cnt = 0;
        for (int j = 0; j < line.length(); ++j) {
            if (line[j] == '0') {
                if (j == 0 || line[j - 1] == '0')
                    continue;
                num = line[j - 1] - '0';
                cout << map[num][(cnt - 1) % map[num].length()];
                cnt = 0;
            } else if (line[j] != '0') {
                cnt++;
            }
        }
        cout << endl;
    }
    return 0;
}

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

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    double sum = 0.0;
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
        sum += 1.0 / (double)A.at(i);
    }

    cout << 1 / sum << endl;
}

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

using namespace std;

int main() {
    int n, *p;
    cin >> n;   p = new int[n];
    for (int i = 0; i < n; i++)
        cin >> p[i];
    sort(p, p+n);
    int ans = p[n-1] / 2;
    for (int i = 0; i < n-1; i++)
        ans += p[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import bisect
import sys
import math

n = int(input())
array = sorted([int(x) for x in input().split()])
if n == 2:
    print(array[1], array[0])
    sys.exit()

half = math.ceil(array[-1]/2)
pos = bisect.bisect_left(array, half)
_dict = {}
_dict[abs(half - array[pos])] = array[pos]
_dict[abs(half - array[pos-1])] = array[pos-1]
_dict[abs(half - array[pos+1])] = array[pos+1]

res = _dict[min(_dict.keys())]
print(array[-1], res)


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

using namespace std;

#define ll long long

const int N=1e6+5;

int m,n,k,ans,l,r,u,v,x,tc,y,q,sz,d,a[N];


char s[N];

int main(){ 
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
   
    double sum=0;
    scanf("%d",&n);
    priority_queue <double,vector<double>,greater<double> > pq;
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]),pq.push((double)a[i]);
    while((int)pq.size()>1){
        double x=pq.top();
        pq.pop();
        x=(x+pq.top())/2;
        pq.pop();
        pq.push(x);
    }
    printf("%.6lf\n",pq.top());

}




Measured memory_bytes: 256
import sys
 
NIL = -1
 
class Node:
    def __init__(self, key):
        self.key = key
        self.parent = NIL
        self.left = NIL
        self.right = NIL
 
class Tree:
    def __init__(self):
        self.root = NIL
 
    def insert(self, z):
        y = NIL
        x = self.root
 
        while x != NIL:
            y = x
 
            if z.key < x.key:
                x = x.left
            else:
                x = x.right
 
        z.parent = y
 
        if y == NIL:
            self.root = z
        elif z.key < y.key:
            y.left = z
        else:
            y.right = z

    def find(self, value, node):
        if node == NIL:
            return False
        elif node.key == value:
            return True
        elif value < node.key:
            # print('go to left')
            return self.find(value, node=node.left)
        else:
            # print('go to right')
            return self.find(value, node=node.right)
 
    def inorder_walk(self, node):
        if node == NIL:
            return None
 
        if node.left != NIL:
            self.inorder_walk(node=node.left)
 
        print(' ' + str(node.key), end='')
 
        if node.right != NIL:
            self.inorder_walk(node=node.right)
 
    def preorder_walk(self, node):
        if node == NIL:
            return None
 
        print(' ' + str(node.key), end='')
 
        if node.left != NIL:
            self.preorder_walk(node=node.left)
 
        if node.right != NIL:
            self.preorder_walk(node=node.right)
 
    def show(self):
        self.inorder_walk(self.root)
        print()
        self.preorder_walk(self.root)
        print()
 
 
n = int(sys.stdin.readline())
T = Tree()
 
for i in range(n):
    line = sys.stdin.readline().split()
     
    if len(line) == 1:
        T.show()
    elif line[0] == 'find':
        value = int(line[1])
        print('yes' if T.find(value, T.root) else 'no')
    else:
        key = int(line[1])
 
        T.insert(Node(key))

Measured memory_bytes: 124952
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll L;
	while(cin>>L) {
		double l=L/3.0;
		cout<<setprecision(20)<<l*l*l<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define L(x) ((x) & -(x))
std::vector<int> e['   '];
int n, m, s['   '], a;
void U(int x, int u) {
  while (x <= n)
    s[x] += u, x += L(x);
}
int Q(int x) {
  int r = 0;
  while (x)
    r += s[x], x -= L(x);
  return r;
}
int main() {
  scanf("%d%d", &m, &n);
  for (int i = 1, l, r; i <= m; i++)
    scanf("%d%d", &l, &r), e[r - l + 1].push_back(l);
  for (int d = 1; d <= n; d++) {
    a = m;
    for (int i = d; i <= n; i += d)
      a += Q(i);
    for (int u : e[d])
      U(u, 1), U(u + d, -1), m--;
    printf("%d\n", a);
  }
  return 0;
}

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

def comb(n, r):
    result = 1
    for i in range(r):
        result = int(result * (n - i) / (i + 1))

    return result

# Nを取得
n = int(input())

# Aiを取得
a_list = list(map(int, input().split()))

# 昇順にソートしたAiを取得
a_sorted = sorted(a_list)

# 最大値およびその1/2の値を取得
a_max = max(a_sorted)

# comb(n,r)が最大になるrを取得
r = 0
d_min = a_max + 1
for a in a_sorted:
    d = abs(a_max - (2 * a))
    if d < d_min:
        d_min = d
        r = a
    else:
        break

# c = comb(a_max, r)

# 結果を出力
print("{} {}".format(a_max, r))


Measured memory_bytes: 14052
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  string w;
  cin >> w;
  unordered_map<char, int> mp;
  rep(i, w.size()) mp[w[i]]++;

  bool f = true;
  for(auto p : mp) {
    int tmp = p.second;
    if(tmp%2 != 0) f = false;
  }
  yorn(f);
  return 0;
}

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

int main(){
  int n, m;
  cin >> n >> m;
  vector<vector<int> > v(n, vector<int>(m));
  vector<int> a(m);
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      cin >> v[i][j];
    }
  }
  for(int i=0;i<m;i++){
    cin >> a[i];
  }

  for(int i=0;i<n;i++){
    int sum=0;
    for(int j=0;j<m;j++){
      sum += v[i][j] * a[j];
    }
    cout << sum << endl;
  }

  return 0;
}

Measured memory_bytes: 1256
#include<iostream>
#include<cstdio>
#include<string>
#include<queue>
#include<algorithm>

using namespace std;

queue<int> Q;
int N;
bool PATH[101][101] = {false};
int len[101];

void BFS(int id){
    Q.pop();
    for (int i = 1; i <= N; i++) {
        if (PATH[id][i]) {
            if (len[i] > len[id] + 1) {
                len[i] = len[id] + 1;
                Q.push(i);
            }
        }
    }
}

void BFS_m(){
    while (!Q.empty()) {
        BFS(Q.front());
    }
}

int main(){
    Q.push(1);
    cin >> N;
    for (int i = 1; i <= N; i++) {
        int bb;
        int n;
        cin >> bb;
        cin >> n;
        for (int k = 0; k < n; k++) {
            int s;
            cin >> s;
            PATH[i][s] = true;
        }
    }
    for (int i = 1; i <= N; i++) len[i] = 2000000000;
    len[1] = 0;
    
    BFS_m();
    
    for (int i = 1; i <= N; i++) {
        if (len[i] == 2000000000) len[i] = -1;
        printf("%d %d\n",i,len[i]);
    }
    
    return 0;
}

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

#include <iostream>
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <deque>
#include <string>
#include <algorithm>
#include <map>


#include <iostream>

#include <fstream>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <deque>
#include <string>
#include <algorithm>
#include <map>



int getTheAnswer() {
    return 42;
}

template< class InputIt>
void incAll(const InputIt &first, const InputIt &last){
  for(auto it = first; it != last; ++it){
    ++*it;
  }
}

template <class InputIt>
void printAll(const InputIt &first, const InputIt &last, std::ostream& out){
  for(InputIt it = first; it != last; ++it){
    out << *it << " ";
  }
}

// only for positive integers
int gcd(int a, int b){
  int tmp;
  if(a < b){
    tmp = a;
    a = b;
    b = tmp;
  }
  while(b != 0){
    tmp = a;
    a = b;
    b = tmp % b;
  }
  return a;
}

int lcm(int a, int b){
  return abs(a*b) / gcd(a, b);
}


using namespace std;
class TaskB {
public:
	void solve(std::istream& in, std::ostream& out) {
    ios::sync_with_stdio(false);
		long long int n, res;
		in >> n;
		res = 1;
		while(n > 1){
			res = (res * n--) % 1000000007;
		}
		out << res << endl;
	}
};


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


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

using namespace std;

int main() {
	int n = 0;
	int x = 0;
	int m[100] = {0};
	int donuts = 0;
	
	scanf("%d %d", &n, &x);
	
	for (int i = 0; i < n; i++) {
		scanf("%d", &m[i]);
	}
	
	// 現在使用した粉の量
	int use_powder = 0;
	
	// まず一個ずつ作る
	for (int i = 0; i < n; i++) {
		use_powder += m[i];
		donuts++;
	}
	
	// xが小さすぎるとき
	if (use_powder > x) {
		printf("xの入力が不適切\n");
		return -1;
	}
	
	// 残りの粉
	int another_powder = x - use_powder;
	
	int min = m[0];
	for (int i = 1; i < n; i++) {
		if (min > m[i]) {
			min = m[i];
		}
	}
	
	donuts += another_powder / min;
	
	printf("%d\n", donuts);
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    #include <math.h>
 
    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    # define M_PI  3.14159265358979323846
 
 
    const int M=1e9+7;
    long long mod(long long x){
        return ((x%M + M)%M);
    }
    long long add(long long a, long long b){
        return mod(mod(a)+mod(b));
    }
    long long mul(long long a, long long b){
        return mod(mod(a)*mod(b));
    }

    void solve(){
        int n,x,t;
        cin>>n>>x>>t;
        int total=0;
        if(n%x==0)
            total=(n/x)*t;
        else{
            total=(n/x);
            total++;
            total*=t;
        }
        cout<<total;
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
//        freopen("timber_input.txt", "r", stdin);
//        freopen("timber_output.txt", "w", stdout);
        int t=1;
        // cin>>t;
        for(int i=1;i<=t;i++){
//            cout<<"Case #"<<i<<": ";
            solve();
        }
        return 0;
    }

Measured memory_bytes: 3648
use std::io;


fn main() {

    let mut abc = read::<usize>();
    abc.sort();
    abc.reverse();
    let x = abc[0] * 10 + abc[1];
    let y = abc[2];
    println!("{}", x + y);
}

#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
N = int(input())
if N % 2 == 1:
    print(((N - 1)** 2) // 2)
    for i in range(1, N):
        for j in range(i + 1, N + 1):
            if not i + j == N:
                print(i, j)
else:
    print(((N - 2) * N) // 2)
    for i in range(1, N):
        for j in range(i + 1, N + 1):
            if not i + j == N + 1:
                print(i,j)
                    


Measured memory_bytes: 3612
<?php
$s = str_split(trim(fgets(STDIN)));
$n = count($s);

$ans = 0;
$i = 0;
while($i < $n){
 if($i % 2 == 0){
  if($s[$i] == "p"){
   --$ans;
  }
 }else{
  if($s[$i] == "g"){
   ++$ans;
  }
 }
++$i;
}

echo $ans . PHP_EOL;
?>

Measured memory_bytes: 21008
import java.io.*;
import java.util.*;
import java.util.function.DoublePredicate;
import java.util.function.DoubleUnaryOperator;
 
public class Main{
	public void solve(){
		int H = nextInt();
		int W = nextInt();
		int A = nextInt();
		int B = nextInt();
		init();
		long ans = 0;
		int x = B + 1;
		int y = H - A;
		while(x <= W && y > 0){
			ans = (ans + ncr(x + y - 2, x - 1) * ncr((W - x) + (H - y), (W - x))) % mod;
			
			
			x++;
			y--;
		}
		out.println(ans);
	}
	
	long mod = 10_0000_0007;

	long bpow(long a,long b){
		return b != 0 ? bpow(a*a%mod,b/2) * ((b&1) != 0?a:1)%mod : 1;
	}

	long[] f = new long[200100];
	long[] invf = new long[200100];

	void init(){
		f[0] = invf[0] = 1;
		for(int i = 1 ; i < 200100 ; i++)
			f[i] = (f[i-1] * i % mod);
		for(int i = 1 ; i < 200100 ; i++)
			invf[i] = bpow(f[i],mod-2);
	}

	long ncr(int n,int r){
		if( n < r ) return 0;
		return f[n] * invf[n-r] % mod * invf[r] % mod;
	}
	
	private static PrintWriter out;
	public static void main(String[] args){
		out = new PrintWriter(System.out);
		new Main().solve();
		out.flush();
	}
	
	
	
	public static int nextInt(){
		int num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10 + (c - '0');
		}
		return minus ? -num : num;
	}
	
	public static long nextLong(){
		long num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10l + (c - '0');
		}
		return minus ? -num : num;
	}
	public static String next(){
		int c;
		while(!isAlNum(c = read())){}
		StringBuilder build = new StringBuilder();
		build.append((char)c);
		while(isAlNum(c = read())){
			build.append((char)c);
		}
		return build.toString();
	}
	
	
	private static byte[] inputBuffer = new byte[1024];
	private static int bufferLength = 0;
	private static int bufferIndex = 0;
	private static int read(){
		if(bufferLength < 0) throw new RuntimeException();
		if(bufferIndex >= bufferLength){
			try{
				bufferLength = System.in.read(inputBuffer);
				bufferIndex = 0;
			}catch(IOException e){
				throw new RuntimeException(e);
			}
			if(bufferLength <= 0) return (bufferLength = -1);
		}
		return inputBuffer[bufferIndex++];
	}
	
	private static boolean isAlNum(int c){
		return '!' <= c && c <= '~';
	}
}

Measured memory_bytes: 11348
#include <bits/stdc++.h>
using namespace std;
const int n = 1e5+5;
int N, K;

int main(){
	cin >> N >> K;
	string s;
	cin >> s;
	K--;
	if(s[K] >= 'A' && s[K] <= 'Z'){
		s[K] = s[K]-'A' + 'a';
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <chrono>
#include <math.h>
using namespace std;

using lli = long long int;
using Vint = vector<int>;
using Vlli = vector<lli>;
using Wint = vector<Vint>;
using Wlli = vector<Vlli>;
using pii = pair<int, int>;
using pll = pair<lli, lli>;

constexpr int MOD = 1e9 + 7;
constexpr int INFi = 2e9 + 1;
constexpr lli INFl = (lli)(9e18) + 1;
const vector<pii> DXDY = {make_pair(1, 0), make_pair(-1, 0), make_pair(0, 1), make_pair(0, -1)};
constexpr char BR = '\n';

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define FORstep(i, a, b, step) for(int (i) = (a); i < (b); i += (step))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(ele, vec) for(auto &(ele) : (vec))
#define vREPcopy(ele, vec) for(auto (ele) : (vec))
#define SORT(A) std::sort((A).begin(), (A).end())


template <class T> inline int argmin(vector<T> vec){return min_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline int argmax(vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline void chmax(T &a, T b){a = max(a, b);}
template <class T> inline void chmin(T &a, T b){a = min(a, b);}
inline int toInt(string &s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline int toInt(const string s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(string &s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(const string s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
template <class T> inline std::string toString(T n){
  if(n == 0) return "0";
  std::string res = "";
  if(n < 0){n = -n;while(n != 0){res += (char)(n % 10 + '0'); n /= 10;}
  std::reverse(res.begin(), res.end()); return '-' + res;}
  while(n != 0){res += (char)(n % 10 + '0'); n /= 10;} std::reverse(res.begin(), res.end()); return res;
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

int divisors(lli n, int m){
  int q = ceil(sqrt(m));
  std::set<int> res;
  for(int i = 1; i <= q; i++){
    if(m % i == 0){
      res.insert(m / i);
      res.insert(i);
    }
  }
  // A = {nの約数 : 1, ..., n}
  // ∑ d * b_i = M
  // ∑ b_i = M / d >= N
  // M >= N * d : find Max d
  int ans = -1;
  vREP(ele, res) if(m >= n * ele) ans = ele;
  return ans;
}

int main(void){
  int N, M; scanf("%d %d", &N, &M);
  printf("%d\n", divisors((lli)N, M));
  return 0;
}

Measured memory_bytes: 888
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	max := 0
	sum := 0
	for i := 0; i < n; i++ {
		p := nextInt()
		sum += p
		if max < p {
			max = p
		}
	}
	sum -= max / 2
	fmt.Println(sum)
}


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1000000007;

int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, q, x, K;
string s[500], t;
ll h,W;
ll used[400][400] ={};
// <------------- Implement Functions Here ----------> //

// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>h>>W;
	for(ll i=0;i<h;i++) cin>>s[i];

	ll ans = 0,b,w;
	mset(used,0);
	
	for(ll i=0;i<h;i++) {
		for(ll j=0;j<W;j++) {
			if(used[i][j]) continue;
			b=0,w=0;
			queue<pll> q;
			q.push({i,j});
			used[i][j] = 1;
				
			while(!q.empty()) {
				pll p = q.front(); q.pop();
				ll x=p.f,y=p.s;
				if(s[x][y] == '#') b++;
				else w++;

				for(ll k=0;k<4;k++) {
					ll xx = x + dx4[k],yy = y + dy4[k];
					if(xx >= h || yy >= W || xx < 0 || yy < 0) continue;
					if(s[x][y] == s[xx][yy]) continue;
					if(used[xx][yy] == 1) continue;
					used[xx][yy] = 1;

					q.push({xx,yy});
				}
			}
			ans += b*w;
		}
	}

	cout<<ans;

}


int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 5036