akhauriyash/Code-Regression huggingface dataset:
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int P=1e9+7;
inline void upd(R int &x,R int y){(x+=y)>=P?x-=P:0;}
inline int add(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int dec(R int x,R int y){return x-y<0?x-y+P:x-y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int ksm(R int x,R int y){
	R int res=1;
	for(;y;y>>=1,x=mul(x,x))(y&1)?res=mul(res,x):0;
	return res;
}
const int N=5e5+5;
int c[N],s[N],suf[N],a[N],vis[N],fac[N],cnt,m,n,res,sum;
inline void chg(R int x){for(;x<=n;x+=x&-x)++c[x];}
inline int query(R int x){R int res=0;for(;x;x-=x&-x)res+=c[x];return res;}
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%d",&n),m=n;
	fp(i,1,n){
		scanf("%d",&a[i]);
		if(a[i])++s[a[i]],--m;
	}
	fp(i,1,n)suf[i]=s[i]=1-s[i],s[i]+=s[i-1];
	fd(i,n,1)suf[i]+=suf[i+1];
	fac[0]=1;fp(i,1,n)fac[i]=mul(fac[i-1],i);
	fd(i,n,1)if(!a[i])++cnt;
		else{
			sum=mul(query(a[i]-1),fac[m]);
			if(cnt)upd(sum,1ll*cnt*s[a[i]]%P*fac[m-1]%P);
			upd(res,mul(sum,fac[n-i]));
			chg(a[i]);
		}
	cnt=sum=0;
	fp(i,1,n)if(!a[i])upd(sum,fac[n-i]),++cnt;
		else if(cnt)upd(res,1ll*sum*suf[a[i]]%P*fac[m-1]%P);
	sum=(1ll*m*(m-1)>>1)%P,cnt=0;
	if(m>=2)fp(i,1,n)if(!a[i])++cnt,upd(res,1ll*sum*(m-cnt)%P*fac[m-2]%P*fac[n-i]%P);
	upd(res,fac[m]); 
	printf("%d\n",res);
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> X(N);
    rep(i, N) cin >> X[i];    

    ll ans = 1;
    ll free = 0;
    for (int i = 0; i < N; ) {
        if (X[i] < 2 * free + 1) {
            ans = ans * (free + 1) % MOD;
            free--;
        }
        else {
            free++;
            i++;
        }
    }
    rep(i, 1, free + 1) ans = ans * i % MOD;
    write(ans);
}

Measured memory_bytes: 640
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
s = input()

res = [0]
for i in range(1, len(s)):
    if s[i] == s[i - 1]:
        res[-1] += 1
    else:
        res.append(0)
print(min(sum(res) + 2 * m, n - 1))


Measured memory_bytes: 4116
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

string s[105];
VI rec[40010];
signed main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  while(true) {
    int h, w, l;
    cin >> h >> w >> l;
    if(!h && !w && !l) return 0;
    REP(i, h) cin >> s[i];

    int x=-1, y=-1, dir=-1;
    REP(i, h) REP(j, w) {
      if(s[i][j]=='N') {
        y=i, x=j, dir=0;
      } else if(s[i][j]=='E') {
        y=i, x=j, dir=1;
      } else if(s[i][j]=='S') {
        y=i, x=j, dir=2;
      } else if(s[i][j]=='W') {
        y=i, x=j, dir=3;
      }
    }
    assert(x!=-1&&y!=-1&&dir!=-1);

    int cnt = 0, r = 0, loop = 0;
    map<VI, int> mp;
    while(true) {
      while(true) {
        int nx = x+dx[dir], ny = y+dy[dir];
        if(IN(0LL, w, nx) && IN(0LL, h, ny) && s[ny][nx]!='#') break;
        dir=(dir+1)%4;
      }
      if(mp.find({x,y,dir}) != mp.end()) {
        r = mp[{x,y,dir}];
        loop = cnt - r;
        break;
      }
      mp[{x,y,dir}] = cnt;
      rec[cnt++] = {x,y,dir};
      x += dx[dir], y += dy[dir];
    }

    // for(auto i: mp) {
    //   cout << i << endl;
    // }

    char c[] = {'N', 'E', 'S', 'W'};
    if(l-r+1 <= 0) {
      // rec[l] が答え
      cout << rec[l][1]+1 << " " << rec[l][0]+1 << " " << c[rec[l-1][2]] << endl;
    } else {
      int tmp = (l-r)%loop;
      // rec[r+tmp] が答え
      cout << rec[r+tmp][1]+1 << " " << rec[r+tmp][0]+1 << " " << c[rec[r+(tmp-1+loop)%loop][2]] << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 4764
#include<stdio.h>
int main(void){
  int n,k,h;
  int ok=0;
  scanf("%d %d",&n,&k);
  for(int i=0;i<n;i++){
    scanf("%d",&h);
    if(h>=k){
      ok+=1;
    }
  }
  printf("%d\n",ok);
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
int main(){
  int a,b,c,d;
  scanf("%d%d%d",&a,&b,&c);
  if(a>b){d=a;a=b;b=d;
          if(b>c){d=b;b=c;c=d;
                  if(a>b){d=a;a=b;b=d;}
                 }
         }
  else if(b>c){d=b;b=c;c=d;
                if(a>b){d=a;a=b;b=d;}
                 }
  printf("%d",c-a);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define lld long double
#define MOD 1000000007
#define CAP 10000000
#define inf 1000000000000000000LL
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define sz(v) v.size()
#define all(v)    v.begin(),v.end()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
ll power(ll x,ll y, ll md=MOD){ll res = 1;x%=md;while(y>0){if(y&1)res = (res*x)%md;x = (x*x)%md;y = y>>1;}return res%md;}
#define dbg(x) cout <<#x<<":"<<x<<endl;
 
#define int ll
 
ll min1() {return inf;}
ll max1() {return -inf;}
 
template<typename... Args>
int min1(int a, Args... args) {return min(a,min1(args...));}
template<typename... Args>
int max1(int a, Args... args) {return max(a,max1(args...));}
 
struct node {
	std::vector<ll> v,w;
};
 
signed main() {
	fast;
 	
	string s;
	cin>>s;
	int n=s.size();
	int k=0;
	string prev="";
	//cout<<"$"<<n;
	for(int i=0;i<n;i++){
		string temp = "";
		temp += s[i];
		//cout<<"#"<<i<<" "<<k<<endl;
		if(temp!=prev) {
			prev=temp;
			if(i!=n-1)k++;
		}
		else if(i<n-2) {
			temp+=s[i+1];
			prev=temp;
			k++;
			i++;
		}
		else if(i==n-2){
			temp+=s[i+1];
			prev=temp;
			i++;
		}
		else k--;
	}
	cout<<k+1;
} 

Measured memory_bytes: 720
#include <atcoder/dsu>
using namespace atcoder;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#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 ALL(v) v.begin(), v.end()
#define SIZE(x) ll(x.size()) 
using P = pair<int, int>;
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; }
const int INF = 2e9;
const ll LINF = (1LL<<60);

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,m; cin >> n >> m;
  dsu d(n);
  REP(i,m){
    int a,b; cin >> a >> b;
    a--,b--;
    d.merge(a,b);
  }

  set<int> ld;
  REP(i,n) ld.insert(d.leader(i));

  cout << SIZE(ld)-1 << endl;
  return 0;
}


Measured memory_bytes: 7684
#秒単位の時間 S が与えられるので、h:m:s の形式へ変換して出力してください。ここで、h は時間、m は 60 未満の分、s は 60 未満の秒とします。
#Input
#S が１行に与えられます。
#Output
#h、m、s を :（コロン）区切りで１行に出力してください。数値が１桁の場合、0 を付けて２桁表示をする必要はありません。

S = int(input())
h = S // 3600
m = S // 60 - h * 60
s = S - h * 3600 - m * 60
print('{}:{}:{}'.format(h,m,s))



Measured memory_bytes: 5584
n = int(input())
a = list(map(int, input().split()))
a.sort()
bai = [0 for _ in range(max(a)+1)]
i = 2
for i in a:
    j = i
    while j < len(bai):
        bai[j] += 1
        j += i

res = 0
if n <= 1:
    print(n)
    exit()

for i in range(n):
    if i == 0:
        if a[i] != a[i+1] and bai[a[i]] == 1:
            res += 1
    elif i == n-1:
        if a[i] != a[i-1] and bai[a[i]] == 1:
            res += 1
    else:
        if a[i] != a[i-1] and a[i] != a[i+1] and bai[a[i]] == 1:
            res += 1

print(res)

Measured memory_bytes: 157468
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <stdexcept>

using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;
using comp = complex<double>;

const ll MOD = 1000000007LL;
const double PI = 3.14159265358979323846;

//conversion
//------------------------------------------
inline int toint(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); }

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __line__ << ")" << " " << __file__ << endl

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

	ll N;
	cin >> N;

	map<ll, ll> as;
	as[0] = 0;
	ll a;
	for (ll i = 0; i < N; ++i) {
		cin >> a;
		if (as.count(a) == 0) {
			as[a] = 0;
		}
		++as[a];
	}

	if (as[0] == N) {
		cout << "Yes" << endl;
	}
	else {
		if (N % 3 != 0) {
			cout << "No" << endl;
		}
		else {
			if (as[0] == (N / 3)) {
				bool can_wear = false;
				for (auto iter = as.begin(); iter != as.end(); ++iter) {
					if (iter->first != 0 && iter->second == (N / 3) * 2) {
						can_wear = true;
						break;
					}
				}
				cout << (can_wear ? "Yes": "No") << endl;
			}
			else if (as[0] == 0) {
				vector<ll> count_to_wear;
				for (auto iter = as.begin(); iter != as.end(); ++iter) {
					if (iter->first != 0 && iter->second == (N / 3)) {
						count_to_wear.emplace_back(iter->first);
					}
				}
				if (count_to_wear.size() == 3 && (count_to_wear[0] ^ count_to_wear[1]) == count_to_wear[2]) {
					cout << "Yes" << endl;
				}
				else {
					cout << "No" << endl;
				}
			}
			else {
				cout << "No" << endl;
			}
		}
	}

	return 0;
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                    \
  ifstream in("abc167/abc167_b.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  ll A, B, C, K;
  cin >> A >> B >> C >> K;

  ll k = K - A;
  ll ans = min(K, A);
  if (k <= 0) {
    cout << ans << endl;
    return 0;
  }
  k = k - B;
  if (k <= 0) {
    cout << ans << endl;
    return 0;
  }
  ans = ans - k;
  cout << ans << endl;
}

Measured memory_bytes: 3652
#include <cstdio>
#include <vector>
#include <bitset>

using namespace std;
typedef long long ll;

const int maxn=1e5+5, mod=1e9+7;

inline int sum(int a, int b){
	if(a+b>=mod){
		return a+b-mod;
	}
	else if(a+b<0){
		return a+b+mod;
	}
	return a+b;
}

inline int mul(int a, int b){
	return (ll)a*(ll)b%mod;
}

pair < int, int > dp[maxn];
bitset < maxn > bio;
vector < int > ms[maxn];

pair < int, int > dfs(int x){
	if(bio[x]){
		return dp[x];
	}
	bio[x]=1;
	pair < int, int > p;
	dp[x]=make_pair(1, 1);
	for(int i=0; i<ms[x].size(); i++){
		if(!bio[ms[x][i]]){
			p=dfs(ms[x][i]);
			dp[x]=make_pair(mul(dp[x].first, p.second), mul(dp[x].second, sum(p.first, p.second)));
		}
	}
	return dp[x];
}

int main(){
	int n;
	scanf("%d", &n);
	int a, b;
	for(int i=0; i<n-1; i++){
		scanf("%d%d", &a, &b);
		a--;
		b--;
		ms[a].push_back(b);
		ms[b].push_back(a);
	}
	dfs(0);
	printf("%d", sum(dp[0].first, dp[0].second));
	return 0;
}

Measured memory_bytes: 12032
#include <iostream>

using namespace std;
#include <string>
typedef long long int ll;
#include <algorithm>
#include <stack>
#include <vector>
#include <array>
#include <queue>


int main(){

  int N;
  int h_i=0;
  int h_i1=0;

  cin >> N;

  cin >>h_i;
  h_i -= 1;
  int hantei=1;//1=OK
  for(int i=0;i<N-1;i++){
    cin >> h_i1;
    if(h_i>h_i1){
      hantei = 0;
    }else{
      if(h_i<h_i1){
        h_i=h_i1-1;
      }else{
        h_i=h_i1;
      }
    }
  }

  if(hantei==1){
    cout << "Yes";
  }else{
    cout << "No";
  }


  return 0;

}


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

int main()
{
	//freopen("/home/zz7/CFInput","r",stdin);
	int a,b;scanf("%d%d",&a,&b);
	if(a+b==15)cout<<"+\n";
	else if(a*b==15)cout<<"*\n";
	else cout<<"x\n";
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    // AtCoder Beginner Contest 154
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        scanner.nextLine();
        List<Integer> values = new ArrayList<>();
        for(int x = 0; x<N; x++){
            values.add(scanner.nextInt());
        }
        String returnVal = "YES";
        Collections.sort(values);
        for(int x=1; x<=N-1; x++){

            if(values.get(x-1).equals(values.get(x))){
                returnVal = "NO";
                break;
            }
        }

        System.out.println(returnVal);

    }




}


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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;
typedef priority_queue< int, vector< int >, greater< int > >  minHeap;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define bug(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << "\n"

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}


inline int addmod(int x,int y)
{
    return (x%mod + y%mod)%mod;
}
inline int submod(int x,int y)
{
    return (x%mod - y%mod + mod)%mod;
}
inline int mulmod(int x,int y)
{
    return (x%mod *1LL* y%mod)%mod;
}
inline int nextSubMask(int i, int mask)
{
    return (i-1)&mask;   /// returns next  submask
}

template<typename T>
void we_r_done(T mssg)
{
    cout<<mssg;
    exit(0);
}

lli MX = 1e6 + 7;

lli mypow(int b , int p){

    if(p<0) return -1;

    lli ret = 1;
    for(int i=1; i<=p; i++){
        ret *= b;
        if(ret>=MX) return -1;
    }
    return ret;
}

int main()
{
    ///freopen("output.txt","w",stdout);

    lli n;
    cin>>n;
    lli ans = n-1;
    for(lli i=1 ; (i*i)<=n; i++){
        if(n%i) continue;
        
        ans = min(ans , i-1 + n/i - 1);
    }
    
    cout<<ans;



    return 0;
}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)
///using bs = bitset<MX>; // how many distinct number can be form?
///sort(atoz(v), [](const data x, const data y){return (x.a==y.a?x.b>y.b : x.a<y.a);});


Measured memory_bytes: 256
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#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>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif




#define int long long
#define rng(i,l,r) for(size_t i=(l);i<(r);++i)
#define rep(i,n) rng(i,0,n)
#define gnr(i,l,r) for(size_t i=(r)-1;i>=(l);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()   //1,2,3,...
#define rALL(obj) (obj).rbegin(), (obj).rend()//...,3,2,1

using namespace std;


//constant
const int MOD = 1e9+7;
const int INF = 1e18;
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};
const double pi = acos(-1);


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; }

int gcd(int a,int b){return b?gcd(b,a%b):a;}
//*max_element(ALL(vector))
//count(ALL(vector),num) -> n
//memset(obj,value,sizeof(obj));




void solve(){
    
    // 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);
    
    int n; cin >> n;
    vector<int> A(n); rep(i,n) cin >> A[i];
    
    int abssum = 0;
    int absmin = INF;
    int count  = 0;
    
    rep(i,n) {
        absmin = min(absmin,abs(A[i]));
        abssum += abs(A[i]);
        count += (A[i]<0)?1:0;
    }
    int ans;
    if(count%2){
        ans = abssum - absmin*2;
    }else{
        ans = abssum;
    }
    
    cout << ans << endl;
    
    
    
    

    
    
    
    
}





signed main() {
    solve();
    return 0;
}




Measured memory_bytes: 1024
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//long long型の最大値(LLONG_MAX)など
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;
typedef long double lb;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)

int main() {
    ll N,M,X;
    cin >> N >> M >> X;
    vector<ll> A(M);
    rep(i,M){
        cin >> A[i];
    }

    ll v1=0,v2=0;
    for(ll i=0;i<M;i++){
        if(A[i]>X){
            v1++;
        }else if(A[i] < X){
            v2++;
        }
    }

    ll ans = min(v1,v2);
    cout << ans << endl;

}


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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||local
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  int n,m;
  cin>>n>>m;
  vector<ll> a(n);
  cin>>a;
  sort(rbegin(a),rend(a));
  int sum = 0;
  rep(i,n)sum+=a[i];
  int cnt = 0;
  rep(i,n){
    if(a[i]*4*m>=sum)cnt++;
  }
  cout<<(cnt>=m?"Yes":"No")<<endl;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] spa = new int[3];
		int[] juice = new int[2];
		int a=2001;
		for(int i=0; i<3; i++){
			spa[i]=sc.nextInt();
		}
		for(int j=0; j<2; j++){
			juice[j]=sc.nextInt();
		}
		for(int i=0; i<3; i++){
			for(int j=0; j<1; j++){
				int work=spa[i]+juice[j];
				int work2=spa[i]+juice[j+1];
				if(work<work2){
					if(work<a){
						a=work;
					}
				}else if(work2<a){
					a=work2;
				}
			}
		}
		System.out.println(a-50);
		// TODO Auto-generated method stub

	}

}

Measured memory_bytes: 17160
def insertionSort (A, N):
    for i in range(N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        printArray(A)

def printArray(A):
    for i,x in enumerate(A):
        if i != 0:
            print(" ", end="")
        print(x, end="")
    print("")

n = int(input())
a = list(int(x) for x in input().split())

insertionSort(a,n)


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

int N;

void DFS(string S, char mx){
    if(S.size() == N){
        cout << S << endl;
        return;
    }
    for(char i = 'a'; i <= mx + 1; i++){
        string t = S;
        t += i;
        DFS(t, max(mx, i));
    }
}

int main(){
    cin >> N;
    DFS("", 'a' - 1);
    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }
template<class T = int64_t> T modpow(T N, T P, T M) { T ret{1}; N %= M; while (P) { if (P & 0x01) { ret *= N; ret %= M; } P >>= 1; N *= N; N %= M; } return ret; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }else{ ; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  int N, K; cin >> N >> K;
  int X, Y; cin >> X >> Y;
  
  if (N <= K) {
    cout << N*X << CRLF;
  } else {
    auto ans = K*X + (N-K)*Y;
    cout << ans << CRLF;
  }
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define  rep(i,n) for(li i = 0; i < (n); ++i)
#define  red(i,n) for(li i = (n)-1; i >= 0; --i)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a) 
using namespace std;
using li = long long;
using ul = unsigned long long;
using vi = vector<li>;
using vs = vector<string>;
inline ul gcd(ul a,ul b) { return b?gcd(b,a%b):a; }
const int INF=1000000009;


int main()
{
    int n,x=0;
    cin>>n;
    int a[n];
    rep(i,n)cin>>a[i];
    sort(a,a+n);
    reverse(a,a+n);
    rep(i,n) x+=(a[i])*(-2*(i%2)+1);
    cout<<x<<endl;
    return 0;
}


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

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = (int)1e9 + 7;

class Countings{
    private:
        int mod;
        vector<long long> factList, invList;
        long long Pow(long long x, long long n);
    public:
        Countings(int sz, int mod);
        long long Permutation(int n, int r);
        long long Combination(int n, int r);
        long long HomogeneousProduct(int n, int r);
};

Countings::Countings(int sz, int mod) : mod(mod), factList(sz + 1), invList(sz + 1) {
    factList[0] = 1;
    for(int i = 1; i < factList.size(); i++) {
        factList[i] = factList[i - 1] * i % mod;
    }
    invList[sz] = Pow(factList[sz], mod - 2);
    for(int i = sz - 1; i >= 0; i--) {
        invList[i] = invList[i + 1] * (i + 1) % mod;
    }
}

long long Countings::Pow(long long x, long long n){
    long long ret = 1;
    while(n > 0) {
      if(n & 1) ret = ret * x % mod;
      x = x * x % mod;
      n >>= 1;
    }
    return ret;
}

long long Countings::Permutation(int n, int r){
    if(r < 0 || n < r) return 0;
    return factList[n] * invList[n - r] % mod;
}

long long Countings::Combination(int n, int r){
    if(r < 0 || n < r) return 0;
    return factList[n] * invList[r] % mod * invList[n - r] % mod;
}

long long Countings::HomogeneousProduct(int n, int r){
    if(n < 0 || r < 0) return 0;
    return (r == 0 ? 1 : Combination(n + r - 1, r));
}

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

    map<int, int> mp;
    int ans = 0;
    FOR(i, 2, n+1){
        int num = i;
        for(int p = 2; p*p <= i; p++){
            while(num % p == 0){
                num /= p;
                mp[p]++;
            }
        }
        if(num > 1) mp[num]++;
    }
    int over2 = 0, over4 = 0, over74 = 0, over24 = 0, over14 = 0;
    for(auto x : mp){
        //cout << x.first << " " << x.second << endl;
        if(x.second >= 74) over74++;
        if(x.second >= 24) over24++;
        if(x.second >= 14) over14++;
        if(x.second >= 4) over4++;
        if(x.second >= 2) over2++;
    }

    Countings ct(10000, MOD);
    ans = over74 + over24 * (over2 - 1) + over14 * (over4 - 1) + ct.Combination(over4, 2) * (over2 - 2);

    cout << ans << endl;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();

        int result = Math.min(B,D) - Math.max(A,C);
        System.out.println(result >= 0 ?  result : 0);
    }

}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
int main(){
  int K, S;
  cin >> K >> S;
  int Y_max, count = 0;
  for(int X = 0; X <= K; X++){
    Y_max = min(K, S - X);
    for(int Y = 0; Y <= Y_max; Y++){
      if(S - X - Y <= K) count += 1;
    }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
import java.util.Collections;

public class Main {
    static Scanner stdIn = new Scanner(System.in);
    public static void main(String[] args){
        int n = stdIn.nextInt();
        Integer[] a = new Integer[n];
        for(int i=0; i<n; i++){
            a[i] = stdIn.nextInt();
        }

        Arrays.sort(a, Collections.reverseOrder());

        long ans = 0l;
        for(int i=0; i<n; i++){
            if(i == 0){
                ans += 0;
            }else{
                ans += a[i/2];
            }
        }
        
        System.out.println(ans);
    }
}


Measured memory_bytes: 63196
import numpy as np

N, K, Q = list(map(int, input().strip().split()))
As = [int(input()) for _ in range(Q)]

points = np.asarray([K for _ in range(N)])

points -= Q
for A in As:
    points[A - 1] += 1

for p in points:
    if p > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 17792
def mapint_inp():
    return map(int, input().split())

def intinp():
    return int(input())

N = intinp()

ans = 0
for i in range(1, N+1):
    if i%3==0 and i%5==0:
        continue
    elif i%3==0:
        continue
    elif i%5==0:
        continue
    else:
        ans += i

print(ans)

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


void solve() {
  int A, B;
  scanf("%d %d", &A, &B);

  int sum = 0;
  int outlet = 1;
  // if (B>1) {
  //   sum++;
  // }
  // if (A<B) {
  //   if ((B-A)%(A-1) ==0) {
  //     sum += (B-A)/(A-1);
  //   } else {
  //     sum += (B-A)/(A-1)+1;
  //   }
  // }
  while (outlet<B) {
    outlet += A-1;
    sum++;
  }

  cout << sum << "\n";
}

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


Measured memory_bytes: 256
import statistics

def f(a, n):
    a2 = [ai - (i+1) for (i,ai) in enumerate(a)]
    b = int(statistics.median(a2))
    
    sadness = sum(abs(ai - b) for ai in a2)
    
    b += 1
    sadness2 = sum(abs(ai - b) for ai in a2)

    
    return min(sadness, sadness2)
    
n = int(input())
a = [int(i) for i in input().split()]
print(f(a, n))


Measured memory_bytes: 27328
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    char c;
    cin >> c;
    c++;
    OUT(c)

    return 0;
}

Measured memory_bytes: 256
n = int(input())
height = [0 for i in range(6)]
for i in range(n):
    tmp = float(input())
    if tmp < 165:
        height[0]+=1
    elif tmp < 170:
        height[1]+=1
    elif tmp < 175:
        height[2]+=1
    elif tmp < 180:
        height[3]+=1
    elif tmp < 185:
        height[4]+=1
    else:
        height[5]+=1
for i, j in enumerate(height,1):
    print(str(i)+":"+"*"*j)


Measured memory_bytes: 5620
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
	int n,k,ans=1;
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		ans+=min(ans,k);
	}
	cout<<ans<<endl;
	return 0;
}


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

int main(void){
        int pn,i,get;
        long int total=0,power1=0,power2=0;
        scanf("%d",&pn);
        int liv[pn];

        for(i=0; i<pn; i++){
                scanf("%d",&liv[i]);
                total+=liv[i];
        }

        get=total/pn;
        for(i=0; i<pn; i++){
                power1+=powf(liv[i]-get,2);
                power2+=powf(liv[i]-get-1,2);
        }
        if(power1<power2)
                power2=power1;
        printf("%d\n",power2);
        return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include <cstdlib>
#include<algorithm>
using namespace std;

int main(){
	int N, K;
	scanf("%d %d", &N, &K);
	int h[N], cost[N];
	for (int i = 0; i <= K && i < N; ++i){
		scanf("%d", &h[i]);
		cost[i] = abs(h[i] - h[0]);
	}
	for (int i = K + 1; i < N; ++i){
		scanf("%d", &h[i]);
		cost[i] = cost[i - 1] + abs(h[i] - h[i - 1]);
		for (int j = 2; j <= K; ++j) if(cost[i - j] + abs(h[i] - h[i - j]) < cost[i]) cost[i] = cost[i - j] + abs(h[i] - h[i - j]);
	}
	printf("%d\n", cost[N - 1]);
	return 0;
}

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

int main() {
  //0 1 2
  //3 4 5
  //6 7 8
  vector<int>vec(9);
  for(int i=0; i<9; i++){
    cin >> vec[i];
  }
  int N;
  cin >> N;
  for(int i=0; i<N; i++){
    int j;
    cin >> j;
    for(int k=0; k<9; k++){
      if(vec[k] == j){
        vec[k] = 0;
      }
    }
  }
  if(vec[0] == 0 && vec[1] == 0 && vec[2] == 0){
    cout << "Yes" << endl;
    return 0;
  }
  else if(vec[3] == 0 && vec[4] == 0 && vec[5] == 0){
    cout << "Yes" << endl;
    return 0;
  }
  else if(vec[6] == 0 && vec[7] == 0 && vec[8] == 0){
    cout << "Yes" << endl;
    return 0;
  }
  else if(vec[0] == 0 && vec[3] == 0 &&  vec[6] == 0){
    cout << "Yes" << endl;
    return 0;
  }
  else if(vec[1] == 0 && vec[4] == 0 && vec[7] == 0){
    cout << "Yes" << endl;
    return 0;
  }
  else if(vec[2] == 0 && vec[5] == 0 && vec[8] == 0){
    cout << "Yes" << endl;
    return 0;
  }
  else if(vec[0] == 0 && vec[4] == 0 && vec[8] == 0){
    cout << "Yes" << endl;
    return 0;
  }
  else if(vec[2] == 0 && vec[4] == 0 && vec[6] == 0){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
}


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

int main(){
 int h,w;
 int height[3000], width[3000];
 int count;
 while(1){
  cin >> h >> w;
  if( h==0 && w==0 ){
    break;
  }
  height[count]=h;
  width[count]=w;
  count++;
 }

 int output_count=0;
 while( output_count<count ){
   for( int i=0; i<height[output_count]; i++ ){
    for( int j=0; j<width[output_count]; j++ ){
     if( i==0 || i==height[output_count]-1 ){
        cout << "#";
     }else{
        if( j==0 || j==width[output_count]-1 ){
          cout << "#";
        }else{
          cout << ".";
        }
     }

      if( j==width[output_count]-1 ){
       cout << endl;
      }
     }
    }
   cout << endl;
   output_count++;
 }

 return 0;
}


Measured memory_bytes: 3100
import math 
N, D = map(int, input().split())
X, Y = [], []
count = 0
for i in range(N):
  tmp = list(map(int, input().split()))
  X = tmp[0]
  Y = tmp[1]
  if math.sqrt(X**2+Y**2) <= D:
    count += 1
print(count)
  


Measured memory_bytes: 9200
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("4 5 3");
            WillReturn.Add("8");
            WillReturn.Add("7");
            WillReturn.Add("4");
            WillReturn.Add("2");
            //2
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("2 10 4");
            WillReturn.Add("20");
            WillReturn.Add("20");
            //4
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("5 2 1");
            WillReturn.Add("900000000");
            WillReturn.Add("900000000");
            WillReturn.Add("1000000000");
            WillReturn.Add("1000000000");
            WillReturn.Add("1000000000");
            //800000000
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static long mA;
    static long mB;
    static long[] mHArr;

    static void Main()
    {
        List<string> InputList = GetInputList();
        long[] wkArr = InputList[0].Split(' ').Select(X => long.Parse(X)).ToArray();

        mA = wkArr[1];
        mB = wkArr[2];

        mHArr = InputList.Skip(1).Select(X => long.Parse(X)).ToArray();
        //降順にソートしておく
        Array.Sort(mHArr, (A, B) => B.CompareTo(A));

        Console.WriteLine(ExecNibunHou());
    }

    //2分法で何回の爆発が必要かを調べる
    static long ExecNibunHou()
    {
        long L = 0;
        long R = mHArr.Sum(X => X / mA + 1);

        while (L + 1 < R) {
            long Mid = (L + R) / 2;

            bool IsOK = DeriveIsOK(Mid);
            if (IsOK) R = Mid;
            else L = Mid;
        }
        return R;
    }

    //K回の爆発でOKかを返す
    static bool DeriveIsOK(long pK)
    {
        //爆発回数
        long BakuhatuCnt = 0;

        //余波の合計
        long YohaSum = pK * mB;

        foreach (long EachH in mHArr) {
            long RestH = EachH - YohaSum;
            if (RestH <= 0) continue;

            long wkDiff = mA - mB;
            long CurrBakuhatuCnt = RestH / wkDiff;
            if (EachH % wkDiff > 0) CurrBakuhatuCnt++;

            BakuhatuCnt += CurrBakuhatuCnt;
            if (BakuhatuCnt > pK) return false;
        }
        return true;
    }
}


Measured memory_bytes: 27740
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    for i in 1..10 {
        if n <= i * 9 && n % i == 0 {
            println!("Yes");
            return;
        }
    }
    println!("No");
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef vector<vector<P>> vvP;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e9;
const ll MAX_N = 100010;

int main() {
    ll n, k;
    cin >> n >> k;

    vl a(n);
    ll sum = 0;
    rep(i, n) {
        cin >> a[i];
        sum += a[i];
    }
    sort(all(a));

    if(sum < k) {
        out(n);
        re0;
    }

    ll left = -1;
    ll right = n;
    while(right - left > 1) {

        ll x = (left + right)/2;

        // a[x]が必要かどうか考える
        if(a[x] >= k) {
            right = x;
            continue;
        }

        vvl dp(n+1, vl(k));  // dp[i+1][j] : a[i]までの要素の総和がjとなるか？
        dp[0][0] = 1;
        rep(i, n) {
            if(i == x) {
                rep(j, k) {
                    if(dp[i][j]) {
                        dp[i+1][j] = 1;
                    }
                }
            }
            else {
                rep(j, k) {
                    if(dp[i][j]) {
                        dp[i+1][j] = 1;
                        if(j + a[i] < k) {
                            dp[i+1][j + a[i]] = 1;
                        }
                    }
                }
            }
        }

        ll noneed = 1;  // a[x]が不必要なら1
        exrep(j, k - a[x], k-1) {
            if(dp[n][j]) {
                noneed = 0;
            }
        }

        if(noneed) {
            left = x;
        }
        else {
            right = x;
        }
    }

    out(right);
    re0;
}

Measured memory_bytes: 195928
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T> std::ostream& operator <<(std::ostream& os, std::vector< T > v)
{
  os << v[0]; for (ll i = 1; i < (ll)v.size(); i++){ os << "\n" << v[i]; }
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H&& head){ std::cout << head << std::endl; }
template<typename H, typename... T> void print(H&& head, T&&... tail){
  std::cout << head << " ", print(std::forward<T>(tail)...);
}

// GCD, LCM
ll gcd(ll a, ll b) {
  while (b != 0) { a %= b; std::swap(a, b); }
  return a;
}
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

// DIGNUM
std::vector<ll> dignum(ll x) {
  if (x == 0) return {0};
  std::vector<ll> res;
  while (x) {
    res.push_back(x % 10);
    x /= 10;
  }
  std::reverse(res.begin(), res.end());
  return res;
}

// FAIL
void fail(){ print(-1); std::exit(0); }
//void fail(){ print("No"); std::exit(0); }

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

  ll N;
  std::cin >> N;
  std::vector< ll > va(N, 0LL);
  for (ll i = 1; i < N; i++) {
    ll a;
    std::cin >> a;
    --a;
    ++va[a];
  }

  print(va);

  return 0;
}


Measured memory_bytes: 6348
#include<stdio.h>

int main(){
char str[201];
int i;
int x;
x='a'-'A';

scanf("%[^\n]",str);

for(i=0;str[i]!='\0';i++){
 if(str[i]>='a'&&str[i]<='z'){str[i]=str[i]-x;}
 else if(str[i]>='A'&&str[i]<='Z'){str[i]=str[i]+x;}
}

printf("%s\n",str);

return 0;
}

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def build_grid(H, W, intv, _type, space=True, padding=False):
    # 入力がスペース区切りかどうか
    if space:
        _input = lambda: input().split()
    else:
        _input = lambda: input()
    _list = lambda: list(map(_type, _input()))
    # 余白の有無
    if padding:
        offset = 1
    else:
        offset = 0
    grid = list2d(H+offset*2, W+offset*2, intv)
    for i in range(offset, H+offset):
        row = _list()
        for j in range(offset, W+offset):
            grid[i][j] = row[j-offset]
    return grid

H, W, K = MAP()

grid = build_grid(H, W, '*', str, space=False, padding=True)

ans = list2d(H+2, W+2, -1)
cnt = 0
for i in range(1, H+1):
    # 苺が1つもない行は1つ前をそのまま持ってくる
    if ''.join(grid[i]).count('#') == 0:
        ans[i] = ans[i-1]
        continue
    for j in range(1, W+1):
        if grid[i][j] == '#':
            cnt += 1
        ans[i][j] = cnt
    # その行で最初の苺が出現する前の場所を塗り直す
    for j in range(W, 0, -1):
        if ans[i][j] == 0 or ans[i][j] == ans[i-1][W]:
            ans[i][j] = ans[i][j+1]

# 先頭行から何もなかった場合は後の行からそのまま持ってくる
for i in range(H, 0, -1):
    if ans[i][1] == -1:
        ans[i] = ans[i+1]

for i in range(1, H+1):
    print(*ans[i][1:W+1])


Measured memory_bytes: 8272
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define MAX 9223372036854775807
#define MIN -9223372036854775807
#define PI 3.141592653589
#define setbits(n) __builtin_popcountll(n)
const ll mod=1e9+7;


int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T=clock();
    
    ll n,m;
    cin>>n>>m;
    vector<string> a(n);
    vector<vector<ll>> dp(n,vector<ll>(m,0));
    for(ll i=0;i<n;i++)
        cin>>a[i];
    dp[0][0]=1; 
    for(ll i=0;i<n;i++){
        for(ll j=0;j<m;j++){
            if(i==0&&j==0) continue;
            ll sum=0;
            if(i>0&&a[i-1][j]=='.')
                sum=dp[i-1][j];
            if(j>0&&a[i][j-1]=='.')
                sum=(sum+dp[i][j-1])%mod;
            dp[i][j]=sum;
        }
    }
    cout<<dp[n-1][m-1];
    

    

    cerr<<"\n\nTIME: "<<(double)(clock()-T)/CLOCKS_PER_SEC<<" sec\n";
    T = clock();
    return 0;
}

Measured memory_bytes: 12640