akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(20);
  int h,w,n;

  cin >> h >> w >> n;
  int ans;
  int i = 0;
  int pw = 0,ph = 0;
  
  while(n > 0){
    i++;
    if(w > h) {
      n -= w - ph;
      pw++;
    }
    else {
      n -= h - pw;
      ph++;
    }
  }

  cout << i << endl;
 
  return 0;
}

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

using namespace std;

int main(){

  while(1){

	string n;
	char c;
	int count = 0;
	
	cin>>n;

	if(n == "#")
	  break;

	if(n[0] == 'q' || n[0] == 'w' || n[0] == 'e' ||
	   n[0] == 'r' || n[0] == 't' || n[0] == 'a' ||
	   n[0] == 's'||n[0] == 'd'||n[0] == 'f'||n[0] == 'g'||
	   n[0] == 'z'||n[0] == 'x'||n[0] == 'c'||n[0] == 'v'||
	   n[0] == 'v'||n[0] == 'b')
	  c = 'l';
	else
	  c = 'r';
	
	for(int i = 1;i < n.length();++i){
	  if(n[i] == 'q' || n[i] == 'w' || n[i] == 'e' ||
		 n[i] == 'r' || n[i] == 't' || n[i] == 'a' ||
		 n[i] == 's'||n[i] == 'd'||n[i] == 'f'||n[i] == 'g'||
		 n[i] == 'z'||n[i] == 'x'||n[i] == 'c'||n[i] == 'v'||n[i] == 'v'||n[i] == 'b'){
		if(c == 'r'){
		  c = 'l';
		  count++;
		}
	  }
		  
	  else{
		if(c == 'l'){
		  c = 'r';
		  count++;
		}
	  }
	  
	}
	cout<<count<<endl;
  }
  
}



Measured memory_bytes: 3160
#include <iostream>
#include <string>
#include <algorithm>
#include <stdlib.h>
#include <iomanip>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

int main() {
  ll n;
  cin >> n;
  ll a[n];
  for (int i=0; i<n; i++) cin >> a[i];
  
  ll b[n];
  for (int i=0; i<n; i++) b[i] = 0;
  
  ll count = 0;
  for (int i=0; i<n; i++){
    ll idx = n-1-i;
    ll sum = 0;
    for (int j=idx; j<n; j=j+idx+1){
      sum += b[j];
    }
    //cout << idx << " " << sum << endl;
    if (sum%2 != a[idx]){
      b[idx] = 1;
      count += 1;
    }
  }
    
  cout << count << endl;
  if (count == 0) exit(0); 
  for (int i=0; i<n; i++){
    if (b[i] == 1) cout << i+1 << " ";
  }
  cout << endl;
}

Measured memory_bytes: 3968
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<queue>
#define lli long long
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define rep0(i,j) for(int i=0;i<j;i++)
#define rep1(i,j) for(int i=1;i<=j;i++)
#define rep0d(i,j) for(int i=j-1;i>=0;i--)
#define MAX 1000000007

using namespace std;

bool cmpf(const pair<lli, lli> left, const pair<lli, lli> right) {
	return left.first < right.first;
}
bool cmps(const pair<lli, lli> left, const pair<lli, lli> right) {
	return left.second < right.second;
}
using namespace std;
lli n, m, p;



int main() {

	cin >> n;
	vector<lli> vec(n);
	vector<lli> ans;

	rep0(i, n) {
		cin >> vec[i];
		auto it = lower_bound(rall(ans),vec[i]);
		if (it == ans.rbegin()) {
			ans.push_back(vec[i]);
		}
		else {
			--it;
			*it = vec[i];
		}
	}
	cout << ans.size();
}


Measured memory_bytes: 2416
n = int(input())

arr = list(map(int, input().split()))

dp = [0,abs(arr[1]-arr[0])]

for i in range(2,n):
    
    dp.append(min(dp[i-1] + abs(arr[i] - arr[i-1]), dp[i-2] + abs(arr[i] - arr[i-2])))
    
print(dp[-1])

Measured memory_bytes: 13980
#define __USE_MINGW_ANSI_STDIO
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef long long ull;
typedef pair<ll, ll> ii;

#define all(v)		((v).begin()), ((v).end())
#define sz(v)		((int)((v).size()))
#define endl		"\n"
#define fx(n)		fixed<<setprecision(n)
#define mk			make_pair	

void File()
{
#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
#ifdef ONLINE_JUDGE
	/*freopen("output.txt", "w", stdout);
	freopen("commandos.in", "r", stdin);*/
#endif
}
void fast()
{
	ios::sync_with_stdio(NULL);
	cout.tie(NULL);
	cin.tie(NULL);
	//File();
}
const double pi = acos(-1.0);
const ll oo = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int nn = 2e5 + 15;
int dx[8] = { 1, 0, -1, 0, 1, -1, 1, -1 };
int dy[8] = { 0, 1, 0, -1, 1, -1, -1, 1 };

int main()
{
	fast();
	ll a, b, h, m;
	cin >> a >> b >> h >> m;
	double cnt = h * 30;
	cnt -= (m * 6);
	cnt += ((m / 60.0) * 30);
	double res = a*a + b*b - 2 * a*b*cos(cnt*pi / 180);
	cout << fx(12) << sqrt(res) << endl;
	return 0;
}

Measured memory_bytes: 4156
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
using namespace std;
typedef long long ll;

int main(){

    int n, m; cin >> n >> m;

    cout << (int)(m*1900 + (n-m)*100)*(pow(2.0,float(m)));

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    string s;
    cin >> s;
    
    if(s == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;

    return 0;
}

Measured memory_bytes: 3596
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP

██╗███████╗████████╗██╗ █████╗ ██╗  ██╗
██║██╔════╝╚══██╔══╝██║██╔══██╗██║ ██╔╝
██║███████╗   ██║   ██║███████║█████╔╝
██║╚════██║   ██║   ██║██╔══██║██╔═██╗
██║███████║   ██║   ██║██║  ██║██║  ██╗
╚═╝╚══════╝   ╚═╝   ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝




*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define pb push_back
#define in insert
#define mp make_pair
#define lw(v) sort(v.begin(),v.end());
#define hi(v) sort(v.begin(),v.end(),greater<long long>());
#define all(v) v.begin(),v.end()
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long t,r=1,r1=0,r2=0,k=0,a,b,c=1,m,d=100,n,e,f=0,x=0,g,p=0,q=0,y=0,z=0;

    vector<pair<long long,long long>>v;
    vector<long long>u;
    map<string,long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4;
   cin>>t;
   while(d<t)
   {
d+=d/100;       f++;


   }
   cout<<f<<endl;




}


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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define PB push_back
#define MP make_pair
#define ALL(x) (x).begin(),(x).end()
typedef long long ll;

string S;

int main()
{
	cin >> S;

	bool flag_n = count(ALL(S),'N');
	bool flag_s = count(ALL(S),'S');
	bool flag_w = count(ALL(S),'W');
	bool flag_e = count(ALL(S),'E');
	if(!(flag_n ^ flag_s) && !(flag_w ^ flag_e)){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <climits>
using namespace std;

#define MOD1097 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mpair make_pair
#define pm(first, second) pb(mpair(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()
#define reall(X) (X).rbegin(), (X).rend()
#define divcel(a, b) (((a) + ((b) - 1)) / (b))

int main(){

    ll M, N;
    cin >> M >> N;
    vector<ll> A(N);
    for(ll i = 0; i < N; i++){
        cin >> A[i];
    }
    if(M == 2){
        ll ans = 0, cnt = 0;
        for(ll i = 0; i < N; i++){
            if(i%2 == 0 && A[i] == 1)ans++;
            if(i%2 == 1 && A[i] == 2)ans++;
            if(i%2 == 0 && A[i] == 2)cnt++;
            if(i%2 == 1 && A[i] == 1)cnt++;
        }
        cout << min(ans, cnt) << endl;
        return 0;
    }
    ll ans = 0;
    for(ll i = 1; i < N; i++){
        if(A[i] == A[i-1]){
            A[i] = -1;
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3632
#include<stdio.h>
int main(void){
  int A,B,C,max;
  scanf("%d %d %d", &A, &B, &C);
  
  max = 10*A + B + C;
  if(10*B + A + C >= max){
    max = 10*B + A + C;
  }
  if(10*C+B+A >= max){
    max = 10*C+B+A;
  }
  
  printf("%d", max);
  
  return 0;
}
  
  	


Measured memory_bytes: 128
H,W = map(int,input().split())
A = [input() for i in range(H)]

from collections import deque
dxy = [(0,1),(1,0)]
dist = [[0]*W for i in range(H)]
visited = [[0]*W for i in range(H)]
visited[0][0] = 1
q = deque([(0,0)])
while q:
    x,y = q.popleft()
    for dx,dy in dxy:
        nx,ny = x+dx,y+dy
        if not 0 <= nx < W: continue
        if not 0 <= ny < H: continue
        if visited[ny][nx]: continue
        if A[ny][nx] == '.': continue
        visited[ny][nx] = 1
        dist[ny][nx] = dist[y][x] + 1
        q.append((nx,ny))

cnt = sum(row.count('#') for row in A)
print('Possible' if dist[-1][-1]+1 == cnt else 'Impossible')

Measured memory_bytes: 3316
#include<iostream>
#include<iomanip>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cassert>
#include<ctime>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<vector>
#include<functional>

using namespace std;

#ifdef DEBUG
#define dprintf      printf
#define dout(x)      cout<<#x" = "<<(x)<<endl
#define darray(x,n)  {int i;rep(i,n)cout<<#x"["<<i<<"] = "<<*((x)+i)<<endl;}
#define dloop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define drep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define dstop()      scanf("%*c")
#else
#define dprintf      (1)?0:printf
#define dout(x)
#define darray(x,n)
#define dloop(i,s,g) if(int i=0){}else
#define drep(i,n)    if(int i=0){}else
#define dstop()      scanf("")
#endif

#define F    first
#define S    second
#define pb   push_back
#define mp   make_pair

#define loop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define rep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define all(x)      (x.begin(),x.end())
#define in(T,...) T __VA_ARGS__; impl(__VA_ARGS__);
#define array(T,id,n) T id[n]; rep(i,n)cin>>id[i];

//#define int long long;
#ifndef int
#define INF (0x7fffffff)
#else
#define INF (0x7fffffffffffffff)
#endif

typedef  long long           ll;
typedef  unsigned            ui;
typedef  unsigned long long  ull;
typedef  pair<int,int>       i_i;
typedef  pair<ll,int>        ll_i;
typedef  pair<ll,ll>         ll_ll;
typedef  pair<double,int>    d_i;
typedef  pair<double,double> d_d;

void impl(){};
template <typename T,typename... TS >
void impl(T &head,TS &... tail)
{
  cin>>head;
  impl(tail ...);
}

signed main(void)
{
  in(int,n);
  ll a[112345]={};
  rep(i,n)cin>>a[i];

  sort(a,a+n);
  darray(a,n);
  
  ll b[112345]={};
  int i,j=0;
  for(i=0;i<n;i++)
    {
      if(b[j]==0)
	{
	  b[j]=a[i]*-1;
	  dprintf("1:i=%d,j=%d,a[i]=%d,b[j]=%d\n",i,j,a[i],b[j]);
       	  continue;
	}
      if((b[j]*-1)==a[i])
	{
	  b[j++]*=-1;
	  dprintf("2:i=%d,j=%d,a[i]=%d,b[j]=%d,b[j-1]=%d\n",i,j,a[i],b[j],b[j-1]);
	  continue;
	}
      if((b[j]*-1)!=a[i])
	{
	  b[++j]=a[i]*-1;
	  dprintf("3:i=%d,j=%d,a[i]=%d,b[j]=%d,b[j-1]=%d\n",i,j,a[i],b[j],b[j-1]);
	  continue;
	}
    }
  sort(b,b+n);
  ll ans=b[n-1]*b[n-2];
  darray(b,n);
  if(b[n-2]>0)
    cout<<ans<<endl;
  else
    puts("0");
  return 0;
}


Measured memory_bytes: 2048
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        while (true){
            String line = br.readLine();
            String[] ln = line.split(" ");
            int H = Integer.parseInt(ln[0]);
            int W = Integer.parseInt(ln[1]);
            if (H==0 && W==0) break;
            for (int j=0; j<H; j++){
                if (j%2==0){
                    for (int i=0; i<W; i++){
                        if (i%2==0) sb.append("#");
                        else sb.append(".");
                    }
                }else{
                    for (int i=0; i<W; i++){
                        if (i%2==0) sb.append(".");
                        else sb.append("#");
                    }
                }
                sb.append("\n");
            }
            sb.append("\n");
        }
        System.out.print(sb);
    }
}

Measured memory_bytes: 21244
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll n,k;
  cin>>n>>k;
  vector<ll>v(n+1,0);
  for(ll i=0;i<n;i++){
    cin>>v[i+1];
  }
  ll ans=0;
  for(ll i=0;i<=min(n,k);i++){//個数
    set<ll>st;
    ll tmp=0;
    for(ll j=1;j<=i;j++){
      st.insert(v[j]);
      tmp+=v[j];
    }
    set<ll> sst;
    ll tm;
    for(ll j=0;j<=min(k-i,n-i);j++){
      sst=st;
      tm=tmp;
      for(ll h=1;h<=j;h++){
        sst.insert(v[n-h+1]);
        tm+=v[n-h+1];
      }
      for(ll h=1;sst.size()&&h<=k-i-j;h++){
        auto itr=sst.begin();
        if(*itr<0){
          tm-=*itr;
          sst.erase(itr);
        }
        else break;
      }
      ans=max(ans,tm);
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 888
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
ll MOD=1e9+7;
#define N 1100

main(){
    int n;
    n=in();
    int a[110];
    rep(i,n)a[i]=in();
    vec ans;
    rep(i,n){
        int count=0,mem=-1;
        rep(j,n){
            if(a[j]>0)count++;
            else continue;
            if(a[j]==count)mem=j;
        }
        if(mem==-1){cout<<-1;return 0;}
        ans.pb(a[mem]);
        a[mem]=0;
    }
    rep(i,n){
        cout<<ans[n-i-1]<<endl;
    }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

struct card
{
	int value;
	char mark;
};

void bubbleSort(card* A, int N)
{
	bool flag = 1;

	while (flag)
	{
		flag = 0;
		for (int j = N - 1; j > 0; j--)
		{
			if (A[j].value < A[j - 1].value) {
				swap(A[j], A[j - 1]);
				flag = 1;
			}
		}
	}
}

void selectionSort(card* A, int N)
{

	for(int i = 0; i < N; i++)
	{
		int minj = i;
		for (int j = i; j < N; j++)
		{
			if (A[j].value < A[minj].value)
			{
				minj = j;
			}
		}
		if (i != minj)
		{
			swap(A[i], A[minj]);
		}
	}
}

int main() 
{
	int N;
	card A[36];
	card B[36];
	card C[36];

	cin >> N;

	for (int i = 0; i < N; i++)
	{
		char input;
		cin >> input;
		A[i].mark = input;
		cin >> input;
		A[i].value = static_cast<int>(input) - static_cast<int>('0');
	}

	for (int i = 0; i < N; i++)
	{
		B[i] = A[i];
		C[i] = A[i];
	}

	bubbleSort(B, N);
	selectionSort(C, N);

	for (int i = 0; i < N; i++)
	{
		if (i) cout << " ";
		cout << B[i].mark << B[i].value;
	}
	cout << endl;

	cout << "Stable" << endl;

	bool stableFlag = true;
	for (int i = 0; i < N; i++)
	{
		if (i) cout << " ";
		cout << C[i].mark << C[i].value;

		if (B[i].mark != C[i].mark)
		{
			stableFlag = false;
		}
	}
	cout << endl;

	if (stableFlag) cout << "Stable" << endl;
	else cout << "Not stable" << endl;

	return 0;
}


Measured memory_bytes: 3100
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
#include<string>
using namespace std;
int main(){
    string S;
    cin>>S;
    if(S[S.size()-1]=='s')cout<<S<<"es"<<endl;
    else cout<<S<<"s"<<endl;
    return 0;
}


Measured memory_bytes: 3136
#include <cstdio>

using namespace std;

const int mod = 998244353;

int add(int a, int b) {
  a += b;
  return a >= mod ? a - mod : a;
}

int sub(int a, int b) {
  a -= b;
  return a < 0 ? a + mod : a;
}

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

int pw(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b % 2 == 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b /= 2;
  }
  return res;
}

int inv(int a) {
  return pw(a, mod - 2);
}

const int N = 200'009;

int f[N];
int rf[N];

int choose(int n, int k) {
  return mul(f[n], mul(rf[k], rf[n - k]));
}

int main() {
  f[0] = 1;
  rf[0] = 1;
  for (int i = 1; i < N; ++i) {
    f[i] = mul(f[i - 1], i);
    rf[i] = inv(f[i]);
  }
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  int ans = 0;
  for (int i = 0; i <= k; ++i) {
    ans = add(ans, mul(choose(n - 1, i), pw(m - 1, n - 1 - i)));
  }
  ans = mul(ans, m);
  printf("%d\n", ans);
}


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

int main() {
    int N, K;
    cin >> N >> K;
    vector<long long> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];

    // ソート
    sort(a.begin(), a.end());

    // K 差の最小値
    long long res = 1LL << 60;  // INF の気持ち
    for (int i = 0; i + K - 1 < N; ++i) res = min(res, a[i + K - 1] - a[i]);
    cout << res << endl;
}

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

using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair

int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
	char a,b;
	cin >> a >> b;
	if(a > b)
		cout << ">\n";
	else if(a == b) cout << "=\n";
	else cout << "<\n";	
	return 0;
}

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

using namespace std;
typedef long long int64;

const int MAXN = 111;

int ans, n, m;

int main()
{
	cin >> n >> m;
	ans = m * (m - 1) >> 1;
	ans += n * (n - 1) >> 1;
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 256
/*
AizuOnline A0216
Title Cutting Down Water Bills
@kankichi573
*/
#include <stdio.h>

int w;
//
int solve(int w)
{
        if(w<=10)
                return(1150);
        if(w<=20)
                return(1150+125*(w-10));
        if(w<=30)
                return(1150+1250+140*(w-20));
        else
                return(1150+1250+1400+160*(w-30));
}


main()
{
        while(EOF!=scanf("%d",&w) && (w != -1))
        {
                printf("%d\n",4280-solve(w));

        }
        return(0);
}

Measured memory_bytes: 600
def resolve():
	n = int(input())
	a = list(map(int, input().split()))
	t = [0]*(10**5+2)
	for i in a:
		t[i] += 1
		t[i+1] += 1
		if i-1 >= 0:
			t[i-1] += 1
	print(max(t))
resolve()

Measured memory_bytes: 52780
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
typedef long long ll;
const int INF = 1000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007ll;


int main(){
	int n;
	std::cin >> n;
	std::vector<int> s(n);
	rep(i,n)std::cin >> s[i];
	sort(all(s));
	if(accumulate(all(s),0)%10!=0)std::cout << accumulate(all(s),0) << std::endl;
	else{
		int i;
		for (i = 0; i < n; i++) {
			/* code */
			if(s[i]%10!=0)break;
		}
		if(i==n)std::cout << 0 << std::endl;
		else std::cout << accumulate(all(s),0)-s[i] << std::endl;
	}
	
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <istream>

using namespace std;

typedef pair<int,int> P;
typedef long long ll;


int main(){
	char c[4];
	cin >> c;
	for(int i=0;i<4;i++){
		if(c[i]=='1') c[i] = '9';
		else if(c[i]=='9') c[i] = '1';
	}

	cout << c << endl;

	return 0;
}


Measured memory_bytes: 256
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int,int> pii;
typedef pair <db,db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline int gcd(int a,int b){if(a==0) return b;return gcd(b%a,a);}
inline int power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD=998244353;
const ll hell=MOD;
const int INF = 1e18;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, 1, 0, -1 };

const int N=200005;

int dp[3005];


void solve()
{
    int n,s;
    cin>>n>>s;
    int a[n+1];
    for(int i=1;i<=n;i++)
        cin>>a[i];
    dp[0]=power(2,n,hell);
    int inv2=power(2,hell-2,hell);
    for(int i=1;i<=n;i++)
    {
        for(int j=s;j>=0;j--)
        {
            if(a[i]<=j)
            dp[j]=(dp[j]+(dp[j-a[i]]*inv2)%hell)%hell;
            
        }
    }
    cout<<dp[s]<<endl;
    
    
    
    
}


int32_t main()
{
    IOS;
    //pre();
    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        
        solve();
    }
    return 0;
}


Measured memory_bytes: 3688
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int

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

    int n,k;
    cin >> n >> k;

    LL result = 0;

    for(int i = 1; i <= n; i++){
        if(k >= i){

        }else{
            int j = i - k;
            int r = n - i + 1;
            result += j;
            if(k == 0) result--;
            int t = r / i;
            result += j * t;
            int s = r - (i * t);
            if(k > s){

            }else{
                result += s - k;
            }
        }
    }
    
    cout << result << endl;

    return 0;
}

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

void update(int val,int i,int s,int e,int index,int *tree){
    if(s>e) return ;
	if(s==e){
		if(i == s) tree[index] = val;
		return;
	}

	if(s>i || e < i) return;

	int mid = (s+e)/2;

	update(val,i,s,mid,2*index,tree);
	update(val,i,mid+1,e,2*index+1,tree);
	tree[index] = max(tree[2*index],tree[2*index+1]);
}

int get(int qs,int qe,int s,int e,int index,int *tree){
    if(s>e) return 0;
	if(qs>e || qe <s ) return 0;
	if(qs<=s && qe>=e) return tree[index];

	int mid = (s+e)/2;

	int left = get(qs,qe,s,mid,2*index,tree);
	int right = get(qs,qe,mid+1,e,2*index+1,tree);
	return max(left,right);
}


int32_t main(){

	int n;
	cin >> n;
	int *index = new int[n];
	int *bty = new int [n];
	int *tree= new int[5*n];
	foi(i,5*n) tree[i] = 0;
    foi(i,n) cin >> index[i];
    foi(i,n) cin >> bty[i];
	int answer = 0;
	int *output = new int[n];
	for(int i = 0; i < n ; i++){
		int val = bty[i];
		int ht = index[i];
		//cout << ht << " -- " << val << endl;
		int updateVal;
		if(ht == 1 ) updateVal = val;
		else updateVal = val + get(1,ht-1,1,n,1,tree);
		update(updateVal,ht,1,n,1,tree);
		answer = max(answer,updateVal);
		output[i] = updateVal;
	}
	cout << tree[1] << endl;


}


Measured memory_bytes: 12800
#include<iostream>
#include<fstream>
#include<algorithm>
#include<string>
#include<cstring>

using namespace std;

int main() {
	int N, A, B;
	cin >> N >> A >> B;
	if ((B - A) % 2 == 0)
		cout << "Alice" << endl;
	else
		cout << "Borys" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
using ll=long long;

int main(void){
    ll n;cin>>n;
    vector<int>p;
    
    while(n>0){
        n--;
        p.push_back(n%26);
        n=n/26;
        
    }
    
    for(int i=p.size()-1;i>=0;i--){
        printf("%c",'a'+p[i]);
    }
    return 0;
    
    
}

Measured memory_bytes: 3644
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n, q;
    string s;
    cin >> n >> q >> s;
    vector<char> t(q), d(q);
    REP(i,q) cin >> t[i] >> d[i];

    int ng = -1, ok = n;
    while (ok - ng > 1){
        int x = (ok + ng) / 2;
        int p = x;
        bool f = true;
        REP(i,q){
            if (s[p] == t[i]){
                if (d[i] == 'R') p++;
                else p--;
            }
            if (p < 0){
                f = false;
                break;
            }else if (p >= n){
                break;
            }
        }
        if (f) ok = x;
        else ng = x;
    }

    int ng2 = n, ok2 = -1;
    while (ng2 - ok2 > 1){
        int x = (ok2 + ng2) / 2;
        int p = x;
        bool f = true;
        REP(i,q){
            if (s[p] == t[i]){
                if (d[i] == 'R') p++;
                else p--;
            }
            if (p >= n){
                f = false;
                break;
            }else if (p < 0){
                break;
            }
        }
        if (f) ok2 = x;
        else ng2 = x;
    }

    cout << max(0, ok2 - ok + 1) << endl;
    return 0;
}

Measured memory_bytes: 900
import java.util.*;

public class Main {

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

    int n = stdIn.nextInt();
    int [] s = new int [n];

    s[2] = n % 10; n /= 10;
    s[1] = n % 10; n /= 10;
    s[0] = n % 10;

    if (s[0] == s[1] && s[1] == s[2]) {


    } else {
        if (s[0] > s[1]){
        s[1] = s[0];
        s[2] = s[0];


      } else {
        if (s[0] == s[1]){
          if (s[1] >= s[2]){
            s[2] = s[0];
          } else {
            s[0] += 1;
            s[1] = s[0];
            s[2] = s[0];
          }
        } else {
          s[0] += 1;
          s[1] = s[0];
          s[2] = s[0];
        }
    }
  }
    int goal = 100 * s[0] + 10 * s[1] + s[2];



    System.out.println(goal);

  }
}

Measured memory_bytes: 23252
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>

using namespace std;
typedef long long int ll;

#define C(I) cout<<(I)<<endl
//#define push(I) push_back(I)

ll n,m,a,b,c,x,y,z,aa[200010],ba[100010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc;
vector<ll> va,vb,vc;
set<int> sta;
map<ll,ll> mpa;

vector<ll> krk(vector<ll> target){
    vector<ll> result;
    ll repeats=1,number=target[0];
    for(int i=1;i<target.size();i++){
        if(number==target[i])repeats++;
        else{
            number=target[i];
            result.push_back(repeats);
            repeats=1;
        }
    }
    result.push_back(repeats);
    return result;
}

int main(){
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>aa[i];
        va.push_back(aa[i]);
    }
    sort(va.begin(),va.end());
    vb=krk(va);
    sort(vb.begin(),vb.end());
    b=0;
    c=0;
    
    
    while((vb.size()-b)>m){
        c+=vb[b];
        b++;
    }
    
    C(c);
    
}

Measured memory_bytes: 8048
// cf. 提出 #7322431 - AtCoder Beginner Contest 128 https://atcoder.jp/contests/abc128/submissions/7322431
#include <bits/stdc++.h>

using namespace std;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> V(N);
    for (int i = 0; i < N; i++) {
        cin >> V[i];
    }

    int maxSum = 0;
    for (int i = 1; i <= min(N, K); i++) {
        for (int j = 0; j <= i; j++) {
            vector<int> vec;
            for (int k = 0; k < j; k++) {
                vec.push_back(V[k]);
            }
            for (int k = 0; k < i - j; k++) {
                vec.push_back(V[V.size() - 1 - k]);
            }
            sort(vec.begin(), vec.end());
            int sum = accumulate(vec.begin(), vec.end(), 0);
            for (int k = 0; k < min((int)vec.size(), K - i); k++) {
                if (vec[k] >= 0) {
                    break;
                }
                sum -= vec[k];
            }
            maxSum = max(sum, maxSum);
        }
    }
    cout << maxSum << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
#define inf 0x3f3f3f3f
int main()
{
    ios::sync_with_stdio(false);
    string str;
    while(cin>>str)
    {
        int ans=inf;
        int len=str.length();
        for(int i=0;i<=len-3;i++)
        {
            int temp=stoi(str.substr(i,3));
            ans=min(ans,abs(temp-753));
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int main()
{
    string s;
    cin >> s;
    string ans;
    ans += s[0];
    ans += to_string((int)s.size()-2);
    ans += s[(int)s.size()-1];
    cout << ans << endl;
    return 0;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main() {
  int64 N, Q;
  cin >> N >> Q;
  dsu d(N);
  REP(i, Q) {
    int64 t, u, v;
    cin >> t >> u >> v;
    if (t == 0) {
      d.merge(u, v);
    } else {
      cout << d.same(u, v) << endl;
    }
  }
}


Measured memory_bytes: 3996
#include<stdio.h>

int Gcount=0;

void kei(int n)
{
    int i;
    int count = 0;
    for(i=1;i<=n;i++){
        if(n % i == 0) count++;
    }
    if(count==8) Gcount++;
}

int main(void)
{
    int i,N;
    scanf("%d", &N);

    for(i=1;i<=N;i++){
        if(i%2==0) continue;
        kei(i);
    }
    printf("%d\n", Gcount);
}

Measured memory_bytes: 128
import fractions as frac
n=int(input())
t=[int(input()) for _ in range(n)]
x=t[0]
ans=t[0]
for i in range(1,n):
    g=frac.gcd(x,t[i])
    ans=x*t[i]//g
    x=ans
print(int(ans))


Measured memory_bytes: 5176
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())
#define forn(i,n) for (int i = 0; i < int(n); ++i)
typedef long long ll;
typedef long long i64;
typedef long double ld;
const int inf = int(1e9) + int(1e5);
const ll infl = ll(2e18) + ll(1e10);

ld p[2][6];

ld calc(ld a) {
    ld res = 0;
    forn (i, 6) {
        //ld pr = (a * p[0][i] + (1 - a) * p[1][i]);
        res += max(a * p[0][i], (1 - a) * p[1][i]);
    }
    return res;
}

int main() {
    #ifdef LOCAL
    assert(freopen("d.in", "r", stdin));
    #else
    #endif
    forn (i, 2)
        forn (j, 6) {
            cin >> p[i][j];
            p[i][j] /= 100;
        }
    ld L = 0, R = 1;
    forn (iter, 500) {
        ld x1 = (2 * L + R) / 3;
        ld x2 = (2 * R + L) / 3;
        ld v1 = calc(x1);
        ld v2 = calc(x2);
        if (v1 < v2)
            R = x2;
        else
            L = x1;
    }
    cout.precision(20);
    cout << fixed;
    cerr << "opt " << (L + R) / 2 << '\n';
    cout << calc((L + R) / 2) << '\n';
}


Measured memory_bytes: 256
N, K = list(map(int, input().split()))
Hs = list(map(int, input().split()))

dp = [2 ** 32] * N
dp[0] = 0

for i in range(N):
    for j in range(1, K + 1):
        if i + j < N:
            dp[i+j] = min(dp[i+j], dp[i] + abs(Hs[i+j]-Hs[i]))
print(dp[N-1])


Measured memory_bytes: 52448
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

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

        public static void Solve()
        {
            var n = int.Parse(Console.ReadLine());
            var s = n.ToString();
            var k = 0;
            for (var i = 0; i < s.Length; i++)
            {
                k += s[i] - '0';
            }
            Console.WriteLine(n % k == 0 ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define slowanddetermined ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;


int main()
{
    slowanddetermined

    int a,b;
    cin>>a>>b;
    //a=a*100;
    //b=b*100;
    for(int i=1;i<100000;i++){

        if((i*10)/100==b && ((i*8)/100)==a){
            cout<<i;
            return 0;
        }
    }
    cout<<-1<<endl;


    return 0;

}


Measured memory_bytes: 256
#include <stdio.h>

void swap(int *a, int *b){
    int tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;
}

int main(void)
{
    int n;
    int a[1000];
    int f[50]={0};
    int i,j;
    float value;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    
    for(i=0;i<n-1;i++){
        for(j=0;j<n-1-i;j++){
            if(a[j]>a[j+1]){
                swap(&a[j],&a[j+1]);
            }
        }
    }
    
    value = (float)a[0];
    for(i=1; i<n; i++){
        value = (value+(float)a[i])/2.0;
    }
    
    printf("%f\n",value);
 
    return 0;
}

Measured memory_bytes: 128
# a < b + c
# b < a + C
# c < a + b

# 4 3 2 1
# a b c 

# abs(a - b) < c < a + b
# a < b < c
# b - a < b < c
# c < a + b 

from math import ceil, floor
from bisect import bisect_left, bisect_right

def solution(N, data): # O(N^2 * logN)
    data.sort()
    c = 0
    for i in range(N-2):
        for j in range(i+1, N-1):
            c += bisect_left(data, data[i] + data[j], j) - j - 1
    return c

if __name__ == '__main__':
    N = int(input())
    L_i = list(map(int, input().split()))
    a = solution(N, L_i)
    print(a)



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

int main() {
  int n,m;
  cin>>n>>m;
  vector<int> s(m);
  for(int i=0;i<m;i++){
    cin>>s[i];
  }
  int k=n;
 for(int i=0;i<m;i++){
    k -=s[i];
  }
  if(k<0){
    cout<<-1<<endl;
  }
 else { cout<<k<<endl;
      }
}


Measured memory_bytes: 3624
from bisect import bisect_left,bisect_right
n=int(input())
A=sorted(list(map(int,input().split())))
B=sorted(list(map(int,input().split())))
C=sorted(list(map(int,input().split())))

ans=0

for i in B:
  sml_B = bisect_left(A,i)
  # print(i,"sml_B",sml_B)
  big_B = len(C)-bisect_right(C,i)
  # print(i,"big_B",big_B)
  ans+=sml_B*big_B
print(ans)


Measured memory_bytes: 23244
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N = read_int()
    A = [0, 0, 0]
    for _ in range(N):
        B = read_ints()
        A = [
            max(A[j]+B[i] for j in range(3) if i != j)
            for i in range(3)
        ]
    return max(A)


if __name__ == '__main__':
    print(solve())


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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  
  bool Alice = false;
  bool Bob = false;
  int cnt = 0;
  for(int i=0;i<=100;i++){
    if(i>=A) Alice = true;
    if(i>=B) Alice = false;
    if(i>=C) Bob = true;
    if(i>=D) Bob = false;
    
    if(Alice==true && Bob==true) cnt ++;
  }
  cout << cnt << endl;
}

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

int n;

int main(void){
    // Here your code !
    bool ans = false;
    scanf("%d", &n);
    string str = to_string(n);
    for (int i = 0; i < str.size() - 2; ++i) {
      if (str[i] == str[i + 1] && str[i + 1] == str[i + 2]) ans = true;
    }
    if (ans) printf("Yes\n");
    else printf("No\n");
}


Measured memory_bytes: 256
#include<stdio.h>
#define ull unsigned long long
#define rep(i,l,r)for(int i=(l);i<(r);i++)
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)

int a[300010];
int num[300010];
ull s[50000];
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	k=min(k,n-k);
	rep(i,1,n+1)scanf("%d",num+i);
	
	rep(i,1,n+1)if(num[i]){
		int cnt=0;
		for(int crr=i;num[crr];){
			int t=num[crr];
			num[crr]=0;
			crr=t;
			cnt++;
		}
		a[cnt]++;
	}
	
	rep(i,0,n)if(a[i]>1){
		a[i]--;
		for(int s=2;a[i]>=s;s*=2){
			a[i]-=s;
			a[i*s]++;
		}
		if(a[i]>1)a[i*a[i]]++,a[i]=0;
		a[i]++;
	}

	int sum=0;
	s[0]=1;
	rep(i,1,n/2+1)rep(_,0,a[i]){
		for(int j=sum/64;j>=0;j--){
			if(i%64)s[j+i/64+1]|=s[j]>>(64-i%64);
			s[j+i/64]|=s[j]<<(i%64);
		}
		sum=min(n/2,sum+i);
	}
	puts(bit(s[k/64],k%64)?"Yes":"No");
}


Measured memory_bytes: 2972
#include<cstdio>
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	int a=1;
	for(int i=0;i<n;i++){
		if(a>k)a+=k;
		else a=a*2;
	}
	printf("%d\n",a);
	return 0;
}

Measured memory_bytes: 128
//  Mayank Agarwal
//  IIIT Hyderabad



#include<bits/stdc++.h>
using namespace std;
const long long int M = 1000000007; 
#define ll long long int
#define ld double
#define pb push_back
#define mp make_pair
ll power(ll x, ll y,  ll p) 
{ 
    ll res = 1;      
    x = x % p;   
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1;x = (x*x) % p; 
    } return res%p; 
} 
ll modinver(ll a,ll b)
{
    return (power(a,1,M)*power(b,M-2,M))%M;
}
void SieveOfEratosthenes(int n) 
{   
    bool prime[10005]; 
    memset(prime, true, sizeof(prime)); 
  
    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()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n;
    cin>>n;
    std::vector<ll> v;
    v.pb(1);
    ll a[100002];
    for (int i = 0; i < n; ++i)
    {
    	cin>>a[i];
    }
    sort(a,a+n);
    ll x=a[0];
    v.pb(x);
    for (int i = 2; i*i <=x; ++i)
    {
    	if(x%i==0)
    	{
    		if(i*i!=x)
    		{
    			v.pb(i);
    			v.pb(x/i);
    		}
    		else
    		{
    			v.pb(i);
    		}
    	}
    }
    ll ans=0,flag=0;
    sort(v.begin(),v.end());
    for (int i = v.size()-1; i >=0 ; --i)
    {

    	ll coun=0;
    	for (int j = 0; j < n; ++j)
    	{
    		if(a[j]%v[i]==0)
    		{
    			coun++;
    		}
    	}
    	// cout<<v[i]<<" "<<coun<<'\n';
    	if(coun>=n-1)
    	{
    		ans=max(v[i],ans);
    	}
    	if(coun==n)
    	{
    		flag=1;
    	}
    }
    if(flag==0)
    {
    	cout<<ans<<'\n';
    	return 0;
    }
    std::vector<ll> v1;
    v1.pb(1);
    x=a[1];
    v1.pb(x);
    for (int i = 2; i*i <=x; ++i)
    {
    	if(x%i==0)
    	{
    		if(i*i!=x)
    		{
    			v1.pb(i);
    			v1.pb(x/i);
    		}
    		else
    		{
    			v1.pb(i);
    		}
    	}
    }
    sort(v1.begin(),v1.end());
    for (int i = v1.size()-1; i >=0 ; --i)
    {

    	ll coun=0;
    	for (int j = 0; j < n; ++j)
    	{
    		if(a[j]%v1[i]==0)
    		{
    			coun++;
    		}
    	}
    	// cout<<v[i]<<" "<<coun<<'\n';
    	if(coun>=n-1)
    	{
    		ans=max(v1[i],ans);
    	}
    }
    cout<<ans<<'\n';


}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define lli long long int
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
#define forn(i, n)  for(int i=0;i<n;++i)
#define rforn(i,start) for(int i = start; i >= 0;--i)
#define forsn(i,start,end) for(int i=start;i<end;++i)
#define rforsn(i,start,end) for(int i=start;i>=end;--i)
#define debug(x) cout<<#x<<" = "<<x<<"\n";
const int CONST = 1e9 + 7;

#define MAX 2000000

int32_t main(){
	fastio;
    #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	//  freopen("output.txt","w",stdout);
	#endif
	
	lli n, x, t;
	cin>>n>>x>>t;

	cout<<(lli)(ceil((double)n/x)*t);

	return 0;
}

Measured memory_bytes: 3644
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        static void Main(string[] args)
        {
            SolveA(args);
            //SolveB(args);
            //SolveC(args);
            //SolveD(args);


        }

        static void SolveA(string[] args)
        {
            int[] nk = ReadAndParseIntArr();
            int n = nk[0];
            int k = nk[1];
            int[] x = ReadAndParseIntArr();

            long min = long.MaxValue;

            for(int left=0;left<x.Length;++left)
            {
                // ここからk本
                // パターン分け
                int right = left + k - 1;
                if(right >= x.Length) { break; }// 本数足りない

                if( x[right] < 0)
                {
                    // 左
                    min = Math.Min(min, -x[left]);
                }else if( x[left] > 0)
                {
                    // 右側
                    min = Math.Min(min, x[right]);
                }
                else
                {
                    // 原点を含む
                    // 右に行ってから左に折り返し
                    int dist = 2 * Math.Abs(x[right]) + Math.Abs(x[left]);
                    min = Math.Min(min, dist);
                    // 左行ってから右に折り返し 
                    dist = 2 * Math.Abs(x[left]) + Math.Abs(x[right]);
                    min = Math.Min(min, dist);
                }
            }

            Console.WriteLine(min);
        }
    }
}

Measured memory_bytes: 21856
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 100000000000000

int main(){
	int n;cin>>n;
	vector<int> c(n-1),s(n-1),f(n-1);
	for(int i=0;i<n-1;i++){
		cin>>c[i]>>s[i]>>f[i];
	}

	vector<int> ans(n,0);
	for(int i=0;i<n;i++){
		ans[i]=s[i]+c[i];
	}

	for(int i=0;i<n-2;i++){//i駅からstart
		for(int j=i+1;j<n-1;j++){
			ans[i]=s[j]+max(0,(ans[i]-s[j]+f[j]-1)/f[j])*f[j];
			ans[i]+=c[j];
		}
	}

	for(int i=0;i<n-1;i++){
		cout<<ans[i]<<endl;
	}
	cout<<0<<endl;
	return 0;
}

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

vector<long long> divisor(long long n) {
    vector<long long> res;
    for (long long i = 1; i * i <= n; i++)
    {
        if (n % i == 0) {
            res.push_back(i);
            if (i != n / i) res.push_back(n / i);
        }
    }
    return res;
}

const long long MOD = 1000000007;
const int MAX = 10000000;
long long fac[MAX], finv[MAX], inv[MAX];

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

long long mod_comb(long long n, long long k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    long long x, y;
    cin >> x >> y;
    comb_init();

    vector<long long> div = divisor(2 * x - y);
    long long ans = 0;
    for (int i = 0; i < (int)div.size(); i++) {
        if (div.at(i) % 3 == 0) {
            long long l = div.at(i) / 3;
            long long k = x - 2 * l;
            if (k < 0) continue;

            ans += mod_comb(k + l, k);
            ans %= MOD;
        }
    }
    //cout << ans << endl;
    long long ans2 = 0;
    for (int i = 0; i <= max(x, y); i++) {
        int j = y - 2 * i;
        if (j < 0) continue;
        
        if ((i + 2 * j == x) && (2 * i + j == y)) {
            ans2 += mod_comb(i + j, i);
            ans2 %= MOD;
        }
    }
    cout << ans2 << endl;
}

Measured memory_bytes: 234624