akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <climits>
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define fish        push_front
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Deque       std::deque
#define PQueue      std::priority_queue
#define Set         std::set
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define HashMap     std::unordered_map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    template<class A, class B> A power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
    template<class A, class B> A lcm   ( A x,  B y ) { return ( x / gcd(x, y) * y ); }
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
    template<class A, class B> inline bool chmax ( A &a, const B &b ) { return b > a ? a = b, true : false; }
    template<class A, class B> inline bool chmin ( A &a, const B &b ) { return b < a ? a = b, true : false; }
    inline boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    HashMap<int, int> mp;

    signed call_of_Cthulhu( signed datum ) {

        int n;
        read n;
        for ( int i = 0; i < n; i++ ) {
            int a;
            read a;
            mp[a]++;
        }
        int ans = 0;
        for ( Pii pii : mp ) {
            int val = pii.first;
            int cnt = pii.second;
            if ( val < cnt ) {
                ans += cnt-val;
            }
            if ( cnt < val ) {
                ans += cnt;
            }
        }
        echo ans fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}


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

typedef long long ll;

const int MAXN = 200010;

int n;
int a[MAXN];
ll dp[MAXN][5];

void update(ll &a, ll b) {
    if (a > b) {
        a = b;
    }
}

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        scanf("%d", a + i);
    }
    memset(dp, 0x3f, sizeof(dp));
    ll inf = dp[0][0];
    dp[0][0] = 0;
    for (int i = 1; i <= n; ++i) {
        ll tmp = dp[i - 1][0];
        update(dp[i][0], tmp + a[i]);

        tmp = std::min(tmp, dp[i - 1][1]);
        update(dp[i][1], tmp + (a[i] ? (a[i] & 1) : 2));

        tmp = std::min(tmp, dp[i - 1][2]);
        update(dp[i][2], tmp + !(a[i] & 1));

        tmp = std::min(tmp, dp[i - 1][3]);
        update(dp[i][3], tmp + (a[i] ? (a[i] & 1) : 2));

        tmp = std::min(tmp, dp[i - 1][4]);
        update(dp[i][4], tmp + a[i]);
    }

    ll ans = LLONG_MAX;
    for (int j = 0; j < 5; ++j) {
        if (dp[n][j] != inf) {
            update(ans, dp[n][j]);
        }
    }
    printf("%lld\n", ans);
    return 0;
}


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

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

  int X , Y;
  X=A/K;
  Y=B/K;

  bool ans = false;
  for (int i = X; i < Y+2; i++) {
   int Z=K*i;
   if (A<=Z && Z<=B){
     ans = true;
     break;
   }
  }

 if (ans) {
   cout << "OK" << endl;
 }
 else {
   cout << "NG" << endl;
 }
  return 0;
}

Measured memory_bytes: 3624
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>

#define ST_ARR_LEN(array) (sizeof(array)/sizeof(*array))
 
using namespace std;
  
int main(){
  int N, R;
  cin >> N >> R;
  
  int ans;
  if(N >= 10){
    ans = R;
  }else{
    ans = R+100*(10-N);
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)
#include <numeric>
#include <iomanip>
#include <map>

using namespace std;

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))
#define rep(i,n) for(long long i = 0;i < n;++i)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(nullptr);
#define fix(n) fixed << setprecision(n)
#define all(v) v.begin(),v.end()

#define PI 3.14159265358979323846;

using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;


int main(void){
    FAST_IO
    
    ll A,B,M;
    cin >> A >> B >> M;

    vll a(A);
    vll b(B);
    rep(i,A) cin >> a[i];
    rep(i,B) cin >> b[i];
    ll ans = *min_element(all(a)) + *min_element(all(b));

    rep(i,M){
        ll x,y,c;
        cin >> x >> y >> c;
        x--;
        y--;

        assign_min(ans, a[x] + b[y] - c);
    }

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

Measured memory_bytes: 4336
fun main (args : Array<String>) {
	val a = readLine()!!
	val b = readLine()!!
	var result : Int = 0
	for (i in 1..3) {
		if (i != a.toInt() && i != b.toInt()) {
			result = i
			break
		} else {
			continue
		}
	}
	return println("${result}")
}

Measured memory_bytes: 33628
// Problem : A - The Number of Even Pairs
// Contest : AtCoder Beginner Contest 159
// URL : https://atcoder.jp/contests/abc159/tasks/abc159_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
 
#define pb push_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define hell1 1000000007
#define hell2 1000000009
#define ms(s, n) memset(s, n, sizeof(s))
#define prec(n) fixed<<setprecision(n)
#define eps 0.000001
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define ll long long
#define ld long double 
#define no_of_digits(n) floor(log10(n)) + 1
#define see(x) cout << #x << "=" << x << endl;
#define see2(x, y) cout << #x << "=" << x << "\t" << #y << "=" << y << endl;
#define see3(x, y, z) cout << #x << "=" << x << "\t" << #y << "=" << y << "\t" << #z << "=" << z << endl;
#define INF 1e9+5
#define LL_MAX 1e18+5

using namespace std;

const ld PI = acos((ld)-1);
 
ll modmult(ll a,ll b, ll p=hell1){   return ((a%p)*(b%p))%p; }
ll modmultbig(ll a,ll b,ll mod=hell1){   if(a==0 or b==0) return 0;if(a==1 or b==1) return (a*b)%mod;ll cur=modmultbig(a,b/2,mod);cur=(2*cur)%mod;if(b%2) cur=(cur+a)%mod;return cur;}
ll modadd(ll a, ll b, ll p=hell1){ if(a>=p) a%=p; if(b>=p) b%=p; if(a+b>p) return (a + b)%p; else return a+b;}
ll modsub(ll a, ll b, ll p=hell1){return (a%p - b%p + p)%p;}
ll fpow(ll n, ll k, ll p = hell1) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = modmult(r,n,p); n = modmult(n,n,p);} return r;}
ll inv(ll a, ll p = hell1) {return fpow(a, p - 2, p);}
ll inv_euclid(ll a, ll m = hell1){ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0;while (a > 1){ll q = a / m;ll t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}

int isPowerof2(ll x) { return (x && !(x & (x-1))); } 

ll log2(ll x) { ll res = 0; while (x >>= 1) res++; return res; } 

bool isPerfectSquare(long double x) {long double sr = sqrt(x); return ((sr - floor(sr)) == 0); }
 
bool boundary(ll i,ll j,ll n, ll m){return (i>=0 && i<n && j>=0 &&  j<m);} //matrix boundary checking

ll ceil(const ll &a, const ll &b){return (a - 1)/b + 1;}
 
string alpha="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

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

// cout << fixed for removing e notation
 
bool comp2(const pair<int, int>&a, const pair<int, int>&b)
{
    if(a.second < b.second)
        return true;
    else if(a.second == b.second)
    {
        if(a.fi > b.fi) return true;
        else return false;
    }
    else return false;
}
 

 
bool prime[10000005];
void SieveOfEratosthenes(int n) 
{
    memset(prime, true, sizeof(prime)); 
    prime[0] = prime[1] = 0;
    for (int p=2; p*p<=n; p++) 
    {
        if (prime[p] == true) 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
    }
}

int main()
{
	int n, m;
	cin >> n >> m;
	
	ll ans = 0;
	ans += (n*(n-1))/2;
	ans += (m*(m-1))/2;
	
	cout << ans << "\n";
}






























































Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string inp;
    cin >> inp;
    sort(inp.begin(), inp.end());
    if(inp[0]==inp[1]&&inp[2]==inp[3]&& inp[2]!=inp[1]){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}


Measured memory_bytes: 256
/*
  AUTHOR:SOURABH
  CREATED:01:05:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<pll , null_type, less< pll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 1000000007
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

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

    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    ll t,i,n,m,j,o,k,u,v,h,ans;
    string s;
    t=1;
    //cin>>t;
    W(t--)
    {
        cin>>n>>m;
        vll a(n+1);
        vector<vll> adj(n+1);
        fs(i,1,n+1)
        {
            cin>>a[i];
        }
        fn(i,m)
        {
            cin>>u>>v;
            adj[u].pb(v);
            adj[v].pb(u);
        }
        ans=0;
        fs(i,1,n+1)
        {
            k=adj[i].size();
            if(k==0)
                {ans++;continue;}
            h=0;
            fn(o,k)
            {
                j=adj[i][o];
                h=max(a[j],h);
            }
            if(a[i]>h)
                ans++;
        }
        cout<<ans;
    }
    return 0;
}




















Measured memory_bytes: 9764
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
const ll INF = 1e18L + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int main() {
  int n; cin>>n;
  vi a(n);
  rep(i,n) cin>>a[i];
  int ans=0;
  int num=1;
  rep(i,n) {
    if(a[i]==num) {
      num++;
    } else {
      ans++;
    }
  }
  if (ans==n) ans=-1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
N = int(input())
S = input()

left_black = [0] * N
for i in range(N):
    if S[i] == '#':
        left_black[i] += 1
for i in range(N - 1):
    left_black[i+1] = left_black[i] + left_black[i+1]
left_black.insert(0, 0)
# print(left_black)

right_white = [0] * N
for i in range(N):
    if S[i] == '.':
        right_white[i] += 1
for i in range(N-1, 0, -1):
    right_white[i - 1] = right_white[i - 1] + right_white[i]
right_white.append(0)
# print(right_white)

m = 10 ** 6
for i in range(N):
    # if S[i] == '#':
    temp = left_black[i] + right_white[i + 1]
    # print(temp)
    m = min(m, temp)
print(m)



Measured memory_bytes: 47456
#include <iostream>
#include <algorithm>
#include<cstdio>
using namespace std;
int ** DPGCD;

int gcd2(int a,int b){
    if (DPGCD[a][b]==-1)
        DPGCD[a][b] = std::__gcd(a,b);
    return DPGCD[a][b];
}

int gcd3(int a,int b,int c){
    return gcd2(gcd2(a,b),c);
}

int main(){
    int K = 0,i=0,j=0,n=0;
    long long int o=0;
    cin >> K;

    DPGCD = new int*[K+1];
    for(i=1;i<=K;i++){
        DPGCD[i] = new int[K+1];
        for(j=1;j<=K;j++){
            DPGCD[i][j] = -1;
        }
    }

    for(i=1;i<=K;i++){
        for(j=1;j<=K;j++){
            for(n=1;n<=K;n++){
                o+= gcd3(i,j,n);
            }
        }
    }
    cout << o;

    for(i=1;i<=K;i++){
        delete[] DPGCD[i];
    }
    delete[] DPGCD;
	return 0;
}


Measured memory_bytes: 3760
#include<cstdio>
#include<cmath>
#define RI register int
#define CI const int&
using namespace std;
const int N=3005;
const double pi=acos(-1);
int n,l,t[N],cur; double ansx,ansy;
int main()
{
    RI i,j; for (scanf("%d%d",&n,&l),i=1;i<=n;++i) scanf("%d",&t[i]);
    for (i=1;i<n;++i) for (cur=0,j=i+1;j<=n;++j,++cur)
    {
        ansx+=1.0*(n-2-cur)*cos(pi*(t[i]+t[j])/l)/(n-2);
        ansy+=1.0*(n-2-cur)*sin(pi*(t[i]+t[j])/l)/(n-2);
        ansx-=1.0*cur*cos(pi*(t[i]+t[j])/l)/(n-2);
        ansy-=1.0*cur*sin(pi*(t[i]+t[j])/l)/(n-2);
    }
    double ct=1.0*n*(n-1)/2.0; ansx/=ct; ansy/=ct;
    return printf("%.16lf %.16lf",3.0*ansx,3.0*ansy),0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
long long h[N];
long long n;
long long a,b;
bool check(long long x){
    long long dis = x*b; //攻击x次，所以每个至少受到x*b
    long long dd = a-b;
    long long sum=0;
    for(long long i = n ; i >= 1 ; i -- ){
        if(h[i]>dis){
            if((h[i]-dis)%dd){
                sum += (h[i]-dis)/dd + 1;
            }
            else sum += (h[i]-dis)/dd;
        }
    }
    if(sum<=x) return true;
    else return false;
}

int main()
{

    long long sum=0;
    cin>>n>>a>>b; //假设所有受到b，对象额外 a-b
    for(long long i = 1 ; i <= n ; i++ ){
        cin>>h[i];
        sum+= (h[i]/b)+1;
    }
    sort(h+1,h+1+n);
    long long l = 1, r = sum;
    long long mid;
    while(l<r){
         mid = (l + r)/2;
        if(check(mid)) r=mid;
        else l=mid+1;
    }
    cout<<l<<endl;
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    cin >> p.at(i);
    if (p.at(i) != i + 1) cnt++;
    if (cnt > 2) break;
  }
  if (cnt > 2) cout << "NO" << endl;
  else cout << "YES" << endl;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
//
//using namespace std;
//
//int main() {
//    long long d,n;
//    while(cin >> d >> n) {
//        if(d == 0) {
//            cout << n << endl;
//            continue;
//        }
//        long long c;
//        if(d == 1)
//            c = 100;
//        else c = 10000;
//        cout << n * c << endl;
//    }
//    return 0;
//}
//



#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e5 + 100;
int a[maxn];
int main() {
    int n;
     while(cin >> n){
        int ans = 0;
        for(int i = 1;i <= n;i++) cin >> a[i];
        for(int i = 1;i <= n;i++){
            while(a[i] % 2 == 0) ans++,a[i] /= 2;
        }
        cout << ans << endl;
     }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);
#define mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f
#define MEM(x, y) memset(x, y, sizeof(x))
#define pb push_back
#define mk make_pair
#define pi pair<int, int>
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = a; i >= (b); --i)
using namespace std;
int dt[][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}, {0, 0}};
//typedef pair<int, int> P;
//priority_queue<int, vector<int>, greater<int> > q;
int main()
{
    IOS;
    ll x;
    cin >> x;
    ll a, b;
    rep(i,-500, 500)
    {
        a = i;
        ll temp = pow(a, 5);
        ll t = temp - x;
        if (t >= 0)
        {
            b = pow(t, 1.0 / 5);
            //b2 = pow(t2, 1.0 / 5);
        }
        else
        {
            b = -1 * pow(abs(t), 1.0 / 5);
           // b2 = -1 * pow(abs(t2), 1.0 / 5);
        }
        if (temp - pow(b, 5) == x)
        {
            cout << a << " " << b;
            break;
        }
    }
}


Measured memory_bytes: 4056
INF = float("inf")
n, m = map(int, input().split())
edges = [None] * m

# n:node num
# e:edges
# s:start node

d = [INF] * n
d[0] = 0
def Bellmanford(n, e, s):

    # 経路は最大でもN-1回移動すると終わるので（閉路がない限り）その分だけ更新
    for i in range(n):
        # すべての辺についてみていく
        for a,b,c in e:
            # aにたどり着ける（コストがINFではない）かつ、今のところのbまでのコストがa->bで行くときより大きい場合、更新
            if d[a] != INF and d[a] + c < d[b]:
                d[b] = d[a] + c

                # N回目更新した際に、それでも最終地点Nまでのコストが更新されたー＞負の閉路がある
                if i == n-1 and b == n-1:
                    return INF


    return -1 * d[-1]



for i in range(m):
    A, B, C = map(int, input().split())
    edges[i] = (A-1, B-1, -C)

ans = Bellmanford(n, edges, 0)
print(ans)

Measured memory_bytes: 3364
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;

int main() {
	int A, B;
	cin >> A >> B;
	cout << max({ A + B, A*B, A - B });

	return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF (1e9)
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

void Main(){

  ll x;
  cin>>x;

  cout << 1+((x-1)/11)*2+((x-1)%11>=6) <<"\n";

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


Measured memory_bytes: 256
import collections
import itertools
s=int(input())
l=[input() for i in range(s)]
counter = collections.Counter(l)

mode_v = counter.most_common()[0][-1]
it = itertools.takewhile(
    lambda kv: kv[-1] == mode_v, counter.most_common()
)
u=[]
for k, v in it:
  u.append(k)
  
u.sort()
for i in range(len(u)):
  print(u[i])

Measured memory_bytes: 45120
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  ll a,b,x;
  cin >> a >> b >> x;
  pr(b/x-(a?(a-1)/x:-1));
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    string s = to_string(n);
    int sz = s.size();

    bool IncNo9 = false;
    for (int i = 1; i < sz; i++) {
        if (s[i] != '9') IncNo9 = true;
    }

    cout << s[0] - '0' + (sz - 1) * 9 - IncNo9 << endl;
    return 0;
}

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

#define INF (i64)(1e18)
#define MOD (i64)(1e9+7)
#define REP(i, n) for(i64 i = 0; i < (n); i++)
#define RANGE(i, a, b) for(i64 i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define SIZE(v) ((i64)(v).size())
template<class T> inline void chmax(T &a, const T &b) { if (a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if (a > b) a = b; }
inline i64 gcd(i64 a, i64 b) {
  if (a < b) swap(a, b);
  return b ? gcd(b, a % b) : a;
}
inline i64 lcm(i64 a, i64 b) {
  return a * b / gcd(a, b);
}

int main() {
  i64 x;
  cin >> x;
  cout << 360 / gcd(x, 360) << endl;
  return 0;
}


Measured memory_bytes: 3584
n,a,b = map(int,raw_input().split())

arr = []

for i in range(n):
	arr.append(int(input()))

def ceil(a,b):
	if a % b == 0:
		return a/b
	else :
		return a/b + 1

def istrue(x):
	t = 0
	for i in arr:
		t += ceil((i - (b*x) if (i - (b*x)) > 0 else 0),(a-b))

	if t <= x :
		return True 

	else :
		return False


left = 0; right = 10**9
for i in range(30):
	mid = (left + right)/2
	if istrue(mid):
		right = mid
	else :
		left = mid

print right

Measured memory_bytes: 8964
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdlib>
#include <queue>
#include <cstring>
#include <set>
#include <map>

using namespace std;

const long long oo = 1000000000000ll;

#define foru(i, l, r) for (int i = l; i <= r; ++i)
#define ford(i, r, l) for (int i = r; i >= l; --i)
#define repu(i, r) for (int i = 0; i < r; ++i)
#define ll long long
#define F first
#define S second
#define mp make_pair
#define pint pair < ll, int >

int n, t, x, res;

int main() {
    cin >> n >> t;
    int l = 0, r = 0;
    foru(i, 1, n) {
        cin >> x;
        if (x <= r) r = x + t;
        else {
            res += r - l;
            l = x; r = x + t;
        }
    }
    res += r - l;
    cout << res;
}


Measured memory_bytes: 256
// --------------
// Tejas Pandey  |
// 02 - 08 - 20  |
// Atcoder BC 174|
// --------------

#include <bits/stdc++.h>
using namespace std;
     
#define mod 1000000007
#define vi vector<int>
typedef long long int ll;
     
int main (void){
  //freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int cw = 0;
  for(int i = 0;i < s.size();i++) if(s[i] == 'W') cw++;
  int ans = n - cw,nw = 0;
  for(int i = 0;i < s.size();i++){
	if(s[i] == 'W') nw++;
	int nr = n - cw - (i + 1 - nw);
	ans = min(ans,abs(nw - nr) + min(nw,nr));
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 3768
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ull unsigned long long int
#define ll long long int
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define MOD (ull)(double)(1e9 + 7)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vb vector<bool>
#define vll vector<ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define vvi vector<vi>
#define vvll vector<vll>
#define vs vector<string>
#define pull pair<ull, ull>
#define F first
#define S second
#define m_p make_pair
#define debug(x) cout << #x << " " << x << endl
#define printArr(a, start, end)for(int i=start ; i<end ; ++i)cout << a[i] << " ";cout << endl;
#define readArr(a, start, end)for(int i=start ; i<end ; ++i)cin >> a[i];
#define read2D(mat, n, m)for(int i=0 ; i<n ; ++i)for(int j=0 ; j<m ; ++j)cin >> mat[i][j];

const long double PI = 3.141592653589793238462643383279502884197169399;

// Find Set LSB = (x&(-x)), isPowerOfTwo = (x & (x-1))

int cnt=0;
int h, w, k;

void foo(vs mat, vb row, vb col){
	for(int i=0 ; i<h ; ++i){
		if(row[i]){
			for(int j=0 ; j<w ; ++j){
				mat[i][j] = 'r';
			}
		}
	}
	for(int i=0 ; i<w ; ++i){
		if(col[i]){
			for(int j=0 ; j<h ; ++j){
				mat[j][i] = 'r';
			}
		}
	}
	
	int x=0;
	for(string& s : mat){
		x += count(all(s), '#');
	}
	
	if(x == k)cnt++;
}

void solve(){
	cin >> h >> w >> k;
	
	vs mat(h);
	int bl=0;
	for(string& s : mat){
		cin >> s;
		bl += count(all(s), '#');
	}
	
	if(bl < k){
		cout << "0";
		return;
	}
	
	int r=0;
	int upR = pow(2, h);
	while(r < upR){
		vb row;
		for(int i=0 ; i<h ; ++i){
			row.pb(r&(1<<i));
		}
		int c=0;
		int upC = pow(2, w);
		while(c < upC){
			vb col;
			for(int i=0 ; i<w ; ++i){
				col.pb(c&(1<<i));
			}
			
			foo(mat, row, col);
			c++;
		}
		r++;
	}
	
	cout << cnt;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int tt=1;
	//cin >> tt;
	
	while(tt--){
		solve();
	}
}


Measured memory_bytes: 4032
#include <iostream>

using namespace std;
typedef long long LL;

int main(){
    LL x;
    cin >> x;
    LL cnt = 0;
    cnt += x / 11 * 2;
    x %= 11;
    if(x > 6){
        cnt += 2;
    }else if(x > 0){
        cnt += 1;
    }
    cout << cnt << endl;
    return 0;
}


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

int main() {
	long N;
	cin>>N;
	if(N%2==1){
		cout<<0<<endl;
	}
	else {
		long ans = 0;
		long fivenum = 10;
		while(fivenum <= N) {
			ans += N/fivenum;
			fivenum *= 5;
		}
		cout<<ans<<endl;
	}
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int h,w,n,m,o;
  scanf("%d\n%d\n%d\n", &h, &w, &n);
  if (h>w) {
    m = h;
  } else {
    m = w;
  }
  if (n % m > 0) {
    o = 1;
  } else {
    o = 0;
  }
  printf("%d\n", n / m + o);
  return 0;
}


Measured memory_bytes: 128
package main

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

func main() {
	// scanInit()
	var s string
	s = scan()
	// 1817181712114
	n := len(s)
	Split := strings.Split(s,"")
	m := 2019
	cnt := map[int]int{}
	total := 0
	x := 1
	ans := 0
	// totalmod := 0
	for i:= n-1; i>=0; i-- {
		if _,ok := cnt[total]; !ok {
			cnt[total] = 0
		}
		cnt[total] += 1 //S_r ≡ S_l (r,lは任意)なら+1なのでこうなってる　a_0も入ってないもの(s_0)が0なので最初に0に+1
		//　理解が普通にクソムズ　数学的な素養と簡単な累積和的知識が必要
		val,_ := strconv.Atoi(Split[i])
		total += val*x //累積和
		total %= m
		ans += cnt[total]
		x = x*10%m
	}
	fmt.Println(ans)
}

var sc = bufio.NewScanner(os.Stdin)
func scanInit () {
	sc.Split(bufio.ScanWords)
}
// func scanInt () int{
// sc.Scan()
//	i,_ := strconv.Atoi(sc.Text())
//	return i
//}
func scan () string{
	sc.Buffer([]byte{}, math.MaxInt64)
 sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 5932
def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def main():
    M1, D1 = read_values()
    M2, D2 = read_values()
    print(1 if M1 != M2 else 0)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
fun main(args: Array<String>) {
    val array = IntArray(readLine()?.toInt() ?: 0) {
        readLine()?.toInt() ?: -1
    }
    shellSort(array)
}

fun insertionSort(array: IntArray, g: Int, cnt: Int): Int {
    var counter = cnt
    for (i in g until array.size) {
        val v = array[i]
        var j = i - g
        while (j >= 0 && array[j] > v) {
            array[j + g] = array[j]
            j -= g
            counter++
        }
        array[j + g] = v
    }
    return counter
}

fun shellSort(array: IntArray) {
    val gArray = arrayListOf(1)
    for (i in 1 until array.size) {
        val h = gArray[i-1] * 3 + 1
        if (h > array.size) {
            break
        }
        gArray.add(h)
    }
    println(gArray.size)
    println(gArray.reversed().joinToString(" "))
    var cnt = 0
    for (g in gArray.reversed()) {
        cnt = insertionSort(array, g, cnt)
    }
    println(cnt)
    println(array.joinToString("\n"))
}


Measured memory_bytes: 148780
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;

using namespace std;

int main(){
 ll a,b,c,d,e,f;
 cin>>a>>b;
 ll ans=0;
    int temp=(4-a);
    ans+=max(temp,0)*100000;
    temp=(4-b);
    ans+=max(temp,0)*100000;
    if(a==1&&b==1)ans=1000000;
 cout<<ans<<endl;
}


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

int main() {
  std::int_fast64_t x1, y1, x2, y2;
  std::cin >> x1 >> y1 >> x2 >> y2;

  const std::int_fast64_t x_diff = x2 - x1;
  const std::int_fast64_t y_diff = y2 - y1;
  const std::int_fast64_t x3 = x2 - y_diff;
  const std::int_fast64_t y3 = y2 + x_diff;
  const std::int_fast64_t x4 = x3 - x_diff;
  const std::int_fast64_t y4 = y3 - y_diff;

  std::cout << x3 << ' ' << y3 << ' ' << x4 << ' ' << y4 << std::endl;
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
N = int(input())
d = [int(i) for i in input().split()]

import itertools
X = list(itertools.combinations(range(N), 2))

Y = 0
Z = int(N * (N - 1) / 2)
for i in range(Z):
    Y += d[X[i][0]] * d[X[i][1]]
print(Y)


Measured memory_bytes: 3060
import sys
import numpy as np
import math  # gcdもあるよ
from collections import deque
from collections import defaultdict
from copy import deepcopy
from itertools import accumulate #リストを与えると累積和を返す
import bisect #二部探索
def input(): return sys.stdin.readline().rstrip()
from functools import lru_cache #メモ化
INF = 10**9 + 7
mod = 10**9 + 7
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int-type.')
    if n < 2:
        raise ValueError('n is more than 2')
    data = [i for i in range(2, n + 1)]
    for d in data:
        data = [x for x in data if (x == d or x % d != 0)]
    return data

def main():
    n = int(input())
    # 1～n-1 までcを回す
    x = math.floor(math.sqrt(n-1))
    ans = 0
    a = 1
    while(a <= x):
        ans += (n-1) // a
        a += 1
    ans -= (x - 1) * x / 2
    ans *= 2
    ans -= x
    print(int(ans))
    return 0

if __name__ == "__main__":
    main()

Measured memory_bytes: 27200
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
template <class T>
bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; }
template <class T>
bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; }

#define MAX 1000000005
 
typedef long long ll;
typedef pair<int, int> P;

int main(int, char**)
{
    int n;
    cin >> n;

    ll ind = 0, a;
    ll ans = 0;
    map<int, int> count;
    rep(i,n) {
        cin >> a;
        if (ind - a >= 0) {
            ans += count[ind-a];
        }
        auto itr = count.find(ind+a);
        if (itr != count.end()) itr->second++;
        else count[ind+a] = 1;
        ind++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 13788
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 1000000000
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  long long N;

  std::cin >> N;

  int zm = INF;

  for (long i = 1; i * i <= N; i ++)
    if (N % i == 0) {
      int x = std::to_string(i).size(), y = std::to_string(N / i).size(), z = std::max(x, y);
      
      zm = std::min(z, zm);
    }

  std::cout << zm << std::endl;

  return 0;
}


Measured memory_bytes: 256
S = input().rstrip("\n")
N = len(S)

a = [0] * (N+1)

for i in range(N):
    if S[i] == "<":
        a[i+1] = max(a[i+1], a[i] + 1)

for i in range(N-1,-1,-1):
    if S[i] == ">":
        a[i] = max(a[i], a[i+1]+1)

print(sum(a))

Measured memory_bytes: 23336
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    while(scanf("%d %d %d",&a,&b,&c)==3)
    {
        if(a+b>=c)
            printf("Yes\n");
        else
            printf("No\n");
    }
        
    return 0;
}

Measured memory_bytes: 256
N,M  = map(int,input().split())

AB_list = []
ans = 0
counter = 0

for i in range(N):
    AB = list(map(int,input().split()))
    AB_list.append(AB)

AB_list.sort()

for i in range(M):
    ans = AB_list[0][0] + ans
    AB_list[0][1] = AB_list[0][1] - 1
    if AB_list[0][1] == 0 :
        del AB_list[0]

print(ans)


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

using namespace std;

typedef long long ll;

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

    map<int, int> M;
    bool ok = true;
    while (m--) {
        int s, d;
        cin >> s >> d;
        s--;

        if (s == 0 && n != 1 && d == 0) {
            ok = false;
        }

        if (M.count(s) == 0) {
            M[s] = d;
        } else {
            if (M[s] != d)
                ok = false;
        }
    }

    if (!ok)
        cout << -1;
    else
        for (int s = 0; s < n; s++) {
            if (M.count(s) == 1)
                cout << M[s];
            else
                if (s == 0 && n != 1)
                    cout << 1;
                else
                    cout << 0;
        }
    cout << '\n';
    
    return 0;
}

Measured memory_bytes: 256
n=int(input())
alist = [int(i) for i in input().split()]

adict = {}
for i in alist:
	if str(i) in adict:
		adict[str(i)]+=1
	else:
		adict[str(i)]=1
	if str(i-1) in adict:
		adict[str(i-1)]+=1
	else:
		adict[str(i-1)]=1
	if str(i+1) in adict:
		adict[str(i+1)]+=1
	else:
		adict[str(i+1)]=1
print(max(adict.values()))

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

int n, maxi;
string a;
map<string, int> m;

int main() {
  cin >> n;
  for (int i=0; i<n; i++) {
    cin >> a;
    m[a]++;
    maxi = max(maxi, m[a]);
  }
  for (pair<string, int> i : m) {
    if (i.second == maxi) cout << i.first << '\n';
  }
}

Measured memory_bytes: 25216
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,s1=2,s2=1,s3;
	cin>>n;
	if(n==0)
	{
		cout<<2<<endl;
		return 0;
	}
	if(n==1)
	{
		cout<<1<<endl;
		return 0;
	}
	for(int i=1;i<n;i++)
	{
		s3=s2+s1;
		s1=s2;
		s2=s3;
	}
	cout<<s3<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int n, k; cin >> n >> k;
    vector<int> num(n);
    REP(i, n) cin >> num[i];
    whole(sort, num);
    ll ans = 0;
    REP(i, n - k) ans += num[i];
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,cc,n) for(int i=cc;i<n;i++)

int main(){
  int n;
  cin>>n;
  
  vector<int> x;
  int maxx=0;
  rep(i,0,n){
    int tmp;
    cin>>tmp;
    maxx=max(maxx,tmp);
    x.emplace_back(tmp);
  }
  
  int ans=0;
  rep(i,1,maxx+1){
    int tmp=0;
    rep(j,0,n){
       tmp+=pow((x[j]-i),2);
    }
    if(ans==0){ans=tmp;}
    ans=min(ans,tmp);
  }
  
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
def swap(A,i,j):
    A[i],A[j] = A[j],A[i]
    return A

def mincost(A):
    B = sorted(A)
    cost = 0
    b0 = B[0]
    
    for i, bi in enumerate(B):
        t = 0
        j = A.index(bi)
        tmp_cost = 0
        
        # swap in a cyclic group
        while j != i:
            t += 1
            bj = B[j]
            k = A.index(bj)
            tmp_cost += bi + bj
            swap(A,j,k)
            j = k
        
        # diff. to swap with min(B)
        dec = t * (bi - b0)
        inc = 2 * (bi + b0)
        
        if dec < inc:
            cost += tmp_cost
        else:
            cost += tmp_cost - dec + inc
    return cost

if __name__ == "__main__":
    input()
    A = list(map(int, input().strip().split()))
    cost = mincost(A)
    print(cost)

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

using namespace std;

int main(){
  long long n,k;
  cin>>n>>k;
    long long x=0,y=1000000000+7;
    for(long long i=k;i<=n+1;i++){
      x+=(n+1)*i-i*i+1;
      x%=y;
    }
  cout<<x<<endl;
}

Measured memory_bytes: 3604
#include<stdio.h>
int main()
{
    int building [4][3][10]= {};
    int b,f,r,v,i,n,j,k;
    scanf("%d",&n);

    for(i=0; i<n; i++)
    {
        scanf("%d %d %d %d",&b,&f,&r,&v);
        building[b-1][f-1][r-1]==0;
        building[b-1][f-1][r-1]=building[b-1][f-1][r-1]+v;
    }
    for(k=0; k<4; k++)
    {
        for(i=0; i<3; i++)
        {
            for(j=0; j<10; j++)
            {
                printf(" %d",building[k][i][j]);
            }
            printf("\n");

        }
        if(k!=3)
            {
                printf("####################\n");
            }
    }
}



Measured memory_bytes: 2112
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main() {
    let n : i32 = read();
    let an:Vec<i64> = read_vec();
    let mut a:Vec<i64> = Vec::new(); // % 2 == 0
    let mut b:Vec<i64> = Vec::new(); //  %2  != 0
    for i in 0..an.len(){
        if i % 2 != 0 {
            a.push(an[i as usize ]);
        }else {
            b.push(an[i as usize ]);
        }
    }
    let ans_n = if n %2 == 0{
        a.reverse();
        a.append(&mut b);
        a
    }else {
        b.reverse();
        b.append(&mut a);
        b
    };
    let ans = ans_n.iter().map(|x| x.to_string()).collect::<Vec<String>>().join(" ").to_string();
    println!("{}",ans);
}

Measured memory_bytes: 22708
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())

import string
from collections import deque

name_table = 'z' + string.ascii_lowercase
ans = deque()


while n > 0:
    q = n // 26
    m = n % 26
    ans.appendleft(name_table[m])
    if m == 0:
        n = q - 1
    else:
        n = q

print(''.join(ans))


Measured memory_bytes: 68676
#include<bits/stdc++.h>
using namespace std;
#include<vector>
#include<queue>
#define ll long long
#define inf INT_MAX
main()
{
ll int n,d;
cin>>n>>d;

	if(d>=n)
	cout<<"1"<<endl;
	else
	{
	if(n%(2*d+1)==0)
	cout<<n/(2*d+1);
	else
	cout<<(n/(2*d+1))+1<<endl;
	}
}



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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const ld INF = 1e10;
const int MAX_N = 1002;

struct edge { int to; ld cost; };
typedef pair<ld, int>P;
int N;
vector<edge>G[MAX_N];
ld d[MAX_N];

void dijkstra(int s) {
	priority_queue<P, vector<P>, greater<P>>que;
	fill(d, d + N+2, INF);
	d[s] = (ld)(0.0);
	que.push(P(ld(0.0), s));
	while (!que.empty()) {
		P p = que.top();
		que.pop();
		int v = p.second;
		if (d[v] < p.first)continue;
		for (int i = 0; i < G[v].size(); i++) {
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}
int main() {
	cin.sync_with_stdio(false);
	int xs, ys, xt, yt;
	cin >> xs >> ys >> xt >> yt;
	cin >> N;
	vector<int>x(N+2), y(N+2),r(N+2);
	x[0] = xs; y[0] = ys; x[N + 1] = xt; y[N + 1] = yt;
	rep(i, N) {
		cin >> x[i + 1] >> y[i + 1] >> r[i + 1];
	}
	rep(i, N + 2) {
		rep(j, N + 2) {
			if (i == j)continue;
			edge e1;
			ll dx = x[i] - x[j];
			ll dy = y[i] - y[j];
			e1.to = j; e1.cost =(ld)max((ld)(0.0),sqrt(dx*dx + dy*dy) - (ld)(r[i] + r[j]));
			G[i].push_back(e1);
		}
	}
	dijkstra(0);
	cout << fixed<<setprecision(15) << d[N + 1] << endl;

	return 0;
}

Measured memory_bytes: 42732
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(){
    ll n,m;
    cin>>n>>m;
    string a[n+10];
    string b[m+10];
    for(ll i=0;i<n;++i){
        cin>>a[i];
    }
    for(ll i=0;i<m;++i){
        cin>>b[i];
    }

    bool flag;
    string ans="No";
    ll sa=n-m+1;

    for(ll i=0;i<sa;++i){
        for(ll j=0;j<sa;++j){
            flag=true;
            if(a[i][j]==b[0][0]){

                for(ll k=0;k<m;++k){
                    for(ll l=0;l<m;++l){
                        if(a[i+k][j+l] != b[k][l]){
                            flag=false;
                        }
                    }
                }
                if(flag){
                    ans="Yes";
                    break;
                }

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


Measured memory_bytes: 256
<?php
fscanf(STDIN, '%d', $n);
$a = array_map('intval', explode(' ', trim(fgets(STDIN))));
$abs_sum = 0;
$abs_min = abs($a[0]);
$minus_cnt = 0;
for ($i = 0; $i < $n; $i++) {
    $abs = abs($a[$i]);
    $abs_sum += $abs;
    $abs_min = min($abs_min, $abs);
    if ($a[$i] < 0) $minus_cnt++;
}
if ($minus_cnt % 2 === 1) $ans = $abs_sum - $abs_min * 2;
else $ans = $abs_sum;
echo $ans . PHP_EOL;

Measured memory_bytes: 16884
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
using namespace std;
typedef long long ll;
ll dp[1005][1005];
int a[1005][1005];
const ll mod=1e9+7;
string s,t;
int main()
{
	int h,w;
	cin>>h>>w;
	for(int i=1;i<=h;i++){
		getchar();
		for(int j=1;j<=w;j++){
			char x;
			cin>>x;
			if(x=='.')
			a[i][j]=1;
			else
			a[i][j]=0;
		}
	}
	
	dp[1][1]=1;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(a[i][j]){
				if(i==1&&j==1)
				continue;
				else{
					ll m=(dp[i][j-1]+dp[i-1][j]);
			     	m%=mod;
			    	dp[i][j]=m;
				}	
			}
		}
	}
	
	ll ans=dp[h][w]%mod;
	cout<<ans<<endl;
}

Measured memory_bytes: 15368
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint ungigned
#define db double
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define pli pair<ll,int>
#define vi vector<int>
#define vpi vector<pii >
#define IT iterator
 
#define PB push_back
#define MK make_pair
#define LB lower_bound
#define UB upper_bound
#define y1 wzpakking 
#define fi first
#define se second
#define BG begin
#define ED end
 
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?(x)-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a))
#define CPY(a,b) memcpy(a,b,sizeof(a))
#define sqr(x) (1ll*x*x)
 
#define LS3 k*2,l,mid
#define RS3 k*2+1,mid+1,r
#define LS5 k*2,l,mid,x,y
#define RS5 k*2+1,mid+1,r,x,y
#define GET pushdown(k);int mid=(l+r)/2
#define INF (1<<30)
using namespace std;

const int N=3005;
char s[N*2];
int a[N],b[N],tp[N*2];
string ss[N],f[N];
int n,an,bn;
string work(int l,int r){
	int tl=-1,tr;
	For(i,1,n) if (a[i]>=l&&a[i]<=r){
		if (tl==-1) tl=i; tr=i;
	}
	string ans="";
	if (a[tl]<b[tl]){
		int las=0;
		For(i,tl,tr) if (las<a[i])
			ans=ans+"ab",las=b[i];
		return ans;
	}
	For(i,tl,tr){
		string c="";
		For(j,l,r) if (tp[j]>=i) c.PB(s[j]);
		ans=max(ans,c);
	}
	return ans;
}
int main(){
	scanf("%d%s",&n,s+1);
	For(i,1,n+n)
		if (s[i]=='a') a[tp[i]=++an]=i;
		else b[tp[i]=++bn]=i;
	int cnt=1,sum=0,las=0;
	For(i,1,n+n){
		sum+=(s[i]=='a'?1:-1);
		if (!sum) ss[++cnt]=work(las,i),las=i+1;
	}
	Rep(i,cnt,1)
		f[i]=max(ss[i]+f[i+1],f[i+1]);
	cout<<f[1];
} 

Measured memory_bytes: 10752
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()

int main()
{
  int n;
  cin >> n;
  int a;
  cin >> a;
  a = max(1, a - 1);
  for(int i = 0 ; i < n - 1 ; i++){
    int b;
    cin >> b;
    if(b < a)
      return cout << "No" << endl, 0;
    b = max(a, b - 1);
    a = b;
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)

z = []
for i in range(m):
    c, d = map(int, input().split())
    z.append([c, d])

z.sort(key=lambda x: x[1], reverse=True)
a_index = 0
z_index = 0
z_num = z[0][0]
ans = 0
# print(a)
# print(z)
flag = 0
for i in range(n):
    if z_num <= 0 and not flag:
        z_index += 1
        if z_index == m:
            flag = 1
        else:
            z_num = z[z_index][0]
    if not flag:
        if z[z_index][1] > a[a_index]:
            z_num -= 1
            ans += z[z_index][1]

        else:
            ans += a[a_index]
            a_index += 1

    else:
        ans += a[a_index]
        a_index += 1

print(ans)


Measured memory_bytes: 25512