akhauriyash/Code-Regression huggingface dataset:
/*author: hyperion_1724
  date: 
*/

//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

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

    READV(N);
    cout<<N*N*N<<endl;

    return 0;
}

Measured memory_bytes: 256
#! /usr/local/bin/python3
# coding: utf-8

def insertion_sort(a):
    for i in range(1, len(a)):
        print(" ".join(map(str, a)))
        w = a[i]
        j = i - 1
        while j >= 0 and w < a[j]:
            a[j + 1] = a[j]
            j -= 1
        a[j + 1] = w

n = int(input())
a = [int(i) for i in input().split()]
insertion_sort(a)
print(" ".join(map(str, a)))


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

const ll mod=1e9+7;

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

/*-------------------------------------------*/

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

    int k,x;
    cin>>k>>x;
    cout<<(k*500>=x?"Yes\n":"No\n");
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> inline void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if (x < y) x = y; }

vector<int> t_parent;
vi t_ord;

void tree_getorder(const vector<vi> &g, int root) {
	int n = g.size();
	t_parent.assign(n, -1);
	t_ord.clear();

	vector<int> stk; stk.push_back(root);
	while (!stk.empty()) {
		int i = stk.back(); stk.pop_back();
		t_ord.push_back(i);
		for (int j = (int)g[i].size() - 1; j >= 0; j--) {
			int c = g[i][j];
			if (t_parent[c] == -1 && c != root)
				stk.push_back(c);
			else
				t_parent[i] = c;
		}
	}
}

int main() {
		int N;
		scanf("%d", &N);
		vector<vector<int> > g(N);
		for (int i = 0; i < N - 1; ++i) {
			int u, v;
			scanf("%d%d", &u, &v), --u, --v;
			g[u].push_back(v);
			g[v].push_back(u);
		}
		tree_getorder(g, 0);
		vector<int> grundy(N);
		for (int ix = (int)t_ord.size() - 1; ix > 0; --ix) {
			int i = t_ord[ix], p = t_parent[i];
			grundy[p] ^= grundy[i] + 1;
		}
		bool ans = grundy[0] != 0;
		puts(ans ? "Alice" : "Bob");
	return 0;
}

Measured memory_bytes: 7196
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int MAXN=100005;
int read(){int x;scanf("%d",&x);return x;}
ll a[MAXN],ans;
int N;
int main(){
	N=read();
	for(int i=1;i<=N;i++) a[i]=read();
	for(int i=1;i<N;i++) if(a[i]%2!=0&&a[i+1]) a[i]--,a[i+1]--,ans++;
	for(int i=1;i<=N;i++) ans+=a[i]/2;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;
struct node {
    string s;
} edg[200];
int cmp(node a, node b) {
    return a.s < b.s;
}
int main() {
    int n, p;
    while (cin >> n >> p) {
        for(int i = 0; i < n; i++) {
            cin >> edg[i].s;
        }
        sort(edg, edg + n, cmp);
        for(int i = 0; i < n; i++)
            cout << edg[i].s;
        cout << endl;
    }
    return 0;
}


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

int main()
{
	std::vector<int> vec1, vec2, vec3;
	int n, a, b, c;
	std::cin >> n;
	for (int i = 0; i < n; ++i)
	{
		std::cin >> a >> b >> c;
		vec1.push_back(a), vec2.push_back(b), vec3.push_back(c);
	}
	for (int i = 0; i < n; ++i)
	{
		if ((vec1[i] * vec1[i] + vec2[i] * vec2[i] == vec3[i] * vec3[i]) 
			|| (vec2[i] * vec2[i] + vec3[i] * vec3[i] == vec1[i] * vec1[i])
			|| (vec1[i] * vec1[i] + vec3[i] * vec3[i] == vec2[i] * vec2[i]))
			std::cout << "YES" << std::endl;
		else
			std::cout << "NO" << std::endl;
	}

	return 0;
}

Measured memory_bytes: 1228
def main():
  N,S = map(int,input().split())
  A = list(map(int,input().split()))
  MOD = 998244353

  # サンプル3 4 2,2,4の場合、P1=1+x^2,P2=1+x^2,P3=1+x^4とすると、解は
  # P1P2P3+P1P2+P2P3+P1P3+P1+P2+P3におけるx^4の係数となる。
  # Q1=P1,Q2=P2+P1P2,Q3=P3+P2P3+P1P2P3とすると、
  # P1P2P3+P1P2+P2P3+P1P3+P1+P2+P3=Q1+Q2+Q3
  # Q1=P1(1+0)
  # Q2=P2(1+Q1)
  # Q3=P3(1+Q2)
  # 今のQに1を足してからPを掛けて、次のQを求める。
  # 解は、それぞれのQのx^4の係数を足していけばよい。
  ans = 0
  q = [0 for _ in range(S+1)]
  for i in range(len(A)):
    q[0] += 1
    q[0] %= MOD
    q2 = q[:]
    for j in range(S):
      if j+A[i] <= S:
        q2[j+A[i]] += q[j]
        q2[j+A[i]] %= MOD
    q = q2[:]
    ans += q[S]
  #print(q)
  print(ans%MOD)
  
main()

Measured memory_bytes: 41708
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

template <class T>
struct BIT {
    BIT(int n) : b(n + 1), n(n) {}
    void add(int i, T v) {
        for (int k = i + 1; k <= n; k += k & -k) b[k] += v;
    }
    T sum(int k) {
        T s = 0;
        for (; k > 0; k -= k & -k) s += b[k];
        return s;
    }
    vector<T> b;
    int n;
};

struct P {
    bool operator<(const P &p) const {
        return r < p.r;
    }
    int l, r, j;
};

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

    int n, q;
    cin >> n >> q;

    vector<int> c(n);
    for (auto& x : c) {
        cin >> x;
        x--;
    }

    vector<P> p(q);
    for (int j = 0; j < q; j++) {
        int l, r;
        cin >> l >> r;
        l--;

        p[j] = { l, r, j };
    }
    sort(p.begin(), p.end());

    BIT<int> bt(n);
    vector<int> ans(q);
    vector<int> b(n, -1);

    int i = 0, s = 0;
    for (int h = 0; h < q; h++) {
        auto [l, r, j] = p[h];
        for (; i < r; i++) {
            int x = c[i];
            if (b[x] >= 0) {
                bt.add(b[x], -1);
                s--;
            }
            b[x] = i;
            bt.add(i, +1);
            s++;
        }
        ans[j] = s - bt.sum(l);
    }

    for (int j = 0; j < q; j++) {
        cout << ans[j] << '\n';
    }

    return 0;
}

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

int main(void){
	int W,H,x,y,r;
	cin>>W>>H>>x>>y>>r;
	if(y-r<0)cout<<"No"<<endl;
	else if(x-r<0)cout<<"No"<<endl;
	else if(x+r>W)cout<<"No"<<endl;
	else if(y+r>H)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
}


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

int main(){
    int N;
    double D;
    cin >> N >> D;
    vector<vector<int>> r(N,vector<int>(2,0));
    rep(i,N){
        cin >> r.at(i).at(0) >> r.at(i).at(1);
    }
    int count=0;
    rep(i,N){
        double d=sqrt(pow(r.at(i).at(0),2)+pow(r.at(i).at(1),2));
        if(d<=D){
            count++;
        }
    }
    cout << count << endl;
}

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

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

	//////////////////////////////////
	//--------end--------
	//
	return 0;
}


Measured memory_bytes: 3628
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>

using namespace std;

struct edge
{
	long long v,nxt,flow;
}e[400050];

long long ecnt,head[200050];

void adde(long long u,long long v,long long flow)
{
	e[ecnt].v = v;
	e[ecnt].nxt = head[u];
	head[u] = ecnt;
	e[ecnt].flow = flow;
	ecnt++;
}

long long s,t;
long long dep[200050];

bool bfs()
{
	queue<long long> que;
	memset(dep,-1,sizeof(dep));
	dep[t] = 0;
	que.push(t);
	while(!que.empty())
	{
		long long u = que.front();
		que.pop();
		if(u == s)
			return true;
		for(long long i = head[u];~i;i = e[i].nxt)
		{
			long long v = e[i].v;
			if(e[i ^ 1].flow && dep[v] == -1)
			{
				dep[v] = dep[u] + 1;
				que.push(v);
			}
		}
	}
	return false;
}

long long curedge[200050];

long long dfs(long long s,long long t,long long flow)
{
	if(s == t)
		return flow;
	long long delta = flow;
	for(long long &i = curedge[s];~i;i = e[i].nxt)
	{
		long long v = e[i].v;
		if(dep[v] == dep[s] - 1 && e[i].flow)
		{
			long long g = dfs(v,t,min((long long)e[i].flow,delta));
			delta -= g;
			e[i].flow -= g;
			e[i ^ 1].flow += g;
			if(!delta) break;
		}
	}
	return flow - delta;
}

long long dinic()
{
	long long ans = 0;
	while(bfs())
		memcpy(curedge,head,sizeof(head)),
		ans += dfs(s,t,1ll << 62);
	return ans;
}

int n;
int p[100050],q[100050];
int inrp[100050],inrq[100050];

int main()
{
	memset(head,-1,sizeof(head));
	int rid = 0;
	scanf("%d",&n);
	for(int i = 0;i < n; ++ i) scanf("%d",&p[i]);
	for(int i = 0;i < n; ++ i) scanf("%d",&q[i]);
	for(int i = 0;i < n; ++ i)
	{
		if(!inrp[i])
		{
			rid ++;
			int cu = i;
			while(!inrp[cu])
			{
				inrp[cu] = rid;
				cu = p[cu];
			}
		}
		if(!inrq[i])
		{
			rid ++;
			int cu = i;
			while(!inrq[cu])
			{
				inrq[cu] = rid;
				cu = q[cu];
			}
		}
	}
	int as = n;
	s = 0; t = rid + 1;
	for(int i = 0;i < n; ++ i)
	{
		if(p[i] == i && q[i] == i) as --;
		else
		{
			if(p[i] == i) adde(s,inrq[i],1),adde(inrq[i],s,0); // q ²»×ª¾ÍÏàµÈ 
			else if(q[i] == i) adde(inrp[i],t,1),adde(t,inrp[i],0); // p ²»×ª¾ÍÏàµÈ 
			else if(p[i] == q[i]) adde(inrp[i],inrq[i],1),adde(inrq[i],inrp[i],0),adde(inrq[i],inrp[i],1),adde(inrp[i],inrq[i],0); // p,q ¶¼×ª/¶¼²»×ª¾ÍÏàµÈ 
			else adde(inrp[i],inrq[i],1),adde(inrq[i],inrp[i],0); //p,q ¶¼²»×ª¾ÍÏàµÈ 
		}
	}
	printf("%lld\n",as - dinic());
	return 0;
}

Measured memory_bytes: 21380
import java.util.*;
import java.util.Map.Entry;

import javax.swing.text.Segment;
import javax.xml.ws.WebEndpoint;

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main //implements Runnable
{
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public static void main(String[] args)   throws Exception, IOException{        
        long mod=1000000007;
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        PriorityQueue<Integer> q=new PriorityQueue<>();
        
//        int n=sc.nextInt();
        int a=sc.nextInt();
        int b=sc.nextInt();
        


        out.println(9<a || 9<b ? -1:a*b);
     	out.flush();
    }
    
    static void ret(String ans) {
    	System.out.println(ans);
    	System.exit(0);
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}


class P {
	int x, y, d;
	P(int  x, int y, int d) {
	  this.x=x;
	  this.y=y;
	  this.d=d;
	}
}

//class P implements Comparable<P>{
//    int a,b;
//    P(int a, int b) {
//    	this.b=b;
//    	this.a=a;
//    }
//
//    public int compareTo(P p){
//        return p.a-a;//des
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) throws IOException{
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public char[] getCharSet() throws IOException{
        return this.nextString().toCharArray();
    }    
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 21332
#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;
static const int MAX = 200000;

int main()
{
   int R[MAX], n;

   cin >> n;
   for (int i = 0; i < n; i++)
      scanf("%d", &R[i]);

   int maxv = -2000000000;
   int minv = R[0];

   for (int i = 1; i < n; i++)
   {
      maxv = max(maxv, R[i] - minv);
      minv = min(minv, R[i]);
   }

   cout << maxv << endl;

   return 0;
}


Measured memory_bytes: 3932
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

n=int(input())
l=list(map(int,input().split()))
m=min(l)
div=make_divisors(m)
div.reverse()
for i in div:
    flg=0
    for j in l:
        if j%i!=0:
            flg=1
            break
    if flg==0:
        ans=i
        break
print(ans)

Measured memory_bytes: 14252
import java.io.*;

import java.math.BigInteger;
import java.util.*;

import java.util.ArrayList;

import java.util.Scanner;


public class Main {

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    static final int mod = 1000000007;

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


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x=sc.nextLong();
        long p=100;
        long y=0;

        while(p<x)
        {
            p+=p/100;
            y++;
        }
        System.out.println(y);

    }
}









Measured memory_bytes: 35520
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String a = scan.next();
		String b = scan.next();
		String c = a + b;
		int n = Integer.parseInt(c);
		boolean f = false;
		for (int i = 0; i < n; i++) {
			if (i*i == n) {
				f = true;
				break;
			}
		}
		if (f) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21844
#pragma GCC optimize("O3")
    #pragma comment(linker, "/stack:200000000")
    #pragma GCC optimize("unroll-loops")
     
    #include <algorithm>
    #include <bitset>
    #include <cassert>
    #include <chrono>
    #include <cmath>
    #include <complex>
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <ctime>
    #include <deque>
    #include <functional>
    #include <iomanip>
    #include <iostream>
    #include <iterator>
    #include <limits>
    #include <climits>
    #include <list>
    #include <map>
    #include <numeric>
    #include <queue>
    #include <random>
    #include <ratio>
    #include <set>
    #include <sstream>
    #include <stack>
    #include <string>
    #include <unordered_map>
    #include <unordered_set>
    #include <utility>
    #include <vector>
    using namespace std;
     
    typedef long long ll;
    typedef long double LD;
    #define int ll
    #define double LD
    #define pb push_back
    #define mp make_pair
    #define REP(i,n) for (int i = 0; i < n; i++)
    #define loop(i,n) for (int i = 0; i < n; i++)
    #define FOR(i,a,b) for (int i = a; i < b; i++)
    #define REPD(i,n) for (int i = n-1; i >= 0; i--)
    #define FORD(i,a,b) for (int i = a; i >= b; i--)
    #define remax(a,b) a = max(a,b)
    #define remin(a,b) a = min(a,b)
    #define mem(a, b) memset(a, b, sizeof a)
    #define append push_back
    #define all(v) v.begin(),v.end()
    #define F first
    #define S second
    #define print(x) cout << (x) << endl
    #define PRECISION(x) cout << fixed << setprecision(x)
    #define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
     
    const double PI=acos(-1);
    const int MOD = 1000000007;
    const int FMOD = 998244353;
    const double eps = 1e-9;
     
    mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
  
  
	signed main()
	{
		int n,p;
		cin>>n>>p;
		string s;
		cin>>s;
		int ans=0;
		if(10%p==0)
		{
			loop(i,n)
			{
				if((s[i]-'0')%p==0)
				{
					ans+=(i+1);
				}
			}
		}
		else
		{
			int t=1,p1=0;
			map<int,int> mp1;
			for(int i=n-1;i>=0;i--)
			{
				mp1[p1]++;
				p1=(p1+(s[i]-'0')*t)%p;
				t=t*10%p;
				ans+=mp1[p1];
			}
		}
		cout<<ans;
	}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    ll h,cnt=0;
    cin >> h;
    ll aoe=1;
    while(h>0){
        h /= 2;
        cnt += aoe;
        aoe *= 2;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <string.h>
#include <math.h>
#include <set>
#include <map>
#include <unordered_map>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define FOR(i,n,m) for(int i=n; i<m; i++)
#define ROF(i,n,m) for(int i=n; i>m; i--)
#define ri(a) scanf("%d",&a)
#define rii(a,b) ri(a),ri(b)
#define riii(a,b,c) rii(a,b),ri(c)
#define lri(a) scanf("%lld",&a)
#define lrii(a,b) lri(a),lri(b)
#define lriii(a,b,c) lrii(a,b),lri(c)
#define pb push_back
#define _1 first
#define _2 second
#define ALL(s) s.begin(),s.end()
#define SZ(x) int((x).size())

const int INF = 0x3f3f3f3f;
const ll INFLL = 1e18;
const int MOD = 1e9+7;
const int alphabet = 26;
const double PI = 3.1415926535;
const int MAXINT = 1e5+1;

int n, W[MAXINT], V[MAXINT];
ll dp[100][MAXINT];

ll solve(int i, int w){
	if(i==n) return 0;
	if(dp[i][w]!=-1) return dp[i][w];

	dp[i][w] = 0;
	if(w-W[i]>=0) dp[i][w] = max(dp[i][w], solve(i+1,w-W[i]) + V[i]);
	dp[i][w] = max(dp[i][w], solve(i+1,w));
	return dp[i][w];
}

int main(){
	int w;
	memset(dp,-1,sizeof(dp));

	rii(n,w);
	FOR(i,0,n) rii(W[i],V[i]);
	printf("%lld\n", solve(0,w));
	return 0;
}
/*

*/  


Measured memory_bytes: 81916
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;

int main(){
  int n,ans=0;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
    if(i%2==0 && a[i]%2==1)ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3592
N,K = map(int,input().split())
nums = [0]*(10**5+1)
for i in range(N):
    a,b = map(int,input().split())
    nums[a] += b
c = 0
for i in range(1,10**5+1):
    c += nums[i]
    if c >= K:
        print(i)
        exit()


Measured memory_bytes: 76940
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner st=new Scanner(System.in);
		int n=st.nextInt();
		int[] a=new int[n];
		for(int i=0;i<n;i++) {
			a[i]=st.nextInt();
		}
		double kotae=0;
		for(int i=0;i<n;i++) {
			kotae+=1.0/(double)a[i];
		}
		double kotae1=0.0;
		kotae1=1.0/kotae;
		System.out.printf("%f",kotae1);

	}

}


Measured memory_bytes: 21588
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#define R register
#define IN inline
#define gc getchar()
#define W while
#define MX 2018
template <class T>
IN void in(T &x)
{
    x = 0; R char c = gc;
    W (!isdigit(c)) c = gc;
    W (isdigit(c))
    x = (x << 1) + (x << 3) + c - 48, c = gc;
}
std::bitset <MX * MX> bt;
int num, sum;
int main(void)
{
    bt[0] = true;
    int a;
    in(num);
    for (R int i = 1; i <= num; ++i)
    {
        in(a);
        bt |= bt << a, sum += a;
    }
    int mid = sum + 1 >> 1;
    for (R int i = mid; i <= sum; ++i)
    {
        if(bt[i]) printf("%d", i), exit(0);
    }
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
//#include <iostream>
//#include <iomanip>
//#include <vector>
//#include <cmath>
//#include <algorithm>
using namespace std;


#define F first
#define PB push_back
#define MP make_pair

typedef unsigned long long ll;

ll p = pow(10, 9) + 7;







int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int N;
    cin >> N;
    vector<int> vals(N + 1);
    for(int i = 1; i <= N; i++)
    {
        cin >> vals[i];
    }

    vector<bool> taken(N + 1);

    int p1 = 1;
    int count = 0;
    do{
        taken[p1] = true;
        p1 = vals[p1];
        count++;
    }while(p1 != 1 && p1 != 2 && vals[p1] != p1 && !taken[p1]);

    cout <<( p1 == 2 ? count : -1) << endl;

}


Measured memory_bytes: 640
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <unordered_set>
using namespace std;

struct modint{
	using i64 = int_fast64_t;
	i64 a;
	static constexpr i64 MOD= 1e9+7;
	modint(){
		a=0;
	};
	modint(i64 a_){
		a=a_ %MOD;
		if(a<0) a+=MOD;
	}

	modint inv()const{
		i64 n=1,m=MOD-2, A=a;
		while(m){
			if(m&1)(n*=A)%=MOD;
			(A*=A) %= MOD;
			m>>=1;
		}
		modint y(n);
		return y;
	}

	bool operator==(const modint& x){
		return a==x.a;
	}
	bool operator!=(const modint& x){
		return a!=x.a;
	}

	modint&  operator =(const modint& x){
		a= x.a;
		return *this;
	}
	modint operator+(const modint& x){

		modint y;
		y.a= a+x.a;
		if(y.a < 0) y.a+=MOD;
		return y;
	}
	modint operator-(const modint& x){

		modint y;
		y.a= a-x.a;
		if(y.a<0) y.a+=MOD;
		return y;
	}
	modint operator*(const modint& x){
		modint y;
		y.a=(a*x.a)%MOD;
		return y;
	}
	modint operator/(const modint& x){
		modint y;
		y.a=(a*(x.inv().a))%MOD;
		return y;
	}

	modint& operator +=(const modint& x){
		a=a+x.a;
		if(a>=MOD)a-=MOD;
		return *this;
	}
	modint& operator -=(const modint& x){
		a=a-x.a;
		if(a<0) a+=MOD;
		return *this;
	}
	modint& operator *=(const modint& x){
		(a*=x.a)%=MOD;
		return *this;
	}
	modint& operator /=(const modint& x){

		(a*=x.inv().a)%=MOD;
		return *this;
	}
};

istream& operator>> (istream& in, modint& x){
	int_fast64_t a_;
	in>>a_;
	modint y(a_);
	x=y;
	return in;
}

ostream& operator<< (ostream& out, const modint& x){
	out<<x.a;
	return out;
}

modint pwr(int_fast64_t a, int_fast64_t b){
	modint _;
	int_fast64_t n=1,A=a;
	while(b){
		if(b&1)(n*=A)%=modint::MOD;
		(A*=A)%=modint::MOD;
		b>>=1;
	}
	_.a=n;
	return _;
}

template<int n> struct COMB{
	int_fast64_t fc[n],ifc[n];

	constexpr COMB():fc(), ifc(){
		fc[0]=1;
		for(int i=1;i<n;++i) fc[i]=fc[i-1]* i % modint::MOD;
		int_fast64_t N=1, A=fc[n-1], b=modint::MOD-2;

		while(b){
			if(b & 1) (N*=A)%=modint::MOD;
			(A*=A)%= modint::MOD;
			b>>=1;
		}
		ifc[n-1]=N;
		for(int i=n-1 ;i>=1 ;--i) ifc[i-1]=ifc[i]*i % modint::MOD;
	};
	modint operator()(int N,int R)const{

		if(N<0|| R<0||N<R)return 0;
		return fc[N]*ifc[R]%modint::MOD* ifc[N-R];
	}
	modint operator[](int N)const{
		modint _;
		_.a= fc[N];
		return _;
	}
	modint operator()(int N)const{
		modint _;
		_.a=ifc[N];
		return _;
	}
};

constexpr COMB<200010> comb;

int main(){

	int N,K;
	cin>>N>>K;
	vector<int> A(N,0);
	for(int i=0;i<N;i++)cin>>A[i];

	sort(A.begin(),A.end());
	
	modint ans{};

	for(int i=0;i<N;i++){
		ans-=comb(N-i-1,K-1)*A[i];
		ans+=comb(i,K-1)*A[i];
	}

	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
struct cource{
  int cost;
  int time;
};


bool cmp(cource a,cource b){
  if(a.cost <= b.cost)return true;
  return false;
}

int main(void){
  int N,T,count = 0; cin>>N>>T;
  vector<cource>r;
  r.resize(N);
  for(int i = 0;i < N;i++){
    cin>>r[i].cost>>r[i].time;
  }


  sort(r.begin(),r.end(),cmp);

  for(int t = 0;t < N;t++){
    if(r[t].time <= T){
      cout<<r[t].cost;
      break;
    }
    if(t == N-1)cout<<"TLE";
  }


}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn = 1e3;
int a[maxn+10];
int main() {
	int n,X,Y;
	scanf("%d%d%d",&n,&X,&Y);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	int ans;
	if(n==0) ans=abs(X-Y);
	if(n==1) ans=abs(a[n]-Y);
	if(n>=2) ans=max(abs(Y-a[n]),abs(a[n-1]-a[n]));
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <limits.h>
void mergeSort(int *, int, int );
void merge( int *, int, int, int );


int  cnt=0;
 int L[2500010],R[2500010];

int main(){
  int left=0,right=0,mid;
  int s[5000005];
  int n,i;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&s[i]);
  }

  mergeSort(s,0,n);
  
  for(i=0;i<n;i++){
    printf("%d",s[i]);
    if(i!=n-1)printf(" ");
  }
  printf("\n%d\n",cnt);

    

  return 0;
}

void mergeSort( int *s, int left, int right){
  int mid;
  if (left+1 < right){
    mid =(left+right)/2;
    mergeSort(s,left,mid);
    mergeSort(s,mid,right);
    merge(s, left, mid, right);
  }
}

void merge(int *s,int left, int mid, int right){
  int n1,n2;
  // int L[2500000],R[250000];
  int i=0,j=0,k;
    
  n1 = mid - left;
  n2 = right - mid;

  for(i=0;i<n1;i++){
    L[i] = s[left+i];
  }
  for(i=0;i<n2;i++){
    R[i] = s[mid+i];
  }
    L[n1]=INT_MAX;
    R[n2]=INT_MAX;  

    i=0;
    j=0;
    
    for(k= left; k<right;k++){
      cnt++;
      if(L[i]<=R[j]){
	s[k]=L[i];
	i++;
      }
      else{
	s[k]=R[j];
	j++;
      }  
    }
  
}



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

const int MOD = 1000000007;
const int INF = 1e9;

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

  string ans = "No";
  if(x >= 30) ans = "Yes";

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define pi 3.141592653589793
#define mod 1e9 + 7
#define pb push_back
#define all(v) v.begin(),v.end()
#define rall(v) v.begin(), v.end(), greater<ll>()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;
using namespace std;
//bool check(string ss) {
//    ll n = ss.size();
//    bool ans = true;
//    for(int i = 0; i < n / 2; ++i) {
//        if(ss[i] != ss[n - i - 1]) {
//            ans = false;
//            break;
//        }
//    }
//    return ans;
//}
int main() {
//    string ss;
//    cin >> ss;
//    ll sz = ss.size();
//    if(check(ss) && check(ss.substr(0, sz / 2)) && check(ss.substr(sz / 2 + 1, sz / 2)))
//         cout << "Yes";
//    else
//         cout << "No";
    long double l;
    cin >> l;
    cout << fixed << setprecision(20) << (l / 3.0)*(l / 3.0)*(l / 3.0);
}


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

int main() {
  int n;
  double a, b, c, d, e, f, px, py, r;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b >> c >> d >> e >> f;
    py = ((e - a) * (a * a + b * b - c * c - d * d) -
          (c - a) * (a * a + b * b - e * e - f * f)) /
         (2 * (e - a) * (b - d) - 2 * (c - a) * (b - f));
    if (c != a) {
      px = (2 * (b - d) * py - a * a - b * b + c * c + d * d) / (2 * (c - a));
    } else {
      px = (2 * (b - f) * py - a * a - b * b + e * e + f * f) / (2 * (e - a));
    }
    r = hypot(px - a, py - b);
    cout << fixed << setprecision(3) << px << " " << py << " " << r << endl;
  }
}


Measured memory_bytes: 3280
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fi first
#define se second
ll dp[100005];
int main()
{
  ll n,we,i,sum=0,j;
  cin>>n>>we;
  ll w[n+1],v[n+1];
  for(i=1;i<=n;i++)
  {
    cin>>w[i]>>v[i];
  }
  for(i=1;i<=n;i++) sum+=v[i];
 for(i=0;i<=sum;i++)  dp[i]=1e+9;
 dp[0]=0;//Very much important else all remain 1e+9
 for(j=1;j<=n;j++)
    {
       
      for(i=sum;i>=v[j];i--)
      {   
          dp[i]=min(dp[i],dp[i-v[j]]+w[j]);
      }
    }
 
  for(i=sum;i>=0;i--)
  {
   //cout<<dp[i]<<" ";
   if(dp[i]<=we) {cout<<i;return 0;}
  }
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
#define INF 100000000000000LL
using namespace std;
typedef long long ll;

ll N, M, A[50], B[50];
ll sa[51], sb[51], dp[51][51][51][51][2][3];

ll dfs(int la, int ra, int lb, int rb, int turn, int pass) {
  ll &ret = dp[la][ra][lb][rb][turn][pass];
  if(ret > -INF) return ret;
  ret = (sa[ra] - sa[la]) - (sb[rb] - sb[lb]);
  if(!(pass == 1 && (la == ra && lb == rb))) ret += dfs(ra, ra, rb, rb, turn ^ 1, pass + (ra - la == 0 && rb - lb == 0));
  if(turn == 0 && ra < N && A[ra] == -1) ret = max(ret, dfs(la, ra + 1, rb, rb, turn ^ 1, 0));
  if(turn == 0 && ra < N && A[ra] != -1) ret = max(ret, dfs(la, ra + 1, lb, rb, turn ^ 1, 0));
  if(turn == 1 && rb < M && B[rb] == -1) ret = min(ret, dfs(ra, ra, lb, rb + 1, turn ^ 1, 0));
  if(turn == 1 && rb < M && B[rb] != -1) ret = min(ret, dfs(la, ra, lb, rb + 1, turn ^ 1, 0));
  return ret;
}

int main(void) {
  cin >> N >> M;
  REP(i, 0, N) cin >> A[i];
  REP(i, 0, M) cin >> B[i];
  REP(i, 0, N) sa[i + 1] = sa[i] + (A[i] != -1 ? A[i] : 0);
  REP(i, 0, M) sb[i + 1] = sb[i] + (B[i] != -1 ? B[i] : 0);
  REP(i, 0, N + 1) REP(j, 0, N + 1) REP(k, 0, M + 1) REP(l, 0, M + 1) REP(m, 0, 2) REP(n, 0, 3) dp[i][j][k][l][m][n] = -INF;
  cout << dfs(0, 0, 0, 0, 0, 0) << endl;

  return 0;
}

Measured memory_bytes: 320248
#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(){
	int x;
	cin >> x;
	if(x<1200)
		cout << "ABC" << endl;
	else
		cout << "ARC" << endl;
	return 0;
}



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

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;

const int MAX = 20;
string mat[MAX], buffer[MAX];
bool used[MAX];
int n, m;

void die(string s) {
	cout << s << '\n';
	exit(0);
}

bool palindrome(const string &s) {
	return equal(s.begin(), s.end(), s.rbegin());
}

bool valid(const vector<int> &perm) {
	fori(i, 0, n) {
		buffer[i] = mat[i];
	}

	multiset<string> S;
	fori(i, 0, n) {
		fori(j, 0, m) {
			buffer[i][j] = mat[i][perm[j]];
		}

		S.insert(buffer[i]);
	}

	while(S.size() > 1) {
		string first = *S.begin(); S.erase(S.begin());

		string revF = first;
		reverse(revF.begin(), revF.end());

		if(S.count(revF)) {
			S.erase(S.find(revF));	
		}
		else {
			string other = *S.begin(); S.erase(S.begin());
			S.insert(first);

			revF = other;
			reverse(revF.begin(), revF.end());
			
			if(S.count(revF)) {
				S.erase(S.find(revF));
			}
			else {
				return false;
			}
		}
	}


	if(S.size() == 1) {
		string f = *S.begin();
		
		if(!palindrome(f)) {
			return false;
		}
	}

	return true;
}

vector<int> state;
void backtrack(int index) {
	if(2 * index >= m - 1) {
		if(valid(state)) {
			die("YES");
		}
		return;
	}

	fori(i, 0, m) {
		if(!used[i]) {
			used[i] = true;
			state[index] = i;

			fori(j, i + 1, m) {
				if(!used[j]) {
					used[j] = true;
					state[m - index - 1] = j;

					backtrack(index + 1);

					used[j] = false;
				}
			}

			used[i] = false;

			break;
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);

	cin >> n >> m;

	state.resize(m, 0);

	fori(i, 0, n) {
		cin >> mat[i];
	}

	if(m & 1) {
		fori(i, 0, m) {
			state[m / 2] = i;
			used[i] = true;
			backtrack(0);
			used[i] = false;
		}
	}
	else {
		backtrack(0);
	}

	die("NO");

	return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let 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() {
    input! {
        n: usize,
        a: [u32; n],
    }
    let mx = a.iter().max().unwrap();
    let mn = a.iter().min().unwrap();
    println!("{}", mx - mn);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define f first
#define s second


signed main()
{
  int n;
  cin>>n;
  int arr[n+1]={0};
int   r=sqrt(n);
  for(int i=1;i<=r;i++)
  {
      for(int j=i;j<=r;j++)
      {
          for(int k=j;k<=r;k++)
          {
              int p=i*i+j*j+k*k+i*j+j*k+k*i;
              if(p>n)
                break;
              set<int>s;
              s.insert(i); s.insert(j); s.insert(k);
              if(s.size()==1)
                arr[p]+=1;
              else if(s.size()==2)
                arr[p]+=3;
              else
                arr[p]+=6;
          }
      }
  }
  for(int i=1;i<=n;i++)
    cout<<arr[i]<<endl;
}




























































































































































































































Measured memory_bytes: 3796
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#define INPUT_INT1(n) int n; std::cin >> n;
#define INPUT_INT2(n,m) int n,m; std::cin >> n >> m;
#define INPUT_INT3(n,m,l) int n,m,l; std::cin >> n >> m >> l;
#define INPUT_INT4(n,m,l,o) int n,m,l,o; std::cin >> n >> m >> l >> o;
#define INPUT_INT5(n,m,l,o,p) int n,m,l,o,p; std::cin >> n >> m >> l >> o >> p;
#define GET_MACRO(_1, _2, _3, _4, NAME, ...) NAME
#define INPUT_INT(...) GET_MACRO(__VA_ARGS__,INPUT_INT4,INPUT_INT3,INPUT_INT2,INPUT_INT1)(__VA_ARGS__)
#define REP(i, n) for (int i = 0; i < n; ++i)

inline void sayyes(void) { std::printf("YES\n"); std::exit(EXIT_SUCCESS); }
inline void sayno(void) { std::printf("NO\n"); std::exit(EXIT_SUCCESS); }

int main(int argc, char* argv[]) {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  /* */
  INPUT_INT(n, l);
  std::vector<std::string> strs(n);
  REP(i, n) {
    std::cin >> strs[i];
  }
  std::sort(strs.begin(), strs.end());
  REP(i, n) {
    std::cout << strs[i];
  }
  std::cout << std::endl;
  /* */

  return EXIT_SUCCESS;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	
	if( c > b && b > a ) { 
		cout << "Yes" << endl;
	} else {
		for(int i = 0; i < k; ++i) {
			if( a >= b ) b *= 2;
			else if( b >= c ) c *= 2;
		}
		
		if( c > b && b > a ) { 
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}
	
	return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std; 
#define mod 1000000007
#define N 100005
#define ll long long
#define ull unsigned long long
#define loop1(i, j, k, step) for (int i=j; i<k; i+=step)
#define loop(i, j, k) for (int i=j; i<k; i++) 
#define rloop1(i, j, k, step) for (int i=j; i>=k; i-=step)
#define rloop(i, j, k) for(int i=j; i>=k; i--)
#define rep(i, k) for(int i = (0); i < (k); i++ )
#define rrep(i, k) for(int i = k-1; i >= 0; i-- )

#define forall(it, l) for(auto it=l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define pop pop_back
#define F first
#define S second
#define sz(x) (int)(x).size()
#define endl "\n"
#define Max (int)INT_MAX
#define Min (int)INT_MIN
#define MEM(a, b) memset(a, (b), sizeof(a))
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;


void solve()
{
	int r;
	cin>>r;
	double cir;
	cir=2*3.14159265*r;
	cout<<cir<<endl;
}
int  main() 
{
	fast_io;
    solve();
	return 0; 
}

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

int a, b, c;

int main() {
  cin >> a >> b >> c;
  int ans = 0;
  while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
    if (a == b && b == c) {
      ans = -1;
      break;
    }
    
    int half_a = a / 2;
    int half_b = b / 2;
    int half_c = c / 2;
    
    a = half_b + half_c;
    b = half_a + half_c;
    c = half_a + half_b;
    
    ans++;
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
/**
* Author : zzy
* Date : 2020-04-19-20.05.46 Sunday
*/
#include <bits/stdc++.h>

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, a, b) for (int i = (int)(a); i >= (int)b; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, r, l) for (int i = (r); i >= (l); i--)
#define ms(x, y) memset(x, y, sizeof(x))
#define SZ(x) ((int)(x).size())

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int n, m;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "r", stdin);
#endif

    cin >> n >> m;
    vi a(m);
    forn(i, m) cin >> a[i];
    int sum = accumulate(all(a), 0);
    if (sum > n) cout << -1 << '\n';
    else cout << n-sum << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 3700
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
using namespace std;
 
struct p{long long x,y;}s[100005];
 
int cmp(p a,p b){
	return a.y < b.y;
}
 
int main(){
	long long n,k,l = 0,r = 0,p;
 
	cin >> n >> k;
	for(int i = 1;i <= n;i++){
		scanf("%lld %lld",&s[i].y,&s[i].x);
	}
	sort(s + 1,s + n + 1,cmp);
	for(int i = 1;i <= n;i++){
		l += s[i - 1].x,r += s[i].x;
		if(k >= l && k <= r){
			p = s[i].y;
			break;
		}
	}
	printf("%lld",p);
}

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

using ull = unsigned long long;
 
vector<ull> alist = {2, 325, 9375, 28178, 450775, 9780504, 1795265022};
 
// calculate (x + y) % m; overflow-safe
inline ull addmod(ull x, ull y, ull m) {
    x %= m;
    y %= m;
    return (x >= m - y? x - (m - y) : x + y);
}
 
// calculate (x * y) % m; overlow-safe
inline ull mulmod(ull x, ull y, ull m) {
    x %= m;
    y %= m;
    ull r = 0;
    while (y > 0) {
        if (y % 2 == 1)
            r = addmod(r, x, m);
        x = addmod(x, x, m);
        y /= 2;
    }
    return r;
}
 
// calculate x^y % m; overflow-safe
ull powmod(ull x, ull y, ull m) {
    x %= m;
    ull r = 1ULL;
    while (y > 0) {
        if (y % 2 == 1)
            r = mulmod(r, x, m);
        x = mulmod(x, x, m);
        y /= 2;
    }
    return r;
}
 
// true for probable prime, false for composite
inline bool miller_rabin(ull n, ull a) {
    ull d = n - 1;
    while (d % 2 == 0) {
        if (powmod(a, d, n) == n-1)
            return true;
        d /= 2;
    }
    ull tmp = powmod(a, d, n);
    return tmp == n-1 || tmp == 1;
}
 
bool is_prime(ull n) {
    if (n <= 1)
        return false;
    if (n <= 10000000000ULL) {
        for (ull i = 2; i*i <= n; i++)
            if (n % i == 0)
                return false;
        return true;
    }
    for (ull a : alist)
        if (!miller_rabin(n, a))
            return false;
    return true;
}

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

	int t,k;
	vector <int> v;

	for(int i=0;i<5;i++)
	{
		cin >> t;
		v.push_back(t);
	}

	cin >> k;

	for(int i=0;i<5;i++)
	{
		for(int j=i+1;j<5;j++)
		{
			if(v[j] - v[i] > k)
			{
				cout << ":(" << '\n';
				return 0;
			}
		}	
	}

	cout << "Yay!" << '\n';
	
	return 0;
}


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

int main() {
	int A[4];
	long N;
	for(int i=0; i<4; ++i) cin >> A[i];
	cin >> N;
	for(int i=0; i<3; ++i) if(2*A[i]<A[i+1]) A[i+1]=2*A[i];
	long M=0;
	if(N%2){
	    --N;
	    M = A[2];
	}
	M += (N/2)*A[3];
	cout << M << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <deque>

int main(){
  int N, H;
  scanf("%d", &N);
  scanf("%d", &H);
  std::vector<int > a(N), b(N);
  std::priority_queue<std::pair<int, int > > attack;
  for (int i=0; i<N; i++){
    scanf("%d", &a[i]);
    attack.push(std::make_pair(a[i],1));
    scanf("%d", &b[i]);
    attack.push(std::make_pair(b[i],0));
  }
  //std::sort(attack.begin(), attack.end(), std::greater<int>());
  int ans = 0;
  while(H>0){
    auto frontval = attack.top();
    //printf("(%d, %d)\n", frontval.first, frontval.second);
    if(frontval.second==0){
      attack.pop();
      H -= frontval.first;
      ans++;
    } else {
      ans += (H+frontval.first-1)/frontval.first;
      H -= frontval.first*((H+frontval.first-1)/frontval.first);
    }
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 3188
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
using namespace std;



short int D[1000007]={};

int main(){
	int a,n;
	
	while(1){
	cin>>a;if(a==0)break;
	cin>>n;
	char p[1000005]={};
	cin>>p;
	int d=0;
	int ans=0;
	for(int i=0;i<n-2;i++){
		if(p[i]=='I'){
			if(p[i+1]=='O'&&p[i+2]=='I'){
			d++;
			if(d>=a){ans++;}
			}
			else d=0;
		}
		

	}
	/*
	int y=a*2;
	for(int i=0;i+y<n;i++){
		if(p[i]=='I'&&i+y<p.size()){
			if(D[i+y]>=a)ans++;
		}
	}*/
	cout<<ans<<endl;}
	return 0;
}

Measured memory_bytes: 2148