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

/*
  REMEMBER:
  1.Think TWICE, code ONCE!
  Are there any counterexamples to your algo?
	
  2.Be careful about the BOUNDARIES in your algo!
  N=1? P=1? Is P a prime? Something about 0?
	
  3.Never make STUPID MISTAKES!
  Integer overflow? Array size? Time complexity? Memory usage? Precition error?
*/

const int _ = 2003;
struct Edge{int end , upEd;}Ed[_ << 1];
int head[_] , cntEd , N; char str[_];

void addEd(int p , int q){
	Ed[++cntEd] = (Edge){q , head[p]};
	head[p] = cntEd;
}

#define PII pair < int , int >
int ans = 2e9 , cnt , sz[_] , mx[_] , mn[_];
void dfs(int x , int p){
	vector < PII > ch; sz[x] = str[x] == '1'; mx[x] = mn[x] = 0;
	for(int i = head[x] ; i ; i = Ed[i].upEd)
		if(Ed[i].end != p){
			int t = Ed[i].end; dfs(t , x); mx[x] += mx[t] + sz[t];
			ch.push_back(PII(mn[t] + sz[t] , mx[t] + sz[t])); sz[x] += sz[t];
		}
	if(!ch.size()) return;
	sort(ch.begin() , ch.end() , [&](PII p , PII q){return p.first > q.first;});
	int cur = ch[0].first;
	for(int i = 1 ; i < ch.size() ; ++i) cur -= ch[i].second;
	mn[x] = max(cur , mx[x] & 1);
}

int main(){
	scanf("%d %s" , &N , str + 1);
	for(int i = 1 ; i < N ; ++i){int p , q; scanf("%d %d" , &p , &q); addEd(p , q); addEd(q , p);}
	for(int i = 1 ; i <= N ; ++i){dfs(i , 0); if(!mn[i]) ans = min(ans , mx[i] / 2);}
	printf("%d\n" , ans == 2e9 ? -1 : ans); return 0;
}

Measured memory_bytes: 512
def mk2d(n)
  arr = Array.new
  n.times do
    a = Array.new(10, 0)
    arr << a
  end
  arr
end
def smallInk(x, y)
  [[x, y],
   [x + 1, y],
   [x - 1, y],
   [x, y + 1],
   [x, y - 1]]
end
def midInk(x, y)
  arr = smallInk(x, y)
  arr << [x + 1, y + 1]
  arr << [x - 1, y + 1]
  arr << [x - 1, y - 1]
  arr << [x + 1, y - 1]
  arr
end
def largeInk(x, y)
  arr = midInk(x, y)
  arr << [x + 2, y]
  arr << [x - 2, y]
  arr << [x, y + 2]
  arr << [x, y - 2]
  arr
end
def drop(arr)
  arr.each do |i|
    x = i[0]
    y = i[1]
    if x >= 0 and x <= 9 and y >= 0 and y <=9
      $paper[i[0]][i[1]] += 1
    end
  end
end
  
#main
$paper = mk2d(10)
arr = Array.new
while line = gets
  arr << line 
end
arr.each do |i|
  a = i.split(",")
  a.map!{|j| j.to_i}
  case a[2]
    when 1
    drop(smallInk(a[0], a[1]))
    when 2
    drop(midInk(a[0], a[1]))
    when 3
    drop(largeInk(a[0], a[1]))
  end
end
empty = 0
max = 0
0.upto($paper.length - 1) do |i|
  0.upto($paper.length - 1) do |j|
    if $paper[i][j] == 0
      empty += 1
    end
    if max < $paper[i][j]
      max = $paper[i][j]
    end
  end
end
p empty
p max

Measured memory_bytes: 6120
object Main {
  def main(args: Array[String]): Unit = {
    val lines = io.Source.stdin.getLines().toSeq
    println(solve(lines))
  }

  def solve(lines: Seq[String]): String = {
    val n = lines.head.toInt
    val mountains = lines.tail.head.split(" ").take(n).map(_.toInt)
    var count = 1
    mountains.zipWithIndex.drop(1).foreach { case (h, i) =>
      if (mountains.take(i).max <= h) count += 1
    }
    count.toString
  }
}


Measured memory_bytes: 25416
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<assert.h>
#define M 1000000007
typedef long long ll;
using namespace std;
vector<vector<ll>>dp;
vector<string>v;
ll solve(int n, int m){
	int x = 1;
	for (int i = 0; i < m; i++){
		if (x == 1 && v[0][i] == '.'){
			dp[0][i] = 1;
		}
		else{
			x = 0;
			dp[0][i] = 0L;
		}
	}
	x = 1;
	for (int i = 0; i < n; i++){
		if (x == 1 && v[i][0] == '.'){
			dp[i][0] = 1;
		}
		else{
			x = 0;
			dp[i][0] = 0L;
		}
	}
	/*
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}
	*/
	for (int i = 1; i < n; i++){
		for (int j = 1; j < m; j++){
			if (v[i][j] == '#')
				dp[i][j] = 0L;
			else
				dp[i][j] = (dp[i - 1][j]%M + dp[i][j-1]%M)%M;
		}
	}
	return dp[n-1][m-1];
}
int main(){
	
	//freopen("input.txt", "r", stdin);
	//freopen("output1.txt", "w", stdout);
	int n, m;
	cin >> n >> m;
	dp.resize(n, vector<ll>(m, 0));
	v.resize(n);
	for (int i = 0; i < n; i++){
		cin >> v[i];
	}
	ll ans = solve(n,m);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9216
n = int(input())
a = list(map(int, input().split()))
di, tetra = 0, 0

for i in a:
    if i%4 == 0:
        tetra += 1
    elif i%4 == 2:
        di += 1

if tetra*2+di >= n or tetra*2+1 >= n:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14252
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;

int main(){
  string str[17]={"Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan",
		  "Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts"};
 
  while(1){
    ll num[18]={};
    int m,n;
    cin >> n >>m;
    if(n==0 && m==0)break;
    num[0] = (ll)n;
    for(int i=1;i<m;i++){
      for(int j=0;j<18;j++)num[j]*=n;
      for(int j=0;j<17;j++)if(num[j]/10000 >=1) num[j+1]+=num[j]/10000, num[j]%=10000;
    }
    for(int j=0;j<17;j++)if(num[j]/10000 >=1) num[j+1]+=num[j]/10000, num[j]%=10000;

       
    for(int i=17;i>=1;i--) 
      if(num[i] !=0) cout << num[i] << str[i-1];
    if(num[0] !=0) cout << num[0];
    cout << endl;
  }
  return 0;
}

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

int main(){
    ll N;
    cin >> N;
    vector<ll> count(N,0);
    rep(j,N-1){
        ll x;
        cin >> x;
        count.at(x-1)++;
    }

rep(i,N){
    cout << count.at(i) << endl;
}
 
}

Measured memory_bytes: 4852
/*  -*- coding: utf-8 -*-
 *
 * c.cc: C - One Quadrillion and One Dalmatians
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_K = 16;

/* typedef */

typedef long long ll;

/* global variables */

int ds[MAX_K];

/* subroutines */

/* main */

int main() {
  ll n;
  scanf("%lld", &n);
  n--;

  int k = 1;
  ll ek = 26;
  for (; ek <= n; n -= ek, k++, ek *= 26);
  //printf("k=%d\n", k);

  for (int i = 0; i < k; i++, n /= 26) ds[i] = n % 26;

  for (int i = k - 1; i >= 0; i--) putchar('a' + ds[i]);
  putchar('\n');
  return 0;
}


Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,X;
  bool Y=false;
  cin>>A>>B;
  for(X=0;X<B*20;X++){
    if(X*8/100==A && X/10==B){
      cout<<X<<endl;
      Y=true;
      break;
    }
  }
  if(Y==false){
    cout<<-1<<endl;
  }
}


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

int main(){
  string s;
  cin >> s;
  
  int ans = 0;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == '1') ans++;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
int main() {
    string ss, t; cin >> ss >> t;
    string sss = ss;
    int flg = -1;
    for (int i = (int)ss.size() - 1; i >= 0; --i) {
        //cout << i << endl;
        if (ss[i] == t[0] || ss[i] == '?') {
            int nowt = 1;
            if (t.size() == 1) {flg = i; break;}
            for (int j = i + 1; ; ++j) {
                if (j >= ss.size()) break;
                if (ss[j] != t[nowt] && ss[j] != '?') break;
                //cout << ss[j] << " " << t[nowt] << endl;
                nowt++;
                if (nowt == t.size() /*- 1*/) flg = i;
            }
        }
        if (flg != -1) break;
    }
    //cout << flg << endl;
    if (flg == -1) cout << "UNRESTORABLE" << endl;
    else {
        rrep(i, flg, flg + t.size()) ss[i] = t[i - flg];
        rep(i, ss.size()) if (ss[i] == '?') ss[i] = 'a';
        cout << ss << endl;
    }
}







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

#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...)
#endif

#ifdef __WIN32
#define LLFORMAT "I64"
#define Rand() ((rand() << 15) + rand())
#else
#define LLFORMAT "ll"
#define Rand() (rand())
#endif

using namespace std;

const int maxn = 6, maxc = 51, maxm = maxn * maxc, maxs = (1 << maxn - 1) | 10;

int n, m, C, l[maxn], p[maxn], S;
long long dp[maxm][maxs], tot, mu;

inline int lowbit(int i) { return i & (-i); }

int main() {
	scanf("%d%d", &n, &C); m = n * C; S = 1 << n - 1;
	for (int i = 0; i < n; ++i) scanf("%d", l + i), p[i] = i;
	sort(l, l + n); reverse(l, l + n);
	do {
		memset(dp, 0, sizeof dp); dp[l[0] * n][0] = 1;
		for (int i = 0; i < m; ++i) for (int j = i; j <= m; ++j) for (int k, s = 0; s < S; ++s) if(dp[j][s] && (k = i % n) && !((s >> k - 1) & 1)) dp[min(m, max(j, i + l[p[k]] * n))][s | (1 << k - 1)] += dp[j][s];
		tot += dp[m][S - 1];
		++mu;
	} while(next_permutation(p + 1, p + n));
	for (int i = 1; i < n; ++i) mu *= (long long) C;
	printf("%.12f\n", (double) tot / (double) mu);
	return 0;
}



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

using namespace std;
typedef long long LL;

int main(){
  int N;
  cin >> N;
  map<int,int> m;
  int ans=0;
  rep(i,N){
    int A;
    cin >> A;
    if(m[A]){
      m[A]--;
      ans--;
    }
    else{
      m[A]++;
      ans++;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4992
x,y = map(int,input().split())
one = 300000
two = 200000
three = 100000
tokubetu = 400000
xprize = 0
yprize = 0

if x==1:
    xprize = one
elif x==2:
    xprize = two
elif x==3:
    xprize = three
if y==1:
    yprize = one
elif y==2:
    yprize = two
elif y==3:
    yprize = three

if x==1 and y==1:
    print(xprize+yprize+tokubetu)
else:
    print(xprize+yprize)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
 
ll powmod(ll x,ll y){
    ll res=1;
    for(ll i=0;i<y;i++){
        res=res*x%mod;
    }
    return res;
}
int main(){
    ll n;
    cin>>n;
    ll ans=powmod(10,n)-powmod(9,n)-powmod(9,n)+powmod(8,n);
    ans%=mod;
    ans=(ans+mod)%mod;
    cout<<ans<<"\n";
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<class F>auto recursive(F f){return[f](auto...a){return f(f,a...);};}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int p;fixprec(int p):p(p){}};
ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.p);}
int main() {
    int N;
    cin >> N;
    N %= 10;
    vector<string> x = {"pon", "pon", "hon", "bon", "hon", "hon", "pon", "hon", "pon", "hon"};
    cout << x[N] << endl;
    
    return 0;
}

Measured memory_bytes: 3604
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(input())
    v = list(map(int, readline().split()))
    c = list(map(int, readline().split()))
    x = [p - q for p, q in zip(v, c)]

    ans = 0
    for elem in x:
        if elem > 0:
            ans += elem

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import bisect as bs
def prime(m):
  N = range(1,m+1, 2)
  N[0] = 2
  for i in range(1, len(N)):
    x = N[i]
    if x: N[i+x::x] = [0]*len(N[i+x::x])
  return filter(None, N)
 
P = prime(10000)
x = []
a = P[0]
for b in P[1:]:
  if b-a==2: x.append(b)
  a=b
while 1:
  n = int(raw_input())
  if n==0: break
  a = x[bs.bisect_right(x, n)-1]
  print a-2, a

Measured memory_bytes: 4656
#include<bits/stdc++.h>
#define r(i,a,n) for(int i=a;i<n;i++)
using namespace std;
int n,u,k,v,a[101][101],start[101],end[101],p,f[101];
void dfs(int u){
	if(!f[u]){
    f[u]++;
    start[u]=++p;
    r(i,1,n+1)if(a[u][i])dfs(i);
    end[u]=++p;
  }
}
int main(){
	cin>>n;
	r(i,0,n){
    cin>>u>>k;
		r(i,0,k){
      cin>>v;
			a[u][v]++;
		}
	}
	r(i,1,n+1)if(!f[i])dfs(i);
	r(i,1,n+1)cout<<i<<' '<<start[i]<<' '<<end[i]<<endl;
}



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

def main():
    N = int(input())
    A = list(map(int, input().split()))

    ma = max(A)
    B = [True] * (ma+1)
    for a in list(set(A)):
        for i in range(a+a, ma+1, a):
            B[i] = False

    import collections
    ans = 0
    for k, v in collections.Counter(A).items():
        if B[k] and v == 1:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 45800
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

int main(){
	int N, M, X;
	cin >> N >> M >> X;
	vector<int> A(M);
	for(int i=0; i<M; ++i) cin >> A[i];
	int left = 0;
	int right = 0;
	for(int i=0; i<M; ++i){
		if(A[i]<X) ++left;
		else ++right;
	}
	cout << min(left, right) << endl;
}

Measured memory_bytes: 3636
#include <stdio.h>


struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;
/*
Node treeMinimum(Node x){


}

Node treeMaximum(Node x){


}

Node treeSearch(Node u, int k){


}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}
*/
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key<x->key)x=x->left;
    else x=x->right;
  }
  z->parent=y;

  if(y==NIL)root=z;
  else if(z->key<y->key)y->left=z;
  else y->right=z;

}

void inorder(Node u){
  if(u==NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    /* if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } */if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } /*else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
      }*/
  }

  return 0;
}



Measured memory_bytes: 25164
N = int(input())
A = list(map(int, input().split()))

Asum = sum(A)

s=0
t=0
for i,Ai in enumerate(A):
    s+=Ai
    if s == Asum/2:
        print(0)
        exit()
    if s >= Asum/2:
        s = i
        break
for i,Ai in enumerate(A[::-1]):
    t+=Ai
    if t >= Asum/2:
        t = i
        break

ans1 = abs(sum(A[:s])-(Asum-sum(A[:s])))
ans2 = abs(sum(A[::-1][:t])-(Asum-sum(A[::-1][:t])))

print(min(ans1,ans2))


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


int main()	
{
	int n,a,sum=0;
	set<int>S;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		if(a<400)S.insert(1);
		else if(a<800)S.insert(2);
		else if(a<1200)S.insert(3);
		else if(a<1600)S.insert(4);
		else if(a<2000)S.insert(5);
		else if(a<2400)S.insert(6);
		else if(a<2800)S.insert(7);
		else if(a<3200)S.insert(8);
		else sum++;
	}
	int k=S.size();
	int Min=max(k,1);
	int Max=k+sum;
	cout<<Min<<" "<<Max<<endl;	
	return 0;
}

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

int main() {
	int i,t;
	int k;
	scanf("%d", &k);
	if (135 <= k && k < 189) {
		t = 1;
	}
	else if (189 <= k) {
		t = 2;
	}
	else {
		t = 0;
	}

	if (k <= 104) {
		printf("0");
	}
	else if (105 <= k && k < 165) {
		t = t + 1;
		printf("%d", t);
	}
	else if (165 <= k && k < 195) {
		t = t + 2;
		printf("%d", t);
	}
	else if (195 <= k) {
		t = t + 3;
		printf("%d", t);
	}
	return 0;
}

Measured memory_bytes: 128
let allVal = require("fs").readFileSync("/dev/stdin", "utf8").split("\n")[1].split(" ")
    let mstVal = Math.max(...allVal)
    let mstPos = allVal.indexOf(mstVal + "")
    allVal.splice(mstPos, 1)
    console.log(allVal.reduce((cur, prev) => cur + +prev, 0) > mstVal ? "Yes" : "No");

Measured memory_bytes: 29660
import sys
import os
import itertools

n = int(input())

def make_divisors(n):
    divisors = {}
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors[i] = n//i
            if i != n // i:
                divisors[i] = n//i

    return divisors

ans = make_divisors(n)
m = max(ans)
print( (m-1) + ans[m]-1)

Measured memory_bytes: 38896
//============================================================================
// Name        : AOJ.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cctype>
#include <string>
#include<algorithm>

using namespace std;
typedef long long ll;
int main(){

	string s;
	int c=0,f=0;

	cin>>s;

	for(int i=0; i<s.size(); ++i){
		if(s[i]=='C'&&f==0){
			c=1;
		}
		if(s[i]=='F'&&c==1){
			f=1;
		}
	}
		if(c==1&&f==1){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}


	return 0;



}


Measured memory_bytes: 768
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second

#define int long long
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e18 + 10;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

signed main(){
	int n;
	while(cin >> n && n) {
		map<pii, int> empty;
		map<pii, int> writed;
		map<int, vector<pii> > v;
		empty[{0,INF}] = 1;
		rep(_, n) {
			string s;
			cin >> s;
			if(s == "W") {
				int a, b;
				cin >> a >> b;
				for(auto it = empty.begin(); it != empty.end();) {
					int l = it -> fi.se - it -> fi.fi;
					if(l == b) {
						writed[it->fi] = a;
						v[a].pb(it->fi);
						it = empty.erase(it);
						break;
					}
					else if(l > b) {
						pii p = {it->fi.fi, it->fi.fi+b};
						pii q = {it->fi.fi+b, it->fi.se};
						writed[p] = a;
						v[a].pb(p);
						it = empty.erase(it);
						empty[q] = 1;
						break;
					}
					else {	// l < b
						writed[it->fi] = a;
						v[a].pb(it->fi);
						it = empty.erase(it);
						b -= l;
					}
				}
			}else if(s == "D") {
				int a;
				cin >> a;
				auto& b = v[a];
				while(b.size() > 0) {
					auto p = b.back();
					writed.erase(p);
					empty[p] = 1;
					b.pop_back();
				}
			}else {
				int a;
				cin >> a;
				int b = -1;
				for(auto& p : writed) {
					if(p.fi.fi <= a && a < p.fi.se) {
						b = p.se;
						break;
					}
				}
				cout << b << endl;
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 41280
#include <algorithm>
#include <iostream>
#include <vector>

#define ll long long
#define LINF 1e18
#define INF 1e9

using namespace std;

int main() {
  ll N;
  cin >> N;
  vector<ll> v(N);
  for (ll i = 0; i < N; i++) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());

  double ans = v[0];
  for (int i = 1; i < N; i++) {
    ans = (double)(ans + v[i]) / 2;
  }

  printf("%.10f\n", ans);
}

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

int main() {
	int n;
	cin>>n;
	string s;
	bool four=false;
	for(int i=0;i<n;i++){
		cin>>s;
		if(s=="Y"){
			four=true;
			break;
		}
	}
	if(four){
		cout<<"Four"<<endl;
	}
	else{
		cout<<"Three"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    double n,k;cin>>n>>k;
    double ans=0.0;

    for(int i=1;i<=n;i++){
        double tmp = k;
        if(i<k){
            while(tmp>i){
                tmp/=2.0;
            }
            ans+= tmp/(n*k);
        }
        else ans+= 1/n;
    }
    printf("%.13f\n", ans);
}

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

struct block{
    int x,y,t;
};

char a[25][25];
int ans = 0;
int d[4][2] = {1,0,0,-1,0,1,-1,0}, n,m;

void bfs(int x, int y){
    queue<block> q;
    block b; b.x = x, b.y = y, b.t = 0;
    vector<vector<bool> > vis(25, vector<bool> (25, 0));
    vis[x][y]=1;
    q.push(b);
    while(!q.empty()){
        block tp = q.front(), newb; 
        q.pop(); 
        for(int i=0; i<4; ++i) {
            newb.x = tp.x+d[i][0], newb.y = tp.y + d[i][1], newb.t = tp.t + 1;
            if(newb.x>=0 && newb.x<n && newb.y>=0 && newb.y<m && a[newb.x][newb.y]=='.' && !vis[newb.x][newb.y])
                ans = max(ans, newb.t),
                q.push(newb),
                vis[newb.x][newb.y] = 1;
        }
    }
    return;
}
int main(){
    fastIO;
    cin>>n>>m;
    for(int i=0; i<n; ++i) for(int j=0; j<m; ++j) cin>>a[i][j];
    for(int i=0; i<n; ++i){
        for(int j=0; j<m; ++j){
            if(a[i][j]=='.') bfs(i,j);
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int yLineNum = sc.nextInt();
		int robotBPlace = sc.nextInt();
		ArrayList<Integer> xList = new ArrayList<>();
		for(int i = 0; i < yLineNum; i++) {
			xList.add(sc.nextInt());
		}
		int idoKyori = 0;
		for(int x: xList) {
			int robotAKyori = (int) Math.pow(x, 2);
			int robotBKyori = (int) Math.pow(x - robotBPlace, 2);
			if(robotAKyori <= robotBKyori) {
				idoKyori += Math.sqrt(robotAKyori) * 2;
			} else {
				idoKyori += Math.sqrt(robotBKyori) * 2;
			}
		}
		System.out.println(idoKyori);
	}

}

Measured memory_bytes: 21716
def factoring(k): #kを因数分解し、素因数とその個数を辞書に入れて返す。
    import math
    dic = dict()
    n = int(math.sqrt(k))+2
    for i in range(2, n):
        count = 0
        while k%i == 0:
            count += 1
            k = k//i
        if count != 0:
            dic[i] = count
    if k != 1: #sqrt(k)までチェックしてもkが1になっていない --> kが素因数
        dic[k] = 1
    return dic

N = int(input())

dic = factoring(N)

def calc(x):
    k = 0
    while True:
        if k * (k + 1) // 2 > x:
            return k - 1
        k += 1


ans = 0
for i in dic:
    tmp = dic[i]
    ans += calc(tmp)

print (ans)

Measured memory_bytes: 9220
n=int(input())
data=[[int(num)for num in input().split(' ')] for i in range(n)]
state=[[[0 for i in range(10)]for j in range(3)]for k in range(4)] 
for datum in data:
    state[datum[0]-1][datum[1]-1][datum[2]-1]+=datum[3]
for i in range(4):
    for j in range(3):
        s=""
        for k in range(10):
            s+=' '+str(state[i][j][k])
        print(s)
    if i!=3:
        print("####################")

Measured memory_bytes: 7732
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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

int main() {
  int a[3];
  rep (i, 3) {
    cin >> a[i];
  }

  int ans = 0;
  int maxN = max(max(a[0], a[1]), a[2]);
  rep (i, 3) {
    while (a[i] != maxN && a[i] + 1 != maxN) {
      a[i] += 2;
      ans++;
    }
  }
  int sameFlag = 1;
  int flag = 0;
  rep (i, 3) {
    if (a[i] != maxN) sameFlag = 0;
    if (a[i] == maxN - 1) flag++;
  }

  if (sameFlag) P(ans);
  else {
    if (flag == 2) ans++;
    else ans += 2;
    P(ans);
  }


  return 0;
}



Measured memory_bytes: 256
import itertools, heapq, bisect
from collections import defaultdict as ddic, deque, Counter

rr = raw_input
rri = lambda: int(raw_input())
rrm = lambda: map(int, raw_input().split())
MOD = 10 ** 9 + 7

###
X = rri()
Y = rri()
print 6 - X-Y


Measured memory_bytes: 27884
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
long long x,y;
int main(){
	cin>>x>>y;
	if(y%2==1){
		cout<<"No"<<endl;

	}
	else{
		if(4*x>=y&&2*x<=y){
			cout<<"Yes"<<endl;
		}
		else cout<<"No"<<endl;
	}
}

Measured memory_bytes: 3616
n, q = list(map(int, input().split(" ")))
a = []
b = []
tree = []

class Node:
    def __init__(self, id):
        self.id = id
        self.counter = 0
        self.linked = []

    def add_node(self, node):
        self.linked.append(node)

    def add_count(self, count):
        self.counter += count

# make node
for i in range(n):
    tree.append(Node(i))

# add node
for i in range(n-1):
    j, k = list(map(int, input().split(" ")))
    tree[j-1].add_node(tree[k-1])

# add count
for i in range(q):
    j, k = list(map(int, input().split(" ")))
    tree[j-1].add_count(k)

# traverse
for i in tree:
    for j in i.linked:
        j.counter += i.counter

m = []
for i in tree:
    m.append(i.counter)

print(" ".join(map(str, m)))


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

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

  int count = 0;
  rep(i, k){
    rep(j, k){
      int l = s - (i + j);
      if (l >= 0 && l <= k){
        ++count;
      }
    }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long &x, long long &y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a%b, y, x);
	y -= a / b * x;
	return d;
}

bool check(llint a, llint b) {
	return a > b;
}

int main() {
	llint a, b, c, d;
	cin >> a >> b >> c >> d;
	llint n;
	cin >> n;
	llint ans = 0;
	if (d < 2 * c) {
		if (d < 4 * b) {
			if (d < 8 * a) {
				ans += n / 2 * d;
				n %= 2;
			}
		}
	}
	if (c < 2 * b) {
		if (c < 4 * a) {
			ans += n*c;
			n %= 1;
		}
	}
	if (b < 2 * a) {
		ans += n * 2 * b;
		n %= 1;
	}
	ans += n * 4 * a;
	n %= 1;
	cout << ans << endl;
	return 0;
}

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

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
ld EPS = 1e-12;
int INF = numeric_limits<int>::max() / 2;
ll LINF = numeric_limits<ll>::max() / 2;
int MOD = 1e9 + 7;
#define rep(i,n) for(int i = 0; i < n; i++)
#define all(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'

vector<vector<pair<int, int> > > edge;//edge[i][j] firstがiからj番目のノード、secondがその重み
vector<int> d(100005,INF);

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,k;
	cin >> n >> k;
	ll ans = 0;
	for(int b = 1; b <= n; b++){
		int p = n/b;
		int r = n%b;
		ans += p * max(0, b-k) + max(0, r - k + 1);
	}
	if(k == 0) ans -= n;
	cout << ans << endl;
}

Measured memory_bytes: 640
N = int(input())
def sup(N):
    indexa = 1
    sum = 0
    while True:
        sum += indexa
        if sum >= N:
            return indexa
        indexa +=1
ans = []
while True:
    k = sup(N)
    ans.append(k)
    N -=k
    if N == 0:
        break
ans.reverse()
n = len(ans)
for i in range(n):
    print(ans[i])

Measured memory_bytes: 3660
N, M = map(int, input().split())
p = dict()
ac = dict()
ans, penalty = 0, 0
for _ in range(M):
  tmp = input().split()
  if tmp[0] in ac:
    continue
  if tmp[1] == 'AC':
    ans += 1
    ac[tmp[0]] = 1
    penalty += p.get(tmp[0], 0)
  else:
    p[tmp[0]] = p.get(tmp[0], 0) + 1
print(ans, penalty)


Measured memory_bytes: 21856
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
void solve() {
	//water
	int a; cin >> a;
	int b; cin >> b;
	//sugar
	int c; cin >> c;
	int d; cin >> d;
	//limit
	int e; cin >> e;
	int f; cin >> f;
	int T = -1;
	int S = 0;
	//100g水を入れる回数(操作1)
	for (int w = 0; 100 * w <= f; w += a) {
		//200g水を入れる回数(操作2)
		for (int x = 0; 100 * (w + x) <= f; x += b) {
			//砂糖をc[g]入れる回数(操作3)
			for (int y = 0; 100 * (w + x) + y <= f; y += c) {
				//砂糖をd[g]入れる回数(操作4)
				//操作1～4の結果f[g]以下となっている物のみ計算を行う
				for (int z = 0; 100 * (w + x) + y + z <= f; z += d) {
					//砂糖の重さ
					int s = y + z;
					//全体の重さ
					int t = 100 * (w + x) + s;
					//砂糖の重さがe[g]以下かつ
					//(前回の砂糖の質量 * 今回の砂糖水の質量 < 今回の砂糖の質量 * 前回の砂糖水の質量)
					//の場合は今回の作成した砂糖水の濃度が前回より高い
					if (s <= (w + x)*e && t > 0 && (T < 0 || S * t < s * T)) {
						S = s;
						T = t;
					}
				}
			}
		}
	}	
	cout << T << ' ' << S << endl;
	return;
}

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

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

int main(){
  vector<pair<int,bitset<1> > >A(9);
  for(int i=0;i<9;i++){
    int a;
    cin >> a;
    A.at(i)=make_pair(a,0);
  }

  int N;
  cin >> N;
  for(int i=0;i<N;i++){
    int b;
    cin >> b;
    for(int j=0;j<9;j++){
      if(A.at(j).first==b){
        A.at(j).second.set();
      }
    }
  }
  if((A.at(0).second==1 && A.at(1).second==1 && A.at(2).second==1)
    ||(A.at(3).second==1 && A.at(4).second==1 && A.at(5).second==1)
    ||(A.at(6).second==1 && A.at(7).second==1 && A.at(8).second==1)
    ||(A.at(0).second==1 && A.at(3).second==1 && A.at(6).second==1)
    ||(A.at(1).second==1 && A.at(4).second==1 && A.at(7).second==1)
    ||(A.at(2).second==1 && A.at(5).second==1 && A.at(8).second==1)
    ||(A.at(0).second==1 && A.at(4).second==1 && A.at(8).second==1)
    ||(A.at(2).second==1 && A.at(4).second==1 && A.at(6).second==1)){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
long double EPS=1E-8;
////////////////////////////////////////

int main(){
    ll n;cin>>n;
    map<string ,int>m;
    rep(i,0,n-1){
        string s;cin>>s;
        auto ite=m.find(s);
        if(ite==m.end()){
            m.insert(make_pair(s,1));
        }else{
            (ite->second)++;
        }
    }
    ll k;cin>>k;
    while(k--){
        string s;cin>>s;
        auto ite=m.find(s);
        if(ite==m.end()){
            m.insert(make_pair(s,-1));
        }else{
            (ite->second)--;
        }
    }
    ll ans=0;
    for(auto x:m){
        Max(ans,x.second);
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
const int inf=0x3f3f3f3f;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    int n,x,t;
    cin>>n>>x>>t;
    int xx=n/x;
    if(n%x!=0)
    	xx++;
    cout<<xx*t<<endl;
	return 0;
}


Measured memory_bytes: 3624
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        #[allow(unused_mut)]
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

fn main() {
    // N 両編成の列車があります。 この列車の前から i 両目は、後ろから何両目でしょうか？
    // 1 ≤ N ≤ 100
    // 1 ≤ i ≤ N
    input! {
        n: usize,
        i: usize,
    }

    println!("{}", n - i + 1);
}


Measured memory_bytes: 4352
#include <stdio.h>
  
int main() {
   int n, i, j, l, k, s, p[100], m[100][100];
   scanf("%d", &n);
 
   for ( i = 0; i < n; i++) {
      scanf("%d %d", &p[i], &p[i+1]);
   }
   for(i = 1; i <= n; i++){
      m[i][i] = 0;
   }
 
   for( l = 2; l <= n; l++ ) {
      for ( i = 1; i <= n - l + 1; i++ ) {
         j = i + l - 1;
         m[i][j] = m[i][i] + m[i+1][j] + p[i-1]*p[i]*p[j];
         for ( k = i + 1; k <= j - 1; k++){
            s = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
            if ( m[i][j] > s )
               m[i][j] = s;
         }
      }
   }

   printf("%d\n", m[1][n]);

   return 0;
}

Measured memory_bytes: 1888
#include<cstdio>

int main(){
	char str[20];
	char c;
	int i = -1;
	scanf("%c", &c);
	while(c - 10){
		i++;
		str[i] = c;
		scanf("%c", &c);
	}
	for(; i >= 0; i--){
		printf("%c", str[i]);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 932
import sys

input=sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))

sgn=0
count=1
for i in range(1,N):
    if sgn==0:
        if A[i]>A[i-1]:
            sgn=1
        elif A[i]<A[i-1]:
            sgn=-1
    elif sgn==1:
        if A[i]<A[i-1]:
            count+=1
            sgn=0
    else:
        if A[i]>A[i-1]:
            count+=1
            sgn=0
print(count)


Measured memory_bytes: 58864
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAXN 200005
#define LL long long
char s[MAXN];
int main()
{
	scanf("%s",s);
	int len=strlen(s);
	int ss=0,sum=0;
	for(int i=0;i<len;i++)
	{
		if(s[i]=='S') ss++;
		else if(s[i]=='T'&&ss) sum+=2,ss--;
	}
	printf("%d\n",len-sum);
}

Measured memory_bytes: 384
from copy import deepcopy
n = int(input())
eff = [list(map(int, input().split())) for _ in range(n)]

dp = [[float('-inf')] * 3 for _ in range(n)]

dp[0] = deepcopy(eff[0])

for i in range(1, n):
    for yi in range(3):
        for ti in range(3):
            if yi != ti:
                dp[i][ti] = max(dp[i][ti], dp[i-1][yi] + eff[i][ti])

print(max(dp[-1]))

Measured memory_bytes: 84568
#include <bits/stdc++.h>
using namespace std;
using ll = long long;


int main(){
	int k, a, b;
	cin >> k >> a >> b;
	for(int i = a; i<=b; i++) {
		if (i%k == 0){
			puts("OK");
			return 0;
		}
	}
	puts("NG");
	return 0;
}

Measured memory_bytes: 3628
import static java.util.Comparator.comparing;

import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ==========================================================
    public void solve() {
    	int N = ni();
    	int[] P = ndi(N);
    	int sv = 1000000000;
    	int ans = 0;
    	for (int i = 0; i < N; i++) {
    		if(P[i] <= sv) {
    			ans++;
    			sv = P[i];
    		}
		}
    	out.println(ans);
    }
    // Set に入れるなら　PPKEY　を使う！
    static class PP{
    	public int key, val;
    	public PP(int key, int val) {
    		this.key = key;
    		this.val = val;
    	}
		public int getKey() {
			return key;
		}
		public void setKey(int key) {
			this.key = key;
		}
		public int getVal() {
			return val;
		}
		public void setVal(int val) {
			this.val = val;
		}
    }
    // ------------------------------------------
    // 入力
    // ------------------------------------------
    public int ni() {
    	return sc.nextInt();
    }
    public long nl() {
    	return sc.nextLong();
    }
    public String ns() {
    	return sc.next();
    }
    public char[] nc() {
    	return sc.next().toCharArray();
    }
    public int[] ndi(int N) {
    	int[] ans = new int[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ni();
		}
    	return ans;
    }
    public long[] ndl(int N) {
    	long[] ans = new long[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = nl();
		}
    	return ans;
    }
    public String[] nds(int N) {
    	String[] ans = new String[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ns();
		}
    	return ans;
    }
    public char[][] ndc(int N) {
    	char[][] ans = new char[N][];
    	for (int i = 0; i < N; i++) {
			ans[i] = nc();
		}
    	return ans;
    }
    public int[][] nddi(int N, int S) {
    	int[][] ans = new int[N][S];
    	for (int i = 0; i < N; i++) {
			for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			}
		}
    	return ans;
    }
}


Measured memory_bytes: 84672
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<string.h>
#include <iomanip>
#include <sstream>
using namespace std;
 
//最大公約数を求める
long long gcd(long long a, long long b){
  if(b == 0){
    return a;
  }
  return gcd(b, a%b);
}
 
//最小公倍数を求める
long long lcm(long long a, long long b){
  return a*b/gcd(b, a%b);
}
 
int main() {
  long long A, B;
  long long ans = 1;
 
  cin >> A >> B;
 
  long long maxKY = gcd(A,B); 
  long long lasti= 0;

	long long num = maxKY; // 最大公約数を素因数分解する>num 

	for (long long i = 2; i*i <= maxKY; i++) {
		while (num%i == 0) { //素数で割れる間はループ
      if(lasti == 0){
        ans++;//既出でない素数ならカウント
      }
			num /= i;
      lasti=i;//既出カウント
		}
    lasti=0;//既出カウントリセット
	}

  if(num != 1){
    //素数で割り切ったあまりが1でなければカウント
    ans++;
  }  

  cout << ans << endl;
}
 

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

long long mod=998244353;
long long fact[300010];
long long res[300010];
long long poww(long long x,long long n)
{
	if(n==0) return 1;
	else if(n==1) return x;
	else
	{
		long long sum=poww(x,n/2);
		sum=sum*sum;
		sum=sum%mod;
		if(n%2!=0)
		sum=sum*x;
		sum=sum%mod;
		return sum;
	}
}
long long C(long long k,long long n)
{
	return (((fact[n]*res[k]) % mod) * res[n-k]) % mod;
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	long long n,a,b,k;
	cin >> n >> a >> b >> k;
	fact[0]=1,res[0]=1;
    for(long long i=1;i<=n;i++)
	{
		fact[i]=fact[i-1]*i;
		fact[i]=fact[i]%mod;
		res[i]=poww(fact[i],mod-2);
		res[i]=res[i]%mod;
	}
	long long ans=0;
	for(long long i=0;i<=n;i++)
	{
		if((k-a*i)%b==0 && (k-a*i)>=0)
		{
			long long t=(k-a*i)/b;
			if(t<=n)
			{
			ans+=(C(t,n) * C(i,n))%mod;
			ans=ans%mod;
		    }
		}
	}
	cout << ans << "\n";
}


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


int main() {
  int N;
  
  int ans = 0;
  cin >> N;

  for(int i=1;i<N;++i){
    for(int j=1;j<N;++j){
      if(i*j < N){
        ans++;
      }else{
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

#pragma GCC optimize("O3")
using namespace std;
#define ll long long
#define ull unsigned long long
#define rep(i,n,N) for(ll i=n;i<=N;++i)
#define rap(i,n,N) for(ll i=n;i>=N;--i)
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define ff fi.fi
#define fs fi.se
#define sf se.fi
#define ss se.se
#define lc (id<<1)
#define rc ((id<<1)|1)
#define db(x) cout << ">>>>>> " << #x << " -> " << x << endl;
#define all(x) x.begin(),x.end()
#define pii pair<int,int> 
#define pll pair<ll,ll>
#define piii pair<int,pii>
#define piiii pair<pii,pii>
#define psi pair<string,int>
#define endl "\n"
const int MAX = 3e5+5;
const ll MAX2 = 11;
const ll MOD = 1000004119;
const ll INF = 2e18;
const int dr[]={1,0,-1,0,1,1,-1,-1,0};
const int dc[]={0,1,0,-1,1,-1,1,-1,0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 450;

ll n,hs[MAX],hst[MAX],z,le,ri,m1,m2,ans,a,b;// z = key hashing
string s;
set<ll> st;

int main(){
//	cout<<fixed<<setprecision(15);
//    freopen("input.txt", "r", stdin);
//	freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    z = 1000003601;
    cin>>s;
    hst[0] = 1;
    for(auto i:s){
    	++n;
    	hs[n] = (hs[n-1]*z+i);
    	hst[n] = (hst[n-1]*z);
	}
    le = 1, ri = n;
    while(ri-le>10){
    	m1 = (le+le+ri)/3;
    	m2 = (le+ri+ri)/3;
    	st.clear();
    	rep(i,m1,n)st.insert(((hs[i]-hs[i-m1]*hst[m1])));
    	a = st.size();
    	st.clear();
    	rep(i,m2,n)st.insert(((hs[i]-hs[i-m2]*hst[m2])));
    	b = st.size();
    	if(a<b)le = m1+1;
    	else ri = m2-1;
    	ans = max(ans,max(a,b));
//    	cout<<m1<<" = "<<a<<endl;
//    	cout<<m2<<" = "<<b<<endl;
	}
//	cout<<hs[1]<<' '<<((hs[2]-hs[1]*z)%MOD+MOD)%MOD<<endl;
	rep(k,le,ri){
    	st.clear();
    	rep(i,k,n)st.insert(((hs[i]-hs[i-k]*hst[k])));
    	ans = max(ans,(ll)st.size());
//    	cout<<k<<" = "<<st.size()<<endl;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 8912
#include<iostream>
#include<vector>
using namespace std;
int partition(vector<int>& A, int p, int r)
{
    int x = A[r];
    int i = p - 1;
    for (int j = p; j < r; j++)
    {
        if (A[j] <= x)
        {
            i++;
            swap(A[i], A[j]);
        }
    }
    swap(A[i + 1], A[r]);
    return i + 1;
}
int main()
{
	int n; cin >> n;
    vector<int> A(n);
    for(int i = 0; i < n; i++) cin >> A[i];
    int basis = partition(A, 0, n - 1);
    for (int i = 0; i < n; i++)
    {
        if(i) cout << " ";
        if(i == basis) cout << "[" << A[i] << "]";
        else cout << A[i];
    }
    cout << "\n";
    return 0;
}



Measured memory_bytes: 3096
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

r = int(input())

if r < 1200:
    print("ABC")
elif r < 2800:
    print("ARC")
else:
    print("AGC")

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

int main() {
	int n; cin >> n;
	vector<int>a1(n), a2(n);
	for (auto&& x : a1)cin >> x;
	for (auto&& x : a2)cin >> x;

	for (int i = 0; i < n - 1; i++)a1[i + 1] += a1[i];
	for (int i = 0; i < n - 1; i++)a2[i + 1] += a2[i];

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

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[550][550];

int main(){
  cin >> n >> m >> l;
  if(n + m >= l)puts("Yes");
  else puts("No");
  return 0;
}


Measured memory_bytes: 256