akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stack>
#include <string>
#include <vector>
typedef long long int ll;
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EREP(i, n) for (int i = (n - 1); i >= 0; --i)
#define mod 1000000007
#define MIN -93193111451418101
#define INF 9223372036854775805
using namespace std;
typedef pair<ll, ll> P;
template <typename T> void fill_all(T &arr, const T &v) { arr = v; }
template <typename T, typename ARR> void fill_all(ARR &arr, const T &v) {
  for (auto &i : arr) {
    fill_all(i, v);
  }
}
#define yo 100001
//------------------変数-----------------------//
char grid[100][100];
ll n, m, k;
P p[100];
//-------------------関数----------------------//

ll f(ll lx, ll uy, ll rx, ll dy) {
  ll cnt = 0;
  REP(i, n) {
    if (p[i].first >= lx && p[i].first <= rx && p[i].second >= dy &&
        p[i].second <= uy) {
      cnt++;
    }
  }
  return cnt;
}

int main() {
  cin >> n >> k;
  ll cnt = 0;
  ll mini = INF;
  REP(i, n) { cin >> p[i].first >> p[i].second; }
  REP(i, n) { //左上
    REP(j, n) {
      REP(z, n) {
        REP(d, n) {
          if (p[i].first >= p[j].first || p[z].second <= p[d].second) {
            continue;
          }
          // cout << f(p[i].first, p[z].second, p[j].first, p[d].second) <<
          // endl;
          if (f(p[i].first, p[z].second, p[j].first, p[d].second) >= k) {
            // cout << (p[j].second - p[i].second) * (p[i].first - p[j].first)
            // <<
            // endl;
            mini = min(mini,
                       (p[z].second - p[d].second) * (p[j].first - p[i].first));
          }
        }
      }
    }
  }
  cout << mini << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi atan(1.0)*4
#define pb(x) push_back(x)
#define in(x) insert(x)
#define fl(x,y) for(ll i=x;i<y;i++)
int main()
{
    ll t,n,k,p,q,r,sum,ct=0,flag=0;
    string s,s1,s2,s3;
    set<ll>st;
    map<ll,ll>mp;
    vector<ll>v;
      cin>>k>>s;
      p=s.size();
      s1=s.substr(0,k);
      if(p<=k) cout<<s<<endl;
      else
        cout<<s1<<"..."<<endl;

}





Measured memory_bytes: 3632
s = list(input())
ans = ""
for i in range(len(s)):
    if s[i] == "0":
        ans += "0"
    elif s[i] == "1":
        ans += "1"
    else:
        if len(ans) != 0:
            ans = ans[0:len(ans) - 1]

print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep2(i,m,n) for (int i = (m); i < (n); ++i)
#define rep(i,n) rep2(i,0,n)
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> P;
template<typename T> struct V : vector<T> { using vector<T>::vector; };
V() -> V<int>;
V(size_t) -> V<int>;
template<typename T> V(size_t, T) -> V<T>;
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
const int INF = 1<<30;
const ll LINF = 1LL<<61;

int main()
{
    string s;
    cin >> s;
    ll ans = 0;
    rep(i,s.size())
    {
        ans += s[i] - '0';
        ans %= 9;
    }
    if(ans == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++ )

int main()
{
  int n, m;
  cin >> n >> m;
  int town[n + 1];
  REP(i, n + 1)
    town[i] = 0;
  REP(i, m) {
    int a, b;
    cin >> a >> b;
    town[a]++;
    town[b]++;
  }
  for(int i = 1; i <= n; i++)
    cout << town[i] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int w,a,b;
  cin >> w >> a >> b;
  if(b>a+w){
    cout << b-a-w;
  }else if(a>b+w){
    cout << a-b-w;
  }else{
    cout << 0;
  }
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(stdR.readLine());
        int[] A = new int[N];
        String[] s = stdR.readLine().split(" ");
        for(int i = 0 ; i < N ; i++) {
            A[Integer.parseInt(s[i]) - 1] = (i + 1);
        }
        StringBuilder sb = new StringBuilder();
        for(int i = 0 ; i < N ; i++) {
            if(i == N - 1) {
                sb.append(A[i]);
            }else{
                sb.append(A[i] + " ");
            }
        }
        System.out.println(sb.toString());
    }
}

Measured memory_bytes: 43732
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define bFor(i,a,b) for(i=a;i>=b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

double distance(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

ll culc(vec& ch){
  ll i=1,bf=0,res=24;
  while(i<25){
    while(!ch[i])i++;
    chmin(res,i-bf);
    bf=i++;
  }
  return res;
}

int main(){
  ll i,j,N,K,x;
  cin>>N;
  vec v(13,0),ch,st(25,0),lis;
  st[0]=st[24]=1;
  rep(i,N){
    cin>>x;
    v[x]++;
  }
  if(N>=24||*max_element(all(v))>2||v[0]||v[12]>1){
    cout<<0<<endl;
    return 0;
  }
  rep(i,13){
    if(v[i]==2){
      st[i]=1;
      st[24-i]=1;
    }else if(v[i]){
      if(i==12){
        st[12]=1;
        continue;
      }
      lis.pb(i);
    }
  }
  if(lis.size()>=12){
    cout<<1<<endl;
    return 0;
  }
  K=pow(2,(ll)lis.size());
  x=0;
  rep(i,K){
    ch=st;
    rep(j,(ll)lis.size())if(i&1<<j){
      ch[lis[j]]=1;
    }else{
      ch[24-lis[j]]=1;
    }
    chmax(x,culc(ch));
  }
  cout<<x<<endl;
  return 0;
}

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

// 前後でAとBの差分がaからbに変化した。変化に伴ってであったか？
// a=0のときは数えない。
bool check(ll a,ll b){
  if (a==0) return false;
  if (b==0) return true;
  if (a<0 && b>0) return true;
  if (a>0 && b<0) return true;
  return false;
}

/*
  Aはt1分間に分速a1メートル、t2分間に分速a2メートル走るのを交互に
  Bはt1分間に分速b1メートル、t2分間に分速b2メートル走るのを交互に
  但しt1+t2分間に走る距離はAの方が大きいとする
  何回交差する？
*/
ll solve(ll t1,ll t2,ll a1,ll a2,ll b1,ll b2){
  ll ab1 = a1 - b1, ab2 = a2 - b2;
  ll meter = t1*ab1; //負の値なら交差する
  if (meter > 0) return 0;
  meter *= -1;
  ll submeter = t1*ab1 + t2*ab2;
    //この値ずつ、t1+t2分ごとにAが先行していく
  ll cnt = meter / submeter;
  ll ans = 2 * cnt;
  if (meter % submeter != 0) ans++;
  return ans;
}

int main() {
  ll t1,t2,a1,a2,b1,b2; cin >>t1 >>t2 >>a1 >>a2 >>b1 >>b2;
  ll checkab = t1*(a1-b1) + t2*(a2-b2);
  if (checkab == 0){
    string ans = "infinity";
    cout <<ans <<endl;
  }else if (checkab > 0){
    ll ans = solve(t1,t2,a1,a2,b1,b2);
    cout <<ans <<endl;
  }else if (checkab < 0){
    ll ans = solve(t1,t2,b1,b2,a1,a2);
    cout <<ans <<endl;
  }
}


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



// #include<bits/stdc++.h>
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string.h>

using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// #define Find order_of_key
// #define at find_by_order
#define x first
#define y second
#define ll long long
#define lll __int128
#define ull unsigned long long
#define ulll unsigned __int128
#define pii pair<int,int>
#define pb push_back
#define all(x) x.begin(),x.end()
#define endl '\n'
#define Te template<class T>
#define pb push_back
const int mod=998244353;
ll Pow(ll a,ll b){
	ll res=1;
	while(b){
		if(b&1)res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}return res;
}

const int M = 1000010;
vector<int>Pr;bool P[M];int F[M],C[M];
#define D(p,x) ((bool)(x==0)-(bool)(x==1))
void sieve() {
    F[1]=1;
    for(int i=2;i<M;++i){if(!P[i]){Pr.pb(i);F[i]=D(i,1);C[i]=1;}
    for(int j=0;j<Pr.size()&&i*Pr[j]<M;++j){P[i*Pr[j]]=1;
    if(i%Pr[j]^0){F[i*Pr[j]]=F[i]*F[Pr[j]];C[i*Pr[j]]=1;}
    else{F[i*Pr[j]]=F[i]*(D(Pr[j],C[i]+1)/(D(Pr[j],C[i])?D(Pr[j],C[i]):1));
    C[i*Pr[j]]=C[i]+1;break;}}}}

int arr[M];
int A[M];
int main(int argc, char const *argv[])
{
	sieve();
	int n;
	int a,ma=0;
	ll ans=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a);
		ma=max(ma,a);
		arr[a]++;
	}
	for(int i=1;i<=ma;i++){
		ll an=0,ann=0;
		for(int j=i;j<=ma;j+=i){
			an=(an+arr[j]*1LL*j)%mod;
			ann=(ann+j*1LL*j*1LL*arr[j])%mod;
		}
		an=(an*an)%mod;
		A[i]=(A[i]+an-ann)%mod;
		if(A[i]<0)A[i]+=mod;
	}
	for(int g=1;g<=ma;g++){
		ll an=0;
		for(int i=g,I=1;i<=ma;i+=g,I++){
			an=(an+A[i]*F[I])%mod;	
		}an=(an*Pow(g,mod-2))%mod;
		ans=(ans+an)%mod;
	}ans=(ans*Pow(2,mod-2))%mod;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 20552
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

int main(){
	int n;
	cin>>n;
	int sx[n];
	int df[n];
	int ew[n-1];
	
	for(int i=0;i<n;i++){
		cin>>sx[i];
	}
	for(int i=0;i<n;i++){
		cin>>df[i];
	}
	for(int i=0;i<n-1;i++){
		cin>>ew[i];
	}
	
	int num=0;
	for(int i=0;i<n;i++){
		num+=df[sx[i]-1];
		//printf("%d\n",df[sx[i]-1]);
		//if(i>=1){
		if(sx[i+1]-1==sx[i]){
			num+=ew[sx[i]-1];
			//printf("\t%d\t\n",ew[sx[i]-1]);
		}
		//}
	}
	
	printf("%d",num);
	return 0;
}




Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define num 2*100000+10

int main(void){
    int N,D,i,C=0;
    double x[num],y[num];
    scanf("%d %d",&N ,&D);

    for ( i = 0; i < N; i++){
        scanf("%lf%lf",&x[i],&y[i]);
        if (D>=sqrt((x[i] * x[i]) + (y[i] * y[i]))){
        C++;
        }
    }
  printf("%d",C);
}

Measured memory_bytes: 5340
#include <bits/stdc++.h>
#ifdef JLOCAL
#include "stress.h"
#endif
using namespace std;

#define rep(i, z, n) for (int i = (z); i < int(n); ++i)
#define repr(i, n, z) for (int i = int(n) - 1; i >= (z); --i)
#define shl(n) (1 << (n))
#define hbit(n, i) (((n) >> (i)) & 1)

#define STRESS 0
using lint = long long;

void solve(istream& cin, ostream& cout) {
    int n, p;
    cin >> n >> p;
    int k0 = 0, k1 = 0;
    rep(i, 0, n) {
        int x;
        cin >> x;
        if (x & 1) {
            k1++;
        } else {
            k0++;
        }
    }
    if (p == 1 && k1 == 0) {
        cout << 0;
        return;
    }
    lint ans = 1LL << k0;
    ans *= max(1LL, (1LL << k1) / 2);
    cout << ans;
}

int main() {
#if !defined(JLOCAL) || !STRESS
#ifdef JLOCAL
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    solve(cin, cout);
#else
    srand();
    for (int ti = 0; ti < 100; ti++) {
        stress::gen();
        stress::stupid();
        ifstream in("input.txt");
        ofstream out("output.txt");
        solve(in, out);
        out.flush();
        stress::check();
    }
    cout << "ok" << endl;
#endif
    return 0;
}


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

signed main() {
    int H, W, K;
    cin >> H >> W >> K;
    int C[6][6];
    rep (i, 6) {
        rep (j, 6) {
            C[i][j] = 0;
        }
    }

    int cnt = 0;
    rep (i, H) {
        rep (j, W) {
            char D;
            cin >> D;
            if (D == '#') C[i][j] = 1; 
        }
    }


//    char D[H][W];
//    memcpy(D, C, sizeof(C));

    for (int bith=0; bith<(1<<(H)); bith++) {
        //cout << 'h';
        int E[6][6];
        memcpy(E, C, sizeof(C));
        if ((bith & 0x01) != 0)  rep (k, 6) E[0][k] = 0;
        if ((bith & 0x02) != 0)  rep (k, 6) E[1][k] = 0;
        if ((bith & 0x04) != 0)  rep (k, 6) E[2][k] = 0;
        if ((bith & 0x08) != 0)  rep (k, 6) E[3][k] = 0;
        if ((bith & 0x10) != 0)  rep (k, 6) E[4][k] = 0;
        if ((bith & 0x20) != 0)  rep (k, 6) E[5][k] = 0;

        for (int bitw=0; bitw<(1<<(W)); bitw++) {
            //cout << 'w';
            int F[6][6];
            memcpy(F, E, sizeof(E));
            if ((bitw & 0x01) != 0)  rep (k, 6) F[k][0] = 0;
            if ((bitw & 0x02) != 0)  rep (k, 6) F[k][1] = 0;
            if ((bitw & 0x04) != 0)  rep (k, 6) F[k][2] = 0;
            if ((bitw & 0x08) != 0)  rep (k, 6) F[k][3] = 0;
            if ((bitw & 0x10) != 0)  rep (k, 6) F[k][4] = 0;
            if ((bitw & 0x20) != 0)  rep (k, 6) F[k][5] = 0;
            int tmp = 0;
            rep (p, 6) {
                rep (q, 6) if (1 == F[p][q]) tmp++;
            }
            if (tmp == K) cnt++;
        }
    }

    cout << cnt << endl;


}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;
const int INF = 1001001001;

int main(){
    int N, K; cin >> N >> K;
    ll ans = 0;
    vector<int> H(N);
    rep(i, N) cin >> H[i];
    sort(H.rbegin(), H.rend());
    for(int i=K; i<N; ++i){
        ans += H[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;
int main()
{
    string s;
    int n, h, sum, l;
    while(cin >> s){
        l = s.length();
        if(l == 1 && (char)(s[0]) == '-'){
            break;
        }
        cin >> n;
        sum = 0;
        for (int i=0; i<n; ++i){
            cin >> h;
            sum += h;
        }
        for (int i=0; i<l; ++i){
            std::cout << s[(sum+i)%l];
        }
        std::cout << endl;
    }
    return 0;
}



Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define FORD(x,y,z) for(int x=y;x>=z;x--)
#define MSET(x,y) memset(x,y,sizeof(x))
#define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 10
void RI(){}
template<typename... T>
void RI( int& head, T&... tail ) {
  scanf("%d",&head);
  RI(tail...);
}

using namespace std;
typedef long long LL;
LL arr[M], cur;
int main()
{
	LL n;
	cin >> n;
	cur = 1e15+5;
	for(int i = 0; i < 5; i++) {
		cin >> arr[i];
		if(cur > arr[i]) cur = arr[i];
	}
	LL cnt = (n / cur) + 4;
	if(n % cur) cnt++;
	cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

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

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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; }
bool isPrime(ll n); // 素数か
vector<ll> primes(ll n); // 素因数分解
int ctoi(char c){return c - '0';}

const ll COM_MAX = (ll)(1e6+100); // combinationの最大値
vector<ll> fac(COM_MAX),finv(COM_MAX),inv(COM_MAX);
void comb_init(); // 初期化
ll comb(ll n,ll k); // nCk


template<typename T>bool isOk(int key,T value){
  return key <= value.fi;
}
template<typename T>T binary_search(vector<pair<int,int>> a,T key){
  T ok = a.size();
  T ng = -1;
  while(abs(ok - ng) > 1){
    T mid = (ok + ng) / 2;
    if(isOk(key,a[mid]))ok = mid;
    else ng = mid;
  }
  return ok;
}


// TODO: write
int main() { 
  int n;cin>>n;int l;cin>>l;
  vector<string> s(n);rep(i,n)cin>>s[i];
  sort(all(s));
  rep(i,n)cout<<s[i];
  cout<<endl;
  return 0;
}




void comb_init(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<COM_MAX;++i){
    fac[i]=fac[i-1]*i%INF;
    inv[i]=INF-inv[INF%i]*(INF/i)%INF;
    finv[i]=finv[i-1]*inv[i]%INF;
  }
}

ll comb(ll n,ll k){
  if(n<k)return 0;
  if(n<0||k<0)return 0;
  return fac[n]*(finv[k]*finv[n-k]%INF)%INF;
}

bool isPrime(ll n) {
	for (int i = 2; n >= i * i; ++i) {
		if(!(n % i))return false;
	}
  return true;
}
vector<ll> primes(ll n){
  vector<ll> v;
  for (ll i = 2; i*i <= n; ++i) {
    while(n%i==0){
      n/=i;
      v.pb(i);
    }
  }
  if(n != 1)v.pb(n);
  return v;
}


/* 二分探索の時に使う
template<typename T>bool isOk(T key,T value){
  return key <= value;
}
template<typename T>T binary_search(vector<T> a,T key){
  T ok = a.size();
  T ng = -1;
  while(abs(ok - ng) > 1){
    T mid = (ok + ng) / 2;
    if(isOk(key,a[mid]))ok = mid;
    else ng = mid;
  }
  return ok;
}
*/

Measured memory_bytes: 23680
#import sys
#import os
#import re
#import datetime

N = int(input())
#print(input().split())
a = list(map(int, input().split()))
#print(a)
countA = {}
for v in a:
	for i in (-1,0,1):
		#print("i = {}".format(i))
		if(v - i in countA):
			countA[v - i] = countA[v - i] + 1
		else:
			countA[v - i] = 1
print(max(countA.values()))

#town = {}
#for _ in range(N):
#	S, P = input().split()
#	town[S] = int(P)
#
#sum2 = sum(town.values()) / 2
#for S, P in town.items():
#	if P > sum2:
#		print(S)
#		break
#else:
#	print('atcoder')

Measured memory_bytes: 23672
#include <iostream>
#include <string>
using namespace std;
int main(void){
    string str, x;
    int n, h;
    
    while(1){
        cin >> str;
        if(str == "-")    break;
        cin >> n;
        for(int i = 0; i < n; i++){
            cin >> h;
            x = str.substr(0, h);
            str.insert(str.size(), x);
            str.erase(0,h);
        }
        cout << str << endl;
    }
    

    return 0;
}



Measured memory_bytes: 3220
sum = [0] * 26

sent = open(0).read()
for c in sent:
    if ord('a') <= ord(c) and ord(c) <= ord('z'):
        sum[ord(c) - ord('a')] += 1
    elif ord('A') <= ord(c) and ord(c) <= ord('Z'):
        sum[ord(c) - ord('A')] += 1

for x in range(26):
    print(chr(x + ord('a')), ":", sum[x])


Measured memory_bytes: 5572
import copy

N, M, Q = map(int, input().split())
abcd_list = []

for q in range(Q):
    a, b, c, d = map(int, input().split())
    abcd_list.append([a, b, c, d])


A_list =[-1] * N
sum_max = 0

A_list_list =[]

def dfs(curr, count):
    if count >= N:
        sum_ = 0
        
        for q in range(Q):
            ai = abcd_list[q][0]
            bi = abcd_list[q][1]
            ci = abcd_list[q][2]
            di = abcd_list[q][3]

            if A_list[bi - 1] - A_list[ai - 1] == ci:
                sum_ += di
        global sum_max
        if sum_max <= sum_:
            sum_max = sum_

        A_list_list.append(copy.copy(A_list))

        return

    # 次の値を求める
    for i in range(curr, M + 1):
        A_list[count] = i
        dfs(i, count + 1)

dfs(1, 0)
print(sum_max)

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

int main(){
  int n, len;
  cin >> n;
  int x[n];
  rep(i,n) cin >> x[i];
  cin >> len;
  int p = 1;
  int s = 0;
  while(p <= n) {
    p *= 2;
    s++;
  }
  vector<vector<int>> dp(n,vector<int>(s));
  rep(i,n) {
    int c = upper_bound(x,x+n,x[i]+len) - x;
    dp[i][0] = c-1;
  }
  for(int i = 1; i < s; i++) {
    rep(j,n) {
      dp[j][i] = dp[dp[j][i-1]][i-1];
    } 
  }
  int q;
  cin >> q;
  int ans[q];
  rep(i,q) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    if(a > b) swap(a,b);
    int l = 0, r = n;
    while(r - l > 1) {
      int m = (l + r) / 2;
      int p = a;
      rep(k,s) {
        if(m & (1<<k)) {
          p = dp[p][k];
        }
      }
      if(p >= b) r = m;
      else l = m;
    }
    ans[i] = r;
  }
  for(auto x : ans) cout << x << endl;
  return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> d(N);
    for(int i=0;i<N;i++){
        cin >> d.at(i);
    }
    int sum=0;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(i==j)continue;
            sum += d.at(i)*d.at(j);
        }
    }
    cout << sum/2 << endl;
}


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

int main() {

    long long a,b;
    long long k;
    
    cin>>a>>b;
    
    k=(a+b)/2.0;
    
    
    if(abs(a-k)==abs(b-k))
        cout<<k<<endl;
    
    else
        cout<<"IMPOSSIBLE"<<endl;
    
        
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<sstream>
#include<algorithm>
 
using namespace std;
#define read(x) scanf("%d",&x)
#define Read(x,y) scanf("%d%d",&x,&y)
#define sRead(x,y,z)  scanf("%d%d%d",&x,&y,&z)
#define gc(x)  scanf(" %c",&x);
#define  INF (ll)1e14//无穷设置的大着点
#define mmt(x,y)  memset(x,y,sizeof x)
#define write(x) printf("%d\n",x)
const int N = 11000;
const int M=  2e5+5;
using namespace std;
typedef long long ll;
struct Edge
{
    int next;
    int to;
    ll dis;
}edge[M*2];
int head[M],tot;
ll d[M];bool vis[M];
inline void add(int from,int to,ll dis){
    edge[++tot].next = head[from];
    edge[tot].to = to;
    edge[tot].dis = dis;
    head[from] = tot;
}
struct node
{
    ll val;int id;
    node(){}
    node(int a,ll b):id(a),val(b){}
    bool operator <(node A)const{
        return val > A.val;
    }
};
void dij(int u)
{
    mmt(vis,0);
    d[u] = 0;
    priority_queue<node> Q;
    Q.push({u,0});
    node tmp;
    while(Q.size()){
        tmp = Q.top();
        Q.pop();
        int x = tmp.id;
        if(vis[x]) continue;
        for(int i =  head[x];~i;i = edge[i].next){
            int y = edge[i].to;
            ll dis = edge[i].dis;
            if(d[y] > d[x] +dis){
                d[y] = d[x] + dis;
                Q.push({y,d[y]});
            }
        }
    }
}
inline void init(int n)
{
    mmt(head,-1);
    tot = 0;
    for(int i = 1;i <= n;++i) d[i] = INF;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    init(n);
    int u,v;ll dis;
    for(int i = 1;i <= n;++i){//加反向边
        add(i,i - 1,0);
    }
    for(int i = 1;i <= m;++i){//只把端点 加进去
        cin>>u >> v>>dis;
        add(u,v,dis);
    }
    dij(1);
    if(d[n] == INF) cout<<-1<<endl;
    else cout<<d[n]<<endl;
}

Measured memory_bytes: 6776
#include<bits/stdc++.h>
#define N 257
#define M 256
using namespace std;
typedef pair<double,int> P0;
typedef pair<int,int> P1;
typedef pair<P0,P1> P;

int main(){
  int n,l[N],R[N],O[N],cnt[N];
  double H;
  vector<P> v;
  while(1){
    cin>>n;
    if(!n)break;
    for(int i=1;i<=n;i++)cin>>l[i];
    for(int S=0;S<16;S++){
      R[0]=S;
      for(int A=0;A<16;A++)
	for(int C=0;C<16;C++){
	  for(int i=0;i<N;i++)cnt[i]=0;
	  for(int i=1;i<=n;i++){
	    R[i]=(A*R[i-1]+C)%M;
	    O[i]=(l[i]+R[i])%M;
	    cnt[O[i]]++;
	  }
	  H=0;
	  for(int i=0;i<N;i++){
	    if(!cnt[i])continue;
	    H-=(1.0*cnt[i]/n)*log(1.0*cnt[i]/n);
	  }
	  H=((int)(H*1000000))/1000000.0;
	  v.push_back(P(P0(H,S),P1(A,C)));
      	}
    }
    sort(v.begin(),v.end());
    cout<<v[0].first.second<<' ';
    cout<<v[0].second.first<<' ';
    cout<<v[0].second.second<<endl;
    v.clear();
  }
  return 0;
}

Measured memory_bytes: 1372
#include <iostream>
#include <vector>
#include <string>

using namespace std;

void check_str(string& S)
{
    for (int i = 0; i < S.size() - 1; i++) {
        if ( S[i] == S[i + 1] ) {
            cout << "Bad" << endl;
            return;
        }
    }
    cout << "Good" << endl;
}

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

    vector<int> aji(N);

    int sum = 0;
    for (int i = 0; i < aji.size(); i++) {
        aji[i] = L + (i + 1) - 1; 
        sum += aji[i];
    }

    int abs_min = abs(aji[0]);
    int abs_min_idx = 0;
    for (int i = 1; i < aji.size(); i++) {
        if( abs(aji[i]) < abs_min ) {
            abs_min = abs(aji[i]);
            abs_min_idx = i;
        }
    }

    sum = sum - aji[abs_min_idx];

    cout << sum << endl;


    return 0;
}

Measured memory_bytes: 256
n = gets.to_i
st = gets.chomp.split("")

half = n / 2
i = 0
i2= half

if st.size % 2 != 0
  puts "No"
  exit
end

if st.size <= 1
  puts "No"
  exit
end

half.times do
  if st [i] != st[i2]
    puts "No"
    exit
  end
  i += 1
  i2 += 1
end

puts "Yes"


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


class BIT:
    def __init__(self, a):
        self.n = len(a)
        self.a = [0] * (self.n + 1)

        for i, j in enumerate(a):
            self.update(i, j)

    def update(self, i, x):
        i += 1
        while i <= self.n:
            self.a[i] = self.a[i] + x
            i += i & (-i)

    def get(self, i):
        s = 0
        i += 1
        while i != 0:
            s = s + self.a[i]
            i -= i & (-i)
        return s


def inmin(x):
    return int(x)-1


if __name__ == "__main__":
    n, q = map(int, input().split())
    if n>5*10**5 or q>5*10**5:
        a=1/0
    c = list(map(inmin, input().split()))
    que = [[i, list(map(inmin, input().split()))] for i in range(q)]
    que.sort(key=lambda x: x[1][1])
    ans = [0] * q

    last = [-1] * n
    bit = BIT([0]*(n+10))
    j = 0
    for i in range(n):
        if last[c[i]] >= 0:
            bit.update(last[c[i]]+5, -1)
        bit.update(i+5, 1)
        last[c[i]] = i
        while j < q and que[j][1][1] == i:
            ans[que[j][0]] = bit.get(i+5) - bit.get(que[j][1][0]+4)
            j += 1
    print(*ans)


Measured memory_bytes: 238064
def calc_cost2(h, k):
    n = len(h)
    if (n == 0):
        return 0

    cost = n * [None]
    cost[0] = 0
    for i in range(1, len(h)):
        cost[i] = min([cost[s] + abs(h[i] - h[s]) for s in range(max(0, i-k), i)])
        #cost[i] = min(map(lambda s: cost[s] + abs(h[i] - h[s]), range(max(0, i-k), i)))

    return cost[n-1]


if __name__ == "__main__":
    n, k = list(map(int, input().split(" ")))
    h = list(map(int, input().split(" ")))
    res = calc_cost2(h, k)
    print(res)

Measured memory_bytes: 13980
import sys


def solve():
    N, K, *H = map(int, sys.stdin.read().split())
    dp = [0] * N
    for i in range(1, N):
        s = i-K if i-K > 0 else 0
        dp[i] = min(dp[j] + abs(H[i] - H[j]) for j in range(s, i))
    return dp[-1]


if __name__ == "__main__":
    answer = solve()
    print(answer)


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

using namespace std;

#define REP(i,n)	for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,s,n)	for(int i=(s), i##_len=(n); i<i##_len; ++i)

#define ALL(obj)	(obj).begin(),(obj).end()

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;
typedef vector<int>				V;
typedef vector<V>				VV;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define MAX 		100050

const ll LINF = (ll)1e18+7;		//
const int INF = 1e9+7;			//2147483647 (Max int)
const int MOD = 1e9+7;
// テンプレ終了
//====================================================================//

ll f(ll x){
	if(x%2==0) return ((x/2)%2 ? x^1 : x);
	else return ((x/2)%2 ? 0 : 1);
}
//
int main(){
	ll A,B;
	cin >> A >> B;
	if(A==0){cout << f(B) << endl;return 0;}
	//cout << f(A-1) << " " << f(B) << endl;
	cout << (A!=B ? f(A-1)^f(B) : A) << endl;

	return 0;
}




Measured memory_bytes: 256
buffer = []
while True:
    x,y = map(int, input().split())
    if x==0 and y==0:
        break
    buffer.append([x,y])
for n in range(len(buffer)):
    for r in range(buffer[n][0]):
        if r == 0 or r == buffer[n][0]-1:
            print('#'*buffer[n][1])
        else:
            if buffer[n][1]>2:
                print('#'+ '.'*(buffer[n][1]-2)+'#')
            if buffer[n][1]<=2:
                print('#'*buffer[n][1])
    print('')


Measured memory_bytes: 5620
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;

typedef pair<int, int> P;

int n;
vector<P> ps;

int main()
{
    int c, m, s, sum;
    while(cin >> n && n) {
        ps.clear();
        for(int k = 0; k < n; k++) {
            cin >> c;
            sum = 0;
            for(int i = 0; i < 4; i++) {
                cin >> m >> s;
                sum += m * 60 + s;
            }
            ps.push_back(P(sum, c));
        }
        sort(ps.begin(), ps.end());
        
        cout << ps[0].second << endl;
        cout << ps[1].second << endl;
        cout << ps[ps.size() - 2].second << endl;

    }
    
}

Measured memory_bytes: 968
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    REP(i, 0, x) {
        int t = 100 * i;
        int res = x - t;
        if (res < 0) {
            continue;
        }
        int a = i;
        for (int j = 5; j >= 1; j--){
            if (res >= j) {
                a -= (res / j);
                res %= j;
            }
        }
        if (a >= 0 && res == 0) {
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Satoshi
{
	class Program
	{
		public static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			string[] s = Console.ReadLine().Split(' ');
			int[] t = new int[n];
			int sum = 0;
			for (int i = 0; i < n; i++)
			{
				t[i] = int.Parse(s[i]);
				sum += t[i];
			}
			int m = int.Parse(Console.ReadLine());
			int[] p = new int[m];
			int[] x = new int[m];
			for (int i = 0; i < m; i++)
			{
				s = Console.ReadLine().Split(' ');
				p[i] = int.Parse(s[0]);
				x[i] = int.Parse(s[1]);
			}
			int ans = 0;
			for (int i = 0; i < m; i++)
			{
				ans = sum - t[p[i] - 1] + x[i];
				Console.WriteLine(ans);
			}
		}
	}
}

Measured memory_bytes: 2776
def main():
  n,k,*t=map(int,open(0).read().split())
  e=tuple(set()for _ in[0]*n)
  for a,b in zip(t[::2],t[1::2]):
    e[a-1].add(b-1)
    e[b-1].add(a-1)
  c,q=k,[0]
  while q:
    v,i=q.pop(),1
    for w in e[v]:
      c=c*(k-i-(v>0))%(10**9+7)
      e[w].remove(v)
      q+=[w]
      i+=1
  print(c)
main()

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

int MOD = 1000000007;
long dp[2][100000];
vector<int> adj[100000];
void dfs(int i, int p){
    dp[0][i] = 1;
    dp[1][i] = 1;
    for(int v : adj[i]){
        if(v != p){
            dfs(v, i);
            dp[0][i] = (dp[0][i] * (dp[0][v] + dp[1][v]))%MOD;
        }
    }
    for(int v : adj[i]){
        if(v != p){
            dp[1][i] = (dp[1][i] * dp[0][v]) % MOD;
        }
    }
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < n - 1; i++){
        int u, v;
        cin >> u >> v;
        u--, v--;
        adj[u].push_back(v), adj[v].push_back(u);
    }
    dfs(0, -1);
    cout << (dp[0][0] + dp[1][0]) % MOD << '\n';
    return 0;
}




Measured memory_bytes: 17640
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007
#define MOD2 1000000014000000049LL
#define EPS 1e-10
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef int_fast64_t ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
inline void fastio(){cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15);}
ll gcd(ll a,ll b){ll c=max(a,b);ll d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}

template<int N, int M>
struct ModFact {
    int inv[N+1];
    int fact[N+1];
    int ifact[N+1];
    constexpr ModFact() : fact(), ifact() {
        ll f = 1;
        fact[0] = f;
        for (int i = 0; i < N; i++) {
            f = f*(i+1)%M;
            fact[i+1] = f;
        }
        f = power(f, M-2);
        ifact[N] = f;
        for (int i = N-1; i >= 0; i--) {
            f = f*(i+1)%M;
            ifact[i] = f;
        }
        inv[0] = 0;
        for (int i = 0; i < N; i++) {
            f = ll(fact[i])*ll(ifact[i+1])%M;
            inv[i+1] = f;
        }
    }
    constexpr ll power(ll a, ll b) {
        ll r = 1;
        while (b>0) {
            if((b&1)!=0) r = (r*a)%M;
            a = (a*a)%M;
            b >>= 1;
        }
        return r;
    }
};

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}

inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

ModFact<100000, MOD> fact;

int main() {
    ll ans = 0, d;
    int a, N, prev, now;
    N = getint();
    prev = getint();
    REP(i, N-1) {
        now = getint();
        d = now - prev;
        prev = now;
        a += fact.inv[i+1];
        if(a > MOD) a -= MOD;
        ans += a * d;
        if(ans > MOD2) ans -= MOD2;
    }
    printf("%lld\n", ((ans%MOD)*fact.fact[N-1])%MOD);
	return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
bool judge(string s){
    for(int i = 0;i<s.size();i++){
        if(s[i]!=s[(i+1)%s.size()]) return false;
    }
    return true;
}
int main(){
    string s;
    cin >> s;
    long long k;
    cin >> k;
    long long a = 0;
    long long n = s.size();
    if(judge(s)){
        cout << (n*k)/2 << endl;
        return 0;
    }
    int kk;
    for(int i = 0;i<n;i++){
        if(s[i]!=s[(i+1)%n]){
            kk = i;
            break;
        }
    }
    long long ans = 0;
    for(int i = kk+2;i<kk+n+1;i++){
        if(s[i%n]==s[(i-1)%n]){
            a++;
            i++;
        }
    }
    ans = a*(k-1);
    for(int i = 1;i<=kk;i++){
        if(s[i]==s[i-1]){
            ans++;
            i++;
        }
    }
    for(int i = kk+2;i<n;i++){
        if(s[i]==s[i-1]){
            ans++;
            i++;
        }        
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include "cmath"
#include "iostream"
#define endl '\n'

using namespace std;

long long a, b, n;

long long f(long long x) { return floorl(a * x / b) - (a * floorl(x / b)); }

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

    cin >> a >> b >> n;

    long long max_ = 0;

    long long max_x = min(b - 1, n);
    long long min_x = 0;

    cout << max(f(min_x), f(max_x));

    return 0;
}

Measured memory_bytes: 3176
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define ll long long

bool primes[101];
int factor[101];

int main(){
    int n;
    cin >> n;
    for (int i = 0; i < 101; ++i) {
        primes[i] = true;
        factor[i] = 0;
    }
    //素数チェック
    primes[0] = false;
    primes[1] = false;
    for (int i = 2; i < 101; ++i) {
        if (primes[i]) {
            for (int k = i + i; k < 101; k += i) {
                primes[k] = false;
            }
        }
    }
    //要素数を確保
    for (int k = 2; k <= n; ++k) {
        for (int i = 2; i <= k; ++i) {
            if (!primes[i]) continue;
            int cnt = 0;
            int t = k;
            while (t % i == 0) {
                t /= i;
                cnt++;
            }
            factor[i] += cnt;
        }
    }
    int ans = 0;
    int ans2 = 0;
    for (int i = 2; i <= n; ++i) {
        for (int j = 2; j <= n; j++) {
            for (int k = 2; k <= n; k++) {
                if (i == j || j == k || i == k) continue;
                if (factor[i] >= 2 && factor[j] >= 4 && factor[k] >= 4) ans2++;
            }
            if (i != j) {
                if (factor[i] >= 14 && factor[j] >= 4) ans++;
                if (factor[i] >= 24 && factor[j] >= 2) ans++;
            }
        }
        if (factor[i] >= 74) ans++;
    }
    cout << ans + ans2 / 2 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int n, t;
    cin >> n >> t;

    vs32 a(n);
    for (auto& x : a)
    {
        cin >> x;
    }

    int back_max = a.back();
    int m = 0;
    int ans = 0;
    for (int i = n - 2; i >= 0; --i)
    {
        int temp = back_max - a[i];
        if (m < temp)
        {
            m = temp;
            ans = 1;
        }
        else if (m == temp)
        {
            ++ans;
        }
        back_max = max(back_max, a[i]);
    }

    cout << ans << "\n";

    return 0;
}



Measured memory_bytes: 3728
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using i64 = int64_t;
using ll = long long;
int main() {
  int D;
  cin >> D;
  vector<int> c(26);
  rep(i,26){
    cin >> c.at(i);
  }
  vector<vector<int>> s(D,vector<int>(26));
  rep(i,D){
    rep(j,26){
      cin >> s.at(i).at(j);
    }
  }
  vector<int> t(D);
  rep(i,D){
    cin >> t.at(i);
    t.at(i) --;
  }
  int v = 0;
  vector<int> last(26,-1);
  rep(i,D){
    int up = s.at(i).at(t.at(i));
    int down = 0;
    last.at(t.at(i)) = i;
    rep(k,26){
      down += c.at(k) * (i - last.at(k));
    }
    v = v + up - down;
    cout << v << endl;
  }
  return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <queue>
#include <stack>
#include <climits>
using namespace std;

typedef long long ll;
#define pb push_back

#define rep(i, n) for (int i=0;i<(n);++i)
#define rep2(i, s, n) for (int i=s;i<(n);++i)
#define rev(i, n) for (int i=(n);i>0;--i)
#define INF (1e9+1e9)

int main() {
    string a, b; cin >> a >> b;

    if ( a[0] < b[0] ) cout << "<" << endl;
    else if ( a[0] > b[0] ) cout << ">" << endl;
    else cout << "=" << endl;
    
}

Measured memory_bytes: 256
#include <stdio.h>
#define rep(x)for(i=0;i<x;i++)

int main(){
	int n,i,l=0,r=0;char s[210];
	scanf("%d\n%s",&n,s);
	rep(n){
		if(s[i]=='(')l++;
		else if(s[i]==')')l--;
		if(l<0){r++;l++;}
	}
	rep(214748364)n--;
	rep(r)printf("(");
	printf("%s",s);
	rep(l)printf(")");
	return 0;
}

Measured memory_bytes: 128
from collections import defaultdict
N = int(input())
dic = defaultdict(list)

for i in range(N-1):
    inf = input().split()
    u = int(inf[0])
    v = int(inf[1])
    w = int(inf[2])
    dic[u-1] += [(v-1,w)]
    dic[v-1] += [(u-1,w)]


dist = [-1]*N
stack = []
dist[0] = 0

stack += [0]

while stack:
    u = stack.pop(-1)
    for i, w in dic[u]:
        if dist[i]==-1:
            dist[i] = dist[u]+w
            stack.append(i)

for i in range(N):
    if dist[i]%2==0:
        print(1)
    else:
        print(0)

Measured memory_bytes: 51616
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
const ll mod=1000000007;
const ll INF=1e15;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end())
#define pb push_back
#define mp make_pair
#define MODP(A,B) A=(A+B)%mod
typedef pair<ll,ll> P;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

ll dp[301][301][301];
void kaku(ll m, ll i, ll j){
    dp[m][i][j]=0;
    dp[i][m][j]=0;
    dp[i][j][m]=0;
    return;
}

int main(){
    ll N,M; cin>>N>>M;
    dp[0][0][0]=1;
    vector<P> d[301];
    rep(i,M){
        ll L,R,X; cin>>L>>R>>X;
        d[R].pb(mp(L,X));
    }

    REP(m,1,N+1){
        
        if(m>1) rep(i,m) rep(j,m){
            MODP(dp[i][j][m],dp[i][j][m-1]);
            MODP(dp[i][m][m-1],dp[i][j][m-1]);
            MODP(dp[m][j][m-1],dp[i][j][m-1]);
            MODP(dp[i][m][j],dp[i][m-1][j]);
            MODP(dp[i][m-1][m],dp[i][m-1][j]);
            MODP(dp[m][m-1][j],dp[i][m-1][j]);
            MODP(dp[m][i][j],dp[m-1][i][j]);
            MODP(dp[m-1][m][j],dp[m-1][i][j]);
            MODP(dp[m-1][i][m],dp[m-1][i][j]);
        }
        else{
            dp[1][0][0]=1;
            dp[0][1][0]=1;
            dp[0][0][1]=1;
        }

        ll A=d[m].size();
        rep(k,A){
            ll L=d[m].at(k).first, X=d[m].at(k).second;
            rep(i,m) rep(j,m){
                ll I=max(i,j), J=min(i,j);
                if(X==3 && J<L) kaku(m,i,j);
                if(X==2 && L<=J) kaku(m,i,j);
                if(X==2 && I<L) kaku(m,i,j);
                if(X==1 && L<=I) kaku(m,i,j);
            }
        }

        /*cout<<"m:"<<m<<endl;
        rep(i,m) {
            rep(j,m) cout<<dp[m][i][j]<<' ';
            cout<<endl;
        }*/
    }
    ll ans=0;
    rep(i,N) rep(j,N){
        ans+=dp[N][i][j];
        ans+=dp[i][N][j];
        ans+=dp[i][j][N];
        ans=(ans%mod);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 213376
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m;
    cin >> n >> m;
    ll l = -INF;
    ll r = INF;
    for (ll i = 0; i < m; i++)
    {
        ll L, R;
        cin >> L >> R;
        l = max(l, L);
        r = min(r, R);
    }
    cout << max(r - l + 1, 0LL) << endl;
}

Measured memory_bytes: 256
// بِسمِ اللہِ  الرَّحم?نِ  الرَّ حِیم
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define MOD 1000000007
#define ll long long
#define pb push_back
typedef pair<ll,ll> pll;
ll power(ll a,ll b,ll p)
{
    a=a%p;
    if(b==1)return a;
    if(b==0)return 1;

    ll temp=power(a,b/2,p);
    ll ans=(temp*temp)%MOD;
    if(b&1)
        ans=(a*ans)%MOD;
    return ans;
}
signed main()
{
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

//    cin.sync_with_stdio(false);
    ll t;
    t=1;
//    cin>>t;
    while(t--)
    {
        ll n;cin>>n;
        vector<pair<string,ll>> v;
        ll tot=0;
        for(ll i=0;i<n;i++)
        {
            string s;ll time;
            cin>>s>>time;
            tot+=time;
            v.push_back({s,time});
        }
        string title;cin>>title;
        ll tot2=0;
        for(ll i=0;i<n;i++)
        {
            if(v[i].first==title)
            {
                tot2+=v[i].second;
                break;
            }
            tot2+=v[i].second;
        }
        cout<<tot-tot2<<endl;
    }
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import math
from functools import reduce


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm, numbers)


N = int(input())
T = [int(input()) for _ in range(N)]
print(lcm_list(T))


Measured memory_bytes: 9612