akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;
const LL N = 1000000007;

LL x,y;
LL m,n;
LL fac[1000005];

LL kpw(LL x,LL y){
	LL ans = 1,tmp = x;
	while(y){
		if(y & 1) ans = (ans * tmp) % N;
		tmp = (tmp * tmp) % N;
		y >>= 1;
	}
	return ans;
}

LL get_inv(LL x){
	return kpw(x,N - 2);
}

LL comb(LL a,LL b){
	return (fac[a] * get_inv(fac[b]) % N) * get_inv(fac[a - b]) % N;
}

int main(){
	cin >> x >> y;
	if(x * 2 - y < 0 || (x * 2 - y) % 3){ cout << 0 << endl; return 0; }
	if(y * 2 - x < 0 || (y * 2 - x) % 3){ cout << 0 << endl; return 0; }
	fac[0] = 1LL; for(LL i = 1;i <= 1000000;i ++) fac[i] = (fac[i - 1] * i) % N;
	m = (x * 2 - y) / 3; n = (y * 2 - x) / 3;
	cout << comb(m + n,m) << endl;
	return 0;
}

Measured memory_bytes: 8064
function Main(input) {
  input = input.split("\n");
  var K = parseInt(input[0].split(" ")[0]);
  var X = parseInt(input[0].split(" ")[1]);
  if(K*500>=X){
    var ans = "Yes";
  }else{
    var ans = "No";
  }

  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<iostream>
#include <string>
#include<vector>
#include<algorithm>
#include <cstdlib>
using namespace std;
int main(){
    int x,a,b;
    cin >> x >> a >> b;
    x -= a;
    while(x>=b){
        x -=b;
    }
    cout << x << endl;
    return 0;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rint register int
#define rep(i,a,b) for (rint i=(a),_E=(b); i<=_E; ++i)
#define per(i,a,b) for (rint i=(a),_E=(b); i>=_E; --i)
#define REP(i,n) for (rint i=0,_E=(n); i<_E; ++i)
#define pb push_back
#define cmin(x,y) (y<x?x=y:0)
#define cmax(x,y) (y>x?x=y:0)
#define put(x) putchar(s[x])
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

const int T = 376;
const char s[9] = "FESTIVAL";
ll f[T][T], r[T], K;

int main() {
	rep (j, 0, 6) f[0][j] = 1;
	rep (i, 1, 7) {
		rep (j, 0, 6) f[i][j] = f[i-1][j];
		if (i-1) f[i][i-1] += T * f[i][i-2];
		else f[i][i-1] += T;
		rep (j, i, 6) f[i][j] += f[i][j-1];
		//printf("%d  %lld\n", i, f[i][6]);
	}
	cin >> K;
	per (i, 6, 0) {
		r[i] = K / f[i][6];
		//printf("#        %d   %lld\n", i, r[i]);
		K %= f[i][6];
	}
	rep (i, 0, 6) {
		if (i) rep (j, 1, T) put(i - 1);
		rep (j, i, 6) put(j);
		rep (j, 1, r[i]) put(7);
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void)
{
	int i,j,len,len2,y,x;
	char s[11],a[11];
	scanf("%s",a);
	scanf("%s",s);
	len=0; len2=0; y=0; x=0;
	len=strlen(a);
	len2=strlen(s);
	for(i=0;i<len;i++){
		if(a[i]==s[i]){
			y++;
		}
		else{
			x++;
		}
	}
	if(x<1){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 1664
#include<cmath>
#include<vector>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int MAXN = 131080;
struct sb{
	long long x, y;
};
sb a[MAXN];
vector <sb> q[MAXN];
int lc[MAXN], rc[MAXN], x, y, w[MAXN], n, m, i, j, k;
long long l, r = (long long)4e10;
inline int get()
{
	char c;
	while ((c = getchar()) < 48 || c > 57);
	int res = c - 48;
	while ((c = getchar()) >= 48 && c <= 57)
		res = res * 10 + c - 48;
	return res;
}
inline bool rule(const sb &a, const sb &b)
{
	return (a.x < b.x || (a.x == b.x && a.y < b.y));
}
inline void solve(int now, long long K)
{
	if (!lc[now] && !rc[now]) {q[now].push_back((sb){w[now], w[now]}); return;}
	solve(lc[now], K); solve(rc[now], K);
	if (q[lc[now]].size() > q[rc[now]].size()) swap(lc[now], rc[now]);
	int n = q[lc[now]].size(), m = q[rc[now]].size(), len = 0;
	for(int i = 0; i < n; i ++)
	{
		int l = 0, r = m - 1;
		while (l < r - 1)
		{
			int mid = l + r >> 1;
			if (q[lc[now]][i].y + q[rc[now]][mid].x > K) r = mid;
			else l = mid;
		}
		int final;
		if (q[lc[now]][i].y + q[rc[now]][r].x <= K) final = r;
		else if (q[lc[now]][i].y + q[rc[now]][l].x <= K) final = l;
		else final = -1;
		if (final == -1) continue;
		a[++len] = (sb){q[lc[now]][i].x, q[rc[now]][final].y};
		a[++len] = (sb){q[rc[now]][final].y, q[lc[now]][i].x};
	}
	sort(a + 1, a + 1 + len, rule);
	long long las = (long long)1e11;
	a[0].x = -1;
	for(int i = 1; i <= len; i ++)
		if (a[i].x != a[i - 1].x && las > a[i].y) q[now].push_back(a[i]), las = a[i].y;
	n = q[now].size();
	for(int i = 0; i < n; i ++)
		q[now][i].x += w[now], q[now][i].y += w[now];
}
inline bool check(long long x)
{
	for(int i = 1; i <= n; i ++)
		q[i].clear();
	solve(1, x);
	if (q[1].size()) return 1;
	else return 0;
}
int main()
{
	n = get();
	for(i = 2; i <= n; i ++)
	{
		x = get(); w[i] = get();
		if (!lc[x]) lc[x] = i;
		else rc[x] = i;
	}
	while (l != r - 1)
	{
		long long mid = l + r >> 1;
		if (check(mid)) r = mid;
		else l = mid;
	}
	if (check(l)) cout << l;
	else cout << r;
}

Measured memory_bytes: 28792
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    ans = A - B*2
    if ans >= 0:
        print(ans)
    else:
        print(0)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
//l={1,2,3,4}
//sort(l,l+N,greater<int>());	降順ソート
//sort(l,l+N);	昇順ソート
//string 変数　　変数.size()で数字化


int main(void)
{
	int n;
	cin >> n;
	long long test[205];
	for (int i = 0; i < n; i++) {
		cin >> test[i];
	}
	int ans = 0;
	for (int i = 0; i <1000 ; i++) {
		for (int j = 0; j < n; j++) {
			if (test[j] % 2 != 0) {
				cout << ans << endl;
				return 0;
			}
			test[j] /= 2;
		}
		ans++;
	}

}

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

#define INF 1e9+1

int main(){
  char N[4]; cin >> N;
  int ans = 1;
  char prev_N = N[0];
  for(int i=1; i<4; ++i){
    if(prev_N==N[i]){
      cout << "Bad" << endl;
      return 0;
    }
    prev_N = N[i];
  }
  cout << "Good" << endl;
  return 0;
}

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

using namespace std;

int gcd(int a, int b)
{
	int c;
	while (a != 0)
	{
		c = a;
		a = b % a;
		b = c;
	}
	return b;
}

int main()
{
	int n;
	cin >> n;
	cout << (2 * n) / gcd(2, n) << endl;

	return 0;
}


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



path = [[] for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    path[A-1].append(B) 
    path[B-1].append(A)
    
    

visited = [False for _ in range(N)]
que = [1]
visited[0] = True
sign = [-1 for _ in range(N)]

while True:
    next_que = []
    if not que:
        break
#     for q in que:
#         probable_room = path[q-1]
#         for p in probable_room:
    else:
        for q in que:
            probable_room = path[q-1]
            for p in probable_room:
#                 if p == q:
#                     continue
                if visited[p-1]:
                    continue
                else:
#                 print(1111)
                    visited[p-1] = True
                    sign[p-1] = q
                    next_que.append(p)
    que = next_que
if all(visited):
    print("Yes")
    for i in range(1,N):
        print(sign[i])
else:
    print("No")
    

Measured memory_bytes: 107108
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
using namespace std;
int INF = 1000000000;
int dx[] = {1,0,-1,0}, dy[] = {0,1,0,-1};

bool in_range(int x, int r){
  return (x >= 0 && x < r);
}

int dfs(vector< vector<int> > &B, int p, int g, int ret){
  if(ret > 10) return INF;
  if(p == g) return ret;
  int h = B.size(), w = B[0].size();
  int r = INF;
  for(int k = 0; k < 4; ++k){
    int x = p/w, y = p%w;
    while(in_range(x,h) && in_range(y,w) && B[x][y] == 0){
      x += dx[k];
      y += dy[k];
    }
    if(in_range(x,h) && in_range(y,w)){
      if(B[x][y] == 3) r = min(r,ret+1);
      else{
        B[x][y] = 0;
        x -= dx[k];
        y -= dy[k];
        if(in_range(x,h) && in_range(y,w) && x*w+y != p){
          r = min(r,dfs(B,x*w+y,g,ret+1));
        }
        B[x+dx[k]][y+dy[k]] = 1;
      }
    }
  }
  if(r > 10) return INF;
  return r;
}

int main(){
  int w, h;
  while(cin >> w >> h, w){
    vector< vector<int> > B(h, vector<int>(w));
    int s, g;
    for(int i = 0; i < h; ++i){
      for(int j = 0; j < w; ++j){
        cin >> B[i][j];
        if(B[i][j] == 2){
          s = i*w + j;
          B[i][j] = 0;
        }
        if(B[i][j] == 3){
          g = i*w + j;
        }
      }
    }
    int ans = dfs(B,s,g,0);
    if(ans == INF) cout << -1 << endl;
    else cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3100
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll MOD=(ll)1e9+7;
//}}}

ll f[200001] = {0};
ll comb[200001];

ll mod_pow(ll x, ll n){
  ll res = 1LL;
  while(n > 0){
    if(n & 1) res = res * x % MOD;
    x = x*x % MOD;
    n >>= 1;
  }
  return res;
}

ll mod_inv(ll x){
  return mod_pow(x, MOD-2) % MOD;
}

ll comb_mod(int n, int r){
  return (((f[n] * mod_inv(f[r])) % MOD) * mod_inv(f[n-r])) % MOD;
}

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> v;
  if(M == 1){
    puts("1");
    return 0;
  }
  rep(n, 2, 100000){
    if(M == 1) break;
    int num = 0;
    while(M % n == 0){
      M /= n;
      num++;
    }
    if(num) v.push_back(num);
  }
  if(M != 1) v.push_back(1);

  f[0] = f[1] = 1;
  int nn = 100000 + N - 1;
  rep(i, 2, nn + 1) f[i] = (i * f[i-1]) % MOD;
  rep(i, nn + 1) comb[i] = comb_mod(nn, i);
  ll ans = 1;
  foreach(x, v){
    ans *= comb_mod(x + N - 1, N - 1);
    ans %= MOD;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
template<typename T> inline bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }

int main(){
    long long n, m;
    cin >> n >> m;
    long long ans = 1LL;
    for (long long g = 1LL; g*g <= m; g++) {
        if (m%g == 0) {
            long long h = m/g;
            if (n <= h) chmax(ans, g);
            if (n <= g) chmax(ans, h);
        }
    }
    cout << ans << endl;
    return 0;
}

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

using ll = long long;

int main(){
    int a,b;
    cin >> a >> b;
    if(a<b) rep(i,b) cout << a;
    else rep(i,a) cout<<b;
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
inline int rd() {
	int x=0,f=1;char ch=getchar();
	while (ch>'9'||ch<'0') {if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
	return x*f;
}
int n,a[1000500];
int main() {
	n = rd();
	for (int _=1;_<=n;_++) a[_] = rd();
	int x = a[1], y = a[1];
	for (int _=1;_<=n;_++) x = max(a[_], x), y = min(a[_], y);
	if (x-y > 1) return puts("No"), 0;
	if (x == y) {
		if (x == n-1 || x<=n/2) puts("Yes"); else puts("No");
	} else {
		int tot = 0, sum = 0;
		for (int _=1;_<=n;_++) if (a[_] == y) tot++; //alone
		for (int _=1;_<=n;_++) if (a[_] == x) sum++; //not alone
		if (tot+1 <= x && x <= tot + sum/2) puts("Yes"); else puts("No");
	}
	
	return 0;
}


Measured memory_bytes: 640
//{{{
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(printde) FUNC(printdbe) FUNC(printdwe) FUNC(printdu);
#endif
template <template <class T, class = std::allocator<T>> class V, class E>
istream& operator >> (istream& in, V<E>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    ll ans = n;
    if(n >= k){
        n %= k;
    }
    for(int i = 0; i < 100; i++){
        n = abs(k - n);
        ans = min(ans, n);
    }
    cout << ans << '\n';
}


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

#define REP(i,n) for ( int i=1; i<=int(n); i++ )  
#define MP make_pair
#define PB push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define X first
#define Y second
template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;
typedef pair<LL, int> pii;
typedef long double LD;
const int INF = 0x3f3f3f3f;

template <class T>  
inline bool RD(T &ret) {  
        char c; int sgn;  
        if (c = getchar(), c == EOF) return 0;  
        while (c != '-' && (c<'0' || c>'9')) c = getchar();  
        sgn = (c == '-') ? -1 : 1 , ret = (c == '-') ? 0 : (c - '0');  
        while (c = getchar(), c >= '0'&&c <= '9') ret = ret * 10 + (c - '0');  
        ret *= sgn;  
        return 1;  
}  
template <class T>  
inline void PT(T x) {  
        if (x < 0) putchar('-') ,x = -x;  
        if (x > 9) PT(x / 10);  
        putchar(x % 10 + '0');  
}

const int N = 2e5 + 100;
char str[N];
int main() {
	scanf("%s", str);
	int ans = 0, cur = 0;
	for(int i = 0; str[i]; i ++) {
		if(str[i] == 'S') cur ++;
		else cur --;
		if(cur < 0) ans += -cur, cur = 0;
	}
	ans += cur;
	printf("%d\n", ans);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    int N,M;cin>>N>>M;
    vi suki(M+1,0);
    for(int i=0;i<N;i++){
        int K;cin>>K;
        for(int j=0;j<K;j++){
            int A;cin>>A;suki[A]++;
        }
    }
    int ans=0;
    for(int i=1;i<=M;i++){
        if(suki[i]==N)ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3600
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <vector>
#include <stack>
#include <map>
#define ri register
#define inf 0x7fffffff
#define E (1)
#define mk make_pair
#define int long long
using namespace std;
inline int read()
{
	int s=0, w=1; ri char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-') w=-1; ch=getchar(); }
	while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48), ch=getchar(); return s*w;
}
void print(int x) {if(x<0) x=-x, putchar('-'); if(x>9) print(x/10); putchar(x%10+'0'); }
signed main()
{
	int a=read(), b=read(), c=read();
	printf("%lld %lld %lld\n",c,a,b);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n, a[109];
int main() {
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	int cons = 1, ret = 0;
	for (int i = 1; i <= n; ++i) {
		if (i == n || a[i] != a[i - 1]) {
			ret += cons / 2;
			cons = 1;
		}
		else ++cons;
	}
	cout << ret << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<math.h>
typedef long long ll;
using namespace std;
int main(){
  int n;cin>>n;
  while(n--){
    ll a,b;
    cin>>a>>b;
    ll ret=sqrt(a*b);
    cout<<(a*b-(a!=b))/ret+ret-2<<endl;
    }
  return 0;
  }

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\???????????????????????????????????????
Scanner sc= new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for(int i= 0; i< values.length; i++) {
values[i] = i+ 1;
}
for(int i= 0; i< n; i++) {
String str= sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) -1;
int b = Integer.parseInt(ab[1]) -1;
// a??¨b????????£???values??????????????????
	int swap = values[a];
	values[a]=values[b];
	values[b]=swap;

}
// values??????????????????
	for(int i=0;i<values.length;i++){
		System.out.println(values[i]);
	}
}
}

Measured memory_bytes: 17196
// Original: https://github.com/tanakh/competitive-rs
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

mod util {
    #[allow(dead_code)]
    pub fn chmin<T>(x: &mut T, y: T) -> bool
    where
        T: PartialOrd + Copy,
    {
        *x > y && {
            *x = y;
            true
        }
    }

    #[allow(dead_code)]
    pub fn chmax<T>(x: &mut T, y: T) -> bool
    where
        T: PartialOrd + Copy,
    {
        *x < y && {
            *x = y;
            true
        }
    }

    /// 整数除算切り上げ
    #[allow(dead_code)]
    pub fn roundup(a: i64, b: i64) -> i64 {
        (a + b - 1) / b
    }

    #[allow(dead_code)]
    pub fn ctoi(c: char) -> i64 {
        c as i64 - 48
    }
}

#[allow(unused_imports)]
use util::*;

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, VecDeque};

fn main() {
    input! {
        n:usize,
        s:chars
    }

    let mut ans = 0;
    let mut l = 0;
    while l < n {
        let mut r = l + 1;
        while r < n && s[l] == s[r] {
            r += 1;
        }
        ans += 1;
        l = r;
    }

    println!("{}", ans);
}


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

using namespace std;

struct Dice
{
    int s[7];
    void roll(char c)
    {
        int tmp;
        if (c == 'E')
        {
            tmp = s[1];
            s[1] = s[4];
            s[4] = s[6];
            s[6] = s[3];
            s[3] = tmp;
        }
        if (c == 'W')
        {
            tmp = s[1];
            s[1] = s[3];
            s[3] = s[6];
            s[6] = s[4];
            s[4] = tmp;
        }
        if (c == 'N')
        {
            tmp = s[1];
            s[1] = s[2];
            s[2] = s[6];
            s[6] = s[5];
            s[5] = tmp;
        }
        if (c == 'S')
        {
            tmp = s[1];
            s[1] = s[5];
            s[5] = s[6];
            s[6] = s[2];
            s[2] = tmp;
        }
        if(c == 'R'){
            tmp = s[3];
            s[3] = s[2];
            s[2] = s[4];
            s[4] = s[5];
            s[5] = tmp;
        }
    }
    int top(){
        return s[1];
    }
    int left(){
        return s[4];
    }
    int right(){
        return s[3];
    }
    int front(){
        return s[2];
    }
};
int main()
{
    Dice d;
    for(int i = 1;i<7;i++){
        scanf("%d",&d.s[i]);
    }
    int n;
    cin >> n;
    while(n--){
        int a,b;
        cin >> a >> b;
        if(d.left() == a) d.roll('E');
        if(d.right()== a) d.roll('W');
        while(d.top()!=a) d.roll('N');
        while(d.front()!=b) d.roll('R');
        cout << d.right() << endl;
    }    

}


Measured memory_bytes: 3116
#include<stdio.h>
int n, m, C[110];
bool chk[110];
int main(){
	int i, a, b, x, t;
	scanf("%d%d", &n, &m);
	for (i = 0; i < m; i++){
		scanf("%d%d", &a, &b);
		a %= n;
		while (b--){
			chk[a] = true;
			a = (a + 1) % n;
		}
	}
	for (i = 0; i < n; i++)if (!chk[i])break;
	if (i == n){
		printf("%d %d\n", n, 1);
		return 0;
	}
	x = i;
	t = 0;
	for (i = x + 1; i <= x + n; i++){
		a = i%n;
		if (!chk[a]){
			if (t)C[t]++;
			t = 0;
		}
		else t++;
	}
	for (i = n; i >= 1; i--){
		if (C[i])printf("%d %d\n", i, C[i]);
	}
}


Measured memory_bytes: 1032
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
 
using namespace std;

int main(void)
{
    long double a, b, c;
    int aa, bb, cc;
    scanf("%d%d%d", &aa, &bb, &cc);
    a = aa, b = bb, c = cc;
    long double eps = 1.0e-14;
    
    if (sqrtl(a) + sqrtl(b) + eps < sqrtl(c)) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
// Why am I so dumb? :c
#include<bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;

typedef long long ll;

char s[305][305];

char t[305][305];

int n, ans;

bool check(int a, int b) {
    for (int x = 0; x < n; ++x) {
        for (int y = 0; y < n; ++y) {
            t[(x + a) % n][(y + b) % n] = s[x][y];
        }
    }

    for (int x = 0; x < n; ++x) {
        for (int y = 0; y < n; ++y) {
            if (t[x][y] != t[y][x]) {
                return 0;
            }
        }
    }

    return 1;
}

void solve() {
    scanf("%d", &n);

    for (int i = 0; i < n; ++i) {
        scanf("%s", s[i]);
    }

    for (int x = 0; x < n; ++x) {
        if (check(x, 0)) {
            ans += (n - x);
        }
    }

    for (int y = 1; y < n; ++y) {
        if (check(0, y)) {
            ans += (n - y);
        }
    }

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

int main() {
    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 512
#pragma region header
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a / gcd(a, b) * b ;
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion

signed main() {
    int n,m;cin >> n >> m;
    vector<P> stu(n),check(m);
    rep(i, n) cin >> stu[i].first >> stu[i].second;
    rep(i, m) cin >> check[i].first >> check[i].second;
    rep(i, n) {
        int mi = inf;
        int k;
        rep(j, m) {
            if(chmin(mi,abs(stu[i].first-check[j].first)+abs(stu[i].second-check[j].second))) k = j;
        }
        cout << ++k << endl;
    }
    return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define SE second
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define mp make_pair
#define LL long long
#define LI long int
#define LLI long long int
#define REP(i,a,b) for(long long i=a;i<b;i++)
#define PER(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define POS(i) cout<<(i?"POSSIBLE":"IMPOSSIBLE")<<endl

using namespace std;
template< unsigned mod >
struct RollingHash {
    vector< unsigned > hashed, power;

    inline unsigned mul(unsigned a, unsigned b) const {
        unsigned long long x = (unsigned long long) a * b;
        unsigned xh = (unsigned) (x >> 32), xl = (unsigned) x, d, m;
        asm("divl %4; \n\t" : "=a" (d), "=d" (m) : "d" (xh), "a" (xl), "r" (mod));
        return m;
    }

    RollingHash(const string &s, unsigned base = 10007) {
        int sz = (int) s.size();
        hashed.assign(sz + 1, 0);
        power.assign(sz + 1, 0);
        power[0] = 1;
        for(int i = 0; i < sz; i++) {
            power[i + 1] = mul(power[i], base);
            hashed[i + 1] = mul(hashed[i], base) + s[i];
            if(hashed[i + 1] >= mod) hashed[i + 1] -= mod;
        }
    }

    unsigned get(int l, int r) const {
        unsigned ret = hashed[r] + mod - mul(hashed[l], power[r - l]);
        if(ret >= mod) ret -= mod;
        return ret;
    }

    unsigned connect(unsigned h1, int h2, int h2len) const {
        unsigned ret = mul(h1, power[h2len]) + h2;
        if(ret >= mod) ret -= mod;
        return ret;
    }

    int LCP(const RollingHash< mod > &b, int l1, int r1, int l2, int r2) {
        int len = min(r1 - l1, r2 - l2);
        int low = -1, high = len + 1;
        while(high - low > 1) {
            int mid = (low + high) / 2;
            if(get(l1, l1 + mid) == b.get(l2, l2 + mid)) low = mid;
            else high = mid;
        }
        return (low);
    }
};
//using RH = RollingHash< 1000000007 >;

int main() {
    string T,P="AC";
    LL q;
    cin >>T>>q>>T;
    LL a[100001];
    RollingHash<1000000007> rh(T), rh2(P);
    for (LL i = 0; i + P.size() <= T.size(); i++) {
        if (rh.get(i, i + P.size()) == rh2.get(0, P.size())) {
            a[i+1]=a[i]+1;
        }else{
            a[i+1]=a[i];
        }
    }
    REP(i,0,q){
        LL r,l;
        cin>>l>>r;
        cout<<a[r-1]-a[l-1]<<endl;
    }
}

Measured memory_bytes: 2560
#include<iostream>
using namespace std;
int main() {

	string hi;
	cin >> hi;
	int i;
	int flag = 0;
	for (i = 0; i < hi.length(); i++) {
		if (hi[i] == 'h') {
			if (flag == 0) {
				flag = 1;
			}
			else {
				cout << "No\n";
				return 0;
			}
		}else if(hi[i] == 'i'){
			if (flag == 1) {
				flag = 0;
			}
			else {
				cout << "No\n";
				return 0;
			}
		}
		else {
			cout << "No\n";
			return 0;
		}

	}
	if (flag == 1) {
		cout << "No\n";
	}
	else {
		cout << "Yes\n";
	}
	return 0;

}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<stack>
#include<algorithm>
using namespace std;
string st;
int n;
stack<int> sa;
int a[1000],sum[1000],len=1,cnt=0,rd=0,ld=0,l=0,r=0;
int flag=-1;
int main(){
	cin>>n;
	cin>>st;
	for(int i=0;i<n;i++){
		if(st[i]=='(')a[i]=1;
		else a[i]=0;
	}
	for(int i=0;i<n;++i){
		if(a[i]==1)l++;
		else r++;
		rd=max(rd,r-l);
	}
	l=r=0;
	for(int i=n-1;i>=0;--i){
		if(a[i]==1)l++;
		else r++;
		ld=max(ld,l-r);
	}
	for(int i=1;i<=rd;++i){
		cout<<'(';
	}
	for(int i=0;i<n;++i){
		cout<<st[i];
	}
	for(int i=1;i<=ld;++i){
		cout<<')';
	}
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll a,b,c,x,ans;
    cin>>a>>b>>c;
    ans=min(b,c),x=c;
    if(ans==b){
        c-=b,ans+=b;
        if(c>a)ans+=a;
        else ans+=c;
        if(a+b<x)ans++;
    }
    else ans+=b;
    cout<<ans;
    return 0;
}


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

int main(){
  long long int N;  
  cin >> N;
  string s = to_string(N);

  int sum = 0;

  for(int i = 0;i < s.size();i++){
    string ss = s.substr(i,1);
    sum += stoi(ss);
  }

  if(N % sum == 0)cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
s = input()
n = len(s)
palindrome = True
for i in range(int(n/2)):
    if s[i] != s[n-1-i]:
        palindrome = False
        break

doublePalindrome = True
for i in range(int(n/4)):
    if s[i] != s[int(n/2)-1-i] or s[int(n/2)+1+i] != s[n-1-i]:
        doublePalindrome = False
        break

if palindrome and doublePalindrome:
    print("Yes")
else:
    print("No")

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

  int year = stoi(s.substr(0,4));
  int mon = stoi(s.substr(5,2));
  int day = stoi(s.substr(8,2));

  if(year > 2019){
    cout << "TBD" << endl;
    return 0;
  }else if(year == 2019){
    if(mon > 4){
      cout << "TBD" << endl;
      return 0;
    }else if(mon == 4){
      if(day > 30){
        cout << "TBD" << endl;
        return 0;
      }
    }
  }
  cout << "Heisei" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[50], b[50], c[50];
int main(){
    int n;
    scanf("%d", &n);   
    for(int i=1;i<=n;i++) scanf("%d", &a[i]);
    for(int i=1;i<=n;i++) scanf("%d", &b[i]);
    for(int i=2;i<=n;i++) scanf("%d", &c[i]);
    int ans = 0;
    for(int i=1;i<=n;i++){
        ans += b[a[i]];
        if(a[i] == a[i-1]+1){
            ans += c[a[i]];
        }
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<set>
#include<stack>
#include<iomanip>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
template<typename T =ll> using v = vector<T>;
template<typename T =ll> using vv = v<v<T>>;
template<typename T =ll,typename U =ll> using p = pair<T,U>;
template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
const ll INF = (ll)1e9;
template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }
    //
    ModInt operator++(int) {
        auto t = *this;
        *this += 1;
        return t;
    }

    ModInt operator--(int) {
        auto t = *this;
        *this -= 1;
        return t;
    }

    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;

int main(){
    ll n; cin >> n;
    auto b=v<mint>(60,0);
    auto c=v<mint>(60,n);
    
    for(ll i=1;i<=n;i++){
        ll a;cin >> a;
        for(ll j=0;a>>j;j++){
            if((a>>j)&1) {
                b[j]++;
                c[j]--;
            }
        }
    }

    mint ans = 0;
    rep(i,60){
        ans+=(b[i]*c[i]*mint(2).pow(i));
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;

priority_queue <string/*, vector<string>, greater<string>*/> a;

map <string, bool> ap;

int n, k;

int cat;

string s;
string b;

struct elem
{
    string x;
    int poz;
    int ok;
};

elem v[50001];

struct tip
{
    int poz;
    char x;
};

tip s2[50001];

int mn = 99;

bool cmp(int a, int b)
{
    if(a == b)
        return 0;

    return 1;
}

void baga()
{
    int i, j;
    for(i = 1; i <= min(n, k); i ++)
    {
        for(j = 1; j <= cat; j ++)
        {
            if(v[j].poz < n && v[j].ok == 0)
            {
                string b = v[j].x;
                b.resize(i);
                b[i - 1] = s[v[j].poz];
                v[j].poz ++;

                if(ap[b] == 0)
                {
                    ap[b] = 1;

                    if(a.size() < k)
                        a.push(b);

                    else
                        if(a.top() > b)
                        {
                            a.pop();
                            a.push(b);
                        }

                    else
                        v[j].ok = 1;
                }

                v[j].x = b;
            }
        }
    }
}

struct cmps
{
    bool operator() (const tip &a, const tip &b)
    {
        if(a.x != b.x)
            return a.x < b.x;

        return a.poz < b.poz;
    }
};

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

    n = s.size();

    int i;
    for(i = 1; i <= n; i ++)
    {
        s2[i].poz = i - 1;
        s2[i].x = s[i - 1];
    }

    sort(s2 + 1, s2 + n + 1, cmps());

    char last = s2[min(n, k)].x;

    cat = 0;
    for(i = 1; i <= n && s2[i].x <= last; i ++)
    {
        v[++ cat].poz = s2[i].poz;
        v[cat].x.resize(1);
        v[cat].x[0] = s[s2[i].poz];
    }

    baga();

    cout << a.top() << "\n";

    return 0;
}


Measured memory_bytes: 1280
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

using namespace std;
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; }

typedef unsigned int uint;
typedef long long llong;
typedef unsigned long long ullong;
typedef long double ldouble;

typedef vector<llong> vecllong;
typedef vector<vecllong> vvecllong;

const llong MOD = 1e9 + 7;
const llong INF = 1e17;

#define FOR(i, n) for (llong i = 0; i < n; i++)
#define FORS(i, a, b) for (llong i = a; i < b; i++)
#define FORR(i, n) for (llong i = n; i > 0; i++)

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

    // 前計算
    llong N = 1e5;
    vector<bool> isPrime(N + 1, true);
    isPrime[0] = false;
    isPrime[1] = false;
    llong nowPrime = 2;
    while(nowPrime <= N) {
        if(!isPrime[nowPrime]) {
            nowPrime++;
            continue;
        }
        llong mulPrime = nowPrime * 2;
        while(mulPrime <= N) {
            isPrime[mulPrime] = false;
            mulPrime += nowPrime;
        }
        nowPrime++;
    }

    vecllong sum2017(N + 1, 0);  // 累積和
    FORS(i, 3, N + 1) {
        sum2017[i] = sum2017[i - 1];
        if(isPrime[i] && isPrime[(i + 1) / 2]) {
            sum2017[i]++;
        }
    }

    llong Q;
    cin >> Q;
    FOR(i, Q) {
        llong left, right;
        cin >> left >> right;
        cout << (sum2017[right] - sum2017[left - 1]) << endl;
    }

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

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

int main(){
  double L,L1,L2,L3;
  cin>> L;
  /* if(L%3==0)
    cout<<(L/3)*(L/3)*(L/3);
  else if(L%3==1)
    cout<<(L-1/3)*(L-1/3)*(L-1/3+1);
  else if(L%3==2)
  cout<<(L-2/3)*(L-2/3+1)*(L-2/3+1);*/

  L1=L/3;
  L2=L/3;
  L3=L-L1-L2;
  printf("%lf",L1*L2*L3);


  return 0;
}


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

bool check(string s,string t)
{
  if(s.length()+1 != t.length()) return false;
  for(int i=0;i<s.length();i++) if(s[i]!=t[i]) return false;
  return true;
}

int main()
{
 	string s,t;
  cin>>s>>t;
  if(check(s,t)) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

ll bpow(ll a , ll b){
  if (b == 0) return 1;
  ll ret;
  if (b%2 == 0){
    ll  t = bpow(a, b/2);
    ret = t*t;
  }else{
    ll t = bpow(a, (b-1)/2);
    ret = a*t*t;
  }
  return ret;
}
int main(){
  ll N, K; cin >> N >> K;
  vector<ll> sum(N+1,0);
  REP(i,N){
    ll a; cin >> a;
    sum[i+1] = sum[i] + a;
  }
  multiset<ll> cand;
  FOR(l,1,N+1) FOR(r,l,N+1){
    cand.insert(sum[r]-sum[l-1]);
  }
  //桁数の最大値
  ll M = ceil(log2(sum[N]));
  ll ans = 0;
  IREP(i,M){
    ll t = ans + bpow(2,i);
    ll c = 0;
    auto it = cand.begin();
    while(it!=cand.end()){
      if(t == (t&(*it))) c++;
      it++;
    }
    if(c>=K) ans = t;
  }
  cout << ans << endl;
}

Measured memory_bytes: 23808
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;

 
lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint 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 COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}

   


  int main(){
      lint a,b,x;
      cin>>a>>b>>x;
      b/=x;
      if(a==0){a=1;
  b++;
      }
      a=(a-1)/x;
     
      cout<<b-a;
}

Measured memory_bytes: 256
x,y = map(int,input().split())
if x==1 and y == 1:
    print(400000+300000*2)
    exit()

ans = 0
if x == 3:
    ans += 100000
elif x == 2:
    ans += 200000
elif x == 1:
    ans += 300000
if y == 3:
    ans += 100000
elif y == 2:
    ans += 200000
elif y == 1:
    ans += 300000

print(ans)

Measured memory_bytes: 38384
let after = stdin.ReadLine() |> int

after
|> float 
|> fun x -> x / 1.08
|> int
|> fun x -> 
  match x with
  | x when int (float x * 1.08) = after -> string x
  | x when int (float (x + 1) * 1.08) = after -> string (x + 1)
  | _ -> ":("
|> printfn "%s"

Measured memory_bytes: 29536
#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <iterator>
#include <unordered_map>
#include <unordered_set>
#include <sstream>
#include <fstream>
#include <tuple>

using namespace std;

#define fori(t) for(int i = 0; i < t; ++i)
#define forj(n) for(int j = 0; j < n; ++j)
#define fork(n) for(int k = 0; k < n; ++k)
#define forai(a) for(auto& i : a)
#define foraj(a) for(auto& j : a)
#define forak(a) for(auto& k : a)
#define forp(s, n, d) for(int p = s; p < n; p += d)
#define fast cin.tie(0); cout.tie(0); std::ios_base::sync_with_stdio(0);
#define pb(a) push_back(a);
#define pob(a) pop_back(a);
#define sorti(a) sort(a.begin(), a.end());
#define sortm(a, n) sort(a, a + n);
#define reversi(a) reverse(a.begin(), a.end());
#define fi first
#define se second
#define yes cout << "Yes\n";
#define no cout << "No\n";
#define ans(a) cout << a << '\n';
#define res(a, n) a.resize(n);
#define read(a, n) a.resize(n); fori(n) cin >> a[i];
//#define int long long
//#define double long double

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<long long, long long> llll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<int, pair<int, int>>> viii;
typedef pair<int, pair<int, int>> iii;
typedef vector<pair<long long, long long>> vllll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<bool> vb;
typedef pair<char, char> cc;
typedef pair<pair<char, char>, char> ccc;
typedef vector<char> vc;
typedef pair<int, char> ic;
typedef pair<ii, char> iic;
typedef vector<bool> vb;
typedef set<int> si;
typedef set<ii> sii;
typedef unsigned long long ull;
typedef pair<ull, ull> ullll;
typedef pair<double, double> dd;
typedef vector<dd> vdd;
typedef vector<pair<ull, ull>> vullll;
typedef pair<bool, bool> bb;
typedef vector<bb> vbb;
typedef vector<vector<ii>> vvii;
typedef vector<vector<iii>> vviii;

const int INF = 2147483647;
const ll LONGINF = 9223372036854775807;
const ll MOD = 1e9 + 7;

vi l;

void solve()
{
    int n;
    cin >> n;
    read(l, n)
    int counter = 0;
    fori(n)
    {
        for (int j = i + 1; j < n; ++j)
        {
            for (int k = j + 1; k < n; ++k)
            {
                vi help;
                help.pb(l[i])
                help.pb(l[j])
                help.pb(l[k])
                sorti(help)
                if (help[0] == help[1] || help[1] == help[2]) continue;
                if (help[2] < help[1] + help[0]) ++counter;
            }
        }
    }
    ans(counter)
}

signed main()
{
    fast
    bool mult = false;
    if (mult)
    {
        int t;
        cin >> t;
        while (t--) solve();
    }
    else solve();
}


Measured memory_bytes: 3196
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
typedef long long int ll;
#define mod 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define m0(x) memset(x,0,sizeof(x))

//qsort用(昇順，降順)
int cmp_asc( const void *p, const void *q ) {
    return *(int*)p - *(int*)q;
}
int cmp_desc( const void *p, const void *q ) {
    return *(int*)q - *(int*)p;
}

int main(void){
    int x,a;
    scanf("%d%d",&x,&a);
    if(x<a) printf("0\n");
    else printf("10");
    return 0;
}

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

long long n, k;
vector<vector<int>> g;

long long solve();

int main() {
  cin >> n >> k;
  g.resize(n);
  for (int i = 1; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    g[--a].push_back(--b);
    g[b].push_back(a);
  }
  cout << solve() << endl;
  return 0;
}

long long solve() {
  using P = pair<long long, long long>;
  function<P(int, int, int)> dfs = [&](int now, int par, int dep) {
    P res(dep >= k / 2 + 1, 0);
    if ((k & 1) && dep == (k + 1) / 2) res.second = 1;
    for (auto to : g[now])
      if (par != to) {
        P tmp = dfs(to, now, dep + 1);
        if (par >= 0)
          res = P(res.first + tmp.first, res.second + tmp.second);
        else
          res = P(res.first + tmp.first, max(res.second, tmp.second));
      }
    if (par < 0) res.first -= res.second;
    return res;
  };
  long long res = n + 1;
  for (int i = 0; i < n; ++i) res = min(res, dfs(i, -1, 0).first);
  return res;
}


Measured memory_bytes: 512