akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";

using namespace std;
const ll maxn = 300000;
ll tree[4*maxn + 20];
ll query(ll node,ll st,ll en,ll le,ll re)
{
	if(le > en or re < st) return 0;
	if(le <= st and en<=re) return tree[node];
	if(st==le && en==re) return tree[node];
	ll mid = (st + en)/2;
	return max(query(2*node ,st,mid,le,re),query(2*node + 1,mid+1,en,le,re));

}
void update(ll node,ll st,ll en,ll idx,ll val)
{
	if(st==en)
	{
		tree[node] = max(val,tree[node]);
		return;
	}
	
	ll mid = (st+en)/2;
	if(idx<=mid) update(2*node,st,mid,idx,val);
	else update(2*node + 1,mid+1,en,idx,val);

	tree[node] = max(tree[2*node],tree[2*node + 1]);
	
}
signed main()
{
    fast;
   
    ll n,k,i,j;
    cin>>n>>k;
    for(i=0;i<n;i++)
    {
    	ll x;
    	cin>>x;
    	ll pmi = max(0LL, x-k);
    	ll pma = min(maxn,x+k);
    	ll num = query(1LL,0LL,maxn,pmi,pma);
    	update(1LL,0LL,maxn,x,num+1);
    }
    ll ans = query(1LL,0LL,maxn,0LL,maxn);
    
    cout<<ans;
    
}

Measured memory_bytes: 11792
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int main(){
	string s;
	string ss;
	cin >> s;
	VS S;
	REP(i,s.length()){
		if(s[i]=='B'){
			if(S.size()>0){
				S.pop_back();
			}
		}
		else{
			ss = s[i];
			S.PB(ss);
		}

	}
	REP(i,S.size()){
		cout << S[i];
	}
	cout << endl;
	return 0;
}



Measured memory_bytes: 256
import queue

N = int(input())
E = {n: set() for n in range(N)}

for _ in range(N - 1):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    E[a].add((b, c))
    E[b].add((a, c))

Q, K = map(int, input().split())
K -= 1
dist = [-1] * N
already = set()
que = queue.Queue()
que.put((K, 0))
while not que.empty():
    now, d = que.get()
    already.add(now)
    dist[now] = d
    out = E[now]
    for n, c in out:
        if n in already:
            continue
        que.put((n, d + c))

for _ in range(Q):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    print(dist[x] + dist[y])


Measured memory_bytes: 109720
#include <stdio.h>

int main(){
  int N,M,S=0;
  scanf("%d %d",&N,&M);
  int F[200000];
  for(int i=0;i<=N;i++)
    F[i]=0;
  int L,R;
  for(int i=1;i<=M;i++){
    scanf("%d %d",&L,&R);
    F[L]++;
    F[R+1]--;
  }
  for(int i=1;i<=N;i++){
    F[i]+=F[i-1];
    if(F[i]==M) S++;
  }
  printf("%d\n",S);
  return 0;
}

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

#define LL long long
#define pii pair<int,int>
using namespace std;
const int inf = 2147483647;

int _max(int x, int y) {return x > y ? x : y;}
int _min(int x, int y) {return x < y ? x : y;}
inline int read() {
    int x = 0, f = 1; char ch = getchar();
    while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
    while(ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
    return x * f;
}
void put(int x) {
	if(x < 0) putchar('-'), x = -x;
	if(x >= 10) put(x / 10);
	putchar(x % 10 + '0');
}

int main() {
	int n = read(), m = read(), a = read(), b = read();
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) putchar(((i <= b) ^ (j <= a)) + '0');
		puts("");
	}
	return 0;
}


Measured memory_bytes: 1280
nums = input().split()
a = int(nums[0])
b = int(nums[1])
c = int(nums[2])
  
if a > b:
    tmp = a
    a = b
    b = tmp
if b > c:
    tmp = b
    b = c
    c = tmp
if a > b:
    tmp = a
    a = b
    b = tmp
  
print(a, b, c)

Measured memory_bytes: 7640
//#pragma warning(disable:4996)
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>
//#include <stdio.h>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9+7;
const long long INF = 1e15;
typedef long long LL;
typedef long double LD;
//typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<int, int> PI;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef unsigned long long ULL;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int L, R, D;
	cin >> L >> R >> D;
	int ans = 0;
	for (int n = L; n <= R; n++) {
		if (n % D == 0)ans++;
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 3180
import java.util.Arrays;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int abc[]=new int[3];
		for(int i=0;i<3;i++)abc[i]=scan.nextInt();
		scan.close();
		int cnt=0;
		Arrays.sort(abc);
		cnt = (abc[2]-abc[1]);
		cnt += ((abc[2]-(abc[0] + cnt))%2==0)?  (abc[2]-(abc[0] + cnt))/2 : (abc[2]-(abc[0] + cnt))/2+2;
		System.out.println(cnt);
	}
}

Measured memory_bytes: 22996
N, A, B = [int(y) for y in input().split(' ')]
count = N // (A+B)
residue = N % (A+B)
 
if A == 0:
  print(0)
elif residue > A:
  print(count*A + A)
elif residue > 0:
  print(count*A + residue)
else:
  print(count*A)

Measured memory_bytes: 3060
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)

a.sort!

break_i = 0
i = 0
while i < n-1 do
  if a[i+1] <= 0
    a[i] *= -1
    a[i+1] *= -1
  else
    break_i = i
    break
  end
  i += 2
  # p a
end

if n.odd?

end

ans = a.inject(&:+)
a[break_i] *= -1
a[break_i+1] *= -1
ans = [ans, a.inject(&:+)].max


puts ans


Measured memory_bytes: 10548
import java.util.*;

public class Main{
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int n = sc.nextInt();
			int w = sc.nextInt();
			
			int [] count = new int[n + 1];
			StringBuilder ans = new StringBuilder();
			for(int i = 1; i <= w; i++){
				for(int j = 1; j * j <= i; j++){
					if(i % j == 0){
						count[j]++;
						if(i / j != j){
							count[i / j]++;
						}
					}
				}
			}
			int nowcount = 0;
			for(int j = 0; j <= n; j++){
				if(count[j] >= 1){
					nowcount++;
				}
			}
			ans.append(" " + nowcount);
			
			for(int i = 1; i <= n - w; i++){
				for(int j = 1; j * j <= i; j++){
					if(i % j == 0){
						count[j]--;
						if(j == i){
							if(count[j] <= 1) nowcount--;
						}
						else{
							if(count[j] == 1)nowcount--;
						}
						if(i / j != j){
							count[i / j]--;
							if(j == 1){
								if(count[i / j] <= 1) nowcount--;
							}
							else{
								if(count[i / j] == 1) nowcount--;
							}
						}
					}
				}
				int num = i + w;
				for(int j = 1; j * j <= num; j++){
					if(num % j == 0){
						count[j]++;
						if(j <= i){
							if(count[j] == 2)nowcount++;
						}
						else{
							if(count[j] == 1)nowcount++;
						}
						if(num / j != j){
							count[num / j]++;
							if(num / j <= i){
								if(count[num / j] == 2)nowcount++;
							}
							else{
								if(count[num / j] == 1)nowcount++;
							}
						}
						
					}
				}
				ans.append(" " + nowcount);
			}
			System.out.println(ans.substring(1));
		}
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}
}

Measured memory_bytes: 39176
#include <stdio.h>

int main(){
	int money[6] = {1, 5, 10, 50, 100, 500}, i, m, total = 0;
	for (i = 0; i < 6; i++){
		scanf("%d", &m);
		total += m*money[i];
	}
	if (total/1000 >= 1)
		printf("1\n");
	else
		printf("0\n");
	return 0;
}

Measured memory_bytes: 584
#include <cstdio>
using namespace std;


int main()
{
    long long int x;

    scanf("%lld", &x);

    long long int counter = 0;

    counter = x / 11;
    counter *= 2;
    if (x % 11 == 0) {
        counter = counter;
    } else if (x % 11 < 7) {
        counter += 1;
    } else {
        counter += 2;
    }

    printf("%lld\n", counter);
}


Measured memory_bytes: 128
#define ll long long int
#include <bits/stdc++.h>
//#include <fstream>
using namespace std;
 
#define         ff               first
#define         ss               second
#define         mp               make_pair
#define         pb               push_back
#define         pf               push_front
#define         vi               vector<ll>
#define         pii              pair<ll,ll>
#define         qi               queue<ll>
#define         mem(a,b)         memset(a,b,sizeof(a))
#define         print(a)         cout<<a<<'\n'
#define         sorted(arr)      sort(arr.begin(),arr.end())
#define         gcd(a,b)         gcd((a),(b))
#define         lcm(a,b)         ((a)*(b))/gcd((a),(b))
#define         all(v)           v.begin(),v.end()
#define         read(a)          scanf("%d", &a)
#define         f(a,n)           for(ll i=a;i<n;i++)
#define         in2(n,m,arr)     for(ll i=0;i<n;i++){for(ll j=0;j<m;j++)cin>>arr[i][j];}
#define         debug(a)         cerr<<a<<" ";
#define         debug1(a)        cerr<<a<<'\n'
 
/*typedef tree<int, null_type, less<int>, rb_tree_tag , tree_order_statistics_node_update> Set;*/
 
 
const unsigned ll mod = 1e9 + 7 ;
const ll inf = (ll)1e18 + 2;
const ll N = (ll)1e6 + 2;
 
//template<typename... T>
//void write(T&... args)
//{
//    ((cout << args << ' '), ...);
//}
ll power ( ll x , ll y)
{
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) ;
        y = y >> 1;
        x = (x * x) ;
    }
    return res  ;
}

//struct node{
//    ll x , y , z;
//};
//map<pair<ll, ll>,ll> c;
//vector<set<ll>> tree;
//vector<ll> ar ;
//set<ll> s;
//ll get(ll x)
//{
//    if(x == ar[x])
//        return x;
//    return ar[x] = get(ar[x]);
//}
//void merge(ll a ,ll b)
//{
//    a = get(a);
//    b = get(b);
//    if(a == b)
//    {
//        return ;
//    }
//    ar[b] = ar[a];
//    //ans[a] += ans[b];
//    //return true;
// }
//
//ll sev[100006];
//vector<ll> pri;
//void seive()
//{
//    for(ll i = 2 ; i < 100006 ; i ++)
//    {
//        if(!sev[i])
//        {
//            for(ll j = i ; j < 100006 ; j += i)
//            {
//                if(!sev[j])
//                    sev[j] = i;
//            }
//        }
//        if(sev[i] == i)
//            pri.pb(i);
//    }
//}

void solve()
{
    ll n;
    cin >> n;
    ll m = 0;
    while(n != 0)
        m ++ , n /= 2;
    ll ans = power(2 , m);
    ans -= 1;
    cout << ans << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t ;
    t = 1;
    //cin >> t;
    //seive();
    while(t --)
    {
        solve();
    }
    //cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}
 


Measured memory_bytes: 256
n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
h = Hash.new(0)
a.each do |x|
  h[x] += 1
end
ans = 0
i = 0
h.sort_by{|key, v| -v}.each do |key, v|
  i += 1
  ans += v if i > k
end
puts ans

Measured memory_bytes: 41728
#include "bits/stdc++.h"

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back

using namespace std;

// #define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline void chmax(T& a,T const& b){a=max(a,b);}
template<class T> inline void chmin(T& a,T const& b){a=min(a,b);}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<60; 

struct UnionFindTree{
  vector<int> par,rank,size;
  UnionFindTree(int N){
    par = rank = vector<int>(N,0);
    size = vector<int>(N,1);
    for(int i = 0; i < N; i++) par[i] = i;
  }
  int find(int x){
    if(par[x] == x) return x;
    else return par[x] = find(par[x]);
  }
  void unite(int x,int y){
    x = find(x);
    y = find(y);
    if(x == y)  return ;
    if(rank[x] < rank[y]){
      par[x] = y;
    }else{
      par[y] = x;
      if(rank[x] == rank[y]) ++rank[x];
    }
    size[x] = size[y] = size[x] + size[y];
  }
  bool same(int x,int y){
    return find(x) == find(y);
  }
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,M; cin >> N >> M;
  vi p(N); rep(i,N) cin >> p[i];
  UnionFindTree uft(N);
  rep(i,M){
    int a,b; cin >> a >> b; a--; b--;
    uft.unite(a,b);
  }
  int ans = 0;
  rep(i,N){
    if(uft.same(i,p[i]-1)) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
X,Y,A,B,C=map(int,input().split())
P=sorted(list(map(int,input().split())),reverse=True)[:X]  #赤、A
Q=sorted(list(map(int,input().split())),reverse=True)[:Y]  #緑、B
R=sorted(list(map(int,input().split())))  #無、C

L=P+Q+R
L.sort(reverse=True)
print(sum(L[:X+Y]))

Measured memory_bytes: 22504
main::IO()
main=do
  abc<-getLine
  let a:b:[]=map read (words abc) ::[Int]
  print (length ((filter (\x->iscyc (show x)) [a..b]) ))

iscyc::String->Bool
iscyc (a:b:c:d:e:[])=(a==e) && (b==d)

Measured memory_bytes: 892
#include<iostream>
using namespace std;
int n,m,c,b[20];
main()
{
	int cnt=0;
	cin>>n>>m>>c;
	for(int i=0;i<m;i++)cin>>b[i];
	for(int i=0;i<n;i++)
	{
		int sum=c;
		for(int j=0;j<m;j++)
		{
			int a;cin>>a;
			sum+=a*b[j];
		}
		cnt+=sum>0;
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    // 1. 差分が t の差以下か？
    // 2. ステップ３　差分が 1 ->  ステップ - 差分  % 2 == 0 だったら移動できる

    var (prevT, prevX, prevY) = listOf(0, 0, 0)
    var n = readLine()!!.toInt()
    for (i in 1..n) {
        val (nextT, nextX, nextY) = readLine()!!.split(" ").map { it.toInt() }

        val diffT = nextT - prevT
        val distance = abs(nextX - prevX) + abs(nextY - prevY)

        if (diffT - distance < 0 || (diffT - distance) % 2 == 1){
            print("No")
            return
        }
    }
    print("Yes")
}

fun abs(num: Int): Int{
    if (num >= 0) return num
    return -1 * num
}


Measured memory_bytes: 55040
#include <stdio.h>
int prime(int a){
  int j;
  if(a< 2) return 0;
  if(a == 2) return 1;
  if(a % 2 == 0) return 0;
  for(j = 3;j * j <= a;j+= 2)
    if(a% j== 0) return 0;
 
  return 1;
}
 
int main(){
  int   i,n,x,c= 0;
  scanf("%d", &n);
  for(i = 0;i < n;i++){
    scanf("%d", &x);
    c += prime(x);
  }
  printf("%d\n", c);
  return 0;
}



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

typedef long long ll;
typedef unsigned long long llu;

int main(int argc, char *argv[]) {
  string x, y;
  cin >> x >> y;

  map<char, ll> m;
  m['A'] = 10;
  m['B'] = 11;
  m['C'] = 12;
  m['D'] = 13;
  m['E'] = 14;
  m['F'] = 15;

  if (m[x[0]] > m[y[0]]) {
    cout << ">" << endl;
  } else if (m[x[0]] < m[y[0]])  {
    cout << "<" << endl;
  } else {
    cout << "=" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll H, W;

    cin >> H >> W;
    if(H==1 || W==1){
        cout << 1 << endl;
    }

    else if(H%2==0 || W%2==0){
        cout << H*W/2 << endl;
    }
    else{
        cout << H*W/2+1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  if(s=="Sunny"){
    cout<<"Cloudy"<<endl;
  }
  else if (s=="Cloudy"){
    cout<<"Rainy"<<endl;;
  }
  else{
    cout<<"Sunny"<<endl;;
  }
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.StringTokenizer;
import java.util.TreeSet;

import javax.swing.*;

import static java.util.Arrays.binarySearch;
import static java.util.Arrays.copyOfRange;
import static java.util.Arrays.sort;

public class Main {

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;

        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {

    private static int mod = 998244353;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        long A = in.nextLong();
        long B = in.nextLong();
        long n = in.nextLong();
        // x = p B + q  q < B
        // Ap + Aq / B - Ap =  Aq / B
        out.println(A * get(B, n) / B);
    }

    private long get(long b, long n) {
        if (n < b) {
            return n;
        }
        return b - 1;
    }

}

class InputReader {

    private final BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

}


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

template <
    typename TYPE,
    std::size_t SIZE>
std::size_t a_len(const TYPE (&array)[SIZE])
{
    return SIZE;
}

using namespace std;
using ll = long long int;
using vi = vector<ll>;

#define REPS(a, i, n) for (ll(i) = a; (i) < (n); ++(i))
#define REP(i, n) REPS(0, i, n)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 912345678;

int a, b, c;

int main()
{
    cin >> a >> b >> c;
    vi k;
    k.push_back(a);
    k.push_back(b);
    k.push_back(c);

    sort(ALL(k));
    cout << k[2] * 10 + k[0] + k[1] << endl;
}

Measured memory_bytes: 256
N = int(input())

result = []
sieve = [0] * (55555  + 1)
sieve[0] = -1
sieve[1] = -1
for i in range(2, 55555 + 1):
    if sieve[i] != 0:
        continue
    if i % 5 == 1:
        result.append(i)
        if len(result) == N:
            break
    sieve[i] = i
    for j in range(i * i, 55555 + 1, i):
        if sieve[j] == 0:
            sieve[j] = i
print(*result)


Measured memory_bytes: 3444
n,m=list(map(int,input().split()))
M=[list(map(int,input().split())) for _ in range(m)]
M.sort(key=lambda X: X[0])
start,end=0,n+1
ans=0

for i in range(m):
  if M[i][0] >= end:
    ans += 1
    start,end=0,n+1
  if M[i][0] > start:
    start=M[i][0]
  if M[i][1] < end:
    end = M[i][1] 
if start != 0 and end != n+1:
  ans += 1 
print(ans)

Measured memory_bytes: 29152
import itertools,sys
def f(a):
 if len(a)<2:yield(a[0],a[0])
 for i in range(1,len(a)):
  for p,s in f(a[:i]):
   for q,t in f(a[i:]):
    yield(p+q,f'({s} + {t})')
    yield(p-q,f'({s} - {t})')
    yield(p*q,f'({s} * {t})')
def s(a):
 for p in itertools.permutations(a):
  for n,s in f(p):
   if n==10:print(s);return 1
for e in sys.stdin:
 a=list(map(int,e.split()))
 if sum(a)and not s(a):print(0)


Measured memory_bytes: 5656
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
using ll = long long;

int main(){
	ios_base::sync_with_stdio(false);
	ll n, m;
	cin >> n >> m;
	string s, t;
	cin >> s >> t;
	const ll k = n / __gcd(n, m) * m;
	bool answer = true;
	for(ll i = 0; i < n; ++i){
		const ll p = i * k / n;
		if(p * m % k == 0){
			const ll j = p * m / k;
			if(s[i] != t[j]){ answer = false; }
		}
	}
	cout << (answer ? k : -1) << endl;
	return 0;
}



Measured memory_bytes: 640
#include <stdio.h>
int main(void){
    int p[10001]={},d1[10001]={},d2[10001]={},d[10000]={};
    int i,n,max,maxnum=0;
    
    while(1){
        scanf("%d",&n);
        if(n==0)break;
        
        for(i=1;i<=n;i++){
            scanf("%d %d %d",&p[i],&d1[i],&d2[i]);
            d[i]=d1[i]+d2[i];
        }
        max=0;
        
        for(i=1;i<=n;i++){
            if(max<d[i]){
                max=d[i];
                maxnum=p[i];
            }
        }
        
        printf("%d %d\n",maxnum,max);
    }
    return 0;
}

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

const int maxn = 1e5 + 10;
int H, W, n, a[maxn], g[105][105];

void Solve(int w, int x, int y, int f)
{
	if (w > n) return;
	int num = a[w];
	if (f)
	{
		if (num <= y + 1)
		{
			for (int i = y; i >= y - num + 1; i --) g[x][i] = w;
			y -= num;
			return Solve(w + 1, x + (y == -1), (y + W) % W, 1);
		}
		else
		{
			for (int i = y; i >= 0; i --) g[x][i] = w;
			num -= y + 1;
			for (int i = 0; i < num; i ++) g[x + 1 + i / W][i % W] = w;
			return Solve(w + 1, x + 1 + num / W, num % W, 0);
		}
	}
	else
	{
		if (num <= W - y)
		{
			for (int i = y; i < num + y; i ++) g[x][i] = w;
			y += num;
			return Solve(w + 1, x + y / W, y % W, 0);
		}
		else
		{
			for (int i = y; i < W; i ++) g[x][i] = w;
			num -= W - y;
			for (int i = 0; i < num; i ++)
				g[x + 1 + i / W][W - i % W - 1] = w;
			return Solve(w + 1, x + 1 + num / W, W - num % W - 1, 1);
		}
	}
}

int main()
{
	cin >> H >> W >> n;
	for (int i = 1; i <= n; i ++) scanf("%d", &a[i]);
	int st = 0; Solve(1, 0, 0, 0);
	for (int i = 0; i < H; i ++)
		for (int j = 0; j < W; j ++)
			printf("%d%c", g[i][j], j == W - 1 ? 10 : 32);
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<string> vs;
const ll mod = 1e9+7;
const ll inf = 1e17;
const int INF = 1e9;
const double PI = acos(-1);
#define fo(i, a, b) for (int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(s) s.begin(), s.end()
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
int main()
{
  int n, x;
  cin >> n >> x;
  vi l(n);
  re(i, n) cin >> l[i];

  int cnt = 1, dis = 0;
  re(i, n) {
    dis += l[i];
    if(dis <= x) cnt++;
  }
  cout << cnt << endl;

  return 0;
}


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

using namespace std;

typedef long long LL;

int N;

multiset<int> tens_set;

int main() {
    cin >> N;
    
    LL a_num, num_sum = 0;
    
    for(int i = 0; i < N; i++) {
        cin >> a_num;
        num_sum += a_num;
        if (a_num % 10 != 0) {
            tens_set.insert(a_num);
        }
    }
    //cout << "n: " << num_sum % 10 << endl;
    
    if (num_sum % 10 != 0) {
        cout << num_sum << endl;
    } else if (tens_set.size() > 0) {
        cout << (num_sum - *(tens_set.begin())) << endl;
    } else {
        cout << "0" << endl;
    }
        
    return 0;
}


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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define AND(x,y,z) 
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')';cout<<endl
#define FOR(i,a,b) for (ll i=(ll)(a);i<(ll)(b);++i)
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)
#define YES(cond) cond ? OUT("YES") : OUT("NO")
#define Yes(cond) cond ? OUT("Yes") : OUT("No")

template<class T> T gcd(const T x,const T y){if(!y){return x;}return gcd(y,x%y);}
template<class T> T lcm(const T x,const T y){return x/gcd(x,y)*y;};
template<class T> T modpow(const T x,const T n,const T mod) {
  T res=1;while(n>0){if(n%2)res=res*x%mod;x=x*x%mod;n/=2;};return res;
}
template<class T> bool alltrue(const T &a){return all_of(ALL(a),[](bool x){return x;});}
template<class T> bool anytrue(const T &a){return any_of(ALL(a),[](bool x){return x;});}
template<class T> bool contain(const T &a,const T &b){for(auto x:b){if (a.find(x)==a.end()){return false;}}return true;}
template<class T> bool mmax(T &m,const T q){ if (m < q) {m = q; return true;} else return false; }
template<class T> bool mmin(T &m,const T q){ if (m > q) {m = q; return true;} else return false; }
template<class T> int siz(const T &a) {return (int)a.size();}
template<class T> set<T> devisers(T n) {
  set<T> res;for(T i=1;i<(T)sqrt(n)+1;i++){if(n%i==0){res.insert(i);res.insert(n/i);}}return res;
}
template<class T> void concat(T &a, const T &b){a.insert(a.end(),b.begin(),b.end());}
template<class T> void getand(const T &a,const T &b,T &c) {
  set_intersection(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}
template<class T> void getor(const T &a,const T &b,T &c) {
  set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}

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

const ll MOD=1e9+7;
const int MAX=1e5+100;

int main() {
  int N,A,B;cin>>N>>A>>B;
  OUT(min(N*A,B));

  return 0;
}


Measured memory_bytes: 256
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define sim template < class c
#define int long long
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << '\n'; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef tree< pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 1e6 + 10 ;
const ll INF = 1e18 + 10 ;
signed main(){
    fastio
    int n ;
    cin >> n ; 
    vector<int> v(n) ;
    set<int> s ; 
    vector<int> cnt(N) ;
    for(int &x : v) {
        cin >> x ; 
        s.insert(x) ; 
        cnt[x]++ ; 
    }
    int ans = 0 ;
    for(int i = 0; i < n; i++){
        if ( cnt[v[i]] > 1 ) continue ; 
        int &x = v[i]  ;
        if ( x == 1 ) {
            ans++ ; 
            continue ;
        }
        bool ok = true ;
        for(int i = 1; i * i <= x; i++){
            if ( x % i == 0 ){
                if ( s.count(i) ) {
                    ok = false; 
                    break ; 
                }
                if ( i == 1 ) continue ;
                if ( x / i != i ) {
                    debug() << imie(x / i) ; 
                    if ( s.count(x / i) ){
                        ok = false; 
                        break ;
                    }
                }
            }
        }
        if ( ok ) debug() << imie(x) ; 
        if ( ok ) ans++ ;
    }
    cout << ans << endl;
    return 0; 
}

Measured memory_bytes: 21908
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        if(500 * a >= b) System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 21844
/*
    g++ -std=c++14 -O2 -Wall a.cpp -o a && a
    g++ -std=c++14 -O2 -Wall a.cpp -o a && a < in.txt > out.txt
    */

//  io
#include <iostream>
//#include <fstream> //http://www.cplusplus.com/reference/fstream/fstream/
//#include <cstdio>
#include <iomanip> //http://www.cplusplus.com/reference/iomanip/
#include <limits>
//  util
#include <string>
#include <cstring>
#include <algorithm>
//#include <utility>
//#include <functional> //http://www.cplusplus.com/reference/functional/
//#include <cstdlib>
#include <cmath>
//#include <complex>
//#include <random>
//#include <bitset>
//  containers https://en.cppreference.com/w/cpp/container
#include <vector>
#include <queue>
#include <set>
//#include <map>
//#include <unordered_set>
//#include <unordered_map>
//  time
//#include <ctime>
//#include <chrono>
//                  https://en.cppreference.com/w/cpp/header/chrono
//                  http://www.cplusplus.com/reference/chrono/

using namespace std;
typedef vector<int> arri;
typedef vector<float> arrf;
typedef pair<int, int> pairi;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 0x7fffffffffffffff;
const ll infneg = -0x7fffffffffffffff;

//file input routed to stdinout
/*
    std::ifineam inFile("input.txt");
    std::ofineam outFile("output.txt");
    std::cin.rdbuf(inFile.rdbuf());
    std::cout.rdbuf(outFile.rdbuf());
    */

bool isSorted(arri &arr)
{
    for (int i = 1; i < arr.size(); i++)
    {
        if (arr[i - 1] > arr[i])
        {
            return false;
        }
    }
    return true;
}

int main()
{
    int l, r;
    cin >> l >> r;

    if (r - l > 2018)
    {
        cout << 0;
        return 0;
    }
    else if (r % 2019 < l % 2019)
    {
        cout << 0;
        return 0;
    }

    int sol = 2020;

    for (int i = r % 2019; i >= l % 2019; i--)
    {
        for (int j = l % 2019; j <= r % 2019; j++)
        {
            if (i == j)
                continue;
            sol = min(sol, ((i * j) % 2019));
        }
    }
    cout << sol;
}

Measured memory_bytes: 256
#include <iostream>
    #include <algorithm>
    #include <numeric>
    #include <utility>
    #include <cmath>
    #include <vector>
    #include <queue>
    #include <string>
    #include <map>
    #define MAX_U   10
    #define MIN_U   0
    #define rep(i,n) for(int i=0;i<n;i++)
    #define sz(x) ((int)(x).size())
    using namespace std;
    typedef long long ll;
    typedef vector<int> vi;
    typedef vector<char> vc;
    typedef vector<string> vs;
    typedef queue<int> qi;
    const int INF=numeric_limits<int>::infinity();
    void printa(){cout<<"\n";}
    template<class T, class... A>void printa(const T&first,const A&... rest){cout<<first;printa(rest...);}
    template<class... A>void printa(const A&... rest){printa(rest...);}
    void prints(){cout<<" ";}
    template<class T, class... A>void prints(const T&first,const A&... rest){cout<<first;prints(rest...);}
    template<class... A>void prints(const A&... rest){prints(rest...);}
    int factorial(int x){int f=1;for(int i=1;i<x+1;i++)f=f*i;return f;}
    int sigma(int x){int s;for(int i=1;i<x+1;i++)s=s+i;return s;}
    int middle(int x){if(x%2==0)return x/2;else return x/2+1;}
    double heron(int a,int b,int c){double s;s=(a+b+c)/2;return sqrt(s*(s-a)*(s-b)*(s-c));}
    double trapezium(int a,int b,int h){return (a+b)*h/2;}
    double triangle(int a,int h){return a*h/2;}
    int main(void){
        cin.tie(0);
        ios::sync_with_stdio(false);
        int a,b;
        cin >>a>>b;
        if(a+b>=10)printa("error");
        else printa(a+b);
        return 0;
    }

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int x = sc.nextInt();
      
      	if(500*k >= x){
        	System.out.println("Yes");
        }else{
        	System.out.println("No");
        }
		sc.close();
	}
}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
using ll = long long; // ll は long long　と同じとする。
int main () {
    ll N , A , B , C , D , E;
    cin >> N >> A >> B >> C >> D >> E;
    ll ans = max({(N - 1) / A , (N - 1) / B , (N - 1) / C , (N - 1) / D , (N - 1) / E}) + 5;
    cout << ans << endl;
    return 0;
}


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

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

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0;i < n;++i) cin >> a[i];
    vector<bool> dp(k+1,false);
    for (int i = 0;i < k+1;++i) {
        bool f = false;
        for (int j : a) {
            if (i-j < 0) break;
            if (!dp[i-j]) f = true;
        }
        if (f) dp[i] = true;
    }
    cout << (dp[k] ? "First" : "Second") << endl;
    return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
int INF = numeric_limits<int>::max() / 2;
using ll = long long;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
    int t = 0;
    int x = 0; 
    int y = 0;
    cin >> n;
    string result = "Yes";
    for(int i = 0; i < n; i++){
        int tt, tx, ty;
        cin >> tt >> tx >> ty;
        if(tt-t < abs(tx - x) + abs(ty - y) || abs(abs(tx - x) + abs(ty - y) - (tt - t)) % 2 == 1){
            result = "No";
        }
        t = tt; x = tx; y = ty;
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>

using namespace std;
typedef long long ll;

int gcd(int a, int b) {
  if (a < b) {
    swap(a, b);
  }
  while(true) {
    if(b == 0) {
      break;
    }
    int r = a % b;
    a = b;
    b = r;
  }
  return a;
}

int main() {
  int n, x;
  cin >> n >> x;
  vector<int> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
    vec[i] = abs(vec[i] - x);
  }
 
  for (int i = 0; i < n - 1; i++) {
    vec[i + 1] = gcd(vec[i], vec[i + 1]);
  }

  cout << vec[n - 1] << endl;
  return 0;
}


Measured memory_bytes: 640
/*********************
*  Author: xuziyuan  * 
*********************/

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

LL n,a[2010],ans=0;
vector <LL> v;

int main()
{
	cin>>n;
	rep(i,n)
	{
		cin>>a[i];
		v.pb(a[i]);
	}
	sort(v.begin(),v.end());
	rep(i,n)
	{
		for(int j=i+1;j<n;j++)
		{
			LL ub=upper_bound(v.begin(),v.end(),v[i]+v[j]-1)-v.begin()-1,
			lb=lower_bound(v.begin(),v.end(),abs(v[i]-v[j])+1)-v.begin(),num=ub-lb+1;
			if(lb<=i&&i<=ub) num--;
			if(lb<=j&&j<=ub) num--;
			ans+=num;
		}
	}
	cout<<ans/3<<endl;
	return 0;
}

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

bool hrz[1005] = {0}, vtc[1005] = {0};  //0w1b
int n,m,k;
int tot = 0;

int main()
{
	scanf("%d%d%d",&n,&m,&k);
	if(n == k || m == k){
		printf("Yes");
		return 0;
	}
	int i,j;
	for(i = 0; i <= n; i ++)
	 for(j = 0; j <= m; j ++)
	 {
	 	if(i*m + j*n - i*j*2 == k){
	 		printf("Yes");
	 		return 0;
		 }
	 }
	 printf("No");
	 return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

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

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

bool isPrime(int x){
    if(x==1)return false;
    if(x==2)return true;
    if(x%2==0)return false;
    for(int i=3;i<=sqrt(x);i+=2){
        if(x%i==0)return false;
    }
    return true;
}

int main() {
   vector<int> v(1000000,0),rui(1000000,0);
   rep(i,1,999999+1)if(isPrime(i))v[i]=1;
   rui[1]=v[1];
   rep(i,2,999999+1)rui[i]=rui[i-1]+v[i];
   
   int n;
   while(cin>>n){
       cout<<rui[n]<<endl;
   }
   
    
    return 0;
}



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

int main(){
  int n;
  cin >> n;
  vector<string> s(n);
  for(int i = 0; i < n; i++) cin >> s[i];
  int ac = 0, wa = 0, tle = 0, re = 0;
  
  for(int i = 0; i < n; i++){
    if(s[i] == "AC") ac++;
    if(s[i] == "WA") wa++;
    if(s[i] == "TLE") tle++;
    if(s[i] == "RE") re++;
  }
  
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
  return 0;
}

Measured memory_bytes: 6420
# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

def pd(str)
  p str if $debugFlag
end

def printd(str)
  print str if $debugFlag
end

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if false
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

$aa = inputs[0][1]
$bb = inputs[0][2]
$cc = inputs[0][3]
arr = inputs[1..-1].flatten


# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

# body
if $debugFlag
  p $aa
  p $bb
  p $cc
  p arr
end

def rec(x, y, z, arr, cost, xnum, ynum, znum)
  if arr == []
    if xnum > 0 and ynum > 0 and znum > 0
      tmp = cost + (x - $aa).abs + (y - $bb).abs + (z - $cc).abs - 30
      return tmp
    else
      return nil
    end
  end
  
  cand = []
  cand << rec(x + arr[0], y, z, arr[1..-1], cost + 10, xnum+1, ynum, znum)
  cand << rec(x, y + arr[0], z, arr[1..-1], cost + 10, xnum, ynum+1, znum)
  cand << rec(x, y, z + arr[0], arr[1..-1], cost + 10, xnum, ynum, znum+1)
  cand << rec(x, y, z, arr[1..-1], cost, xnum, ynum, znum)
  cand.compact!

  return cand.min
end

puts rec(0, 0, 0, arr, 0, 0, 0, 0)


Measured memory_bytes: 1916
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <iomanip>
#include <cstdio>

using namespace std;


int N,ptr = 0,res = 0;
int A[100000];
int main()
{
    scanf("%d", &N);
    for(int i = 0; i < N; i++) scanf("%d", &A[i]);
    sort(A,A+N);
    while(ptr<N)
    {
        int cc = A[ptr], f = 0;
        while(ptr<N && A[ptr] == cc) f++, ptr++;
        res += f%2;
    }
    printf("%d\n", res);
}


Measured memory_bytes: 640
from math import ceil #切り上げ
import numpy as np
 
def inp(): return int(input()) #一個だけ読み取り
def inpm(): return map(int,input().split()) #mapオブジェクトで呼び出し
def inpl(): return list(map(int, input().split())) #数字リストをintで
def inpls(): return list(input().split()) #リストをstrで

sum = 100
i = 0
X = inp()
while X > sum:
  sum = int(sum * 1.01)
  i += 1
print(i)


Measured memory_bytes: 27132
import collections
import math

a= int(input())
l=list(map(int, input().split()))

c = collections.Counter(l)

all_ans = 0
for n in c.values():
    if n<=1:
        continue
    all_ans+=math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
for n in l:
    print(all_ans-(c[n]-1))

Measured memory_bytes: 26780
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int N, t;
	cin >> N;
	queue<int> Q;
	vector<int> C;
	map<ll, ll> cnt;
	rep(i,N){
		cin >> t;
		Q.push(t);
	}
	C.push_back(Q.front());
	Q.pop();
	while(!Q.empty()){
		if(C[C.size()-1] != Q.front()){
			C.push_back(Q.front());
		}
		Q.pop();
	}
	rep(i,C.size())cnt[C[i]] = 0;
	vector<ll> dp(C.size(), 0);
	dp[0] = 1;
	cnt[C[0]] = 1;
	for(int i = 1; i < C.size(); ++i){
		dp[i] = dp[i-1] + cnt[C[i]];
		dp[i] %= MOD;
		cnt[C[i]] = dp[i];
	}	
	ll ans = dp[C.size()-1];
	ans %= MOD;
	if(ans < 0)ans += MOD;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 17884
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define lli long long int
int main() {
    fast;
    // lli q; cin>>q; while(q--){

         lli n,mx=INT_MIN,mn=INT_MAX,k=0,ans=0,sum=0,Count=0,x;
         string s;
        vector<lli>a;
        cin>>n>>x>>k;
        if(n%x==0){
            cout<<k*(n/x);
        }
        else{
            cout<<k*(n/x +1);
        }
        
}



Measured memory_bytes: 3596
from fractions import gcd
 
n = int(input())
a = list(map(int, input().split()))
 
rs, ls = [0], [0]
for i in range(n-1):
  rs.append(gcd(rs[i], a[i]))
  ls.append(gcd(ls[i], a[-i-1]))
 
print(max(gcd(r, l) for r, l in zip(rs, ls[::-1])))

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

typedef long long LL;

int main()
{   ios::sync_with_stdio(false);
    LL x, year=0, money=100;

    cin>>x;

    while(money<x){
        money += money/100;
        year++;
    }
    cout<<year;

	return 0;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

int main(){
    int n,C;cin>>n>>C;
    vin time(100050);
    vvin start(C,vin(100050)),finish(C,vin(100050));
    int s,t,c;
    rep(i,n){
        cin>>s>>t>>c;
        time[s]++;
        time[t+1]--;
        start[c-1][s]++;
        finish[c-1][t]++;
    }
    rep(i,100020)time[i+1]+=time[i];
    int sum;
    rep(i,100020){
        sum=0;
        rep(j,C)sum+=min(start[j][i],finish[j][i]);//同チャンネルならs==tでも被りとはならない。
        time[i]-=sum;
    }
    sort(all(time));
    reverse(all(time));
    cout<<time[0]<<endl;
}

Measured memory_bytes: 24568
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//数が大きい時のせぐふぉはコードテストで試してみる
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
//同じ作業繰り返す系の問題：収束先を見つける
//関係性は隣接行列で記録
//過半数：N/2.0で判定
//ある量からある量を引く系の問題：端から定義してやる
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll MOD = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

//a,bの最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1));
}

//Nのd桁目の数
ll dignum(ll N, ll d) {
	ll x = pow(10, d);
	N %= x;
	ll y = pow(10, d - 1);
	N /= y;
	return N;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

int main() {
	ll N, C, K; cin >> N >> C >> K;
	vector<ll> T(N); rep(i, N)cin >> T[i];
	sort(ALL(T));

	ll s = T[0];
	ll cnt = 0;
	ll ans = 0;
	rep(i, N) {
		if (T[i] > s + K || cnt == C) {
			ans++;
			s = T[i];
			cnt = 1;
		}
		else cnt++;
	}
	if (cnt != 0)ans++;

	cout << ans << endl;
}

Measured memory_bytes: 8832