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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

int msb(int x){
	return 63-__builtin_clzll(x);
}

int N;
int A[111111];

signed main(){
	cin>>N;
	rep(i,N)cin>>A[i];

	int base=0;
	rep(i,N)base^=A[i];

	rep(i,60){
		if(!(base>>i&1))continue;
		rep(j,N)if(A[j]>>i&1)A[j]^=1ll<<i;
	}

	for(int i=0;i<N;i++){
		for(int j=i+1;j<N;j++){
			if(A[i]<A[j])swap(A[i],A[j]);
		}
		if(A[i]==0)break;
		for(int j=0;j<N;j++){
			if(i==j)continue;
			if(A[j]>>msb(A[i])&1)A[j]^=A[i];
		}
	}


	int X=0;
	rep(i,N)X^=A[i];
	int Y=base^X;
	cout<<base+(X&Y)*2<<endl;
	return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace Prac
{
    class Prog
    {
        public static void Main()
        {
            var s = Console.ReadLine().ToCharArray();
            var p = Console.ReadLine().ToCharArray();
            var result = "No";
            var index = 0;
            for (var i = 0; i < s.Length; i++)
            {
                if (s[i] == p[0])
                {
                    for (var j = 0; j < p.Length; j++)
                    {
                        index = ((i + j) < (s.Length)) ? i + j : i + j - s.Length;
                        if (s[index] != p[j])
                            break;
                        else
                            if (j == p.Length - 1)
                                result = "Yes";
                    }
                }
            
            }
            Console.WriteLine(result);
           
        }
    }
}

Measured memory_bytes: 5260
#include<stdio.h>
int main(void)
{
	char s[4];
	scanf("%s",s);
	if(s[0]=='a' && s[1]=='b' && s[2]=='c'){
		printf("Yes\n");
	}
	else if(s[0]=='c' && s[1]=='a' && s[2]=='b'){
		printf("Yes\n");
	}
	else if(s[0]=='b' && s[1]=='c' && s[2]=='a'){
		printf("Yes\n");
	}
	else if(s[0]=='a' && s[1]=='c' && s[2]=='b'){
		printf("Yes\n");
	}
	else if(s[0]=='b' && s[1]=='a' && s[2]=='c'){
		printf("Yes\n");
	}
	else if(s[0]=='c' && s[1]=='b' && s[2]=='a'){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1e9+7LL;

int main() {
    int N; cin >> N;
    int cnt = 0;
    rep(i, N){
        int d1, d2; cin >> d1 >> d2;
        if(d1==d2) cnt++;
        else cnt = 0;

        if(cnt==3){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

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

ll J[2][100000], JO[2][100000], JOI[2][100000];
ll cj[100000], ci[100000];
char s[1000000];

int main() {
	int n;
	scanf("%d%s", &n, s);
	J[1][0] = 1;
	rep(i, n) {
		if (i) {
			rep(j, 2) {
				J[j][i] += J[j][i - 1];
				JO[j][i] += JO[j][i - 1];
				JOI[j][i] += JOI[j][i - 1];
			}
		}
		switch (s[i]) {
		case 'J':rep(j, 2)J[j][i]++; cj[i]++; break;
		case 'O':rep(j, 2)JO[j][i] += J[j][i]; break;
		case 'I':rep(j, 2)JOI[j][i] += JO[j][i]; ci[i]++; break;
		}
	}
	ll Max = max(JOI[0][n - 1] + JO[0][n - 1], JOI[1][n - 1]);
	for (int i = 1; i < n; i++)cj[i] += cj[i - 1];
	for (int i = n - 2; i >= 0; i--)ci[i] += ci[i + 1];
	rep(i, n - 1) {
		Max = max(Max, cj[i] * ci[i + 1] + JOI[0][n - 1]);
	}
	printf("%lld\n", Max);
}

Measured memory_bytes: 9564
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n;i>=0;i--)
#define MAX 100000
#define ll long long
#define dmp make_pair
#define dpb push_back
#define P pair<int,int>
#define fi first
#define se second
using namespace std;
//__gcd(a,b), __builtin_popcount(a);
const int INF = 2147483647;
#define B 100
 
int bucket[MAX/B][B];
int data[MAX/B];
void update(int a, int b, int x){
    int f1 = 1, f2 = 1;
    while(a <= b && a%B != 0){
        if(f1 && data[a/B] != -1){
            for(int i = 0;i < 100;i++)bucket[a/B][i] = data[a/B];
            f1 = 0;data[a/B] = -1;
        }
        bucket[a/B][a%B] = x;
        a++;
    }
    while(a <= b && b%B != 99){
        if(f2 && data[b/B] != -1){
            for(int i = 0;i < 100;i++)bucket[b/B][i] = data[b/B];
            f2 = 0;data[b/B] = -1;
        }
        bucket[b/B][b%B] = x;
        b--;
    }
    while(a < b){
        data[a/B] = x;
        a += B;
    }
}
 
int find(int x){
    if(data[x/B] != -1){
        for(int i = 0;i < 100;i++)bucket[x/B][i] = data[x/B];
        data[x/B] = -1;
    }
    return bucket[x/B][x%B];
}
 
int main(){
    int n, q, c, s, t, x, ans;
    scanf("%d%d", &n, &q);
    fill(data, data+MAX/B, -1);
    fill((int*)bucket, (int*)(bucket+MAX/B), INF);
    while(q--){
        scanf("%d", &c);
        if(!c){
            scanf("%d%d%d", &s, &t, &x);
            update(s, t, x);
        }else{
            scanf("%d", &x);
            ans = find(x);
            printf("%d\n", ans);
        }
    }
    //rep(i,n)printf("%d ", bucket[0][i]);
    return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define LL long long
#define PI 3.14159265359
template<class T> inline void chmax(T & a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}




int main(void) {
	int N;
	cin >> N;

	vector<double> x(N);
	rep(i, N) cin >> x[i];
	vector<double> y(N);
	rep(i, N) cin >> y[i];

	double ans = 0;
	rep(i, N) ans += abs(x[i] - y[i]);
	printf("%.6f\n", ans);

	ans = 0;
	rep(i, N) ans += pow(abs(x[i] - y[i]),2);
	printf("%.6f\n", sqrt(ans));

	ans = 0;
	rep(i, N) ans += pow(abs(x[i] - y[i]), 3);
	printf("%.6f\n", pow(ans,1.0/3.0));

	ans = 0;
	rep(i, N) chmax(ans, abs(x[i] - y[i]));
	printf("%.6f\n", ans);
	return 0;
}



Measured memory_bytes: 3384
n = int(input())
amari = 0
name = []
a = "abcdefghijklmnopqrstuvwxyz"

while n >= 1 :
    amari = n % 26    
    if amari == 0:
        amari = 26
    name.insert(0, a[int(amari-1)])
    n = (n - amari) / 26

ans = ''.join(name)
print(ans)

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

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define INF 0x3f3f3f3f
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

ll MOD = 1e9 + 7;
const int N = 2e5 + 5;
ll fat[N];

void init(){
    fat[0] = 1LL;
    for(int i = 1; i < N; i++) fat[i] = (fat[i-1] % MOD * i % MOD) % MOD;
}

ll fastp(ll a, ll p){
    if(p == 0) return 1LL;
    if(p&1) return (a % MOD * fastp(a, p-1) % MOD) % MOD;
    ll x = p / 2;
    ll t = fastp(a, x);
    return (t % MOD * t % MOD) % MOD;
}

ll nck(ll n, ll k){
    if(k > n) return 0;

    ll prod = 1LL;
    for(ll i = n; i >= n - k + 1; i--) prod = (prod % MOD * i % MOD) % MOD;

    ll down = fastp(fat[k], MOD - 2);

    return (prod % MOD * down % MOD) % MOD;
}

int main(){
    fcin;

    init();
    ll n, a, b;
    cin >> n >> a >> b;

    ll tot = fastp(2, n);

    tot -= nck(n, a);
    tot = (tot + MOD) % MOD;
    tot -= nck(n, b);
    tot = (tot + MOD) % MOD;

    cout << (tot - 1) % MOD << endl;
    return 0;
}



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

int main() {
	long n,d,i,ans;
	cin >> n >> d;
	
	d*=d;
	long x,y;
	ans=0;
	for(i=0; i<n; i++){
		cin >> x >> y;
		if(x*x+y*y<=d){
			ans++;
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3632
n = int(input())
if n != 52:
    s = [i for i in range(1,14)]
    h = [i for i in range(1,14)]
    c = [i for i in range(1,14)]
    d = [i for i in range(1,14)]
    for i in range(n):
        A = input().split()
        if A[0] == "S":
            s.remove(int(A[1]))
        elif A[0] == "H":
            h.remove(int(A[1]))
        elif A[0] == "C":
            c.remove(int(A[1]))
        elif A[0] == "D":
            d.remove(int(A[1]))
    for i in range(len(s)):
        print("S"+" "+str(s[i]))
    for i in range(len(h)):
        print("H"+" "+str(h[i]))
    for i in range(len(c)):
        print("C"+" "+str(c[i]))
    for i in range(len(d)):
        print("D"+" "+str(d[i]))


Measured memory_bytes: 5616
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

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

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

typedef complex<double> Point, Vector;
typedef pair<Point, Point> Segment, Line;
typedef vector<Point> Polygon;
typedef pair<Point, double> Circle;

#define X real()
#define Y imag()
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)

double dot(Vector a, Vector b){
    return a.X * b.X + a.Y * b.Y;
}

double cross(Vector a, Vector b){
    return a.X * b.Y - a.Y * b.X;
}

// 直交判定
bool isOrthogonal(Vector a, Vector b){
    return equals(dot(a, b), 0);
}

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

    double x1, y1, x2, y2,x3, y3, x4, y4;
    while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4){
        Vector a = Point(x1, y1) - Point(x2, y2);
        Vector b = Point(x3, y3) - Point(x4, y4);

        cout << (isOrthogonal(a, b) ? "YES" : "NO") << endl;
    }

    return 0;
}


Measured memory_bytes: 3296
S = input()

easy_step = True
for i in range(len(S)):
    if (i+1) % 2 == 0:
        easy_step &= S[i] in ['L', "U", "D"]
    else:
        easy_step &= S[i] in ["R", "U", "D"]
if easy_step:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)                                 //g++ ll.cpp -o ll.exe
#define zeroes(x) memset(x,0,sizeof(x))                                        //all elements to 0
#define all(x) (x).begin(), (x).end()
typedef long long int ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;
const ll maxn=100000;







bool sortbysec(const pair<int,int> &a,                         //sorting of elements wrt second
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 




int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

   ll n;
   cin>>n;
   ll cnt=0,a,b;
   ll k=0;

   while(n--)
   {
    cin>>a>>b;
    if(a==b)
        cnt++;
    else
        cnt=0;

    if(cnt==3)
        k=1;

   }
   if(k==1)
    cout<<"Yes";
else
    cout<<"No";



    
    return 0;
}

Measured memory_bytes: 3648
s=input()
a,b=s[::2],s[1::2]
a_lst=[i for i in a]
a0=a_lst.count("0")
a1=a_lst.count("1")
b_lst=[i for i in b]
b0=b_lst.count("0")
b1=b_lst.count("1")
print(min(a0+b1,a1+b0))

Measured memory_bytes: 4060
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin >> n;
    bool ans = false;
    for(int i=0;i<=n/4;i++){
        for(int j=0;j<=n/7;j++){
            if(i*4 + j*7 == n){
                ans = true;
            }
        }
    }
    if(ans==false) cout << "No" << endl;
    else cout << "Yes" << endl;
    
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
cnt = [0]*(n+1)
for i in a:
    cnt[i] += 1
combo1 = [-1]*(n+1)
combo2 = [-1]*(n+1)
total = 0
for i in range(n):
    if combo1[a[i]] == -1:
        c = cnt[a[i]]
        combo1[a[i]] = (c*(c-1)//2)
        combo2[a[i]] = ((c-1)*(c-2)//2)
        total += combo1[a[i]]
'''
print(combo1)
print(combo2)
print(total)
'''
for i in a:
    ans = total - combo1[i] + combo2[i]
    print(ans)

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

int main(){
    int N;
    cin >> N;
    char c[N+1];
    rep1(i, N) cin >> c[i];

    int W2R = 0;
    int R2W = 0;

    rep1(i, N){
        if(c[i] == 'R'){
            R2W++;
        }
    }
    int ans = R2W;
    int temp;


    for(int k = 1; k <= N; k++){
        if (c[k] == 'R'){
            R2W--;
        }else{
            W2R++;
        }

        if (R2W >= W2R){
            temp = R2W;
        }else{
            temp = W2R;
        }

        if (ans > temp){
            ans = temp;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3784
#include <cassert>
#include <vector>
#include <iostream>
using namespace std;
vector<int> nodes;
bool used[100100];
int rk[100100], parent[100100];
vector<int> adj[100100], rev[100100];

void dfs(int i) {
    used[i] = true;
    for (int j : adj[i]) {
        if (used[j]) continue;
        dfs(j);
    }
    nodes.push_back(i);
    rk[i] = nodes.size()-1;
}

int main() {
    int n, m; cin >> n >> m;
    for (int i = 0; i < n + m - 1; i++) {
        int a, b; cin >> a >> b;
        adj[a].push_back(b); rev[b].push_back(a);
    }
    fill(rk, rk+n, -1);
    int root;
    for (int i = 1; i <= n; i++) if (rev[i].empty()) { root = i; break; }
    dfs(root);
    for (int i = n-2; i >= 0; i--) {
        int v = nodes[i];
        int r = -1, p = 0;
        for (int u : rev[v]) {
            if (rk[u] > i && (r == -1 || rk[u] < r)) { p = u; r = rk[u]; }
        }
        assert (p != 0);
        parent[v] = p;
    }
    for (int i = 1; i <= n; i++) cout << parent[i] << endl;
}


Measured memory_bytes: 17788
import java.io.*;
import java.util.*;

public class Main {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	void solve() throws IOException {
		int n = nextInt();
		int v = nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
		}

		int[] b = new int[n - 1];
		for (int i = 0; i < n - 1; i++) {
			b[i] = a[i + 1] - a[i];
		}

		int[] seq = new int[40];
		int ptr = 0;
		while (true) {
			seq[ptr++] = v;
			if (v == 0) {
				break;
			}
			v /= 2;
		}
		
		for (int i = 0, j = ptr - 1; i < j; i++, j--) {
			int tmp = seq[i];
			seq[i] = seq[j];
			seq[j] = tmp;
		}

		int[][] nxt = new int[ptr][n];
		int[][] prv = new int[ptr][n];

		for (int i = 0; i < ptr; i++) {
			int gap = seq[i];
			for (int j = 0; j < n;) {
				int nxtJ = j + 1;
				while (nxtJ < n && b[nxtJ - 1] <= gap) {
					nxtJ++;
				}

				for (int k = j; k < nxtJ; k++) {
					nxt[i][k] = nxtJ - 1;
					prv[i][k] = j;
				}

				j = nxtJ;
			}
		}

		int[] pref = new int[1 << (ptr - 1)];
		int[] suff = new int[1 << (ptr - 1)];

		for (int mask = 0; mask < 1 << (ptr - 1); mask++) {
			for (int i = 0; i < ptr - 1; i++) {
				if (test(mask, i)) {
					int was = pref[mask ^ (1 << i)];
					if (was == n) {
						pref[mask] = n;
					} else {
						pref[mask] = Math.max(pref[mask], nxt[i][was] + 1);
					}

					was = suff[mask ^ (1 << i)];
					if (was == n) {
						suff[mask] = n;
					} else {
						suff[mask] = Math.max(suff[mask], n - prv[i][n - 1 - was]);
					}
				}
			}
		}

		int[] maxLeft = new int[n + 1]; // index - length of right
		Arrays.fill(maxLeft, -1);
		int allMask = (1 << (ptr - 1)) - 1;
		for (int maskL = 0; maskL <= allMask; maskL++) {
			int maskR = allMask ^ maskL;

			int valL = pref[maskL];
			int valR = suff[maskR];
			
			maxLeft[valR] = Math.max(maxLeft[valR], valL);
		}

		int canL = -1;
		for (int i = 0; i < n;) {
			int j = nxt[ptr - 1][i];
			for (int k = i; k <= j; k++) {
				canL = Math.max(canL, maxLeft[n - 1 - k]);
			}

			String outp = canL >= i ? "Possible" : "Impossible";

			for (int k = i; k <= j; k++) {
				out.println(outp);
			}

			i = j + 1;
		}
	}

	boolean test(int mask, int i) {
		return ((mask >> i) & 1) == 1;
	}

	Main() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new Main();
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 111440
/**
 *    +--+--+--++--++--In the name of ALLAH--++--++--+--+--+
 *
 *    author:  skmonir
 *    created: 21-Jun-2020 18:02:44
**/

#include <bits/stdc++.h>

using namespace std;

#define endl                '\n'
#define TN                  typename
#define mod                 1000000007LL
#define len(x)              (int) x.size()
#define all(x)              x.begin(), x.end()
#define rall(x)             x.rbegin(), x.rend()
#define mem(x, y)           memset(x, y, sizeof x)
#define FOR(x, l, r)        for (int x = l; x <= r; ++x)
#define ROF(x, l, r)        for (int x = l; x >= r; --x)

template <TN T> inline void Int(T &n) {
    n = 0; int f = 1; int ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
    n = n * f;
}

template <TN T> T gcd(T a, T b) {return !b ? a : gcd(b, a % b);}
template <TN T> inline void umin(T &a, T b) {a = a < b ? a : b;}
template <TN T> inline void umax(T &a, T b) {a = a > b ? a : b;}
template <TN T, TN W> inline void Int(T &x, W &y) {Int(x), Int(y);}
template <TN T, TN W, TN Q> inline void Int(T &x, W &y, Q &z) {Int(x, y), Int(z);}

const int N = 1e5 + 7;
const int inf = 1e9 + 7;


int solve() {
    int n, k; cin >> n >> k;
    vector<int> p(n);
    for (int &x : p) {
        cin >> x;
    }

    sort(all(p));
    long long res = 0;
    for (int i = 0; i < k; ++i) {
        res += p[i];
    }

    cout << res << endl;

    return 0;
}

int main() {
    int tests = 1, CaseNo = 0;
    // Int(tests);
    while (tests--) {
        //printf("Case %d: ", ++CaseNo);
        solve();
    }
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n);++i)
using namespace std;
using ll = long long; 
using P = pair<int,int>;
ll mod = 1000000007;
const int inf = 2147483647;
const ll MAX_N = 2100000;
const ll MAX_W = 2010000;

/*************ここから**********************/
class union_find{
public: 
    ll N;
    ll par[MAX_N];
    ll rank[MAX_N];
 
    union_find(void){init();};
    union_find(ll n):N(n){init();}
    void init(){
        for(int i=0;i<N;i++){
            par[i] = i;
            rank[i] = 0;
        }
    }
    //xの始点を探す
    ll find(ll x){
        if(par[x] == x){
            return x;
        }else{
            return par[x] = find(par[x]);
        }
    }
    //グループを結合
    void unite(ll x,ll 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]++;
        }
    }
    //始点の親が同じか
    bool same(ll x,ll y){
        return find(x) == find(y);
    }
    //引数xの含まれるグループを表示
    void print_tree(ll x){
        string str;
        str = "{";
        for(int i=0;i<N;i++){
            if(same(x,i)){
              str = str + to_string(i) + ",";
            }
        }
        str[str.size()-1] = '}';
        cout << str << endl;
    }
    //すべてのグループを表示
    void print_all(void){
        vector<bool> is_printed(N,false);
        for(int i=0;i<N;i++){
            if(!is_printed[i]){
                print_tree(i);
                for(int j=0;j<N;j++){
                    if(same(i,j)) is_printed[j] = true;
                }
            }
        }
        return;
    }
};

/**************ここまで*************************/
int main(void){
    ll n,m; cin >> n >> m;
    union_find uf(n);
    rep(i,m) {
        ll a,b;cin >> a >> b;
        a--;b--;
        uf.unite(a,b);
    }
    vector<ll> group(n);
    for(int i=0;i<n;i++){
        group[uf.find(i)]++;
    }
    ll ans = 0;
    for(int i=0;i<n;i++){
        ans = max(ans,group[i]);
    //    cout << "i= " <<i << "group:" << group[i] << endl;
    }
    // uf.print_all();
    cout << ans << endl;
}

Measured memory_bytes: 8008
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<complex>
using namespace std;

int main(){
  int n; cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  reverse(a.begin(), a.end());
  for(int i = 0; i < n; i++){
    cout << a[i];
    if(i == n-1) cout << endl;
    else cout << " ";
  }
  return 0;
}



Measured memory_bytes: 3088
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

#define REP(i,a,b) for(int i=int(a);i<int(b);i++)

using namespace std;

typedef long long int lli;

struct Point {
    double x, y, z;
    Point() { Point(0, 0, 0); }
    Point(double x, double y, double z) : x(x), y(y), z(z) {}
    Point operator+(Point p) {
        return Point(x + p.x, y + p.y, z + p.z);
    }
    Point operator-(Point p) {
        return Point(x - p.x, y - p.y, z - p.z);
    }
    double operator*(Point p) {
        return x * p.x + y * p.y + z * p.z;
    }
};

Point operator*(double r, Point p) {
    return Point(r * p.x, r * p.y, r * p.z);
}

int main () {
    int N, Q;
    cin >> N >> Q;
    vector<Point> obs(N);
    vector<double> R(N);
    vector<lli> L(N);
    REP (i, 0, N) {
        cin >> obs[i].x >> obs[i].y >> obs[i].z >> R[i] >> L[i];
    }
    double eps = 1e-9;
    REP (i, 0, Q) {
        Point s, d;
        cin >> s.x >> s.y >> s.z >> d.x >> d.y >> d.z;
        lli ans = 0;
        REP (j, 0, N) {
            double t = -((d - s) * (s - obs[j]) / ((d - s) * (d - s)));
            double dis = t * t * (d - s) * (d - s) + 2 * t * ((d - s) * (s - obs[j])) + s * s + obs[j] * obs[j] - 2 * s * obs[j];
            if (0.0 <= t && t <= 1.0 + eps && dis - eps <= R[j] * R[j]) ans += L[j];
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3228
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>

using namespace std;


int main(){
   int A,B,Q;
   cin >>A>>B>>Q;
   long long S[A];
   long long T[B];
   for(int i=0;i<A;i++) cin >> S[i];
   for(int i=0;i<B;i++) cin >> T[i];
   vector<pair<long long, long long> > v;
   int si=0;int ti=0;
   while(si<A || ti<B){
      if(si>=A){
         v.push_back(make_pair(T[ti], T[ti]-S[A-1]));
         ti++;
      }
      else if(ti>=B){
         v.push_back(make_pair(S[si], S[si]-T[B-1]));
         si++;
      }
      else if(S[si] <= T[ti]){
         long long d = -S[si]+T[ti];
         if(ti>0) d = min(d, S[si]-T[ti-1]); 
         v.push_back(make_pair(S[si], d));
         si++;
      }
      else{
         long long d = -T[ti]+S[si];
         if(si>0) d = min(d, T[ti]-S[si-1]); 
         v.push_back(make_pair(T[ti], d));
         ti++;
      }
   }
   /*for(int i=0;i < A+B; i++){
      cout << v[i].first <<", "<< v[i].second << endl;
   }*/
   for(int i=0;i<Q;i++){
      long long x;
      cin >> x;
      vector<pair<long long, long long> >::iterator itr;
      itr = lower_bound(v.begin(), v.end(), make_pair(x, 0LL));
      long long ans = LLONG_MAX;
      if(itr!=v.end()){
         ans = min(ans,abs(x-(*itr).first)+(*itr).second);
      }
      if(itr!=v.begin()){
         itr--;
         ans = min(ans,abs(x-(*itr).first)+(*itr).second);
      }

      cout << ans << endl;

   }
   return 0;
}


Measured memory_bytes: 8048
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(NULL);cin.tie(0);cout.tie(0);
#define make_pair mp
#define pb push_back
#define ALL(s) s.begin(), s.end()
using namespace std;
typedef long long ll;
const int maxn = 1<<21;
const int mod = 1e9+7;
const int INF = 1e9+5;
int h[100005];
int main()
{
	int n, k;
	cin >> n >> k;
	for(int i=0;i<n;i++)cin >> h[i];
	vector<int> dp(n,INF);
	dp[0] = 0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<=i+k;j++)
		{
			if(j<n)dp[j] = min(dp[j],dp[i]+abs(h[i]-h[j]));
			else break;
		} 
	}
	cout << dp[n-1] << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
typedef long long ll;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	// ?????????????????°??????????????????
	int a, b, s, l;
	cin >> a >> b;
	s = a*b;
	l = (2 * a) + (2 * b);
	cout << s << " " << l << endl;
	// ???????????§
}


Measured memory_bytes: 3084
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int A,B;
	cin >> A >> B;
	int ret = A*B;
	cout << (ret&1?"Odd":"Even") << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 256
def get_pair(x):
    s = int(str(x)[0])
    e = x % 10
    return s, e


N = int(input())
freq = {}
for i in range(1, N+1):
    s, e = get_pair(i)
    freq[(s, e)] = freq.get((s, e), 0) + 1
ans = 0
for s, e in freq:
    ans += freq.get((s, e), 0) * freq.get((e, s), 0)
print(ans)


Measured memory_bytes: 3188
N, M = map(int, input().split())
a = set([int(input()) for _ in range(M)])
INF = 1000000007

dp = [0] * (N + 1)
dp[0] = 1
if 1 not in a:
	dp[1] = 1
else:
	dp[1] = 0
for i in range(2, N + 1):
	if i in a:
		continue
	dp[i] = dp[i - 1] + dp[i - 2]
	dp[i] %= INF

print(dp[N])


Measured memory_bytes: 13212
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBUG = true;

int main(){

    string s;
    cin >> s;

    int ans = 0;
    for(int i = 0; i < s.size() / 2; i++){
        int id = s.size() - 1 - i;
        if(s[i] != s[id]) ans ++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<utility>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#define maxn 1010
#define INF 0x3f3f3f3f
#define LL long long
#define ULL unsigned long long
#define E 1e-8
#define mod 1000000007
#define P pair<int,int>
using namespace std;

int main()
{
    int a,b,c;
    while(scanf("%d%d%d",&a,&b,&c)!=EOF){
        if(a>c||a+b<c)
            printf("NO\n");
        else
            printf("YES\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
const int maxn = 1e6+5;
const int mod = 1e9+7;
const double eps = 1e-8;
using namespace std;

void tlfclwx(){ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

int main()
{
    int a, b, c; cin >> a >> b >> c;
    if(a+b+c >= 22) cout << "bust" << endl;
    else cout << "win" <<endl;
}


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


#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define INF 1145141919
#define ll long long

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int N,T;
    cin >> N >> T;
    int c[N+1],t[N+1];
    REP(i,N) cin >> c[i] >> t[i];

    int ans = INF;
    REP(i,N){
        if (t[i] <= T) ans = min(ans,c[i]);
    }
    if (ans == INF) cout << "TLE" << endl;
    else cout << ans << endl;
       
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public static class Program
{
    public static void Main(params string[] args)
    {
        var a = Console.ReadLine()
            .Split(' ')
            .Select(int.Parse)
            .ToArray();
        var n = a[0];
        var x = a[1];
        var l = Console.ReadLine()
            .Split(' ')
            .Select(int.Parse)
            .ToArray();
        var c = 1;
        var p = 0;
        foreach (var inc in l)
        {
            p += inc;
            if (p > x)
            {
                break;
            }
            c++;
        }
        Console.WriteLine(c);
    }
}


Measured memory_bytes: 13268
#[allow(unused_imports)]
use std::cmp;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    #[allow(unused_mut)]
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

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

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

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

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

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

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

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

fn gcd(x: i64, y: i64) -> i64 {
  if y == 0 {
    return x;
  }
  gcd(y, x % y)
}

fn main() {
  input!{
    n: usize,
    x: i64,
    ys: [i64; n]
  }
  let mut ans = 0;
  for y in &ys {
    ans = gcd(ans, (x - y).abs());
  }
  println!("{}", ans);
}


Measured memory_bytes: 6396
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
// #define LOCAL
const int MAXN=2e5+10;
const ll MOD=17;
ll _gcd(ll a,ll b){if(b==0)return a;return _gcd(b,a%b);}
ll gcd(ll a,ll b){a=abs(a),b=abs(b);if(a<b)swap(a,b);return _gcd(a,b);}
ll qpow(ll a,ll n){ll rt=1;while(n){if(n&1)rt=(rt*a)%MOD;a=a*a%MOD;n>>=1;}return rt;}
ll factor[MAXN];
void cal_factor(){factor[0]=1;for(int u=1;u<MAXN;u++){factor[u]=(factor[u-1]*u)%MOD;}}
ll C(ll n,ll k){return factor[n]*qpow(factor[n-k],MOD-2)%MOD*qpow(factor[k],MOD-2)%MOD;}
int updiv(int a, int b){
    if(a%b==0)return a/b;
    return a/b+1;
}
int N,K;
int A[MAXN];
bool check(int x){
    int cnt=0;
    for(int u=0;u<N;u++){
        int t=A[u];
        if(t>x)
        cnt+=t%x==0?t/x-1:t/x;
    }
    return cnt<=K;
}
void solve()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N>>K;
    for(int u=0;u<N;u++)cin>>A[u];
    int l=1,r=1e9,lst=-1;
    while(l<=r){
        int mid=l+(r-l)/2;
        if(check(mid)){
            r=mid-1;
            lst=mid;
        }else{
            l=mid+1;
        }
    }
    assert(lst!=-1);
    cout<<lst;
}
int main()
{
#ifdef LOCAL
    freopen("in.txt","r",stdin);
#endif
    solve();
}

Measured memory_bytes: 4364
n = int(input())
li = [0]*10050

for i in range(1,105):
    for j in range(1,105):
        for k in range(1,105):
            s = i*i+j*j+k*k+i*j+j*k+i*k
            
            if s<10050:
                li[s]+=1
                
for i in range(1,n+1):
    print(li[i])

Measured memory_bytes: 9224
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  map<int, int> amap;
  for(int x=1;x<=100;++x) {
    for(int y=1;y<=100;++y) {
      for(int z=1;z<=100;++z) {
        amap[x*x+y*y+z*z+x*y+y*z+z*x]++;
      }
    }
  }
  for(int i=1;i<=N;++i) cout<<amap[i]<<endl;
}



Measured memory_bytes: 5308
w, h, n = map(int, input().split())
w1 = 0
h1 = 0
w2 = w
h2 = h
for _ in range(n):
    x, y, a = map(int, input().split())
    if a == 1 and x > w1:
        w1 = x
    elif a == 2 and x < w2:
        w2 = x
    elif a == 3 and h1 < y:
        h1 = y
    elif a == 4 and h2 > y:
        h2 = y

ans = (w2 - w1) * (h2 - h1)
if w2 - w1 < 0 or h2 - h1 < 0:
    print(0)
else:
    print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <vector> //動的配列
#include <string>
#include <list> //双方向リスト
#include <map> //連想配列
#include <set> //集合
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <bitset>
#include <numeric>
#include <tuple>



typedef long long ll;


using namespace std;

typedef pair<int, int> P;
#define FOR(i,a,b) for(int i=(int)(a) ; i < (int) (b) ; ++i )
#define rep(i,n) FOR(i,0,n)
#define sz(x) int(x.size())


template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

//小さい順から取り出すヒープ
//priority_queue<ll, vector<ll>, greater<ll> > pque1;

const int MAX = 1001001;
const int MOD = 1000000007;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



int main(){
    int x,y;
    cin>>x>>y;
    if ((x+y)%3!=0){
        cout<<0<<endl;
        return 0;
    }
    int dif=x-y;
    int sum=x+y;
    int a,b;
    a=(sum+3*dif)/6;
    b=(sum-3*dif)/6;
    //cout<<a<<b;
    // 前処理
    COMinit();

    // 計算例
    cout << COM(a+b, b) << endl;
    
    return 0;
}


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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define mp make_pair
#define ll long long
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2097162
#define inf 1e9
#define MOD 1000000007

int main()
{

    double w,h,x,y;
    cin >> w >> h >> x >> y;
    printf("%.10lf ", (w*h)/2.0);
    if(w/2.0 == x && h/2.0 == y) cout << 1;
    else cout << 0;
}


Measured memory_bytes: 256
#ifdef _MSC_VER
#pragma warning(disable : 4996)
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << '\n'
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) {
	if (a > b) a = b;
}
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) {
	if (a < b) a = b;
}
typedef pair<int, int> pii;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7;
constexpr int MAX = 200020;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll INF = 1e18;


void solve() {
	int N; cin >> N;
	set<string>st;
	REP(i, N) {
		string s; cin >> s;
		st.insert(s);
	}
	print(st.size());
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	// int q; cin >> q;
	// while (q--)
	solve();
}


Measured memory_bytes: 19276
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

typedef unsigned long long int ulint;
typedef long long int lint;

template <typename T>
vector<size_t> sort_indexes(const vector<T> &v) {

  // initialize original index locations
  vector<size_t> idx(v.size());
  iota(idx.begin(), idx.end(), 0);

  // sort indexes based on comparing values in v
  // using std::stable_sort instead of std::sort
  // to avoid unnecessary index re-orderings
  // when v contains elements of equal values 
  stable_sort(idx.begin(), idx.end(),
       [&v](size_t i1, size_t i2) {return v[i1] < v[i2];});

  return idx;
}

int main(){
  ulint N;
  cin >> N;

  vector<lint> init;
  vector<lint> end;
  

  vector<bool> removed = vector<bool>(N, false);
    
  for (int i = 0; i < N; ++i) {
    lint x, l;
    cin >> x >> l;
    init.push_back(x - l);
    end.push_back(x + l);
  }


  vector<size_t> end_sort = sort_indexes(end);
  vector<size_t> init_sort = sort_indexes(init);

  int ret = 0;

  int j = 0;
  for (int i = 0; i < N; ++i) {
    if (removed[end_sort[i]]) {
      continue;
    } else {
      ++ret;

      while ((j < N) && (init[init_sort[j]] < end[end_sort[i]])) {
        removed[init_sort[j]] = true;
        ++j;
      }
      
    }
  }    

  cout << ret << endl;
}



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

using namespace std;

int sq(int x)
{
	return x * x;
}

signed main()
{
	int n, sum = 0;
	cin >> n;
	vector<int> vec(n);
	for (int i = 0; i < n; i++)
	{
		cin >> vec[i];
		sum += vec[i];
	}

	int mid = round(double(sum) / n);
	int ans = 0;
	for (int i = 0; i < n; i++)
		ans += sq(mid - vec[i]);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#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)
        #define Test(){int t;cin >> t;for(int i=1;i<=t;i++){cout << "Case #" << i << ": ";solve();}}
        #define test(){int t; cin>>t; for(int i=1;i<=t;i++){solve();}}
        #define vi vector<int>
        #define vii vector<pair<int,int> > 
        #define vci vector<pair<char,int> >
        #define vic vector<pair<int,char> > 
        #define N 200005
        #define pb push_back
        const double PI=acos(-1);
        const int MOD = 1000000007;
        const int FMOD = 998244353;
        
        
        void solve()
        {
        	int x;
  			cin>>x;
  int p = 0,c = 1;
  map<int,int> mp1;
  while(1){
    int rem = p*10 + 7;
    rem %= x;
    p = rem;
    if(rem == 0){
      cout<<c;
      return;
    }
    if(mp1[rem] == 1)
      break;
    mp1[rem] = 1;
    c++;
  }
  cout<<"-1";
		}
        signed main()
        {
        	solve();
		}

Measured memory_bytes: 66124
#include <bits/stdc++.h>
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define TRAV(i, a) for(auto & i : (a))
#define SZ(x) ((int)(x).size())
#define PR std::pair
#define MP std::make_pair
#define X first
#define Y second
typedef long long ll;
typedef std::pair<int, int> PII;
typedef std::vector<int> VI;

const int LOG = 61;

void solve(){
	int n;
	std::cin >> n;
	std::vector<ll> A(n);
	FOR(i, n) std::cin >> A[i];
	std::string s;
	std::cin >> s;

	if(s.back() == '1'){
		std::cout << 1 << "\n";
		return;
	}

	std::vector<ll> base(LOG, -1);

	auto add = [&](ll a){
		for(int i = LOG-1; i >= 0; --i){
			if(a & (1ll<<i)){
				if(base[i] == -1){
					base[i] = a;
					return;
				}else{
					a = a^base[i];
				}
			}
		}
	};

	auto check = [&](ll a){
		for(int i = LOG-1; i >= 0; --i){
			if(a & (1ll<<i)){
				if(base[i] == -1) return false;
				a ^= base[i];
			}
		}
		return true;
	};
	
	for(int i = n-1; i >= 0; --i){
		if(s[i] == '0'){
			add(A[i]);
		}else{
			if(!check(A[i])){
				std::cout << 1 << "\n";
				return;
			}
		}
	}

	std::cout << 0 << "\n";
}

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

	int t;
	std::cin >> t;
	while(t--) solve();

	return 0;
}

Measured memory_bytes: 3620
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;

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

	cin >> W >> N >> M;
	vector<long long int>dp(W + 1);
	while (N--) {
		cin >> L >> R;
		for (int j = W; j >= L; j--) {
			dp[j] = max(dp[j], dp[j - L] + R);
		}
	}
	for (int i = 1; i <= M; i++) {
		cout << dp[W / i] * i << endl;
	}
}


Measured memory_bytes: 3260