akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
 
 
public class Main{
	
	public static long[] pre = new long[17];
	
	public static void init(){
		long p = 1;
		long cnt = 1;
		long res = 0;
		
		for(int i = 0; i < 17; i++){
			long less3 =  (p * 10 - 1)/3 - (p - 1)/3;
			long less5 =  (p * 10 - 1)/5 - (p - 1)/5;
			long less15 = (p * 10 - 1)/15 - (p - 1)/15;
			
			res += ((p * 10 - 1) - (p - 1) - less3 - less5 + less15) * cnt;
			res += (less3 - less15) * 4;
			res += (less5 - less15) * 4;
			res += less15 * 8;
			
			pre[i] = res;
			cnt++;
			p *= 10;
		}
	}
	
	public static long count(long s){
		long p = 1;
		long cnt = 1;
		long res = 0;
		
		int pos = (int)(Math.log10(s)) - 1;
		if(pos >= 0){
			res = pre[pos];
			p = (long) Math.pow(10, pos + 1);
			cnt = pos + 2;
		}
		
		long less3 =  (s - 1)/3 - (p - 1)/3;
		long less5 =  (s - 1)/5 - (p - 1)/5;
		long less15 = (s - 1)/15 - (p - 1)/15;
		
		res += ((s - 1) - (p - 1) - less3 - less5 + less15) * cnt;
		res += (less3 - less15) * 4;
		res += (less5 - less15) * 4;
		res += less15 * 8;
		
		return res;
	}
	
    public static void main(String[] args) throws IOException {
    	Scanner sc = new Scanner(System.in);
    	
    	final long s = sc.nextLong();
    	
    	init();
    	
    	long upper = s;
		long lower = 1/*(long) Math.pow(10 ,(long)Math.log10(s))*/;
		
		while(upper - lower > 1){
			long med = (upper + lower)/2;
			long dist = count(med);
			//System.out.println(upper + " " + lower + " " + med + " (" + dist + ", " + dist2 + ") " + s);
			
			if(dist > s){
				upper = med;
			}else if(dist < s){
				lower = med;
			}else{
				upper = med;
				lower = med - 1;
			}
		}
		
		long less = s - count(lower);
		StringBuilder b = new StringBuilder();
		
		for(long i = lower; b.length() < less + 20; i++){
			
			if(i % 15 == 0){
				b.append("FizzBuzz");
			}else if(i % 5 == 0){
				b.append("Buzz");
			}else if(i % 3 == 0){
				b.append("Fizz");
			}else{
				b.append(Long.toString(i));
			}
		}
		
		System.out.println(b.substring((int)(less)-1, (int)(less)+19));
    	
    }
     
}

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

bool isPrime[100000];

int main() {
for (int i = 2; i < 10000; i++) {
isPrime[i] = true;
}
for (int i = 2; i < 10000; i++) {
for (int j = i * i; j < 10000; j+= i) {
isPrime[j] = false;
}
}
int N; cin >> N;
for (int i = 11; N; i += 10) {
if (isPrime[i]) {
N--;
cout << i << " \n"[N == 0];
}
}
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;

char s[10000];


int main(){
	scanf("%s",s);
	int len = strlen(s);
	printf("ABC");
	for(int i = 0;i <len;i++){
		printf("%c",s[i]);
	}
	printf("\n");
}

Measured memory_bytes: 128
# coding: utf-8
# Your code here!

def gcd(x,y):
    if x<y:
        x,y=y,x
    while y>0:
        r=x%y
        x=y
        y=r
    return x

a=list(map(int,input().split(" ")))
print(gcd(a[0],a[1]))


Measured memory_bytes: 5604
#include <iostream>
#include <memory>
#include <numeric>
#include <string>
#include <vector>

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

using llint = long long int;
using namespace std;

llint gcd(int a, int b) {
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

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

    llint sum = 0;
    for (int i = 1; i <= k; i++) {
        for (int j = 1; j <= k; j++) {
            for (int l = 1; l <= k; l++) {
                sum += gcd(gcd(i, j), l);
            }
        }
    }
    cout << sum << endl;
}



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

vector<ll> a(1), p(1);

ll f(ll n, ll x) {
  // if (x >= 0 || x > a[N]) return 0;
  if (n == 0) {
    return (x <= 0 ? 0 : 1);
  } else if (x <= 1 + a[n - 1]) {
    return f(n - 1, x - 1);
  } else {
    return p[n - 1] + 1 + f(n - 1, x - 2 - a[n - 1]);
  }
}

int main() {
  ll n, x;
  cin >> n >> x;

  a[0] = 1, p[0] = 1;
  rep(i, n) {
    a.push_back(a[i] * 2 + 3);
    p.push_back(p[i] * 2 + 1);
  }

  cout << f(n, x) << endl;

  return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
using namespace std;
int h, w, a, s, c[15][15];
int main() {
	int i, j, k;
	scanf("%d%d", &h, &w);
	for(i=0; i<10; i++) for(j=0; j<10; j++) scanf("%d", &c[i][j]);
	for(k=0; k<10; k++) for(i=0; i<10; i++) for(j=0; j<10; j++) {
		c[i][j] = min(c[i][j], c[i][k]+c[k][j]);
	}
	h *= w;
	while(h--) {
		scanf("%d", &a);
		if(a!=-1) s += c[a][1];
	}
	printf("%d", s);
	return 0;
}

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

int dp[101][100001];
int main(){
  int N,W;
  cin>>N>>W;
  int v[N+1],w[N+1];
  for(int i=1;i<=N;i++){
    cin>>v[i]>>w[i];
  }
  fill(dp[0],dp[101],0);//初期化
  for(int i=1;i<=N;i++){
    for(int j=1;j<=W;j++){
      if(j<w[i]) dp[i][j]=dp[i-1][j];
      else dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
    }
  }
  cout<<dp[N][W]<<"\n";
}



Measured memory_bytes: 42564
INF = 10 ** 20
ops = ["+", "-", "*"]
nums = [str(i) for i in range(0, 10)]
priorities = []
for op1 in ops:
  for op2 in ops:
    for op3 in ops:
      if op1 != op2 and op1 != op3 and op2 != op3:
        priorities.append([[op1], [op2], [op3]])
        priorities.append([[op1], [op2, op3]])
        priorities.append([[op1, op2], [op3]])
        priorities.append([[op1, op2, op3]])

def calc(num_lst, op_lst, priority):
  for x in range(len(priority)):
    while op_lst:
      for i, op in enumerate(op_lst):
        if op in priority[x]:
          if op == "+":
            num_lst = num_lst[:i] + [num_lst[i] + num_lst[i + 1]] + num_lst[i + 2:]
          elif op == "-":
            num_lst = num_lst[:i] + [num_lst[i] - num_lst[i + 1]] + num_lst[i + 2:]
          else:
            num_lst = num_lst[:i] + [num_lst[i] * num_lst[i + 1]] + num_lst[i + 2:]
          op_lst.pop(i)
          break
      else:
        break
  return num_lst[0]

def parse(s, priority):
  num_lst = []
  op_lst = []
  p = 0
  if s[p] == "(":
    p += 1
    num, addp = parse(s[p:], priority)
    num_lst.append(num)
    p += addp

  elif s[p] in nums:
    acc = ""
    while s[p] in nums:
      acc += s[p]
      p += 1
    num_lst.append(int(acc))
  
  while p < len(s) and s[p] != ")":
    op_lst.append(s[p])
    p += 1
    acc = ""
    if s[p] == "(":
      p += 1
      num, addp = parse(s[p:], priority)
      num_lst.append(num)
      p += addp
    else:
      #print(s[p])
      while s[p] in nums:
        acc += s[p]
        p += 1
      num_lst.append(int(acc))
  p += 1

  return (calc(num_lst, op_lst, priority), p)

def main():
  s = "(" + input() + ")"
  ans = -INF
  for priority in priorities:
    a, _ = parse(s, priority)
    ans = max(ans, a)
  print(ans)
main()


Measured memory_bytes: 5628
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n;
    ll k, a[200005] = {}, f[200005] = {}, l = -1, r = 1e18 + 328;
    cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> f[i];
    sort(a, a + n); sort(f, f + n); reverse(f, f + n);
    while (l + 1 < r) {
        ll m = (l + r) / 2, c = 0;
        for (int i = 0; i < n; i++) c += max(0ll, a[i] - m / f[i]);
        if (c <= k) r = m;
        else l = m;
    }
    cout << r;
}


Measured memory_bytes: 6748
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin >> a >>b;
    int cond = b-((b/2)*2);
    if (b>=2*a && b<=4*a && b>=0 && a>=0 && cond==0)
    	cout << "Yes" << endl;
    else
    	cout << "No" << endl;
    return 0;
}

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

int main(){
  int n,tmp;
  cin >> n;
  string ans = "No";
  string N = to_string(n);
  tmp = 0;
  for(int i = 0;i < N.length();i++){
    tmp += N.at(i) - '0';
  }
  if(n%tmp == 0){
    ans = "Yes";
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
 
    vector <int> nums;
    int now = 1;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        if(s[i] == (char)('0' + now)) cnt++;
        else {
            nums.push_back(cnt);
            now = 1 - now;
            cnt = 1;
        }
    }
    if (cnt != 0) nums.push_back(cnt);
 
    if (nums.size() % 2 == 0) nums.push_back(0);
 
    int Add = 2 * k + 1;
 
    int ans = 0;
 
    int left = 0;
    int right = 0;
    int tmp = 0;
 
    for (int i = 0; i < nums.size(); i += 2){
        int nextleft = i;
        int nextright = min(i + Add, (int)nums.size());
 
        while(nextleft > left) {
            tmp -= nums[left];
            left++;
        }
 
        while (nextright > right) {
            tmp += nums[right];
            right++;
        }
 
        ans = max(tmp, ans);
    }
 
    cout << ans << endl;
    return 0;
}

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

class UnionFind {
public:
	vector<long long>par; long long size_ = 0;
	void init(long long size__) {
		size_ = size__; par.resize(size_ + 1, -1);
	}
	long long root(long long x) {
		if (par[x] == -1) return x;
		par[x] = root(par[x]);
		return par[x];
	}
	void unite(long long x, long long y) {
		x = root(x); y = root(y);
		if (x != y) par[y] = x;
	}
	bool same(long long x, long long y) {
		if (root(x) == root(y)) return true;
		return false;
	}
};

long long n, m, k, a[100009], b[100009], c[100009], w[100009], col[100009], cntw, ret, sum;
vector<int>x[100009]; vector<tuple<int, int, int>>L;

void dfs(int pos) {
	if (col[pos] >= 1) return;
	col[pos] = cntw;
	for (int i = 0; i < x[pos].size(); i++) dfs(x[pos][i]);
}

int main() {
	cin >> n >> m >> k;
	for (int i = 1; i <= n; i++) cin >> c[i];
	for (int i = 1; i <= m; i++) {
		cin >> a[i] >> b[i] >> w[i];
		if (c[a[i]] == 1 && c[b[i]] == 1) {
			x[c[a[i]]].push_back(c[b[i]]); x[c[b[i]]].push_back(c[a[i]]);
		}
	}
	for (int i = 1; i <= k; i++) {
		if (col[i] >= 1) continue;
		cntw++; dfs(i);
	}
	for (int i = 1; i <= m; i++) {
		int p1 = a[i]; if (c[a[i]] >= 1) p1 = col[c[a[i]]]; else p1 = a[i] + n;
		int p2 = b[i]; if (c[b[i]] >= 1) p2 = col[c[b[i]]]; else p2 = b[i] + n;
		L.push_back(make_tuple(w[i], p1, p2));
	}
	sort(L.begin(), L.end());
	UnionFind UF; UF.init(2 * n + 2);
	for (int i = 0; i < L.size(); i++) {
		if (UF.same(get<1>(L[i]), get<2>(L[i])) == false && ret < cntw - 1) {
			ret++; sum += get<0>(L[i]); UF.unite(get<1>(L[i]), get<2>(L[i]));
		}
	}
	if (ret < cntw - 1) sum = -1;
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 9332
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void solve() {
    LL h,w,m;
    cin >> h >> w >> m;
    VI hs(w), ws(h);
    set<PII> s;
    int a,b;
    REP(i,0,m) {
        cin >> a >> b;
        --a;--b;
        hs[b]++;
        ws[a]++;
        s.emplace(a,b);
    }
    int maxh = *max_element(all(hs));
    int maxw = *max_element(all(ws));
    VI hc,wc;
    REP(i,0,w) if (hs[i] == maxh) hc.push_back(i);
    REP(i,0,h) if (ws[i] == maxw) wc.push_back(i);
    // REP(i,0,h) dump(hs[i]);
    // REP(i,0,w) dump(ws[i]);
    for (int h: hc) for (int w: wc) {
        if (s.count(MP(w,h)) == 0) {
            cerr << h << ", " << w << endl;
            cout << maxh + maxw << endl;
            return;
        }
    }
    cout << maxh + maxw - 1 << endl;
}

signed main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 23800
// https://atcoder.jp/contests/abc154/tasks/abc154_d

#include <bits/stdc++.h>
#define watch(x) cerr << (#x) << " is " << (x) << endl;
#define ld long double
using namespace std;
int main() {
    int N, K;
    cin >> N >> K;

    int a[N+1];
    for(int i = 1; i <= N; i++) {
        cin >> a[i];
    }

    int psa[N+1];
    psa[0] = 0;
    for(int i = 1; i <= N; i++) {
        psa[i] = a[i] + psa[i-1];
    }

    int bestind = -1;
    int ma = 0;
    for(int i = K; i <= N; i++) {
        if(psa[i] - psa[i-K] > ma) {
            bestind = i-K+1;
            ma = psa[i] - psa[i-K];
        }
    }
    
    watch(bestind)
    ld ev = 0;
    for(int i = bestind; i <= bestind+K-1; i++) {
        ld x = a[i];
        ev += (((x+1)*x)/2) * (1/x);
    }

    cout << fixed << setprecision(7) << ev << endl;




}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    long a[n];
    for(int i=0;i<n;i++)cin >> a[i];
    int ans = 0;
    while(true){
        bool chk = true;
        for(int i=0;i<n;i++){
            if(a[i]%2==0){
                a[i]/=2;
            }else{
                chk = false;
            }
        }
        if(!chk)break;
        ans++;
    }
    cout << ans<<endl;
}

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

int main() {
	vector<int> K(5);
	for(int i = 0 ; i < 5 ; i++) cin >> K[i];
	int k; cin >> k;
	if(K[4] - K[0] <= k){
	cout << "Yay!"  << endl;
	return 0;
}
    cout << ":(" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define vi vector<int>
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define ii pair<int,int>
#define qu queue <int>
#define qmax priority_queue <int>
#define qmin priority_queue <int, vector<int>,greater<int>>

using namespace std;

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

    if(a == 3 || a == 5 || a == 7)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rep1(i, n) for(ll i = 1; i < n+1; i++)
#define all(A) A.begin(),A.end()
typedef long long ll;

int main(){
  ll n;
  ll k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i,n){
    cin >> a[i];
  }
  sort(all(a));
  const ll INF = (ll)pow(10,18)+1;
  ll xng = -INF;
  ll xok = INF;
  while(abs(xok-xng)>1){
    ll xmid = (xok+xng)/2;
    ll cnt = 0;//okだった数を数える
    rep(i,n){
      ll ng;//ng...a[i]*a[mid]がxmid以上
      ll ok;//ok...a[i]*a[mid]がxmid未満
      if(a[i] < 0){
        ng = i;
        ok = n;//なるべく少なくしたいから相手は最大
      }
      if(a[i] >= 0){
        ng = n;
        ok = i;//なるべく少なくしたいから相手は最小
      }
      while(abs(ok-ng)>1){
        ll mid = (ok+ng)/2;
        if(a[i]*a[mid] < xmid) ok = mid;
        else ng = mid;
      }
      //cout << i << "," << ok << endl;
      if(a[i] < 0){
        cnt += n-ok;//okな範囲は右側
      }
      if(a[i] >= 0){
        cnt += ok-i;//okな範囲は左側
      }//while
    }//i
    if(cnt >= k) xok = xmid;
    else xng = xmid;
  }//while
  cout << xng << endl;
}

Measured memory_bytes: 4760
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 310, mod = 998244353;
int n,a[N];

inline int Mod(int x){
	return x>=mod?x-mod:x;
}
inline int power(int a,int b){
	int ret=1;
	for (;b;b>>=1,a=1ll*a*a%mod) if (b&1) ret=1ll*ret*a%mod;
	return ret;
}
inline int calc(){
	return power(3,n);
}

int dp[N*N];
inline int calc1(){
	fil(dp,0),dp[0]=1;
	int sum=0;
	For(i,1,n){
		sum+=a[i];
		Dow(j,sum,a[i]) dp[j]=(dp[j]+2ll*dp[j-a[i]])%mod;
	}
	int ans=0;
	For(i,0,sum/2) ans=(ans+dp[i])%mod;
	return ans;
}

inline int calc2(){
	fil(dp,0),dp[0]=1;
	int sum=0;
	For(i,1,n){
		sum+=a[i];
		Dow(j,sum,a[i]) dp[j]=(2ll*dp[j]+dp[j-a[i]])%mod;
		FOR(j,0,a[i]) dp[j]=2*dp[j]%mod;
	}
	int ans=0;
	For(i,(sum+1)/2,sum) ans=(ans+dp[i])%mod;
	return ans;
}

inline int calc3(){
	fil(dp,0),dp[0]=1;
	int sum=0;
	For(i,1,n){
		sum+=a[i];
		Dow(j,sum,a[i]) dp[j]=(dp[j]+dp[j-a[i]])%mod;
	}
	if (sum%2==1) return 0;
	return 3ll*dp[sum/2]%mod;
}

int main(){
	n=read();
	For(i,1,n) a[i]=read();
	int ans=calc();
	ans=Mod(ans+mod-calc1());
	ans=Mod(ans-2*calc2()%mod+mod);
	ans=Mod(ans+calc3());
	printf("%d\n",ans);
}


Measured memory_bytes: 4128
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
#include<set>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	string sa,sb="ACL";
	cin>>n;
	for(i=0;i<n;i++){
		sa+=sb;
	}
	cout<<sa<<endl;
}

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

int main(){
  string s, p;
  int flag = 0;
  cin >> s;
  cin >> p;

  string check = s+s;
  for(int i=0; i<s.size(); i++){
    //p?????????????????´?????????
    if(check[i] == p[0]){
      //s???p????????´????????¨????????????????????§??????
      for(int j=0; j<p.size(); j++){
        flag = 1;
        if(check[i+j] != p[j]){
          flag = 0;
          break;
        }
      }
      //????????°????????£??????yes?????????????????????
      if(flag == 1) break;
    }
  }

  if(flag == 1){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 3184
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <string>
#include <vector>

using usize = std::size_t;
using u32 = std::uint32_t;

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

usize ask(const usize x, const usize y) {
  if (x == y) {
    return 0;
  }
  std::cout << "? " << x + 1 << " " << y + 1 << std::endl;
  usize r;
  std::cin >> r;
  return r;
}

void exc(const std::vector<usize>& a) {
  std::cout << "!";
  for (const auto e : a) {
    std::cout << " " << e + 1;
  }
  std::cout << std::endl;
}

int main() {

  usize n;
  std::cin >> n;

  usize far, dist = 0;
  for (usize i = 0; i != n; ++i) {
    usize d = ask(0, i);
    if (d >= dist) {
      dist = d;
      far = i;
    }
  }

  std::vector<usize> ans(n);
  for (usize i = 0; i != n; ++i) {
    ans[ask(far, i)] = i;
  }

  exc(ans);

  return 0;
}



Measured memory_bytes: 3668
def main():
    s = str(input())
    s += '0'
    k = int(input())
    result = set()
    for i in range(1, 6):
        for j in range(len(s)-i):
            result.add(s[j:j+i])
    out = list(result)
    out.sort()
    print(out[k-1])
if __name__ =='__main__':
    main()

Measured memory_bytes: 4464
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
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;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 

vll dp(100100);

ll sum(ll n) {
ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}


 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n;
    ci(n);
  vll A(n);
  FOR(i,0,n){
    ci(A[i])
  }
  ll ans=0;
  FOR(i,0,n){
    ll a;
      ci(a);
    ans+=a;
  }

  vll C(n-1);
  FOR(i,0,n-1){
    ci(C[i]);
  }

  FOR(i,1,n){
    if(A[i]-A[i-1]==1){
      ll a=A[i-1];
      ans+=C[a-1];
    }
  }
  co(ans)
}

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

int main(){
  int L;
  cin >> L;
  stack<int>stk;

  vector<int>flag(100,0);

  for(int i=0;i<L;i++){
    int c;
    cin>>c;
    if(c>0){
      if(flag[c]==1){
        cout << i+1 << endl;
        return 0;
      }
      stk.push(c);
      flag[c]=1;
    }else{
      c=c*-1;
      if(flag[c]!=1 or stk.top()!=c){
        cout << i+1 <<endl;
        return 0;
      }
      stk.pop();
      flag[c]=0;
    }
  }
  cout << "OK" << endl;
}



Measured memory_bytes: 3104
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

char dn[2400000], * di = dn;
const int MAX = 200000;
class shuturyoku_unko {
public:
	char C[MAX * 6 + 10];
	char* K[MAX + 10];
	constexpr shuturyoku_unko() : C(), K() {
		auto di = C + 1;
		C[0] = '0';
		K[0] = C;
		K[1] = di;
		rep1(i, MAX) {
			int X = i;
			int keta = 0;
			char c[10] = {};
			while (X) {
				*(c + keta) = '0' + X % 10;
				X /= 10;
				keta++;
			}
			for (int j = keta - 1; j >= 0; j--)* di++ = (*(c + j));
			K[i + 1] = di;
		}
	}
} f;
inline void putint(ll X) {
	int ue = X / 100000;
	if (ue) {
		for (auto i = f.K[ue]; i < f.K[ue + 1]; i++)* di++ = *i;
		int sita = X - ue * 100000ll;
		rep(i, 5 - (f.K[sita + 1] - f.K[sita])) *di++ = '0';
		for (auto i = f.K[sita]; i < f.K[sita + 1]; i++)* di++ = *i;
	}
	else for (auto i = f.K[X]; i < f.K[X + 1]; i++)* di++ = *i;
	*di++ = '\n';
}

int A[200000];
int B[200010];

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

	int N = getint();
	ll kotae = 0;
	rep(i, N) kotae += B[(A[i] = getint())]++;
	rep(i, N) putint(kotae - B[A[i]] + 1);
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 6016
#include<cstdio>
bool isprime(int n,int k=2){if(n==1){return false;}if(n<k*k){return true;}if(n%k==0){return false;}return isprime(n,k+1);}int main(){int a,d,n,c;while(true){scanf("%d%d%d",&a,&d,&n);if(n==0){break;}c=0;while(c<n){if(isprime(a)){c++;}a+=d;}printf("%d\n",a-d);}}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vpii;

ll INF = (1ll << 32);
double EPS = 1e-4;

ll MOD = 1000000007;

int main() {
  ll N, M;
  cin >> N >> M;

  unordered_set<ll> s;
  for (ll i = 1; i * i <= M; i++) {
    if (M % i == 0) {
      s.insert(i);
      s.insert(M / i);
    }
  }

  ll ans = 1;
  for (ll i: s) {
    if (M / i >= N) {
      ans = max(ans, i);
    }
  }

  cout << ans << endl;
}

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

int main() {
  
  int n, m;
  cin >> n >> m;
  
  vector<int> condition(m * 2, 0);
  for (int i = 0; i < m; i++) {
    cin >> condition.at(i * 2) >> condition.at(i * 2 + 1);
  }
  
  // judge
  int complete = 0, answer = -1;
  
  if (n == 1) {    
    for (int i = 0; i < 10; i++) {      
      
      for (int j = 0; j < m; j++) {
        answer = i;
        
        if (answer == condition.at(j * 2 + 1)) {
          complete++;
        }
      }
      
      if (complete == m) {
        answer = i;
        break;
      }
      else {
        complete = 0;
        answer = -1;
      }
    }
    //cout << "1" << endl;
  }
  
  if (n == 2) {
    for (int i = 10; i < 100; i++) {
      
      for (int j = 0; j < m; j++) {
        answer = i;
        
        if (condition.at(j * 2) == 1) answer /= 10;
        if (condition.at(j * 2) == 2) answer %= 10;
        
        if (answer == condition.at(j * 2 + 1)) {
          complete++;
        }
      }
      
      if (complete == m) {
        answer = i;
        break;
      }
      else {
        complete = 0;
        answer = -1;
      }
    }
    //cout << "2" << endl;
  }
  
  if (n == 3) {
    for (int i = 100; i < 1000; i++) {
      
      for (int j = 0; j < m; j++) {        
        answer = i;
        
        if (condition.at(j * 2) == 1) answer /= 100;
        if (condition.at(j * 2) == 2) answer = answer % 100 / 10;
        if (condition.at(j * 2) == 3) answer = answer % 100 % 10;
        
        if (answer == condition.at(j * 2 + 1)) {
          complete++;
        }
      }
      
      if (complete == m) {
        answer = i;
        break;
      }
      else {
        complete = 0;
        answer = -1;
      }
    }
	//cout << "3" << endl;
  }
  
  cout << answer << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 //Compiler version g++ 6.3.0
int main(){
  int a,b,ans;
  cin >> a >> b;
  for(int i=a; i<=b; i++){
    if(i/10000==i%10&&(i%10000)/1000==(i%100)/10){
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import math
import itertools
import fractions
import heapq
import collections
import bisect
import sys
import copy

sys.setrecursionlimit(10**9)
mod = 10**7+9
inf = 10**20

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


n,m = LI()

ll = []
for i in range(m):
    ll.append(LI())

for i in range(0,1000):
    if len(str(i))!=n:
        continue
    s = str(i)
    flag = True
    for j in ll:
        if s[j[0]-1]!=str(j[1]):
            flag = False
            break
    if flag:
        print(i)
        exit()

print(-1)

Measured memory_bytes: 5296
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <cstring>
#include <string>
#include <map>
#include <stack>
using namespace std;
map<string,long long>m;
typedef long long ll;


string s;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie();
    int k,x;
    cin >>k >> x;
    cout << max({k+x,k-x,k*x}) <<endl;
    return 0;
}


Measured memory_bytes: 256
N, x = map(int, input().split())
a = list(map(int, input().split()))

a.sort()
ans = 0
for ai in a:
    if x - ai < 0:
        x -= ai
        break
    x -= ai
    ans += 1

if x > 0 and ans > 0:
    ans -= 1
    
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <map>
#include <stack>
#include <string>
#include <list>
#include <math.h>
using namespace std;

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


signed main(){

	string S;
	cin >> S;
	bool n, s, e, w;
	if (S.find("N") != string::npos) n = true; else n = false;
	if (S.find("S") != string::npos) s = true; else s = false;
	if (S.find("E") != string::npos) e = true; else e = false;
	if (S.find("W") != string::npos) w = true; else w = false;

	bool r;
	if (((n&s) | (!n&!s))
		&
		((e&w) | (!e&!w))) r = true;
	else r = false;

	if (r) cout << "Yes" << endl;
	else cout << "No" << endl;


	return 0;
}





Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace program
{
    class Program
    {
        static void Main()
        {
            int N = Input.ScanInt();
            int[] preMax = new int[3];
            int[] Max = new int[3];
            for(int i = 0; i < N; i++)
            {
                int[] input = Input.ScanIntArray();
                Max[0] = Math.Max(input[0] + preMax[1], input[0] + preMax[2]);
                Max[1] = Math.Max(input[1] + preMax[0], input[1] + preMax[2]);
                Max[2] = Math.Max(input[2] + preMax[0], input[2] + preMax[1]);
                preMax = (int[])Max.Clone();
            }

            Console.WriteLine($"{Max.Max()}");
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }
}


Measured memory_bytes: 17444
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(x) (x).begin(),(x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
#define sz(x) (int)(x).size()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << c/a*b << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;
ll mod = 998244353;
  

int main(){
 ll n,s;
 cin>>n>>s;
 vector<ll> a(n);
 for(ll i=0;i<n;i++)cin>>a[i];
 vector<vector<ll> > dp(n+1,vector<ll>(s+1,0) );
 dp[0][0] = 1;
 //map<mp,ll> dp;
 //dp[mp(0,0)] = 1;
 //vector<ll> beki(n+1,1);
 //for(ll i=1;i<=n;i++) beki[i] = (beki[i-1]*2)%mod;


 /*for(ll j=0;j<n;j++){
  map<mp,ll> tmp=dp;
  for(auto i:tmp){
   ll cnt = i.first.second+1;
   ll value = i.first.first + a[j];
   ll c = i.second;
   if(value <= s ){
    dp[ mp(value,cnt) ]+=i.second;
    dp[ mp(value,cnt) ]%=mod;
   }
  }
 }

 ll ans = 0;
 for(auto i:dp){
  ll cnt = i.first.second;
  ll value = i.first.first;
  if( value == s ){
   ans += (beki[n-cnt]*i.second)%mod;
   ans %= mod;
  }
 }*/
 for(ll i=0;i<n;i++){
  for(ll j=0;j<=s;j++) dp[i+1][j] += (2*dp[i][j])%mod , dp[i+1][j] %= mod;
  for(ll j=a[i];j<=s;j++) dp[i+1][j] += dp[i][j-a[i]] , dp[i+1][j] %= mod;
 }
 ll ans = 0;
 cout<<dp[n][s]<<endl;



    return 0;
}


Measured memory_bytes: 73748
#include <stdio.h>

int main(void)
{
	float x, y;
	float a, b, c, d, e, f;
	
	while (scanf("%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f) != EOF){
		if ((c * e) - (b * f) != 0 || ((a * e) - (b * d)) != 0){
			x = ((c * e) - (b * f)) / ((a * e) - (b * d));
			if (b != 0){
				y = (c - (a * x)) / b;
			}
			else {
				y = (f - (d * x)) / e;
			}
		}
		
		else if ((d * c) - (a * f) != 0 || (d * b) - (a * e) != 0){
			y = ((d * c) - (a * f)) / ((d * b) - (a * e));
			if (a != 0){
				x = (c - (b * y)) / a;
			}
			else {
				x = (f - (e * y)) / d;
			}
		}
		
		if (x == 0.0){
			x = 0.0;
		}
		
		if (y == 0.0){
			y = 0.0;
		}
		
		printf("%.3f %.3f\n", x, y);
	}
	return;
}

Measured memory_bytes: 0
#include<iostream>
#include<set>
#include<cstring>
#include<algorithm>
#define ll long long 
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	int num[500];
	int sum=0;
	for(int i=0;i<n;i++){
		cin>>num[i];
		sum=sum+num[i];
	}//输入完毕 
	double tot=(1*1.0/(4*m))*sum;
	int su=0;
	for(int i=0;i<n;i++){
		if(num[i]>=tot){
			su++;	
		}
	}
	if(su>=m){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
} 

Measured memory_bytes: 256
#設定
import sys
input = sys.stdin.buffer.readline

con = 10 ** 9 + 7
#ライブラリインポート
from collections import defaultdict

class Combination(object):
	def __init__(self, N, con):
		self.fac = [0] * (N + 1)
		self.inv = [0] * (N + 1)
		self.finv = [0] * (N + 1)
		self.fac[0], self.fac[1] = 1, 1
		self.inv[1] = 1
		self.finv[0], self.finv[1] = 1, 1

		# 前計算
		for i in range(2, N + 1):
			self.fac[i] = self.fac[i - 1] * i % con
			self.inv[i] = self.inv[con % i] * (con - (con // i)) % con
			self.finv[i] = self.finv[i - 1] * self.inv[i] % con

	def com(self, N, k):
		return (self.fac[N] * self.finv[k] * self.finv[N - k]) % con

#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, M, K = getlist()
	C = Combination(N * M - 2, con)
	c = C.com(N * M - 2, K - 2)
	s = (N * (N + 1) * (N - 1)) // 6 * (M ** 2)
	t = (M * (M + 1) * (M - 1)) // 6 * (N ** 2)
	ans = c * (s + t)
	print(ans % con)

if __name__ == '__main__':
	main()

Measured memory_bytes: 26988
n, k = map(int, input().split())
a = list(map(int, input().split()))

ans = 0
for d in range(40, -1, -1):
    x = 1<<d
    n_bin = len([1 for i in range(n) if a[i]&x > 0])
    if n_bin < n-n_bin and x <= k: # less bit:1 than bit:0 in d-th digit in a -> put bit:1 in the answer
        n_bin = n - n_bin # number of 0-bit, added to the answer via xor
        k -= x # subtract d-th bit from k
    ans += x*n_bin

print(ans)


Measured memory_bytes: 14620
import math

N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
count = 0
tmp = []

for i in range(N):
    r1 = X[i]
    for j in range(N):
        t = str(i)+str(j)
        if i == j or t in tmp or str(j)+str(i) in tmp:
            continue

        r2 = X[j]
        ls = [(r1[j] - r2[j])**2 for j in range(D)]
        res = math.sqrt(sum(ls))

        if res % 1 == 0:
            count += 1
        tmp.append(t)

print(count)

Measured memory_bytes: 3064
a,b = map(int,input().split())

if a < 0 and b < 0:
    if (b - a + 1) % 2 == 0:
        print("Positive")
    else:
        print("Negative")

elif a <= 0 and b >= 0:
    print("Zero")

else:
    print("Positive")

Measured memory_bytes: 9156
import sys
from operator import itemgetter, attrgetter
from itertools import starmap
import cmath
from math import isinf, sqrt, acos, atan2
readline = sys.stdin.readline
EPS = 1e-9
ONLINE_FRONT = -2
CLOCKWISE = -1
ON_SEGMENT = 0
COUNTER_CLOCKWISE = 1
ONLINE_BACK = 2
class Circle(object):
    __slots__ = ('c', 'r')
    def __init__(self, c, r):
        self.c = c
        self.r = r
class Segment(object):
    __slots__ = ('fi', 'se')
    def __init__(self, fi, se):
        self.fi = fi
        self.se = se
Line = Segment
def cross(a, b):
    return a.real * b.imag - a.imag * b.real
def dot(a, b):
    return a.real * b.real + a.imag * b.imag
def norm(base):
    return abs(base) ** 2
def project(s, p2):
    base = s.fi - s.se
    r = dot(p2 - s.fi, base) / norm(base)
    return s.fi + base * r
def reflect(s, p):
    return p + (project(s, p) - p) * 2.0
def ccw(p1, p2, p3):
    a = p2 - p1
    b = p3 - p1
    if cross(a, b) > EPS: return 1
    if cross(a, b) < -EPS: return -1
    if dot(a, b) < -EPS: return 2
    if norm(a) < norm(b): return -2
    return 0
def intersect4(p1, p2, p3, p4):
    return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 and
			ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0)
def intersect2(s1, s2):
    return intersect4(s1.fi, s1.se, s2.fi, s2.se)
def getDistance(a, b):  return abs(a - b)
def getDistanceLP(l, p):
    return abs(cross(l.se - l.fi, p - l.fi) / abs(l.se - l.fi))
def getDistanceSP(s, p):
    if dot(s.se - s.fi, p - s.fi) < 0.0: return abs(p - s.fi)
    if dot(s.fi - s.se, p - s.se) < 0.0: return abs(p - s.se)
    return getDistanceLP(s, p)
def getDistances(s1, s2):
    if intersect2(s1, s2): return 0.0
    return min(getDistanceSP(s1, s2.fi), getDistanceSP(s1, s2.se),
               getDistanceSP(s2, s1.fi), getDistanceSP(s2, s1.se))
def getCrossPoint(s1, s2):
	base = s2.se - s2.fi
	d1 = abs(cross(base, s1.fi - s2.fi))
	d2 = abs(cross(base, s1.se - s2.fi))
	t = d1 / (d1 + d2)
	return s1.fi + (s1.se - s1.fi) * t
def getCrossPointsCL(c, l):
    pr = project(l, c.c)
    e = (l.se - l.fi) / abs(l.se - l.fi)
    base = sqrt(c.r * c.r - norm(pr - c.c))
    return Segment(*sorted((pr + e * base, pr - e * base)), key=attrgetter('real', 'imag'))
def getCrossPointsCC(c1, c2):
    d = abs(c1.c - c2.c)
    a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2.0 * c1.r * d))
    t = cmath.phase(c2.c - c1.c)
    return Segment(*sorted((c1.c + cmath.rect(c1.r, t + a), c1.c + cmath.rect(c1.r, t - a)), key=attrgetter('real', 'imag')))
def contains(g, p):
    n = len(g)
    x = False
    for i in range(n):
        a = g[i] - p
        b = g[(i + 1) % n] - p
        if abs(cross(a, b)) < EPS and dot(a, b) < EPS: return 1
        if a.imag > b.imag: a, b = b, a
        if a.imag < EPS and EPS < b.imag and cross(a, b) > EPS: x = not x
    return 2 if x else 0
n = int(readline())
pg = [0] * n
for i in range(n):
    x, y = map(int, readline().split())
    pg[i] = complex(x, y)
q = int(readline())
for _ in [0] * q:
    x, y = map(int, readline().split())
    print(contains(pg, complex(x, y)))

Measured memory_bytes: 8256
#include <iostream>
#include <vector>

using namespace std;

vector<int> fact(100,1);

void fact_count(int N){
    for(int i=2; i<N+1; i++){
        int tmp =i;
        for(int j=2; j<i+1; j++){
            while (tmp%j==0){
                fact[j]+=1;
                tmp/=j;
            }
        }
    }
}

int count_756(vector<int> pattern,int flag){
    int cnt=1;
    for(int i=0; i<pattern.size(); i++){
        int num=pattern[i];
        int tmp=0;
        for(int j=0; j<fact.size(); j++){
            if (fact[j]>=num){
                tmp+=1;
            }
        }
        cnt*=tmp-i;
    }
    return cnt/flag;
}

int main(){
    int N;
    cin >> N;
    
    fact_count(N);
    
    vector<vector<int>> pattern(4,vector<int>());
    pattern={{5,5,3},{25,3},{15,5},{75}};
    vector<int> flag;
    flag={2,1,1,1};
    
    int ans=0;
    for (int i=0; i<pattern.size(); i++){
        ans+=count_756(pattern[i],flag[i]);
    }
    cout << ans << '\n';
}

Measured memory_bytes: 256
//There was and will always be only one Chester. RIP legend
//--------------------Life is beautiful--------------------
#include<bits/stdc++.h>
using namespace std;
#define Nilesh ios_base::sync_with_stdio(false);
int main()
{
	Nilesh
	string a;
	cin>>a;
	int l=a.length();
	int cnt=0;

	for(int i=0;i<l;i++)
    {
        if(a[i]=='1')
            cnt++;
    }
    cout<<cnt;

}


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

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

void solve()
{
	unsigned long long int N, K;
	cin >> N >> K;
	vector<P> a(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> a[i].first >> a[i].second;
	}
	sort(a.begin(), a.end());
	unsigned long long int pos = 0;
	int index = 0;
	while (pos < K)
	{
		pos += a[index].second;
		++index;
	}
	cout << a[index - 1].first << endl;
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};
 
template<class T> 
inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> 
inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};
 



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Timer TM;

    
    ll a,b,h;
    cin>>a>>b>>h;
    cout<<(a+b)*h/2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> //全てのヘッダファイルをインクルード
 
//ループ
#define rep(i, n) for(int i = 0; i < (n); i++) //普通のループ
#define repr(i, n) for(int i = n; i >= 0; i--) //逆ループ
 
//型名省略
typedef long long ll;
//値
static const ll MX = 100005;
static const ll MX_ll = 1e18;
const double PI = acos(-1); //π
 
using namespace std;
 
//ソート
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
 
//#include "./lib/generic/search.h"

//文字列入力した小数値を小数点なくして返す
int changeDoubleToInt(string decimal){ 
    decimal.erase(1, 1); //小数点削除
    int n_decimal = atoi(decimal.c_str()); //c_strでchar*に変換後、atoiでintに変換
    return n_decimal;
}

//最大公約数
int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
}

int main(){
   int x;
   cin >> x;
   if(x>=400 && x<=599) cout << "8" << endl;
   else if(x>=600 && x<=799) cout << "7" << endl;
   else if(x>=800 && x<=999) cout << "6" << endl;
   else if(x>=1000 && x<=1199) cout << "5" << endl;
   else if(x>=1200 && x<=1399) cout << "4" << endl;
   else if(x>=1400 && x<=1599) cout << "3" << endl;
   else if(x>=1600 && x<=1799) cout << "2" << endl;
   else if(x>=1800 && x<=1999) cout << "1" << endl;
   return 0;
}

Measured memory_bytes: 3620
N,_=gets.chomp.split(' ').map{|n| n.to_i}
icnt = 0
hevn = {}
hodd = {}
gets.chomp.split(' ').map{|n| n.to_i}.each{|i|
	case icnt%2
	when 0
		hevn[i].nil? ? hevn[i] = 1 : hevn[i]+=1
	when 1
		hodd[i].nil? ? hodd[i] = 1 : hodd[i]+=1
	end
	icnt+=1
}
evnsorted = hevn.sort{|a,b| b[1] <=> a[1]}
oddsorted = hodd.sort{|a,b| b[1] <=> a[1]}
# p evnsorted
# p oddsorted
evnmax = evnsorted[0]
oddmax = oddsorted[0]
if(evnmax[0] == oddmax[0])
	if(evnsorted.size < 2)
		if(oddsorted.size < 2)
			puts "#{N/2}"
			exit(0)
		else
			oddmax = oddsorted[1]
		end
	else
		if(oddsorted.size < 2)
			evnmax = evnsorted[1]
		else
			evnmax2 = evnsorted[1]
			oddmax2 = oddsorted[1]
			if(evnmax2[1] <= oddmax2[1])
				oddmax = oddmax2
			else
				evnmax = evnmax2
			end
		end
	end
end
puts "#{N-evnmax[1]-oddmax[1]}"


Measured memory_bytes: 20140
#include<iostream>
#include<string>
 
using namespace std;
 
int main(void){
    int A,B,C;
    cin>>A>>B>>C;
    if(C<=A+B+1){
       cout<<B+C<<endl; 
    }else {
        cout<<B+A+B+1<<endl;
    }
    
    return 0;

}

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

int main() {
	int a, b, k, i;
	int j = 0;
	int array[11];
	cin >> a >> b >> k;
	for (i = 1; i <= min(a,b); i++) {
		if (a%i == 0 && b%i == 0) {
			j++;
			array[j] = i;
		}
	}
	cout << array[j-k+1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int abs(int num){
	if(num < 0)	num *= -1;
	return num;
}


int main(int argc, char const *argv[])
{
	int min = 999,val;
	char S[12];
	scanf("%s",S);
	for (int i = 0; i < strlen(S) - 2; ++i){
		val = abs(753 - (100 * (S[i] - '0') + 10 * (S[i + 1] - '0') + (S[i + 2] - '0')));
		if(min > val)	min = val;
	}
	printf("%d\n", min);
	return 0;
}

Measured memory_bytes: 128