akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	sort(a.begin(), a.end());
	vector<int> res = {a[0]};
	for (int i = 1; i < n; ++i) {
		if (a[i] != a[i - 1]) res.push_back(a[i]);
	}
	int ans = 0;
	rep(i, res.size() - 1) ans += res[i + 1] - res[i];
	//rep(i,res.size()) cout << 
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
#define INF 10000000
int a,b,d;
int cntA,cntB;

void cal2(){//a*i==b*j+d, b*i=a*j+d

  for(int i=0;i<100000;i++)
    if((a*i)%b==d%b && cntA+cntB>i+abs((a*i)/b-d/b))cntA=i,cntB=abs((a*i)/b-d/b);

  for(int i=0;i<100000;i++)
    if((b*i)%a==d%a && cntA+cntB>i+abs((b*i)/a-d/a))cntA=abs((b*i)/a-d/a),cntB=i;
  
}

int main(){
  while(1){
    cin>>a>>b>>d;
    if(!a&&!b&&!d)break;
    cntA=cntB=INF;
    cal2();
    cout <<cntA<<" "<<cntB<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <queue>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
const int MAX_N = 100010;

vector<pair<int, int> > ba;

int main(){
    int N,M;
    cin >> N >> M;
    REP(i,M){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        ba.push_back(make_pair(b,a));
    }
    sort(ba.begin(), ba.end());

    int x = -1;
    int cnt = 0;
    REP(i,M){
        pair<int, int> y = ba[i];
        int a = y.second;
        int b = y.first;
        if(a <= x && x < b) continue;
        else {
            cnt++;
            x = b-1;
        }
    }

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 1400
#include <cmath>
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>

using namespace std;

typedef vector<int> vi;

int a[100010],b[100010];
bool v[100010];
vi e[100010];

int main()
{
    //freopen("input.txt","r",stdin);
    int n,m;scanf("%d%d",&n,&m);
    for (int i=0;i<m;i++)
    {
        int x,y;scanf("%d%d",&x,&y);
        e[x].push_back(y);e[y].push_back(x);
    }
    int l1=1,l2=1;a[1]=b[1]=1;v[1]=1;
    while (1)
    {
        bool ok=0;
        for (vi::iterator p=e[a[l1]].begin();p!=e[a[l1]].end();p++)
            if (!v[*p]) {a[++l1]=*p;v[*p]=ok=1;break;}
        if (!ok) break;
    }
    while (1)
    {
        bool ok=0;
        for (vi::iterator p=e[b[l2]].begin();p!=e[b[l2]].end();p++)
            if (!v[*p]) {b[++l2]=*p;v[*p]=ok=1;break;}
        if (!ok) break;
    }
    printf("%d\n",l1+l2-1);
    for (int i=l2;i>1;i--) printf("%d ",b[i]);
    for (int i=1;i<=l1;i++) printf("%d%c",a[i],i<l1 ? ' ' : '\n');
    return 0;
}


Measured memory_bytes: 6784
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

const int mod = 1000000007;

long long inv[200200] = {0,1}, fact[200200] = {1,1}, ifact[200200] = {1,1};

int H,W,N; pair<int, int> P[3030]; long long D[3030];

int main()
{
	for (int i=2;i<200200;i++){
		inv[i] = (mod - mod / i) * inv[mod % i] % mod;
		fact[i] = fact[i-1] * i % mod;
		ifact[i] = ifact[i-1] * inv[i] % mod;
	}

	scanf ("%d %d %d",&H,&W,&N);

	for (int i=0;i<N;i++) scanf ("%d %d",&P[i].first,&P[i].second);
	P[N] = {1,1};
	P[N+1] = {H,W};
	N += 2;
	sort(P,P+N);

	D[0] = mod - 1;
	for (int i=0;i<N;i++){
		for (int j=i+1;j<N;j++) if (P[i].first <= P[j].first && P[i].second <= P[j].second){
			int dx = P[j].first - P[i].first;
			int dy = P[j].second - P[i].second;
			long long coeff = fact[dx+dy] * ifact[dx] % mod * ifact[dy] % mod;
			D[j] = (D[j] + D[i] * (mod - coeff)) % mod;
		}
	}

	printf ("%lld\n",D[N-1]);

	return 0;
}


Measured memory_bytes: 4864
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// head

const int N=2010;
int n,x,a[N],mv[N];
int main() {
	scanf("%d%d",&n,&x);
	ll ret=0;
	rep(i,0,n) {
		scanf("%d",a+i);
		ret+=a[i];
	}
	rep(i,0,n) mv[i]=a[i];
	rep(j,0,n+1) {
		rep(i,0,n) mv[i]=min(mv[i],a[(i+n-j)%n]);
		ll s=0;
		rep(i,0,n) s+=mv[i];
		ret=min(ret,s+(ll)j*x);
	}
	printf("%lld\n",ret);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define FOR(n) for(int i=0;i<n;++i)
#define inf 0x3f3f3f3f
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

signed main() {
	int n;
	cin >> n;
	if (n >= 30)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3592
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
using namespace std;
typedef long long LL;
const int MaxN = 1e5;
const int Inf = 1 << 30;
const LL mod = 1e9 + 7;

int main()
{
	int p;
	char S[2][105];
	while(~scanf("%s%s",S,S + 1)){
		if(strlen(S[0]) > strlen(S[1]) ) p = 1;
		else if(strlen(S[0]) < strlen(S[1])) p = -1;
		else p = strcmp(S[0],S[1]);
		if(p > 0) printf("GREATER\n");
		else if(p < 0) printf("LESS\n");
		else printf("EQUAL\n");
	}
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <limits.h>
#include <queue>
#define V_MAX 10000
#define INF INT_MAX
using namespace std;

class Edge{
public:
  int to,cost;
  Edge(int t,int c){to=t; cost=c;}
};

typedef pair<int,int> P;

vector<Edge> G[V_MAX+1];
int V,E;
int mincost[V_MAX+1];
bool used[V_MAX+1];

int solve(){

  fill(mincost,mincost+V_MAX+1,INF);
  fill(used,used+V_MAX+1,false);
  
  priority_queue<P,vector<P>,greater<P> > qu;
  int res=0;

  qu.push(P(0,0));
  
  while(!qu.empty()){

    P p=qu.top();
    qu.pop();
    int v=p.second;
    
    if(used[v]) continue;
    used[v]=true;
    res+=p.first;
    
    for(int i=0;i<G[v].size();i++){
      Edge e=G[v][i];
      if(!used[e.to]) qu.push(P(e.cost,e.to));
    }
  }
  return res;
}



int main(){

  
  cin>>V>>E;
  int s,t,c;
  for(int i=0;i<E;i++){
    cin>>s>>t>>c;
    Edge e1(t,c),e2(s,c);
    G[s].push_back(e1);
    G[t].push_back(e2);

  }

  cout<<solve()<<endl;
  
  return 0;
}

Measured memory_bytes: 6776
#include<iostream>
#include<cstring>
#include<queue>
using namespace std;
const int maxn=10005;
const int MOD=1e9+7;
int dp[maxn][maxn];
int n,m,ans;
char a[maxn];
int main()
{
	cin>>n>>m;
	dp[1][1]=1;
	for(int i=1;i<=n;i++)
	{
		cin>>a+1;
		for(int j=1;j<=m;j++)
		{
			if(i==1&&j==1)
			continue;
			else
			{
				if(a[j]!='#')
				{
					dp[i][j]=dp[i-1][j]+dp[i][j-1];
				    dp[i][j]%=MOD;
				}
			}
		}
	}
	cout<<dp[n][m]%MOD<<endl;
	return 0;
}

Measured memory_bytes: 11456
/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */
 
#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(int i=ini;i<(int)n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x)     x.begin(),x.end()
#define tc   int tt; scf(tt); while(tt--)
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll M =1e9+7;
const int N = 1e5+7;



void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) 
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

    
int main()
{
    int n;
    scf(n);
    
    if(n>=30)
    printf("Yes\n");
    
    else
    printf("No\n");
    
    
        
}

Measured memory_bytes: 3652
#include <stdio.h>

int main(void)
{
    int N;
    int r, t;
    int i;
    
    scanf("%d", &N);
    for (i = 0; i < N; i++){
        scanf("%d%d", &r, &t);
        
        if (t % 30 == 0 && r % 100 == 0){
            printf("%d\n", ((t / 30) * 5 + r / 100));
            continue;
        }
        
        if (t % 30 == 0 && r % 100 != 0){
            printf("%d ", ((t / 30) * 5 + r / 100));
            printf("%d\n", ((t / 30) * 5 + r / 100 + 1));
            continue;
        }

        if (t % 30 != 0 && r % 100 == 0){
            printf("%d ", ((t / 30) * 5 + r / 100));
            printf("%d\n", ((t / 30 + 1) * 5 + r / 100));
            continue;
        }
        printf("%d ", ((t / 30) * 5 + r / 100));
        printf("%d ", ((t / 30) * 5 + r / 100 + 1));
        printf("%d ", ((t / 30 + 1) * 5 + r / 100));
        printf("%d\n", ((t / 30 + 1) * 5 + r / 100 + 1));
    }
    return (0);
}



Measured memory_bytes: 2044
d=input().split()
for o in list(input()):
 s={'N':(0,1,5,4),'W':(0,2,5,3),'E':(0,3,5,2),'S':(0,4,5,1)}[o]
 for i in range(3):d[s[i+1]],d[s[i]]=d[s[i]],d[s[i+1]]
print(d[0])


Measured memory_bytes: 5560
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h);
    rep(i, h) {
        cin >> s[i];
    }
    int ans = 0;
    for (int i = 0; i < 1 << h; i++) {
        for (int j = 0; j < 1 << w; j++) {
            vector<string> t = s;
            rep(y, h) {
                if (i & 1 << y) {
                    rep(x, w) {
                        t[y][x] = '.';
                    }
                }
            }
            rep(x, w) {
                if (j & 1 << x) {
                    rep(y, h) {
                        t[y][x] = '.';
                    }
                }
            }
            int cnt = 0;
            rep(y, h) {
                rep(x, w) {
                    if (t[y][x] == '#') cnt++;
                }
            }
            if (cnt == k) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
// nichijou
#define REP(i,a,b) for (int i(a); i < (b); ++i)
#define RP(i,n) REP(i,0,n)
#define PER(i,a,b) for(int i((a)-1); i >= (b); --i)
#define PR(i,n) PER(i,n,0)
#define REP1(i,a,b) REP(i,a,(b)+1)
#define RP1(i,n) REP1(i,1,n)
#define PER1(i,a,b) PER(i,(a)+1,b)
#define PR1(i,n) PER1(i,n,1)
#define DO(n) RP(__i,n)
template<class T,class U>
bool cmax(T & a, const U & b) {return a < b ? a = b, 1 : 0;}
template<class T,class U>
bool cmin(T & a, const U & b) {return b < a ? a = b, 1 : 0;}

// data type
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define F first
#define S second

// STL container
typedef vector<int> vi;
typedef vector<ll> vll;
#define SZ(a) ((int)(a).size())
#define ALL(a) begin(a), end(a)
#define CLR(a) (a).clear()
#define BK(a) ((a).back())
#define FT(a) ((a).front())
#define DB(a) (a).pop_back()
#define DF(a) (a).pop_front()
#define PB push_back
#define EB emplace_back

/* I gave you my heart and then you turned around. */
void _BG(const char * s) {cerr<<s<<endl;};
template<class T, class ... TT>
void _BG(const char * s,T a, TT...b)
{
	for (int c = 0; *s && (c || *s != ','); ++s) {
		cerr<<*s;
		for (char x : "([{") c += *s == x;
		for (char x : ")]}") c -= *s == x;
	}
	cerr<<" = "<<a;
	if (sizeof...(b)) {
		cerr<<", ";
        ++s;
    }
    _BG(s,b...);
}
#define BG(...) do { \
	cerr << __PRETTY_FUNCTION__ << ':' << __LINE__ << ": "; \
	_BG(#__VA_ARGS__,__VA_ARGS__); \
} while(0)

/* Reading input is now 20% cooler! */
bool RD() {return 1;}
bool RD(char & a) {return scanf(" %c", &a) == 1;}
bool RD(char * a) {return scanf("%s", a) == 1;}
bool RD(double & a) {return scanf("%lf", &a) == 1;}
bool RD(int & a) {return scanf("%d", &a) == 1;}
bool RD(ll & a) {return scanf("%lld", &a) == 1;}

template<class T, class ... TT>
bool RD(T & a, TT & ... b) {return RD(a) && RD(b...);}

/* Do princesses dream of magic sheep? */
#define DR(T,...) T __VA_ARGS__; RD(__VA_ARGS__)
#define RI(...) DR(int,__VA_ARGS__)

/* For it's time for you to fulfill your output. */
void PT(const char & a) {putchar(a);}
void PT(char const * const & a) {fputs(a, stdout);}
void PT(const double & a) {printf("%.16f", a);}
void PT(const int & a) {printf("%d", a);}
void PT(const ll & a) {printf("%lld", a);}

/* The line will last forever! */
template<char s = ' ', char e = '\n'>
void PL() {if (e) PT(e);}
template<char s = ' ', char e = '\n', class T, class ... TT>
void PL(const T & a, const TT & ... b)
{PT(a); if (sizeof...(b) && s) PT(s); PL<s,e>(b...);}

/* Good Luck && Have Fun ! */
const int N = 1e5 + 87;
ll a[N];
int main()
{
    RI(n);
    RP(i,n) RD(a[i]);
    pll p = {2,2};
    PR(i,n) {
        ll l = (p.F + a[i] - 1) / a[i], r = p.S / a[i];
        if (l > r) {
            PL(-1);
            return 0;
        }
        p = {l*a[i], (r+1)*a[i]-1};
    }
    PL(p.F,p.S);
}


Measured memory_bytes: 1024
// -----------------------------------
// Author     : MatsuTaku
// Affiliation: Tokushima University
// Country    : Japan
// Date       : 04/08/2020
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n; cin>>n;
  set<ll> box;
  for (int i = 0; i < n; i++) {
    ll a; cin>>a;
    if (box.count(a))
      box.erase(a);
    else
      box.insert(a);
  }
  cout << box.size() << endl;

  return 0;
}


Measured memory_bytes: 4992
k, s = map(int, input().split())
counter = 0
for x in range(k + 1):
    for y in range(x, k + 1):
        z = s - x - y
        if y <= z <= k:
            if x == y == z:
                counter += 1
            elif x == y or y == z:
                counter += 3
            else:
                counter += 6

print(counter)


Measured memory_bytes: 9176
# coding: utf-8

x,y = map(int,input().split())
money = 0

if x == 1:
    money += 300000
elif x == 2:
    money += 200000
elif x == 3:
    money += 100000

if y == 1:
    money += 300000
elif y == 2:
    money += 200000
elif y == 3:
    money += 100000

if x==1 and y==1:
    money += 400000

print(money)

Measured memory_bytes: 3064
#include<stdio.h>
int m[]={2189,89,1232,866,1796,2603},a,b,c,d,r;int main(){for(char s[9];~scanf("%s",s);r+=a%3?b%3?(b+6-a)%6<3?2:5:3+!b:a?6:1)*s<65?printf(r?"%d\n":0,r),a=c=r=0,b=1:*s%6-4?d=(*s-78?*s%5-1:0)+c&3,a=m[a]>>3*d&7,b=m[b]>>3*d&7:c+=3+*s;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <numeric>
#include <iomanip>


int main(void) {
	int n, m, c;

	std::cin >> n >> m >> c;

	std::vector<int> b(m);

	for (size_t i = 0; i < m; i++) {
		std::cin >> b[i];
	}

	int count = 0;
	for (size_t i = 0; i < n; i++) {
		long long ans = c;
		for (size_t j = 0; j < m; j++) {
			int a;
			std::cin >> a;

			ans += a * b[j];
		}
		//std::cout << ans << std::endl;
		if (ans > 0) {
			count++;
		}
	}

	std::cout << count << std::endl;

	return 0;
}

Measured memory_bytes: 256
//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 100000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 1000000000
typedef long long ll;
//orz yht
using namespace std;
const int D=26;
char s[200005];
int p[200005];
ll len[1000],num[1000];
int i,j,k,n,m;
ll l,r;
ll work(ll x,int ch){
	int i,j;
	ll ans=0;
	ch+='a';
	len[1]=n;
	num[1]=0;
	for(i=1;i<=n;i++)
	if(s[i]==ch)
	num[1]++;
	len[2]=n+m;
	num[2]=num[1];
	for(i=1;i<=m;i++)
	if(s[i]==ch)
	num[2]++;
	for(i=2;i;i++){
		if(len[i-1]+len[i]>=x)
		break;
		len[i+1]=len[i-1]+len[i];
		num[i+1]=num[i-1]+num[i];
	}
	for(j=i;j;j--){
		if(x>=len[j]){
			x-=len[j];
			ans+=num[j];
		}
	}
	for(i=1;i<=x;i++)
	if(s[i]==ch)
	ans++;
	return ans;
}
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	scanf("%s",s+1);
	n=strlen(s+1);
	n/=2;
	j=0;
	for(i=2;i<=n;i++){
		while(j && s[j+1]!=s[i])
		j=p[j];
		if(s[j+1]==s[i])
		p[i]=++j;
	}
	m=n-p[n];
	cin>>l>>r;
	for(i=0;i<D;i++)
	cout<<work(r,i)-work(l-1,i)<<" ";
	puts("");
	//system("pause");
	return 0;
}

Measured memory_bytes: 896
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    N = II()
    a = LI()

    half = N // 2
    ans = []
    ans.extend(a)
    for i in range(half - 1, -1, -1):
        sum_later = 0
        for j in range(2 * i + 1, N, i + 1):
            sum_later += ans[j]

        amari = sum_later % 2
        if amari == a[i]:
            ans[i] = 0
        else:
            ans[i] = 1
    print(sum(ans))
    for i in range(len(ans)):
        if ans[i] == 1:
            print(i + 1)


main()


Measured memory_bytes: 98396
#include<cstdio>
int a[110],n,ans=1e9;
int mi(int a,int b){return a>b?b:a;}
int ab(int x){return x<0?-x:x;}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		a[i]+=a[i-1];
	}
	for(int i=1;i<=n;i++)
		ans=mi(ans,ab(a[i]-a[n]+a[i]));
	printf("%d",ans);
	return 0;
}


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

int main()
{
    int N,cou=0;
    scanf("%d",&N);
    for(int i=1; i<=N; i++){
        if(i%2!=0) cou++;
    }
    float res = cou*1.0/N*1.0;
    printf("%f\n",res);
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		
		int cnt = 0;
		
		while(n > 0) {
			
			cnt++;
			n = n/k;
		}
		
		System.out.println(cnt);
	
	}



}

Measured memory_bytes: 23764
import scala.io.StdIn.{readInt,readLine}
import scala.collection.mutable.ListBuffer

object Main {
  def isWinner(a:Array[(Int,String)]) = {
    def scan(a:List[(Int,String)]):Int = {
      a match {
        case Nil => 1
        case hd1::hd2::hd3::tail if hd1._2!=hd2._2 || hd2._2!=hd3._2 => 0
        case hd1::hd2::hd3::tail if(hd1._1==hd2._1 && hd2._1==hd3._1) => scan(tail)
        case hd::tail => {
          val buf = new ListBuffer[(Int,String)]
          var (x1,x2) = (false,false)
          for(i<-tail) {
            if(i._1==(hd._1+1) && !x1) { x1 = true }
            else if(i._1==(hd._1+2) && !x2) { x2 = true }
            else buf += i
          }
          if(x1 && x2) scan(buf.toList)
          else 0
        }
      }
    }
    scan(a.toList)
  }

  def main(args:Array[String]) = {
    val t = readInt
    for(i<-1 to t) {
      val a = (readLine.split(" ").map(_.toInt) zip readLine.split(" ")) .sortWith{ (x,y)=>
        if(x._2<y._2) true
        else if(x._2==y._2) {
          x._1<y._1
        } else false
      }
      println(isWinner(a))
    }
  }
}

Measured memory_bytes: 44232
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}
ll kai(vector<ll> A, ll key) {
	ll an = 0;
	rep(i, A.size()) {
		an += (A.at(i) - 1) / key;
	}
	return an;
}
// index が条件を満たすかどうか
bool isOK(int index,vector<ll> A, int K) {
	if (kai(A,index) <= K) return true;
	else return false;
}

// 汎用的な二分探索のテンプレ
int binary_search(ll MA,vector<ll> A,ll K) {
	int left = 0; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = MA; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, A,K)) right = mid;
		else left = mid;
	}

	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
vector<ll> fact, factinv, inv;
ll mod = 1e9 + 7;
void prenCkModp(ll n) {
	fact.resize(n + 5);
	factinv.resize(n + 5);
	inv.resize(n + 5);
	fact.at(0) = fact.at(1) = 1;
	factinv.at(0) = factinv.at(1) = 1;
	inv.at(1) = 1;
	for (ll i = 2; i < n + 5; i++) {
		fact.at(i) = (fact.at(i - 1) * i) % mod;
		inv.at(i) = mod - (inv.at(mod % i) * (mod / i)) % mod;
		factinv.at(i) = (factinv.at(i - 1) * inv.at(i)) % mod;
	}

}
ll nCk(ll n, ll k) {
	if (n < 0 || k < 0){
		return 1;
	}
	else if (n < k) {
		return 0;
	}
	return fact.at(n) * (factinv.at(k) * factinv.at(n - k) % mod) % mod;
}

ll dp[100002];
void res() {
	for (ll n = 0; n < 102; n++) {
		for (ll v = 0; v < 100002; v++) {
			dp[n] = 1e12;
		}
	}
}
int main() {
	string S, T;
	cin >> S >> T;
	ll an = 1e9;
	rep(i, S.size() - T.size() + 1) {
		string K = S.substr(i, T.size());
		ll m = 0;
		rep(j, T.size()) {
			if (K.at(j) != T.at(j))m++;
		}
		an = min(an, m);
	}
	cout << an << endl;
}


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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 100;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;
const int mod = 1000000007;

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


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

memo = [-1]*(N+1)


def ryuka(i):
    if i == 0:
        return 2
    elif i == 1:
        return 1
    else:
        if memo[i-1] != -1:
            ryuka1 = memo[i-1]
        else:
            ryuka1 = ryuka(i-1)
            memo[i-1] = ryuka1

        if memo[i-2] != -1:
            ryuka2 = memo[i-2]
        else:
            ryuka2 = ryuka(i-2)
            memo[i-2] = ryuka2

        return ryuka1 + ryuka2


print(ryuka(N))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <iostream>
#include <utility> // pair
#include <string>
#include <vector>
#define MAX_N 100001
#define rep(i, a, b) for(ll i=a; i<b; i++)
#define rer(i, a, b) for(ll i=a-1; i>=b; i--)
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n;
int dp[MAX_N];
string s;
string a[4] = {"dream", "dreamer", "erase", "eraser"};

signed main(){
    cin >> s;
    dp[0] = 1;
    n = s.size();
    rep(i, 1, n+1){
        rep(j, 0, 4){
            int k = a[j].size();
            if(i-k < 0) continue;
            if(dp[i-k] && s.substr(i-k, k) == a[j]) dp[i] = 1;
        }
    }
    // rep(i, 0, n+1) cout << dp[i];
    if(dp[n] == 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 896
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cstring>
#include<cmath>
#include <numeric>
#include<queue>
#include<climits>
#include<cstdio>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
//#define INF ((LLONG_MAX) / (2))
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;
typedef pair<ll,int> LL_IP;
#define INF 1e9+7

int main(){

    ll n,x;
    cin >> n >> x;
    vector<ll> a(n);
    REP(i,n){
        cin >> a[i];
    }

    ll ans = 0,tmp = 0;
    for(ll i = 0;i < n;i++){
        tmp += a[i];
        if(tmp > x){
            ans += tmp-x;
            tmp = a[i]-(tmp-x);
        }else{
            tmp = a[i];
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
N = int(input())
x = []
res = 0
for i in range(3, N+1, 2):
    if len(x) == 0:
        x.append(i)
    else:
        y = i
        z = {}
        flag = True
        while flag:
            flag = False
            for j in x:
                if y % j == 0:
                    y /= j
                    z.setdefault(j, 0)
                    z[j] += 1
                    flag = True
        if y == i:
            x.append(i)
        else:
            yakusu = 1
            for j in z.values():
                yakusu *= j + 1
            if yakusu == 8:
                res += 1
print(res) 

Measured memory_bytes: 3064
n,m=map(int,input().split())
a=[int(input().replace(" ",""),2) for i in range(n)]
o=998244353
c=0
for j in range(m)[::-1]:
 for i in range(c,n):
  if a[i]&1<<j:
   for k in range(n):
    if i!=k and a[k]&1<<j:
     a[k]^=a[i]
   a[i],a[c]=a[c],a[i]
   c+=1
p=lambda x:pow(2,x,o)
print(p(n+m-c-1)*(p(c)-1)%o)

Measured memory_bytes: 3064
n = int(input())
s = input()

cnt = s.count("R") * s.count("G") * s.count("B")

for i in range(len(s)-2):
    for j in range(i + 1, len(s)-1):
        k = 2 * j - i
        if k < n and (s[k] != s[j] and s[j] != s[i] and s[i] != s[k]):
            cnt -= 1
print(cnt)


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

int main() {
  int n,a=0,b=0,max=0;
  cin >> n;
  vector<int> card(n);
  for (int i=0; i<n; i++) {
    cin >> card.at(i);
  }
  sort(card.begin(),card.end());
  for (int i=0; i<card.size(); i++) {
    if (i%2 == 0) a += card.at(card.size()-1-i);
    else  b += card.at(card.size()-1-i);
  }
  cout << a-b << endl;
}

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

using namespace std;

int main(){
	int n;
	cin >> n;
	while(n--){
		string s; cin >> s;
		string t[] = {" ", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
		string res = "";
		int cnt = 0, idx = 0;
		for(int i=0;i<s.size();i++){
			if(s[i]=='0'){
				if(idx!=0){
					res += t[idx][cnt];
				}
			}
			if(idx == s[i]-'0'){
				cnt = (cnt+1)%t[idx].size();
			} else {
				cnt = 0;
			}
			idx = s[i]-'0';
		}
		cout << res << endl;
	}
}

Measured memory_bytes: 1216
let makeStools heights =
    let mutable stools = []

    let rec makeStoolsRec prev heights =
        match heights with
        | [] -> ()
        | head :: tail ->
            let stool =
                match prev <= head with
                | true -> 0L
                | false -> prev - heights.[0]

            stools <- stool :: stools

            makeStoolsRec (heights.[0] + stool) tail

    makeStoolsRec 0L heights

    stools

stdin.ReadLine() |> ignore

stdin.ReadLine().Split()
|> Seq.map int64
|> Seq.toList
|> makeStools
|> List.sum
|> printfn "%d"


Measured memory_bytes: 61828
import java.util.Scanner;

public class Main {
	public static void main(String[] arg) {
		Scanner in = new Scanner(System.in);
		while (in.hasNext()) {
			int max = 0;
			int start = 0;
			String sa = in.next();
			String sb = in.next();
			StringBuilder sbb = new StringBuilder();
			int s = sa.length() + sb.length() - 1;
			for (int i = 0; i < s; i++) {
				if (max > sa.length() - start) {
					break;
				}
				if (i < sb.length()) {
					sbb.insert(0, sb.charAt(sb.length() - i - 1));
				} else {
					sbb.insert(0, ' ');
					start++;
				}
				if (i >= sa.length()) {
					sbb.setLength(sbb.length() - 1);
				}
				int count = 0;
				for (int posi = start; posi < sbb.length(); posi++) {
					if (sa.charAt(posi) == sbb.charAt(posi)) {
						count++;
					} else if (count != 0) {
						count = 0;
					}
					max = Math.max(count, max);
				}
			}
			System.out.println(max);
		}
		in.close();
	}
}

Measured memory_bytes: 22152
#include<iostream>
#include<vector>
#include<stdio.h>
using namespace std;
int main(){
int n,count=0;
  char s[50];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>s[i];
  }
  for(int i=0;i<n-2;i++){
    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
    count++;
    }
  }
  cout<<count<<endl;
return 0;
} 

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan=new Scanner(System.in);
		long N = scan.nextLong();

		int root=(int)Math.sqrt((double)N);

		long ansNum=0;
		for(int i=root;i>0;i--){
			if(N%i==0){
				//iで割り切れる
				ansNum=N/i;break;
			}
		}

		for(int i=0;i<11;i++){
			if(ansNum==0){
				System.out.println(i);
				break;
			}
			ansNum/=10;

		}

	}

}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
//Function
lli combi(lli n, lli r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
lli sigma1(lli n){return n*(n+1)/2;}
lli sigma2(lli s, lli n){return sigma1(n) - sigma1(s -1);}
using namespace std;
// }}} End Header

int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	int n, k;
	string s, t;
	cin >> s >> t;



	sort(all(s));
	sort(all(t));
	reverse(all(t));

	if(s < t) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt();
		int a[] = new int[m];
		int tmp = 0, tmp2 = 0;
		for(int i = 0; i < m; ++i) {
			a[i] = sc.nextInt();
			if(a[i] < x)++tmp;
			else ++tmp2;
		}
		sc.close();
		int ans = 0;
		ans = Math.min(tmp, tmp2);
		System.out.println(ans);
	}

}


Measured memory_bytes: 22740
#include<bits/stdc++.h>
using namespace std;
int main()
{int n,k;
cin>>n>>k;
vector<int> num(n);
int sum = 0;
for(int i = 0;i<n;i++)
cin>>num[i];
sort(num.begin(),num.end());
for(int i = 0;i<k;i++)
sum+=num[i];
cout<<sum<<endl; 
    return 0;
}

Measured memory_bytes: 3604
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let h: usize = read();
    let w: usize = read();
    let ss: Vec<String> = (0..h).map(|_| read()).collect();
    let sharps: String = (0..w + 2).map(|_| '#').collect();

    println!("{}", sharps);
    for s in ss {
        println!("#{}#", s);
    }
    println!("{}", sharps);
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb push_back;
#define sp " ";
#define INF 10000000000
void vout(vector<int> v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli n;
    cin>>n;
    lli nc=n;
    map<lli,lli> prime;
    lli i=2;
    lli ans=0;
    while(nc!=1){
        if(i*i>n) {
            prime[n]=1;
            break;
        }
        if(nc%i==0){
            lli count=0;
            while(nc%i==0){
                nc/=i;
                count++;
            }
            prime[i]=count;
        }
        i++;
    }
    for(auto v:prime){
        lli count=1,now=0;
        lli per=0;
        while(v.second>now){
            now+=count;
            per++;
            count++;
            if(v.second<now){
                per-=1;
            }
        }
        ans+=per;
    }
    out(ans);
}

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

const int MOD = (int)1e9+7;

int main(){
	long long A,B,K;
	cin >> A >> B >> K;

	if(A<=K){
		cout << 0 << " ";
		cout << max((long long)0,B-(K-A)) << endl;
	}
	else{
		cout << A-K << " ";
		cout << B << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<limits.h>
#include<utility>
#include<bits/stdc++.h>
#include<vector>
#include<tuple>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(A) A.begin(),A.end()
bool comparator(P a, P b) {
	return a.first / a.second < b.first / b.second;
}


int main() {
	int x, y, z;
	cin >> x >> y >> z;
	cout << z << " " << x << " " << y << endl;
}


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

#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";

#define     SPEED       ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define 	setprecn(x) cout<<fixed<<setprecision(x);
#define 	ll          long long int
#define 	pb          push_back
#define 	pll         pair<ll,ll>
#define 	vll         vector<ll>
#define 	ff          first
#define 	ss          second
#define 	all(a)      (a).begin(),(a).end()
#define 	sz(x)       (ll)x.size()
#define 	hell        1000000007
#define 	rep(i,n)    for(i=0;i<n;i++)
#define 	repe(i,a,b) for(i=a;i<b;i++)
#define 	lbnd        lower_bound
#define 	ubnd        upper_bound
#define 	bs          binary_search
#define 	mp          make_pair

ll power(ll a,ll b)
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	ll c=power(a,b/2);
	if(b%2==0)
		return((c%hell)*(c%hell))%hell;
	return ((((c%hell)*(c%hell))%hell)*(a%hell))%hell;
}

/********************************************************/
//	d.erase(unique(all(d)), d.end());
ll h[100105],dp[100005],n,k;


ll f(ll x)
{
	if(x==n-1) return 0;
	if(x>n-1) return hell;
	if(dp[x]==-1)
	{
		dp[x]=hell;
		ll i;
		rep(i,k)
			dp[x]=min(dp[x],f(x+i+1)+abs(h[x+i+1]-h[x]));
	}
	return dp[x];
}

int main()
{
	SPEED;
	ll t,c=0,i,j,m,cs=0;
	t=1;

	// cin>>t;
	string s;
	while(t--)
	{
		cin>>n>>k;
		// n=s.length();
		// ll a[n];
		rep(i,n)
		{
			cin>>h[i];
			dp[i]=-1;
		}
		dp[0]=0;dp[1]=abs(h[0]-h[1]);
		repe(i,2,n)
		{
			dp[i]=hell;
			rep(j,min(i,k))
				dp[i]=min(dp[i-j-1]+abs(h[i-j-1]-h[i]),dp[i]);
		}
		cout<<dp[n-1];
		if(t!=0)
	   		cout<<"\n";
	}
	return 0;
}

Measured memory_bytes: 1792
while 1 do
  h,w=gets.split.map(&:to_i)
  if h==0 and w==0 then
    break
  end
  for i in 1..h
    str=''
    for j in 1..w
      if (i+j)%2>0 then
        str+='.'
      else
        str+='#'
      end
    end
    puts str
  end
  puts ''
end  



Measured memory_bytes: 7252
#include <bits/stdc++.h>
#define fir first
#define sec second
#define pb 	push_back
#define ll  long long
//#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int>
#define debug(x) cerr<<#x<<" =: "<<x<<endl;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define Find find_by_order
#define Order order_of_key
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 mrand(random_device{}());
ll rnd(ll x) { return mrand() % x;}
ll ksm(ll a,ll b,ll mod){ll ans=1;a%=mod;while(b){if(b&1) ans=ans*a%mod;b>>=1;a=a*a%mod;}return ans;}
ll phi(ll n){ll ans=n;for(ll i=2;i*i<=n;i++){if(n%i==0) {while(n%i==0) n/=i;ans=ans*(i-1)/i;}}if(n>1) ans=ans*(n-1)/n;return ans;}
//head

const int maxn=2e3+7;
const ll mod=1e9+7;

string ss[maxn];

vector<ll>a,b,c;

bool cmp(ll a,ll b){
	return a>b;
}

ll solve(ll T){
	int n,k;cin>>n>>k;
	for(int i=1;i<=n;i++) {
		ll x;cin>>x;
		if(x>0) a.pb(x);
		if(x==0) c.pb(x);
		if(x<0) b.pb(x);
	}
	sort(all(a),cmp);
	sort(all(b));
	sort(all(c));
	if(k==n) {
		ll ans=1;
		for(auto x:a) ans*=x,ans%=mod;
		for(auto x:b) ans*=x,ans%=mod;
		for(auto x:c) ans*=x,ans%=mod;
		ans+=mod;
		return cout<<(ans+mod)%mod<<endl,0;
	}
	else {
		if(a.size()+b.size()<k) return cout<<"0"<<endl,0;
		if(a.size()==0) {
			ll ans=1;
			if(k&1) {
				if(c.size()==0) {
					for(int i=1;i<=k;i++) ans=ans*b[b.size()-i]%mod,ans+=mod,ans%=mod;
					ans+=mod,ans%=mod;
					return cout<<ans<<endl,0;
				}
				else return cout<<0<<endl,0;
			}
			else {
				for(int i=0;i<k;i++) ans=ans*b[i]%mod,ans%=mod;
				ans+=mod;
				ans%=mod;
				return cout<<ans<<endl,0;
			}
		}
		else {
			if(b.size()&1) b.pop_back();
			ll ans=1;
			ll p=0,q=0;
			if(k&1) ans*=a[p++],k--;
			while(k){
				if(q+2>b.size()||a[p]*a[p+1]>b[q]*b[q+1])
					ans=ans*a[p]%mod*a[p+1]%mod,ans%=mod,p+=2;
				else ans=ans*b[q]%mod*b[q+1]%mod,ans+=mod,ans%=mod,q+=2;
				k-=2;
			}
			cout<<ans<<endl;
		}
	}
	return 0;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll T=1;
//    cin>>T;
    for(ll cas=1; cas<=T; cas++) {
        solve(T);
    }
	return 0;
}


Measured memory_bytes: 5668
#include<stdio.h>
int main()
{
	char ch[100];int i,j,a,b;
	scanf("%s",&ch);b=-1;a=-1;
	for(i=0;i<=99;i++)
	{
		if(ch[i]=='C')
		{a = i;
		break;
	
	}
	}

	if(a!=-1&&a<=98)
	{
		for(j=0;j<=99;j++)
		{
			if(ch[j]=='F')
			{
				b=j;
			
			}
		}
		if(a<b) printf("Yes");
		else printf("No");
	}
	else printf("No");
	return 0;
	
}


Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <iomanip>
#include <cstdlib>
#include <climits>
#include <set>
using namespace std;

//関数getinputdata宣言
vector<vector<string>> getinputdata();
vector<vector<int>> getinputdata2();
vector<vector<double>> getinputdata3();

void m_solutions2019_a(vector<vector<string>> v) {

    int n = atoi(v[0][0].c_str());

    cout << (n-2)*180 <<endl;


}

int main() {

    vector<vector < string>> vec_arr_result;
    //    vector<vector<int>> vec_arr_result;
    vec_arr_result = getinputdata();

    m_solutions2019_a(vec_arr_result);

    return 0;
}

//関数getinputdata実装

vector<vector<double>> getinputdata3() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<double>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<double> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atof(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;
}

//関数getinputdata実装

vector<vector<int>> getinputdata2() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<int>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<int> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atoi(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;


}

//関数getinputdata実装

vector<vector < string >> getinputdata() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector < string>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<string> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(ret);
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;

}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
 
int main() {
    char s1[1000001];
    char s2[10001];
    int i, j, k;
 
    scanf("%s", s1);
    scanf("%s", s2);
     
    int s1len = strlen(s1);
    int s2len = strlen(s2);
 
    for (i = 0; i < s1len; i++) {
        if(strncmp(s2, &s1[i], s2len)==0) printf("%d\n", i);
    }
 
    return 0;
}


Measured memory_bytes: 2824
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>
#include <complex>
#include <bitset>
#include <tuple>
using namespace std;

typedef long long int lli;

int A, B;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> A >> B;
    cout << A * B;
    return 0;
}

Measured memory_bytes: 3652
n, m, k = map(int, input().split())

mod = 1000000007
def pow(x, n):
    ret = 1
    while n > 0:
        if (n & 1) == 1:
            ret = (ret * x) % mod
        x = (x * x) % mod
        n >>= 1
    return ret

fac = [1]
inv = [1]
for i in range(1, n * m + 1):
    fac.append((fac[-1] * i) % mod)
    inv.append(pow(fac[i], mod - 2))

def cmb(n, k):
    return (fac[n] * inv[k] * inv[n - k]) % mod

def doit(n, m, k):
    ret = 0
    for d in range(m):
        ret = (ret + d * (m - d)) % mod
    return (ret * n * n * cmb(n * m - 2, k - 2)) % mod

print((doit(n, m, k) + doit(m, n, k)) % mod)

Measured memory_bytes: 18912
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> p(n);
    int sum=0;
    for (int i=0; i<n; i++) {
        cin>>p[i];
        sum += p[i];
    }
    sort(p.begin(), p.end());
    sum -= p[n-1]/2;
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd1(ll x,ll y){
	ll temp=x;
	while(x%y!=0){
		x=y;
		y=temp%y;
		temp=x;
	}
	return y;
}

int main(){
	ll a,b;
	cin>>a>>b;
	
	ll d=a*b;
	ll c=d/gcd1(a,b);
	cout<<c;
	return 0;
}


Measured memory_bytes: 256
//https://cpprefjp.github.io/reference/algorithm/prev_permutation.html ->prev_permutation
//https://cpprefjp.github.io/reference/algorithm/next_permutation.html ->next_permutation


#include<iostream>
#include<vector>
#include<algorithm>

int main(){
    std::vector<int> num;
    
    int n;
    std::cin>>n;

    int num_buf;
    for(int i=0;i<n;i++){
        std::cin>>num_buf;
        num.push_back(num_buf);
    }

    bool op;

    op=std::prev_permutation(num.begin(),num.end());
    for(int i=0;i<n;i++){
        if(op==true){
            if(i!=n-1){
                std::cout<<num[i]<<" "<<std::flush;
            }else{
                std::cout<<num[i]<<std::endl;
            }
            
        }else if(op==false){
            break;
        } 
    }

    op=std::next_permutation(num.begin(),num.end());
    for(int i=0;i<n;i++){
        if(i!=n-1){
            std::cout<<num[i]<<" "<<std::flush;
        }else{
            std::cout<<num[i]<<std::endl;
        }
        
        
    }

    op=std::next_permutation(num.begin(),num.end());
    for(int i=0;i<n;i++){
        if(op==true){
            if(i!=n-1){
                std::cout<<num[i]<<" "<<std::flush;
            }else{
                std::cout<<num[i]<<std::endl;
            }
        }else if(op==false){
            break;
        }
    }

    return 0;

}



Measured memory_bytes: 3156
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);

void solve(){
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    int sum = 0;
    REP(i, n){
        sum += a[i];
    }
    int i = 0;
    bool flag = true;
    if(sum%10 != 0){
        cout << sum << endl;
    }
    else if(sum%10 == 0){
        while(sum%10 == 0 && i<n){
            if(a[i]%10 != 0){
                sum -= a[i];
                flag = false;
                if(sum%10 != 0) break;
            }
            i++;
        }
        if(flag) cout << 0 << endl;
        else cout << sum << endl;
    }
     
}

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

Measured memory_bytes: 256
N,K = [int(s) for s in input().split()]
s = list(map(int,input().split()))
a = 0
for i in range(N-K+1):
    if i == 0:
        a = min(abs(s[i]-s[i+K-1])+abs(s[i]),abs(s[i]-s[i+K-1])+abs(s[i+K-1]))
    else:
        if min(abs(s[i]-s[i+K-1])+abs(s[i]),abs(s[i]-s[i+K-1])+abs(s[i+K-1])) < a:
            a = min(abs(s[i]-s[i+K-1])+abs(s[i]),abs(s[i]-s[i+K-1])+abs(s[i+K-1]))
print(a)

Measured memory_bytes: 14480