akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
// #define M_PI 3.14159265358979323846 // CFでは定義しておく必要あり
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

template<class T>
inline bool chmax(T &a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
};

template<class T>
inline bool chmin(T &a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
};

void print() {
  cout << endl;
};

template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
};

template <class T>
void print(vector<T> &vec, ll k){
   ll n = vec.size();
   k = min(k, n);
   rep(i, 0, k-1) cout << vec[i] << " ";
   cout << vec[k-1] << endl;
};

template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
    print(vec);
  }
};

template<class T, class U>
void print(pair<T,U> &p){
  cout << p.first << " " << p.second << "\n";
};

const ll LINF = 1e18;

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

  int N, M; cin >> N >> M;
  vl a(N), b(N), c(M), d(M);
  rep(i, 0, N) {
    cin >> a[i] >> b[i];
  }
  rep(i, 0, M) {
    cin >> c[i] >> d[i];
  }

  vpl ans(N, make_pair(LINF, 0ll));
  rep(i, 0, N) {
    ll ai = a[i];
    ll bi = b[i];
    rep(j, 0, M) {
      ll cj = c[j];
      ll dj = d[j];
      ll dist = abs(ai-cj)+abs(bi-dj);
      if (dist < ans[i].first) {
        ans[i].first = dist;
        ans[i].second = j+1;
      }
    }
  }

  for (auto pi: ans) {
    cout << pi.second << endl;
  }

  return 0;
};


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

#define select(_1, _2, x, ...) x

#define repn(i, n) for (int i = 0; i < (n); i++)
#define repr(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, ...) select(__VA_ARGS__, repr, repn)(i, __VA_ARGS__)

#define rrepn(i, n) for (int i = (n - 1); i >= 0; i--)
#define rrepr(i, a, b) for (int i = (b - 1); i >= (a); i--)
#define rrep(i, ...) select(__VA_ARGS__, rrepr, rrepn)(i, __VA_ARGS__)

#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;

const int INF = 1e9;
const ll LINF = 1e18;


int main() {
    string s;
    cin >> s;

    rep(i, s.length()) {
        if (s[i] != s[s.length() - 1 - i]) {
            cout << "No" << endl;
            return 0;
        }
    }

    rep(i, (s.length() - 1) / 2) {
        if (s[i] != s[(s.length() - 1) / 2 - 1 - i]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int n,i,ans=0;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++) scanf("%d",&a[i]);
  for(i=1;i<n-1;i++){
    if((a[i-1]<a[i] && a[i]<a[i+1]) || (a[i+1]<a[i] && a[i]<a[i-1])) ans++;
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 128
#pragma region includes, macros
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <map>
#include <set>
#include <list>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef int64_t i64;
typedef pair<i64, i64> P;

template<class T>
const T INF = numeric_limits<T>::max();
template<class T>
const T SINF = numeric_limits<T>::max() / 10;
static const i64 MOD = 1000000007;

//int dx[5] = {-1,0,0,0,1}, dy[5] = {0,-1,0,1,0};
//int dx[8] = {-1,0,1,1,1,0,-1,-1}, dy[8] = {1,1,1,0,-1,-1,-1,0};
//int dx[9] = {-1,0,1,1,1,0,-1,-1,0}, dy[9] = {1,1,1,0,-1,-1,-1,0,0};

struct edge {
    i64 from, to, cost;
    edge(i64 to, i64 cost) : from(-1), to(to), cost(cost) {}
    edge(i64 src, i64 to, i64 cost) : from(src), to(to), cost(cost) {}
};

// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
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 V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
    for (auto& e : t) fill_v(e, v);
}
//

#pragma endregion

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

int main() {
    int n, k;
    string s;
    cin >> n >> k >> s;
    s[k - 1] = s[k - 1] + 'a' - 'A';
    cout << s << endl;
}


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

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

  ll k = 2;
  while (k < 2000) {
    if (k * (k - 1) == N * 2) {
      break;
    }
    k++;
  }
  if (k == 2000) {
    cout << "No" << endl;
    return 0;
  }

  vector<vector<ll>> A(k);
  ll t = 1;
  REP(i, 0, k) {
    ll p = 1;
    while (A[i].size() < k - 1) {
      A[i].push_back(t);
      A[i + p].push_back(t);
      t++;
      p++;
    }
  }

  cout << "Yes" << endl;
  cout << k << endl;
  REP(i, 0, k) {
    cout << A[i].size();
    REP(j, 0, A[i].size()) cout << " " << A[i][j];
    cout << endl;
  }
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 100005

int N,K;
int A[SIZE];

int main(){

	scanf("%d %d",&N,&K);

	int loc;
	for(int i = 0 ; i < N; i++){

		scanf("%d",&A[i]);
		if(A[i] == 1){

			loc = i;
		}
	}

	int ans = BIG_NUM;
	int L,R;

	for(int left = 0; left <= K-1; left++){

		L = loc-left;
		R = loc+((K-1)-left);

		if(L < 0)continue;
		if(R > N-1)continue;

		int tmp = 1;
		//printf("left:%d L:%d R:%d\n",left,L,R);

		if(L > 0){

			tmp += L/(K-1);
			if(L%(K-1) != 0)tmp++;
		}
		if(R < N-1){

			tmp += (N-1-R)/(K-1);
			if((N-1-R)%(K-1) != 0)tmp++;
		}
		ans = min(ans,tmp);
	}

	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 4096
#include <algorithm>
#include <numeric>
#include <map>
#include <vector>
#include <cmath>
#include <complex>
#include <iostream>
#include <iomanip>

using namespace std;

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

int enc(int y,int m,int d){
  return y*31*12 + m * 31 + d;
}

int main() {
  int n;scanf("%d",&n);
  vector<string> ts(n),as(n);vector<int> ds(n);
  REP(i,n){
	cin >> ts[i] >> as[i];
	string dstr;cin >> dstr;
	int y,m,d;sscanf(dstr.c_str(),"%d/%d/%d",&y,&m,&d);
	ds[i]=enc(y,m,d);
  }

  int m;scanf("%d",&m);
  REP(i,m){
	string t,a;
	cin >> t >> a;
	int dl=-(1<<28),dr=1<<28;
	string dlstr,drstr;cin >> dlstr >> drstr;
	if(dlstr!="*"){
	  int y,m,d;sscanf(dlstr.c_str(),"%d/%d/%d",&y,&m,&d);
	  dl=enc(y,m,d);
	}
	if(drstr!="*"){
	  int y,m,d;sscanf(drstr.c_str(),"%d/%d/%d",&y,&m,&d);
	  dr=enc(y,m,d);
	}
	REP(j,n){
	  bool ok=true;

	  if(t!="*" && ts[j].find(t)==string::npos)ok=false;
	  if(a!="*" && as[j].find(a)==string::npos)ok=false;
	  if(!(dl<= ds[j] && ds[j] <=dr))ok=false;
	  if(ok){
		cout << ts[j] <<endl;
	  }
	}
	if(i!=m-1)cout <<endl;
  }



}

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

signed main() {
  int n = read();
  vector<pi> red, blue;
  vector<bool> isUse(n, false);
  REP(i, n) {
    int x = read(), y = read();
    red.EB(x, y);
  }
  REP(i, n) {
    int x = read(), y = read();
    blue.EB(x, y);
  }
  sort(ALL(red), greater<pi>());
  sort(ALL(blue), greater<pi>());
  int ans = 0;
  REP(i, n) {
    int x = red[i].first, y = red[i].second;
    int index = -1, tmp = 200;
    REP(j, n) {
      if (isUse[j])
        continue;
      if (x < blue[j].first && y < blue[j].second) {
        if (blue[j].second < tmp) {
          tmp = blue[j].second;
          index = j;
        }
      }
    }
    if (index != -1) {
      isUse[index] = true;
      ans++;
    }
  }
  print(ans);
}


Measured memory_bytes: 256
var s:string;
    i,len,x,y,ans:longint;
begin
 readln(s);
 len:=length(s);
 for i:=1 to len do
 begin
  if (x>=y+1) then begin inc(y); if (s[i]='g') then inc(ans); end
  else begin inc(x); if (s[i]='p') then dec(ans); end;
 end;
 writeln(ans);
end.

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

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

	string s;
	cin >> s;

	ll k;
	cin >> k;

	int n = s.size();
	if(s[0] != s[n-1]){
		ll ans = 0;
		ll a = 1;
		rep(i, n-1){
			if(s[i] == s[i+1]){
				a++;
			}else{
				ans += a / 2 * k;
				a = 1;
			}
		}

		ans += a / 2 * k;
		cout << ans << endl;
	}else{
		ll l = 0;
		rep(i, n-1){
			if(s[i] == s[i+1] && l == i){
				l = i + 1;
			}
		}

		ll r = n - 1;
		for(int i = n - 1; i >= 1; i--){
			if(s[i] == s[i-1] && r == i){
				r = i - 1;
			}
		}

		if(l == n - 1){
			cout << (n * k) / 2 << endl;
		}else{
			ll mid = 0;
			ll a = 1;
			for(int i = l + 1; i < r-1; i++){
				if(s[i] == s[i+1]){
					a++;
				}else{
					mid += a / 2 * k;
					a = 1;
				}
			}

			mid += a / 2 * k;
			// cout << l << "," << mid << "," << r << endl;
			cout << (l + 1) / 2 + ((l+1) + (n-r)) / 2 * (k - 1) + mid + (n - r) / 2 << endl;
		}
	}

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        final int MAXDATE = 100;
        
        while (true) {
            int n = sc.nextInt();
            int q = sc.nextInt();
            if (n == 0) {
                break;
            }
            
            int[] date = new int[MAXDATE + 1];
            for (int i = 0; i < n; i++) {
                int m = sc.nextInt();
                for (int j = 0; j < m; j++) {
                    int tmp = sc.nextInt();
                    date[tmp]++;
                }
            }
            
            int ans = 0;
            int max = 0;
            for (int i = 1; i < date.length; i++) {
                if (date[i] >= q && date[i] > max) {
                    ans = i;
                    max = date[i];
                }
            }
            System.out.println(ans);
        }
    }
}

Measured memory_bytes: 62696
#include<cstdio>
#include<iostream>
using namespace std;
inline int read()
{
	int x=0,f=1; char ch=0;
	while(!isdigit(ch)) f=(ch=='-'?-1:1),ch=getchar();
	while(isdigit(ch)) x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x*f;
}
int main()
{
	int n=read(),k=read();
	for(register int i=max(-1000000,k-n+1);i<=min(k+n-1,1000000);i++){
		printf("%d ",i);
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

int main(){
    int A, B, C;
    cin >> A >> B >> C;
    int usm=A+B+C;
    if(usm>21){
        cout << "bust" << endl;
    }else{
        cout << "win" << endl;
    }
}

Measured memory_bytes: 256
program proA
  implicit none
  integer*8 x,y,i,n
  
  read(*,*) x,y

  if(x==y.or.mod(x,y)==0) then
     write(*,*)-1
     stop
  end if
  i=1
  do while (x*i<1.0E+18)
     n=x*i
     if(mod(n,y) .ne. 0) then
        write(*,*) n
        stop
     end if
     i=i+1
  end do

  write(*,*) -1
end program proA


Measured memory_bytes: 768
A = int(input())
B = int(input())
C = int(input())
X = int(input())
print(len({(a, b, c)
      for a in range(A + 1)
      for b in range(B + 1)
      for c in range(C + 1)
      if 500 * a + 100 * b + 50 * c == X}))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
int main()
{
    ll n,i;
    cin>>n;
    vector<ll>dp(n+1,1);
    if(n<3)
    cout<<"0";
    else if(n<6)
    cout<<"1";
    else
    {
     dp[0]=0;
     dp[1]=0;
     dp[2]=0;
     dp[3]=1;
     dp[4]=1;
     dp[5]=1;
     for(i=6;i<=n;i++)
     dp[i]=(dp[i-1]+dp[i-3])%mod;
     cout<<dp[n]%mod;
        
    }
    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#define int long
using namespace std;
bool comp(const pair<int,int>&p1,const pair<int,int>&p2)
{
	return p1.first==p2.first?p1.second<p2.second:p1.first>p2.first;
}
pair<int,int>P[1<<17];
int cnt[1<<17]={};
main()
{
	int n;cin>>n;
	for(int i=0;i<n;i++)
	{
		int a;cin>>a;
		P[i]=make_pair(a,i);
	}
	sort(P,P+n,comp);
	int now=n+1;
	P[n]=make_pair(0,0);
	for(int i=0;i<n;i++)
	{
		if(now>P[i].second)now=P[i].second;
		cnt[now]+=-~i*(P[i].first-P[i+1].first);
	}
	for(int i=0;i<n;i++)cout<<cnt[i]<<endl;
}


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


using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 1010;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}



// Main Code
int main()
{
	int n, k;
	cin>>n>>k;
	int l = 1;
	int r = n;
	int ans = 0;
	while(l < r)
	{
		l += k;
		l--;
		ans++;
	}
	cout<<ans<<endl;
	
}


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

int main(){


    string findword,ring;

    int N,i=0,count=0,A=0,ringf=0;

    bool check;

    cin >> findword >> N;  

    while(i < N){
 
        cin >> ring;

        ring += ring;
   
        ringf = ring.find(findword);

        if(ringf >= 0 && ringf < ring.size()) count++;

        i++;

   }

  cout << count << endl;

  return 0;

}
    
    

Measured memory_bytes: 1212
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array;


void main() {
    int a, b, c, d;
    scanf("%d %d %d %d ", &a, &b, &c, &d);
    writeln(min(a,b) + min(c,d));
}


void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

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


int main(void) {
	int n, k;
	long double total = 0.0;
	long double now = 0.0;
	int p;

	cin >> n >> k;

	if (n >= k) {
		FOR(i, 1, k - 1) {
			p = i;
			now = 1.0;
			while (p < k) {
				p *= 2;
				now *= 0.5;
			}
			//total += (now) / (double)n;
			total += now;
		}
		//total += 1.0*(n - k + 1) / (double)n;
		total += 1.0*(n - k + 1);
	}
	else {
		FOR(i, 1, n) {
			p = i;
			now = 1.0;
			while (p < k) {
				p *= 2;
				now *= 0.5;
			}
			//total += (now) / (double)n;
			total += now;
		}
	}

	//cout << total << endl;

	//printf("%.10lf\n", total);
	printf("%.15Lf\n", total/(long double)n);

	return 0;
}

Measured memory_bytes: 256
from collections import deque


def read_int():
    return int(input().strip())


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


def solve():
    K = read_int()
    if K < 10:
        return K
    Q = deque(range(1, 10))
    counter = 10
    while True:
        num = Q.popleft()
        digit = num%10
        for d in range(-1, 2):
            if 0 <= digit+d < 10:
                if counter == K:
                    return num*10+digit+d
                counter += 1
                Q.append(num*10+digit+d)


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


Measured memory_bytes: 6084
package main

import "fmt"

func main() {
    var n int64
    fmt.Scan(&n)
    ans := n - 1
    for i := int64(1); i * i <= n; i++ {
        if n % i == 0 {
            ans = i + n / i - 2
        }
    }
    fmt.Println(ans)
}


Measured memory_bytes: 512
#[allow(unused_imports)]
use io::*;
use proconio::marker::*;
use proconio::{fastout, input};
use std::*;

#[fastout]
fn main() {
    input! {
        H: usize,
        W: usize,
        K: usize,
        m: [Chars;H],
    }

    let mut ans = 0;
    for maskR in 0..1 << H {
        for maskC in 0..1 << W {
            let mut black = 0;
            for i in 0..H {
                for j in 0..W {
                    if ((maskR >> i) & 1 == 0 && (maskC >> j) & 1 == 0 && m[i][j] == '#') {
                        black += 1;
                    }
                }
            }
            if black == K {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2144
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <numeric>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S;
    cin >> S;
    ll counter = 0;
    REP(i, S.length()-1){
        if(S[i+1]!=S[i]) counter++;
    }
    cout << counter << endl;

    return 0;
}


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

int main(){
    int N;
    cin >> N;
    if (N % 10 == 9){
        cout << "Yes" << endl;
    }
    else if (90<=N && N<=99){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3616
#include<stdio.h>

int main(void){
  int n, x, i, j, k;
  int cnt = 0;
  
  while(1){
    scanf("%d %d", &n, &x);
    if(n == 0 && x == 0) break;

    for(i=1;i<n-1;i++){
      for(j=i+1;j<n;j++){
	for(k=j+1;k<n+1;k++){
	  if(i + j + k == x) cnt++;
	}
      }
    }

    printf("%d\n", cnt);
    cnt = 0;

  }
  
  return 0;
}


Measured memory_bytes: 2056
import std.string;
import std.algorithm;
import std.math;
import std.array;
import std.format;
import std.range;
import std.stdio;
import std.conv;

struct Node
{
    size_t value;
    Node*[] childs;

    static
    Node* parse(string str)
    {
        Node* dst = new Node;
        size_t cnt;
        foreach(e; str) if(e == '[') ++cnt; else break;
        if(cnt == 1){
            dst.value = str[1 .. $-1].to!size_t;
            return dst;
        }else{
            size_t s, c;
            foreach(i, e; str){
                if(c == 1) s = i;
                if(e == '[') {++c; if(c == 1) s = i;};
                if(e == ']') {--c; if(c == 1) dst.childs ~= parse(str[s .. i+1]); };
            }
        }

        return dst;
    }

    string toString()
    {
        if(childs.length == 0) return '[' ~ value.to!string ~ ']';
        else{
            auto app = appender!string();
            app.put('[');
            foreach(e; childs)
                app.put(e.toString());
            app.put(']');
            return app.data;
        }
    }

    size_t query()
    {
        if(childs.length == 0) return (value + 1)/2;
        else{
            size_t[] vs;
            foreach(e; childs) vs ~= e.query;
            vs.sort();
            vs = vs[0 .. ($+1)/2];
            return vs.reduce!"a+b";
        }
    }
}


void main()
{
    foreach(i; 0 .. readln().chomp().to!size_t){
        writeln(Node.parse(readln().chomp()).query);
    }
}

Measured memory_bytes: 2112
#include<iostream>

long long rec(long long x, long long y, long long d){
	if(x%y==0)
		return d+2*x-y;
	else
		return rec(y, x%y, d+ 2*(x-x%y));
}

int main(){
	long long n, x;
	long long ans;
	std::cin>>n>>x;

	ans= rec(std::max(n-x, x), std::min(n-x, x), n);

	std::cout<<ans<<std::endl;

	return 0;
}

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

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

        Arrays.sort(v);
        double sum = (double)(v[0] + v[1]) / 2;
        for(int i=2; i<n; i++){
            sum = (double)(sum + v[i]) / 2;
        }

        System.out.println(sum);
    }
}

Measured memory_bytes: 35476
import java.io.*;

public class Main{
	public static void main(String[] arsg) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int count = Integer.parseInt(br.readLine());
		double[] x = new double[count];
		double[] y = new double[count];
		String[] strx = (br.readLine()).split(" ");
		String[] stry = (br.readLine()).split(" ");
		
		
		for(int i = 0;i<count;i++){
			x[i] = Integer.parseInt(strx[i]);
		}
		for(int i = 0;i<count;i++){
			y[i] = Integer.parseInt(stry[i]);
		}
		double sum = 0;
		for(int i = 0;i<count;i++){
			sum +=  Math.abs(x[i] - y[i]);
		}
		System.out.printf("%.6f\n",sum);
		sum = 0;
		for(int i = 0;i<count;i++){
			sum += Math.pow(x[i]-y[i],2);
		}
		System.out.printf("%.6f\n",Math.sqrt(sum));
		sum = 0;
		for(int i = 0;i<count;i++){
			sum += Math.pow(Math.abs(x[i]-y[i]),3);
		}
		double d = Math.cbrt(sum);
		System.out.printf("%.6f\n",d);
		sum = Math.abs(x[0]-y[0]);
		for(int i = 0;i<count;i++){
			sum = Math.max(sum,Math.abs(x[i]-y[i]));
		}
		System.out.printf("%.6f\n",sum);
		
	}
}

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

int main() {
  int N, A, B, C, D;
  cin >> N;

  A = N/1000;
  B = (N%1000)/100;
  C = ((N%1000)%100)/10;
  D = ((N%1000)%100)%10;
  
  if (((A==B)&&(A==C))||((B==C)&&(B==D))||((A==B)&&(A==C)&&(A==D)))
    cout << "Yes" << endl;
  else 
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin >> N;
  int min;
  cin >> min;
  int p,count=1;
  for(int i=1;i<N;i++){
    cin >> p;
    if(min>=p) {
      count++;
      min = p;
    }
  }
  cout << count << endl;
  
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define N 200005
ll mod=1000000007;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define all(x) x.begin(),x.end()
#define lb lower_bound
ll powermodm(ll x,ll n,ll M){ll result=1;while(n>0){if(n % 2 ==1)result=(result * x)%M;x=(x*x)%M;n=n/2;}return result;}
ll power(ll _a,ll _b){ll _r=1;while(_b){if(_b%2==1)_r=(_r*_a);_b/=2;_a=(_a*_a);}return _r;}

int main(){
    ll n,m,a,b;
    cin>>n>>m>>a>>b;
    ll x[n+1][m+1];
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            x[i][j]=0;
        }
    }
    
    for(int i=1;i<=b;i++){
        for(int j=1;j<=m;j++){
            x[i][j]=1;
        }
    }
    
    for(int i=1;i<=a;i++){
        for(int j=1;j<=n;j++){
            x[j][i]=!x[j][i];
        }
    }
    
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cout<<x[i][j];
        }
        cout<<endl;
    }
    
    return 0;
}

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

int main() {
    ll x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    ll dx = x2 - x1;
    ll dy = y2 - y1;

    cout << x1 + dx - dy << " " << y1 + dx + dy << " " << x1 - dy << " " << y1 + dx << endl; 
    re0;
}

Measured memory_bytes: 256
#include <stdio.h>

using namespace std;

int main(){
	int a,b;
	char op;
	while(true){
		scanf("%d %c %d",&a,&op,&b);
		if(op == '?') break;
		switch(op){
		case '+':
			printf("%d\n",a+b);
			break;
		case '-':
			printf("%d\n",a-b);
			break;
		case '/':
			printf("%d\n",a/b);
			break;
		case '*':
			printf("%d\n",a*b);
			break;
		}
	}
}

Measured memory_bytes: 1028
import heapq

n = int(input())
A = [-int(i) for i in input().split()]
heapq.heapify(A)

def battle(a,b):
    # x = attack, y = defense
    x, y = min(a,b),max(a,b)
    x -= y * (x // y)
    return x,y

while len(A) != 1:
    a = heapq.heappop(A)
    b = heapq.heappop(A)
    
    while a != 0 and b != 0: a,b = battle(a,b)
    heapq.heappush(A, a) if a != 0 else heapq.heappush(A, b)

print(-A[0])
    

Measured memory_bytes: 14180
#include <bits/stdc++.h>
using namespace std;
int main(){

	int freq[26]; char ch; 
	 int count=0;
	 for(int i=0;i<26;i++)
	    freq[i]=0;	 	 
	string s; cin>>s; bool flag=false; int index;
	for(int i=0;i<s.length();i++)
	{     ch=s[i];
		  index=int(ch)-97;
		  cerr<<"index= "<<index<<" ";
           count=freq[index];
           count++;
           freq[index]=count;
	}
	for(int i=0;i<26;i++)
	{
		if(freq[i]%2!=0)
			{flag=true;
		    break;}
	}
	

   if(flag)
   	  cout<<"No";
   	else 
   		cout<<"Yes";
	return 0;	
}

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

#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1e9+7;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

template<class T>
inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template<class T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
///////////////////////////////////////////////
/*(._.)*/
int main(){
	int A,B,C;
	cin >> A >> B >> C;
	int rest = A-B;
	cout << max(C-rest,0) << endl;
}


Measured memory_bytes: 256
import numpy as np
from functools import *
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline



def acinput():
    return list(map(int, input().split(" ")))

x=np.array(acinput())


for i in range(len(x)):
    if x[i]==0:
        print(i+1)
        break

Measured memory_bytes: 26960
N, M = [int(i) for i in input().split()]
A = [[i for i in list(input())] for _ in range(N)]
B = [[i for i in list(input())] for _ in range(M)]

k = (N-1)-(M-1)+1

def judge(x, y):
    for i in range(M):
        for j in range(M):
            if not(A[x+i][y+j]==B[i][j]):
                return False
    return True


for i in range(k):
    for j in range(k):
        if judge(i, j):
            print("Yes")
            quit()

print("No")


Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
    int i;
    char a[100];
    while(~scanf("%s",a)){
        for(i=0;i<strlen(a);i++){
            if(i==5||i==13){
                printf(" ");
            }
            else{
                printf("%c",a[i]);
            }
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<cmath>

using namespace std;
#define REP(i,m,n) for(int i=m;i<n;++i)
#define REPll(i,m,n) for(ll i=m;i<n;++i)
#define INF 10000000000000000
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define all(v) v.begin(),v.end()

int main() {
	string s, t;
	cin >> s >> t;
	char tmp;
	REP(i, 0, s.size()) {
		tmp = s[s.size() - 1];
		REP(j, 1, s.size()) {
			s[s.size() - j] = s[s.size() - j - 1];
		}
		s[0] = tmp;
		if (s == t) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int h, w, n, x, y, c;
    bool z = 0;
    string s, t;
    cin >> h >> w >> n >> x >> y >> s >> t;
    c = x;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'D') c++;
        if (c > h) z = 1;
        if (t[i] == 'U' && c > 1) c--;
    }
    c = x;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'U') c--;
        if (c < 1) z = 1;
        if (t[i] == 'D' && c < h) c++;
    }
    c = y;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'R') c++;
        if (c > w) z = 1;
        if (t[i] == 'L' && c > 1) c--;
    }
    c = y;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'L') c--;
        if (c < 1) z = 1;
        if (t[i] == 'R' && c < w) c++;
    }
    if (z) cout << "NO";
    else cout << "YES";
}


Measured memory_bytes: 920
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

ll a[100005],dp[2][100005];

int main()
{ios_base::sync_with_stdio(false);
int n;
cin>>n;
rep(i,1,n)cin>>a[i];

rep(i,1,n)dp[0][i]=dp[0][i-1]+abs(a[i]-a[i-1]);
ren(i,n,1)dp[1][i]=dp[1][i+1]+abs(a[i]-a[i+1]);

rep(i,1,n)
{
	ol(dp[0][i-1]+dp[1][i+1]+abs(a[i-1]-a[i+1]));on;
}
return 0;
}



Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a<c){
    if(c-a>b){
      cout<<"NO"<<endl;
    }
    if(c-a<=b){
      cout<<"YES"<<endl;
    }
  }
  else if(a==c){
    cout<<"YES"<<endl;
  }
  else if(a>c){
    cout<<"NO"<<endl;
  }
}

Measured memory_bytes: 256
#abc093 b
a,b,k=map(int,input().split())
l1=[i for i in range(a,min(a+k,b+1))]
l2=[i for i in range(max(a,b-k+1),b+1)]
ans=set(l1+l2)
for i in sorted(ans):
    print(i)


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

int main() {

    string S;
    cin >> S;
    bool alphabet[26];
    rep(i, 26) alphabet[i] = false;

    for (int i = 0; S[i] != '\0'; ++i) {
        alphabet[S[i]-'a'] = true;
    }

    rep(i, 26) {
        if (!alphabet[i]) {
            cout << char(i + 'a') << endl;
            return 0;
        }
    }

    cout << "None" << endl;

    return 0;
}

Measured memory_bytes: 3728
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1e+15
#define MOD 1000000007
using namespace std;


int main(){
    int H,W;
    cin >> H >> W;
    char grid[H][W];
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            cin >> grid[i][j];
        }
    }
    
    ll dp[H][W];
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            dp[i][j]=0;
        }
    }
    
    for(int i=0; i<H && grid[i][0]=='.'; i++){
        dp[i][0]=1;
    }
    for(int j=0; j<W && grid[0][j]=='.'; j++){
        dp[0][j]=1;
    }
    
    for(int i=1; i<H; i++){
        for(int j=1; j<W; j++){
            if(grid[i][j]=='#'){
                dp[i][j]=0;
            }else{
                dp[i][j] = dp[i-1][j] + dp[i][j-1];
                dp[i][j] %= MOD;
            }
        }
    }
    
    cout<< dp[H-1][W-1] << endl;
    return 0;
}


Measured memory_bytes: 9088
#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define ll long long
#define rsz resize
#define mod 1000000007
vector<vector<int> >v(1010);
int main()
{
   int n;
   cin>>n;
   set<string>s;
   for(int i=0;i<n;++i)
   {
       string a;
       cin>>a;
       s.insert(a);
   }
   cout<<s.size()<<endl;
}


Measured memory_bytes: 19284
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;
ll mod = 1e9+7;

int main() {
    ll n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    ll c = 0;
    rep(i,n){
        for(int j = i; j < n; ++j) {
            if(a[i] > a[j]) c++;
        }
    }
    ll ans = c*k%mod;

    ll d = 0;
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < n; ++j) {
            if(a[i] > a[j]) d++;
        }
    }
    ans += k*(k-1)/2%mod * d%mod;
    ans%=mod;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin >> n >> k;
	int s=n-k;
	if(s%(k-1)==0){
		cout << s/(k-1)+1 << endl;
	}
	else{
		cout << s/(k-1)+2 << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define MOD 1000000007
#define mod 1000000037
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define INF 2e9

vector<vector<lli> >dp;
vector<lli>v;

lli func(lli l,lli r)
{
    if(dp[l][r]!=-1)
        return dp[l][r];
    if(l==r)
    {
        dp[l][r]=v[l];
        return v[l];
    }
    if(r==l+1)
    {
        dp[l][r]=max(v[l],v[r]);
        return dp[l][r];
    }
    //cout << l << " " << r << endl;
    lli a=func(l+2,r),b=func(l+1,r-1),c=func(l+1,r-1),d=func(l,r-2);
    //cout << a << " " << b << " " << c << " " << d << endl;
    dp[l][r]=max(min(v[l]+a,v[l]+b),min(v[r]+c,v[r]+d));
    return dp[l][r];
}

int main()
{
    fastio;
    lli n;
    cin >> n;
    v.resize(n);
    lli sum=0;
    for(lli i=0;i<n;i++)
    {
        cin >> v[i];
        sum+=v[i];
    }
    dp.resize(n);
    for(lli i=0;i<n;i++)
    {
        vector<lli>t(n,-1);
        dp[i]=t;
    }
    // cout << func(0,n-1) << endl;
    // for(int i=0;i<n;i++)
    // {
    //     for(int j=0;j<dp[i].size();j++)
    //         cout << dp[i][j] << " ";
    //     cout << endl;
    // }
    lli ans=2*func(0,n-1)-sum;
    cout << ans << endl;
}

Measured memory_bytes: 70912
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
#define inf 1000000000000000000
#define MAXN 1000001
#define eps 0.0000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}

// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

//////////////

#define S second
#define F first
#define int long long  

//////////

signed main()
{
    int a,b;
    cin>>a>>b;
    if(b%a==0)
        cout<<a+b;
    else
        cout<<b-a;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(auto (i) = (n)*0; (i) < (n); (i)++)
#define RNG(i, a, b) for(auto (i) = (a); (i) < (b); (i)++)
#define RBF(i, v) for(auto& (i) : (v))
#define ALL(x) (x).begin(), (x).end()

using LL = long long;
using UL = unsigned;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }

LL n, k;
V<LL> a;

template<typename T> bool judge(T x) {
	bool ans;

	LL cnt = 0;
	RBF(i, a) {
		LL tmp = ceil(static_cast<double>(i) / x) - 1;
		cnt += tmp;
	}
	if (cnt > k) {
		ans = false;
	}
	else {
		ans = true;
	}

	return ans;
}
// 範囲[a, b]の連続する整数のなかで，judge()=trueとなる最小の値を二分探索で求める
template<typename T> T bin_search_min(T a, T b) {
	T ng = a - 1, ok = b + 1;
	while (ok - ng > 1) {
		T mid = (ng + ok) / 2;
		if (judge(mid)) {
			ok = mid;
		}
		else {
			ng = mid;
		}
	}
	// ok > bならjudge()=trueとなる値が存在しなかったことを意味する
	return ok;
}

signed main() {
	cin >> n >> k;
	a = V<LL>(n);
	LL b = 0;
	REP(i, n) {
		LL tmp;
		cin >> tmp;
		a[i] = tmp;
		b = max(b, tmp);
	}

	LL ans = bin_search_min(1ll, b);
	col(ans);
	return 0;
}

Measured memory_bytes: 4708
using System;
using System.Linq;
using static System.Console;

namespace Contest
{
    class Program
    {
        public static void Main(string[] args)
        {
            var data = ReadLine().Split().Select(int.Parse).ToArray();
            var dice = new Dice(data);
            var op = ReadLine();
            foreach (var dir in op)
            {
                dice.RollDice(dir);
            }
            WriteLine(dice.GetNumber());
        }
    }

    class Dice
    {
        public int[] Data { get; set; }
        public int X { get; set; } = 0;
        public int Y { get; set; } = 0;
        public Dice(int[] data)
        {
            Data = data;
        }

        public void RollDice(char c)
        {
            // 0: Top
            // 5: Bottom
            // 1: Forward
            // 4: Back
            // 3: Left
            // 2: Right
            int tmp;
            switch (c)
            {
                case 'N': { tmp = Data[0]; Data[0] = Data[1]; Data[1] = Data[5]; Data[5] = Data[4]; Data[4] = tmp; break; }
                case 'S': { tmp = Data[0]; Data[0] = Data[4]; Data[4] = Data[5]; Data[5] = Data[1]; Data[1] = tmp; break; }
                case 'W': { tmp = Data[0]; Data[0] = Data[2]; Data[2] = Data[5]; Data[5] = Data[3]; Data[3] = tmp; break; }
                case 'E': { tmp = Data[0]; Data[0] = Data[3]; Data[3] = Data[5]; Data[5] = Data[2]; Data[2] = tmp; break; }
                default: break;
            }
        }

        public int GetNumber()
        {
            return Data[0];
        }

    }
}


Measured memory_bytes: 18376
package main

import (
	"fmt"
)

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)
	area1 := a * b
	area2 := c * d
	if area1 > area2 {
		fmt.Println(area1)
	} else {
		fmt.Println(area2)
	}
}


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

using namespace std;

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

	long long n;
	cin>>n;
	int cnt=0;
	vector<long long>seq;
	for(long long i=2;i*i<=n;++i)
	{
		long long temp=i;
		while(!(n%temp))
		{
			seq.emplace_back(temp);
			seq.emplace_back(n/temp);
			temp*=i;
		}
	}
	sort(begin(seq),end(seq));
	seq.erase(unique(begin(seq),end(seq)),end(seq));
	set<long long>sets;
	assert(true);
	for(int i=0;i<(int)seq.size();++i)
	{
		if(seq[i]>1)
		{
			for(int j=i+1;j<(int)seq.size();++j)
			{
				long double var=log10(1.0*seq[j])/log10(1.0*seq[i]);
				if(!(seq[j]%seq[i]))
				{
					if(ceill(var)==floorl(var) && var>1.0)
					{
						sets.insert(seq[j]);
					}
					seq[j]=0;
				}

			}
			sets.insert(seq[i]);
		}
	}
	bool chk=(n==1);
	for(long long num:sets)
	{
		if(num>n)break;
		if(!(n%num))
		{
			cnt++;
//			cerr<<num<<' ';
			n/=num;
		}
	}
	if(!cnt && !chk)cnt=1;
	cout<<cnt<<'\n';
}


Measured memory_bytes: 3928
#include <stdio.h>

int main(void)
{
	char siai[3][100] = {{0}};
	int i, j;
	int a[3], b[3];
	
	for (i = 0; i < 3; i++){
		scanf("%s", siai[i]);
		if (siai[0][0] == '0'){
			break;
		}
	}
	
	while (1){
		
		for(i = 0; i < 3; i++){
			a[i] = 0;
			b[i] = 0;
		}
		i = 0;
		while(i != 3){
			j = 1;
			while (siai[i][j] != '\0'){
				if (siai[i][j] == 'A'){
					a[i]++;
				}
				else {
					b[i]++;
				}
				j++;
			}
			
			if (a[i] > b[i]){
				a[i]++;
			}
			else {
				b[i]++;
			}
			
			printf("%d %d\n", a[i], b[i]);
			i++;
		}
		
		for (i = 0; i < 3; i++){
			scanf("%s", siai[i]);
			if (siai[0][0] == '0'){
				break;
			}
		}
		
		if (siai[0][0] == '0'){
			break;
		}
	}
	
	return (0);
}

Measured memory_bytes: 0
n = int(input())
a = list(map(int, input().split()))
 
b = [0] * n
 
for i in range(n, 0, -1):
    if sum(b[i-1::i]) % 2 == a[i-1]:
        continue
    else:
        b[i-1] = 1
 
c = []
for i in range(n):
    if b[i] == 1:
        c.append(i+1)
print(sum(b))
if len(c) > 0:
    print(*c)

Measured memory_bytes: 14136