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

#if DEBUG && !ONLINE_JUDGE
  #include "header.h"
#else
  #define debug(args...)
#endif

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long lli;
typedef long double ld;

#define pb push_back
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x).size()
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(auto i=(a);i<b;i++)

#define INF (int)1e9
#define EPS 1e-9
#define MOD 1000000007
void preprocess(void) {
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  preprocess();
  int n; cin>>n;
  vector<ii> ar;
  rep(i,0,n) {
    int x; cin>>x;
    ar.pb({x, i});
  }
  sort(all(ar));
  rep(i,0,n) cout<<ar[i].se+1<<" ";
  cout<<endl;
}



Measured memory_bytes: 1780
#!/usr/bin/env python3

mod = 10**9 + 7


def main():
    N = int(input())
    A = list(map(int, input().split()))
    Asum = [0] * N
    Asum[0] = A[N - 1]
    for i in range(1, N):
        Asum[i] = Asum[i - 1] + A[N - 1 - i]
    ans = 0
    for i in range(N - 1):
        ans += (A[i] * Asum[N - 2 - i]) % mod
        ans %= mod
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 31544
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,m=LI()
  s=S()

  ans=[]
  counter=1
  for x in s[1:]:
    if x=='0':
      if counter>m:
        return -1
      ans.append(counter)
      counter=1
    else:
      counter+=1

  ans.reverse()
  _ans=[]

  sm=0
  for x in ans:
    if sm+x>m:
      _ans.append(sm)
      sm=x
    else:
      sm+=x
  if sm>0:
    _ans.append(sm)

  _ans.reverse()
  return ' '.join([str(x) for x in _ans])


# main()
print(main())


Measured memory_bytes: 13644
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;

int main() {
  ll N;
  cin >> N;
  vector<vector<ll>> X(N, vector<ll>(N, 0));
  vector<vector<ll>> Y(N, vector<ll>(N, 0));

  for (ll i = 0; i < N; i++) {
    ll a;
    cin >> a;
    X[i].resize(a);
    Y[i].resize(a);
    for (ll j = 0; j < a; j++) {
      ll x, y;
      cin >> x >> y;
      X[i][j] = x-1;
      Y[i][j] = y;
    }
  }

  ll ans = 0;
  // 正直者をbit全探索
  for (ll bit = 0; bit < (1 << N); bit++) {
    bool ok = true;
    // 正直者の発言の矛盾チェック
    for (ll i = 0; i < N; i++) {
      if (!((bit >> i) & 1)) continue;

      for (ll j = 0; j < (ll)X[i].size(); j++) {
        if (((bit >> X[i][j]) & 1) != Y[i][j]) {
          ok = false;
          break;
        }
      }
    }

    if (ok) {
      ll count = 0;
      for (ll i = 0; i < N; i++) {
        if ((bit >> i) & 1) {
          count++;
        }
      }

      ans = max(ans, count);
    }
  }

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


Measured memory_bytes: 256
#include<stdio.h>

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


Measured memory_bytes: 128
#include<stdio.h>

#define H 5000001

int h;
int A[H];
	
void maxHeapify(int i){
	
	int l,r,largest,temp;
     
     l = left(i);
     r = right(i);
    
    if (l <= h && A[l] > A[i]) largest = l;
    else largest = i;
    
    if(r <= h && A[r] > A[largest]) largest = r;

    if(largest != i){
         temp=A[i];
         A[i]=A[largest];
         A[largest]=temp;
         maxHeapify(largest);
    }

}

void buildMaxHeap(){
	int i;
    for(i = h/2;i>=1;i--){
        maxHeapify(i);
    }
}

int left(int i){
	
	int lid;
    
    lid=2*i;
    //if(lid>h) lid=-1;
    
    return lid;

}

int right(int i){

	int rid;
    
    rid=2*i+1;
    //if(rid>h) rid=-1;
   
    return rid;
    
}

int main(){
	
	int i;
	
	scanf("%d",&h);
	
	for(i=1;i<=h;i++){
		scanf("%d",&A[i]);
	}
	
	buildMaxHeap();
	
	for(i=1;i<=h;i++){
		printf(" %d",A[i]);
	}
	
	printf("\n");
	
	return 0;

}



Measured memory_bytes: 3692
#include <iostream>
#include <vector>

using namespace std;

const int INF = 1e9 + 10;

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

  vector<int> an(N);
    
  int l = INF, r = -INF, c;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    an[i] = a;
    l = min(l, an[i]);
    r = max(r, an[i]);
  }

  int s = INF;
  for (int i = l; i <= r; i++) {
    int t = 0;
    for (int j = 0; j < N; j++) {
      t += (an[j] - i) * (an[j] - i); 
    }
    s = min(s, t);
  }

  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <map>

std::map<long long int, long long int> check;
long long int b,c,d,e;
long long int func(long long int k)
{
	if(check.find(k)!=check.end()) return check[k];
	
	long long int ans = -1;
	for(int i=0;i<=4;i++)
	{
		if((k+i)%2==0 && (k+i)/2 < k)
		{
			long long int s = func((k+i)/2) + b + i*e;
			if(ans==-1) ans = s;
			else ans = ans<s?ans:s;
		}
		if((k+i)%3==0 && (k+i)/3 < k)
		{
			long long int s = func((k+i)/3) + c + i*e;
			if(ans==-1) ans = s;
			else ans = ans<s?ans:s;
		}
		if((k+i)%5==0 && (k+i)/5 < k)
		{
			long long int s = func((k+i)/5) + d + i*e;
			if(ans==-1) ans = s;
			else ans = ans<s?ans:s;
		}
	}
	
	for(int i=1;i<=4;i++)
	{
		if((k-i)%2==0 && (k-i)>=0)
		{
			long long int s;
			if(k-i==0) s = i*e;
			else s = func((k-i)/2) + b + i*e;
			
			if(ans==-1) ans = s;
			else ans = ans<s?ans:s;
		}
		if((k-i)%3==0 && (k-i)>=0)
		{
			long long int s;
			if(k-i==0) s = i*e;
			else s = func((k-i)/3) + c + i*e;
			
			if(ans==-1) ans = s;
			else ans = ans<s?ans:s;
		}
		if((k-i)%5==0 && (k-i)>=0)
		{
			long long int s;
			if(k-i==0) s = i*e;
			else s = func((k-i)/5) + d + i*e;
			
			if(ans==-1) ans = s;
			else ans = ans<s?ans:s;
		}
	}
	if(k<=2000000000)
	{
		long long int s = k*e;
		ans = ans<s?ans:s;
	}
	
	return check[k] = ans;
}

int main()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		check.clear();
		long long int a;
		scanf("%lld%lld%lld%lld%lld",&a,&b,&c,&d,&e);
		printf("%lld\n",func(a));
	}
}

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

signed main()
{
    int k;
    cin>>k;
    queue<int>q;
    for (int i = 1; i <= 9; i++)
    {
        q.push(i);
    }
    vector<int>v;
    while(1){
        int x=q.front();
        q.pop();
        v.push_back(x);
        if(v.size() >=k) break;
        int y=x*10;
        int s=x%10;
        for (int i = 0; i < 10; i++)
        {
            if(abs(s - i ) <=1 )q.push(y+i);
        }
       // cerr<<v.size()<<endl;
    }
    sort(ALL(v));
    cout<<v.back()<<endl;

    return 0;
}

Measured memory_bytes: 2548
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
					  cerr << "\n\n" << "Time elapsed: " << \
					  (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
					  return 0
#define ll long long int
#define ull unsigned long long int
#define db long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define pii pair<int , int>
#define pdd pair<db , db>
#define pll pair<ll , ll>
#define vpl vector<pll >
#define vll vector<ll >
#define mod 1000000007
#define inf 100000000000000007
#define eps 0.000001
#define stp fixed<<setprecision(20)
#define endl '\n'

ll cnt[31];

int main()
{
	fastio;
	#ifdef APNA_IO
		start_routine();
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);
    #endif
 	
 	ll n;cin>>n;
 	ll ans=0;
 	for(ll i=0;i<n;i++)
 	{
 		ll x;cin>>x;
 		ans=__gcd(ans,x);

 	}
 	cout<<ans;
 	


		
	#ifdef APNA_IO
		end_routine();
    #endif
}



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

int main(){
    int n; cin >> n;
    map<int, int> c1,c2;
    int v;
    for(int i = 1; i <= n; i++){
        cin >> v;
        if(i % 2 == 1) c1[v]++;
        else c2[v]++;
    }
    pair<int, int> p1[MAX],p2[MAX];
    int i = 0;
    for(auto& it : c1){
        pair<int, int> p = it;
        p1[i] = make_pair(p.second, p.first);
        i++;
    }
    sort(p1, p1+i);

    int j = 0;
    for(auto& it : c2){
        pair<int, int> p = it;
        p2[j] = make_pair(p.second, p.first);
        j++;
    }
    sort(p2, p2+j);

    if(p1[i-1].second != p2[j-1].second){
        cout << n - (p1[i-1].first + p2[j-1].first) << endl;
    }else{
        if(p1[i-1].first == p2[j-1].first && p1[i-1].first == n/2) cout << n/2 << endl;
        else if(i == 1) cout << n - (p1[i-1].first + p2[j-2].first) << endl;
        else if(j == 1) cout << n - (p1[i-2].first + p2[j-1].first) << endl;
        else cout << min(n - (p1[i-1].first + p2[j-2].first), n - (p1[i-2].first + p2[j-1].first)) << endl;  

    }
}

Measured memory_bytes: 5760
package main

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

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

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

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

//Main
var sc = bufio.NewScanner(os.Stdin)
var k int
var s string

func main() {
	sc.Split(bufio.ScanWords)
	k = nextInt()
	s = nextStr()
	if k >= len(s) {
		fmt.Println(s)
	} else {
		fmt.Printf("%s...\n", s[:k])
	}

}


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

int main(){
    long long N, K;
    scanf("%lld%lld", &N, &K);
    vector<pair<long long, long long>> ss(N);
    for(auto& i : ss)scanf("%lld%lld", &i.second, &i.first);
    sort(ss.rbegin(), ss.rend());

    vector<long long> cnt(N + 1);
    long long ans(0), tmp(0), x(0);
    stack<pair<long long, long long>> q;
    for(long long i = 0; i < K; ++i){
        tmp += ss[i].first;
        if(!cnt[ss[i].second])++x;
        else q.push(ss[i]);
        ++cnt[ss[i].second];
    }

    ans = max(ans, tmp + x * x);
    for(auto i = K; i < N && x <= K; ++i){
        if(cnt[ss[i].second])continue;
        if(q.empty())break;
        auto t = q.top();
        q.pop();
        tmp += ss[i].first - t.first;
        --cnt[t.second];
        ++cnt[ss[i].second];
        ++x;
        ans = max(ans, tmp + x * x);
    }

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

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    cout << fixed << setprecision(10);
    
    string s; cin >> s;

    int bs = 0;
    string ans = "";
    rep(i, s.size()) {
        if (s[i] == 'D') {
            ans += s[i];
        } else if (s[i] == '?') {
            ans += 'D';
        } else {
            ans += s[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3864
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; }                            /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; }                            /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; }                     /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define rep(i, n) for (int i = 0; i < n; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void)
{
  long long int x;
  scanf("%lld", &x);

  long long int ans = MOD;
  for (int i = (int)sqrt(x); i > 0; i--)
  {
    if (x % i != 0)
      continue;
    ans = x / i + i;
    break;
  }
  printf("%lld\n", ans - 2);
  return 0;
}


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

const int inf = 1e9;
const ll linf = 1e18;

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

    int n, k; cin >> n >> k;
    
    map<int, int> mp;
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        mp[a]++;
    }
    vector<int> v;
    for (auto &e: mp) {
        v.push_back(e.second);
    }
    sort(v.begin(), v.end());
    int ans = 0;
    for (int i = 0; i < (int)v.size() - k; i++) {
        ans += v[i];
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int N,K,A=1,B=1;
  cin >> N >> K;
  for (int i = 0; i < N; i++){
    if (A < K){
      A *= 2;
    }else{
      A += K;
    }
  }
  cout << A << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SZ(a) ((int)(a).size())
#define PB push_back
#define MP make_pair
const int maxn = 200009;
const int MOD = 1e9 + 7;
int main(){
#ifdef LOCAL
  freopen("a.in", "r", stdin);
#endif
  ios_base::sync_with_stdio(false),cout.tie(0),cin.tie(0);
  int l,r,d,ans=0;
  cin>>l>>r>>d;
  for(int i=l;i<=r;++i)if(i%d==0)ans++;
  cout<<ans<<"\n";
  
  return 0;
}
//2020.07.11 20:00:44


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

int main(){
  string S;
  cin >> S;
  if(S.length() < 26){
    for(int i = 0; i < 26; ++i){
      bool f = true;
      for(size_t j = 0; j < S.length(); ++j){
        if(S[j] == 'a' + i){
          f = false;
          break;
        }
      }
      if(f){
        cout << S << (char)('a'+i) << endl;
        return 0;
      }
    }
  }
  for(int i = 25; i > 0; --i){
    if(S[i-1] < S[i]){
      cout << S.substr(0,i-1);
      char c = S[i];
      for(int j = 25; j >= i; --j){
        if(S[j] > S[i-1]) c = min(c,S[j]);
      }
      cout << c << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int q[2][1010025] = {0};

int main(void)
{
	int h, w, i, j, ans = 0, nh, nw;
	int f = 0, r = 0;
	int m[1005][1005] = {0}, t[1005][1005] = {0};
	char s[1005];

	scanf("%d %d", &h, &w);
	for (i = 0; i < h; i++)
	{
		scanf("%s", s);
		for (j = 0; j < w; j++)
		{
			if (s[j] == '.')
			{
				m[i + 1][j + 1] = 1;
			}
			else
			{
				q[0][r] = i + 1;
				q[1][r] = j + 1;
				r++;
			}
		}
	}

	while (f < r)
	{
		nh = q[0][f];
		nw = q[1][f];
		f++;

		ans = ans > t[nh][nw] ? ans : t[nh][nw];
		for (i = -1; i <= 1; i += 2)
		{
			if (m[nh + i][nw] && !t[nh + i][nw])
			{
				q[0][r] = nh + i;
				q[1][r] = nw;
				r++;
				t[nh + i][nw] = t[nh][nw] + 1;
			}
			if (m[nh][nw + i] && !t[nh][nw + i])
			{
				q[0][r] = nh;
				q[1][r] = nw + i;
				r++;
				t[nh][nw + i] = t[nh][nw] + 1;
			}
		}
	}

	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 17384
#include<iostream>
#include<algorithm>
#include<fstream>
#include<vector>
#include<deque>
#include<assert.h>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<stdio.h>
#include<string.h>
#include<utility>
#include<math.h>
#include<bitset>
#include<iomanip>
#include<complex>
using namespace std;
const int N=(int)1e6+6,mod=(int)0;
int a[N],n,m,cnt[N<<2],ch[N<<2],mn[N<<2];
void pull(int v){
	int l=v<<1,r=l|1;
	int val=min(mn[l],mn[r]);
	mn[v]=val+ch[v];
	cnt[v]=(val==mn[l]?cnt[l]:0)+(val==mn[r]?cnt[r]:0);
}

void build(int v=1,int b=0,int e=n){
	if (b+1==e){
		cnt[v]=1;
		mn[v]=0;
		return;
	}
	int m=b+e>>1,l=v<<1,r=l|1;
	build(l,b,m);
	build(r,m,e);
	pull(v);
}
 
void update(int i,int j,int x,int v=1,int b=0,int e=n){
	if (i >=e||b>=j) return;
	if (i <=b&&e<=j){
		mn[v]+=x;
		ch[v]+=x;
		return;
	}
	int m=b+e>>1,l=v<<1,r=l|1;
	update(i,j,x,l,b,m);
	update(i,j,x,r,m,e);
	pull(v);
}
int xl[N], xr[N];
void add(int val, int x){
	update(xl[val],xr[val],-1);
	xl[val]-=x;
	update(xl[val],xr[val],+1);
}
int main(){
	scanf("%d%d",&n,&m);
	build();
	for (int val=0;val<=n;val++) xl[val]=val,xr[val]=val;
	for (int j=0;j<n;j++){
		scanf("%d",&a[j]);
		xl[a[j]]--;
	}
	for (int val=0;val<=n;val++) update(xl[val],xr[val],+1);
	while (m--){
		int pos,val;
		scanf("%d%d",&pos,&val);
		--pos;
		add(a[pos],-1);
		a[pos]=val;
		add(a[pos],1);
		cout<<(mn[1]==0?cnt[1]:0)<<endl;
	}	
}

Measured memory_bytes: 22784
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
using ll = long long;

int main() {
	string S, T;
	cin >> S >> T;
	int m = 0;
	int s = S.size();
	int t = T.size();
	for (int i = 0; i < s - t + 1; i++) {
		int j = i;
		int cnt = 0;
		for (int k = 0; k < t; k++, j++) {
			if (S[j] == T[k]) cnt++;
		}
		m = max(m, cnt);
	}
	int ans = t - m;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628
a, b, c, d = map(int, input().split())
xmx = max([a, b])
xmin = min([a, b])
#xabsmx = max([a, b], key = abs)
#xabsmin = min([a, b],key = abs)
ymx = max([c, d])
ymin = min([c, d])
#yabsmx = max([c,d], key = abs)
#yabsmin = min([c, d],key = abs)
if xmin >= 0:#all X plus
    if ymx <= 0:#all Y minas
        print(xmin * ymx)
    else:
        print(xmx * ymx)

elif xmx <= 0:#all X minas
    if ymin >= 0:#all Y plus
        print(xmx * ymin)
    else:
        print(xmin * ymin)
else:#X plus and minas
    if ymx <= 0:#all Y minas
        print(xmin * ymin)
    elif ymin >= 0:#all Y plus
        print(xmx * ymx)
    else:#Y plus and minas
        if xmx * ymx > xmin * ymin:
            print(xmx * ymx)
        else:
            print(xmin * ymin)

Measured memory_bytes: 9140
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意


n = int(input())
#ans = "".join([i+j for i,j in zip(input().split())])
c,d = [i for i in input().split()]
ans = "".join([i+j for i,j in zip(c,d)])



print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define mod 1000000007
#define inf 1e18
#define w(x) int x; cin>>x; while(x--)
using namespace std;
bool sieve[100007];
void sieve_make() 
{
	memset(sieve,true,sizeof(sieve));
	sieve[0]=sieve[1]=false;
	for(int i=2;i*i<=100006;i++)
	{
		if(sieve[i])
		{
			for(int j=2*i;j<=100006;j+=i)
				sieve[j]=false;
		}
	}
}

int max(int a,int b)
{
	if(a>b)
		return a;
	return b;
}
int min(int a,int b)
{
	if(a<b)
		return a;
	return b;
}
int modexp(int a,int b,int c)
{
	if(a==0) return 0;
	if(b==0) return 1;

	int ans;
	if(b%2==0)
	{
		int small=modexp(a,b/2,c);
		ans=(small*small)%c;
	}
	else
	{
		int small=modexp(a,b-1,c);
		ans=(a%c);
		ans=(small*ans)%c;
	}
	return (ans+c)%c;
}

string rev(string s)
{
	reverse(s.begin(), s.end());
	return s;
}
bool sign(int x)
{
	if(x>0)
		return true;
	return false;
}

int base3(string b)
{
	int ans=0,c=0;
	for(int i=b.length()-1;i>=0;i--)
	{
		ans+=(b[i]-'0')*pow(3,c++);
	}
	return ans;
}


int32_t main()
{
	ios::sync_with_stdio(NULL);
    cin.tie(NULL);
    cout.tie(NULL);
	
	
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int ans=0;
	if(k>=a)
	{
		ans+=a;
		k-=a;
		if(k>=b)
			k-=b;
		if(k>0)
		{
			ans-=k;
		}

	}
	else
	{
		ans+=k;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3700
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

ll s[1001];
ll sm[500500];
int c[40];
ll p2;

int fn(ll a, ll b) {
    return (a&p2) > (b&p2);
}

int main() {
    int n = gi();
    int k = gi();
    s[0] = 0;
    for (int i = 0; i < n; i++)
        s[i+1] = s[i] + gi();

    memset(c, 0, sizeof(c));
    int m = 0;
    for (int i = 0; i < n; i++)
        for (int j = i+1; j <= n; j++)
            sm[m++] = s[j] - s[i];

    p2 = 1LL << 40;
    for (int i = 39; i >= 0; i--) {
        p2 /= 2;
        int c = 0;
        for (int j = 0; j < m; j++)
            if (sm[j] & p2)
                c++;
        if (c >= k) {
            sort(sm, sm+m, fn);
            m = MIN(c, m);
        }
    }

    ll res = sm[0];
    for (int i = 1; i < k; i++)
        res &= sm[i];

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 4224
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

void solve() {
    ll a, b, c, d, n, k, x,l;
    string s, t;
    ll ans = 0;
    double dans = 0;
    string sans = "Good";

    cin  >> n;
    ll w[100];
    ll sum = 0;
    rep(i, n) {
        cin >> w[i];
        sum += w[i];
    }

    ll before = 0;
    rep(i,n){
        ll s1 = before + w[i];
        ll s2 = sum - s1;

        if(i == 0) ans = s1-s2;
        ans = min(abs(ans), abs(s1 - s2));

        before = s1;
    }

    std::cout << ans << endl; 
    // std::cout << sans << endl; 
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    solve();
    // stop
        return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100

int main(){
  int graph[MAX][MAX];
  int i,n,a,b,c,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      graph[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d",&a);
    scanf("%d",&b);
    a--;
    for(j=0;j<b;j++){
      scanf("%d",&c);
      c--;
      graph[a][c]=1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j)
	printf(" ");
      printf("%d",graph[i][j]);
    }
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2728
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cout << #x " = " << (x) << '\n';
#define P(x) cout << #x << '\n';    
#define int long long
typedef pair<int, int> pii;
const int mod = 1000000007;

const int maxn = 30;
int a[maxn][maxn];
int h, w;
int vis[maxn][maxn];
struct node
{
	int x, y, mov = 0; 
};
queue<node> q;
bool isv(int i, int j, int mov)
{
	if(i >= 1 && i <= h && j >= 1 && j <= w && a[i][j] == 1 && vis[i][j] == 0)
	{
		vis[i][j] = 1;
		q.push({i, j, mov + 1});
	}
}

int bfs(int stx, int sty, int destx, int desty)
{
	while(!q.empty()) q.pop();
	for(int i = 1; i <= h; ++ i)
		for(int j = 1; j <= w; ++ j)
			vis[i][j] = 0;
	q.push({stx, sty, 0LL});
	vis[stx][sty] = 1;
	int ans = 0;
	while(!q.empty())
	{
		node cur = q.front();
		q.pop();
		int x = cur.x, y = cur.y, mov = cur.mov;
		if(x == destx && y == desty)
		{
			ans = mov;
			break;
		}
		isv(x + 1, y, mov);
		isv(x - 1, y, mov);
		isv(x , y + 1, mov);
		isv(x, y - 1, mov);
		
	}
	return ans;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(9);
	#ifdef LOCAL_DEFINE
		freopen("in.txt", "rt", stdin);
	#endif
	
	cin >> h >> w;
	for(int i = 1; i <= h; ++ i)
	{
		for(int j = 1; j <= w; ++ j)
		{
			char ch;
			cin >> ch;
			if(ch == '.')
			{
				a[i][j] = 1;
			}
			else
			{
				a[i][j] = -1;
			}
		}
	}
	int ans = 0;
	for(int i = 1; i <= h; ++ i)
	{
		for(int j = 1; j <= w; ++ j)
		{
			for(int x = 1; x <= h; ++ x)
			{
				for(int y = 1; y <= w; ++ y)
				{
					if(a[i][j] == 1 && a[x][y] == 1)
					{
						ans = max(ans, bfs(i, j , x, y));
					}
				}
			}
		}
	}
	cout << ans << '\n';
	
	return 0;
}






Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	long long int a[n];
	for(int i=0;i<n;i++){
		a[i]=0;
	}
	for(int i=0;i<=n;i++){
		if(i==0){
			a[i]=2;
		}else if(i==1){
			a[i]=1;
		}else{
			a[i]=a[i-2]+a[i-1];
		}
	}
	cout << a[n] << endl;
	return 0;
}

Measured memory_bytes: 256
<?php
  $n = trim(fgets(STDIN));
  for($i=0; $i<$n; $i++){
      $s = trim(fgets(STDIN));
      $word[$s]++;
  }
  $m = trim(fgets(STDIN));
  for($i=0; $i<$m; $i++){
      $s = trim(fgets(STDIN));
      $word[$s]--;
  }
  $get = 0;
  foreach ($word as $yen){
      if($yen > 0){
          $get = max($yen,$get);
      }
  }
  echo $get;

Measured memory_bytes: 4728
n,q = map(int,input().split())
s = input()
lr_list = [list(map(int,input().split())) for nesya in range(q)]
hoge = [0]*(n+1)
for i in range(n):
  hoge[i+1] = hoge[i] + (1 if s[i:i+2] == 'AC' else 0)
for lr in lr_list:
  l = lr[0]
  r = lr[1]
  print(hoge[r-1] - hoge[l-1])

Measured memory_bytes: 31428
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http.Headers;
using System.Security.Cryptography;

namespace AtCoder
{
	public class ABC
	{
		static public void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
			Solve(args);
			Console.Out.Flush();
		}

		const int mod = 1000000007;  // 10^9+7
		static int Mod(long x, int m) { return (int)((x % m + m) % m); }
		static long Mod(long x, long m) { return (x % m + m) % m; }

		static public void Solve(string[] args)
		{
			//string s = Console.ReadLine();
			//int n = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();

			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			int n = vs[0];
			int m = vs[1];

			UnionFind tree = new UnionFind(n);
			for (int i = 0; i < m; i++) {
				vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
				tree.Unite(vs[0] - 1, vs[1] - 1);
			}

			int ans = 0;
			foreach (var item in tree._Parent) {
				ans = Math.Max(ans, item.Size);
			}
			Console.WriteLine(ans);

		}
	}

	#region Union-Find木 UnionFind
	public class UnionFind
	{
		public readonly UnionFindNode[] _Parent;

		/// <summary>
		/// Union-Find木
		/// </summary>
		/// <param name="n">サイズ</param>
		public UnionFind(int n)
		{
			_Parent = new UnionFindNode[n];
			for (int i = 0; i < n; i++) {
				_Parent[i] = new UnionFindNode(i, 1);
			}
		}

		public int Find(int x)
		{
			if (_Parent[x].Parent == x) {
				return _Parent[x].Parent;
			}
			return _Parent[x].Parent = Find(_Parent[x].Parent);
		}

		public int Size(int x)
		{
			return _Parent[Find(x)].Size;
		}

		/// <summary>
		/// xとyの木を併合
		/// </summary>
		/// <param name="x"></param>
		/// <param name="y"></param>
		public void Unite(int x, int y)
		{
			int rx = Find(x);
			int ry = Find(y);
			if (rx != ry) {
				_Parent[ry].Parent = rx;
				_Parent[rx].Size += _Parent[ry].Size;
			}
		}

		/// <summary>
		/// x, yが同じ木に属している
		/// </summary>
		/// <param name="x"></param>
		/// <param name="y"></param>
		/// <returns></returns>
		public bool Same(int x, int y)
		{
			int rx = Find(x);
			int ry = Find(y);
			return rx == ry;
		}

		public override string ToString()
		{
			return string.Join(" ", _Parent.Select(p => $"({p.Parent},{p.Size})"));
		}
	}
	public class UnionFindNode
	{
		public int Parent;
		public int Size;
		public UnionFindNode(int parent, int size)
		{
			Parent = parent;
			Size = size;
		}
	}
	#endregion

}


Measured memory_bytes: 48696
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <queue>
#include <map>
using namespace std;
const int maxn=55;
const int mod=1e9+7;
typedef long long ll;
int dp[maxn][maxn][maxn*maxn];
int n,k;
inline void upd(int &x,int y){
	x=(x+y)%mod;
	return ;
}
int main(){
	cin>>n>>k;
	if (k%2==1){
		cout<<"0"<<endl;
		return 0;
	}
	k/=2;
	dp[0][0][0]=1;
	for (int i=0;i+1<=n;i++){
		for (int j=0;j<=i;j++){
			for (int l=0;l<=k;l++){
				if (dp[i][j][l]==0) continue;
				if (l+j<=k) upd(dp[i+1][j][l+j],dp[i][j][l]);
				if (j>0){
					if (l+j<=k) upd(dp[i+1][j][l+j],1ll*dp[i][j][l]*j%mod);
					if (l+j<=k) upd(dp[i+1][j][l+j],1ll*dp[i][j][l]*j%mod);
					if (l+j-1<=k) upd(dp[i+1][j-1][l+j-1],1ll*dp[i][j][l]*j%mod*j%mod);
				}
				if (l+j+1<=k) upd(dp[i+1][j+1][l+j+1],dp[i][j][l]);
			}
		}
	}
	cout<<dp[n][0][k]<<endl;
}

Measured memory_bytes: 10508
# include <algorithm>
# include <cassert>
# include <cctype>
# include <cstdio>
# include <cstdlib>
# include <cstring>
# include <cmath>
# include <iostream>
# include <map>
# include <queue>
# include <set>
# include <sstream>
# include <stack>
# include <string>
# include <vector>
# include <iomanip>

# define rep(i, n) for (int i = 0; i < (int)(n); i++)
# define irep(i, n) for (int i = int(n) - 1; i >= 0; i--)
# define FOR(i, m, n) for (int i = int(m); i < (int)(n); i++)

using namespace std;
typedef long long ll;


// %% begin matrix %%

typedef vector<int> vec;
typedef vector<vec> mat;

void pretty_print(mat g) {
  rep (i, g.size()) {
    rep (j, g[0].size()-1) {
      cout << g[i][j] << ' ';
    }
    cout << g[i][g[0].size()-1] << endl;
  }
}


mat mul(mat A, mat B) {
  mat C(A.size(), vec(B.size()));
  rep (i, A.size()) {
    rep (k, B.size()) {
      rep (j, B[0].size()) {
        C[i][j] += A[i][k] * B[k][j];
      }
    }
  }
  return C;
}

// %% end matrix %%


int main() {
  int n, k, x, y;
  cin >> n >> k >> x >> y;
  int ans = min(k,n) * x;

  if (n-k > 0) {
    ans += (n-k) * y;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};

int dist(P a, P b) {
    return abs(a.first-b.first)+abs(a.second-b.second);
}


int main(){
    int h, w, d;
    cin >> h >> w >> d;
    vector<vector<int>> a(h, vector<int>(w));
    rep(i, h) rep(j, w) {
        cin >> a[i][j];
        a[i][j]--;
    }
    int q;
    cin >> q;
    vector<P> pos(h*w);
    rep(i, h) rep(j, w) {
        pos[a[i][j]] = P(i, j);
    }
    vector<vector<int>> mp(d, vector<int>(1));

    rep(i, h*w) {
        if (i/d==0) continue;
        mp[i%d].push_back(mp[i%d].back()+dist(pos[i], pos[i-d]));
    }

    rep(i, q) {
        int l, r;
        cin >> l >> r;
        l--; r--;
        int x = l%d;
        int ans = mp[x][r/d] - mp[x][l/d];
        cout << ans << endl;
    }
    
    return 0;
}


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

const long long int MOD = 1000000007;

vector<long long int> inverse;
vector<long long int> f, f_inverse;

void factorial_Initialize(int max){
    vector<long long int> a(max+1,1);
    inverse = a;
    f = a;
    f_inverse = a;

    for (int i=2; i<=max; i++){
        inverse[i]   = MOD - inverse[MOD % i] * (MOD / i) % MOD;
        f[i]         = f[i-1]         * i          % MOD;
        f_inverse[i] = f_inverse[i-1] * inverse[i] % MOD;
    }
}

long long int nCr(int n, int r){
    if(n < r || r < 0) return 0;
    if (n >= f.size()){
        factorial_Initialize(n);
    }
    return f[n] * f_inverse[r] % MOD * f_inverse[n-r] % MOD;
}

int main(){
    int n;
    cin >> n;
    
    vector<int> a(n+1), count(n+1);
    int memo1, memo2;
    for(int i=0; i<n+1; i++){
        cin >> a[i];
        count[a[i]] += 1;
        if(count[a[i]] == 2) memo2 = i;
    }
    for(int i=0; i<memo2; i++){
        if(a[i] == a[memo2]){
            memo1 = i;
            break;
        }
    }

    for(int i=1; i<=n+1; i++){
        cout << (nCr(n+1,i) - (nCr(n-memo2+memo1+1,i) - nCr(n-memo2+memo1,i)) + MOD) % MOD << endl;
    }
    return 0;
}

Measured memory_bytes: 4336
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main() {
    int x, a;
    cin >> x >> a;
    if (x < a) {
        cout << 0 << endl;
    } else {
        cout << 10 << endl;
    }
}

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

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

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

const int INF = 1LL << 20;

int N, A, B, C;
vector<int> L;

int rec(int i, int a, int b, int c) {
    if (i == N) {
        if (!a || !b || !c) return INF;
        return abs(a - A) + abs(b - B) + abs(c - C);
    } 

    int dfs = rec(i+1, a, b, c);

    chmin(dfs, rec(i+1, a + L[i], b, c) + (a ? 10 : 0));
    chmin(dfs, rec(i+1, a, b + L[i], c) + (b ? 10 : 0));
    chmin(dfs, rec(i+1, a, b, c + L[i]) + (c ? 10 : 0));

    return dfs;
}

int main(){
    cin >> N >> A >> B >> C;
    L.resize(N);
    for (int i = 0; i < N; i++) cin >> L[i];

    cout << rec(0, 0, 0, 0) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f
#define pi 3.1415926535898
using namespace std;
const int N=2e5+10;
const int mod=1e9+7;
int a[N],b[N];
ll sum;
int  maxs=-1000;
int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
        maxs=max(maxs,a[i]);
    }
    sort(b,b+n);
    for(int i=n-1;i>=0;i--)
    {
        if(b[i]>=maxs&&m>0)
        {
            sum++;
            m-=b[i];
        }
    }

    if(m<0)
    {
        cout<<sum<<endl;
        return 0;
    }
    sum+=m/maxs;
    if(m%maxs)
    {
        sum++;
    }
    cout<<sum<<endl;
    return 0;
}


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

const int INF = 2e9;

int main(){
    int a;
    cin >> a;
    cout << a*a*a << endl;
}

Measured memory_bytes: 256
"""
    こんにちは。これはクシャルです
    
    Author : thekushalghosh (クシャル)
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################

def solve():
    n,k = invr()
    a = inlt()
    a.sort()
    print(sum(a[:k]))
            
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * (max(a) + 1)
    for i in range(len(a)):
        q[a[i]] = q[a[i]] + 1
    return(q)
 
def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
    return(q)

#-----------------------------------------------------------------------#
        
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
    
main()

Measured memory_bytes: 63076
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

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

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

const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};

vector< vector<int> > Graph;
vector< int > value;





int main(int argc, const char * argv[]) {
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s; cin >> s;
    if(s[0]==s[2]) cout << "Yes" << endl;
    else cout << "No" <<endl;
    
    
    
    
    
}



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

int main() {
  string s;
  cin >> s;
  
  vector<string> x(4);
  for(int i = 0; i < 4; i++){
    x.at(i) = s.at(i);
  }
  
  sort(x.begin(), x.end());
  
  if(x.at(0) == x.at(1) && x.at(1) != x.at(2) && x.at(2) == x.at(3)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<typename T=int>inline T get(){
   char c=getchar(); bool neg=(c=='-');
   T res=neg?0:c-'0'; while(isdigit(c=getchar()))res=res*10+(c-'0');
   return neg?-res:res;
}
template<typename T=int>inline void put(T x,char c='\n'){
   if(x<0)putchar('-'),x*=-1; int d[20],i=0;
   do{d[i++]=x%10;}while(x/=10); while(i--)putchar('0'+d[i]);
   putchar(c);
}
//end

int n,m,q;
int a[51],b[51],c[51],d[51];
int res=0,A[11];
void dfs(int i,int x){
   if(i==n){
      int sum=0;
      rep(j,0,q){
         if(A[b[j]]-A[a[j]]==c[j])sum+=d[j];
      }
      chmax(res,sum);
      return;
   }
   rep(_,x,m+1){
      A[i]=_; dfs(i+1,_);
   }
}

int main(){
   n=get(),m=get(),q=get();
   rep(i,0,q){
      a[i]=get(),b[i]=get(),c[i]=get(),d[i]=get();
      a[i]--; b[i]--;
   }
   dfs(0,1); printf("%d\n",res);
   return 0;
}

Measured memory_bytes: 3708
#include <stdio.h>

 #define N 100

int arrayg[N][N], arrayn[N], arraywid[N];
 
void Defdep(int a, int k){
    int i;

    arraywid[a] = k;

    for (i = 1; i <= arrayn[a]; i++){

        if (arraywid[arrayg[a][i]] > k)
        {
            Defdep(arrayg[a][i], k + 1);
        }
    }
}
 
int main(void)
{
    int i,j;
    int n,l;
 
    scanf("%d", &n);
 
    for (i = 1; i <= n; i++){

        arraywid[i] = N * N;

        for (j = 1; j <= n; j++){

            arrayg[i][j] = 0;
        }
    }
 
    for (i = 1; i <= n; i++){

        scanf("%d", &l);

        scanf("%d", &arrayn[l]);

        for (j = 1; j <= arrayn[l]; j++){

            scanf("%d", &arrayg[l][j]);
        }
    }
 
    Defdep(1, 0);
 
    for (i = 1; i <= n; i++){
 
       if (arraywid[i] == N * N)
        {
            arraywid[i] = -1;
        }
        printf("%d %d\n", i, arraywid[i]);
    }
 
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;

#define rep(i,x,y) for(int i=(x); i<(y); ++i)
const int INF = (1<<30);
const ll INFLL = 1LL<<62;
const long double EPS = 1e-12;

template <typename T>
void vec_print(vector<T> VEC){
  rep(i, 0, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  rep(i, 0, MAT.size()){
    rep(j, 0, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

class HOGE{
  public:
    ll index;
    ll value;
    HOGE(ll index, ll value){
      this->index = index;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "index : " << index << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll A, B, C;
  cin >> A >> B >> C;
  if(A+B>=C){
    cout << "Yes\n";
  }else{
    cout << "No\n";
  }

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << '\n'
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) {if (a > b) a = b;}
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) {if (a < b) a = b;}
void fail() { cout << -1 << endl; exit(0); }

typedef pair<int, int> pii; typedef pair<long long, long long> pll;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9+7;
constexpr int MAX = 50050;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll LINF = 1e18 + 1; constexpr int INF = 1e9 + 1;
//const int dx[4] = { 0,0,-1,1 }, dy[4] = { 1,-1,0,0 };


void solve() {
	char c; cin >> c;
	if (isupper(c))print("A");
	else print("a");
}





signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//mt.seed((int)(time(0)));
	//int q;
	//cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int N=5005;
int n,mo,a[N],f[N];
int main(){
	scanf("%d%d",&n,&mo);
	int T=(n-1)/2;
	For(i,1,T+1) a[i]=1;
	For(i,n-T+1,n) a[i]=-1;
	Rep(i,n,1) a[i]+=a[i+1];
	For(i,2,n) a[i]*=-1;
	sort(a+2,a+n+1);
	reverse(a+2,a+n+1);
	For(i,2,n) a[i]++;
	f[0]=1;
	For(i,2,n) For(k,0,n-a[i])
		f[k+a[i]]=(f[k+a[i]]+f[k])%mo;
	int ans=0;
	For(i,0,n)
		ans=(ans+1ll*(n-i)*f[i])%mo;
	printf("%d\n",ans); 
}
/*
5000 998244353
*/


Measured memory_bytes: 256