akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<string>
#include<iostream>
#include<algorithm>
#include<queue>
#include<tuple>
#include<map>//map<char,char> a["a"]="a"
#include<limits>//ex numeric_limits<int>::max()
#include<math.h>
#define llong long long
#define INF 999999999

using namespace std;

//約数列挙
vector<int> divisor(int n){
    vector<int> res;
    for (int i = 1; i*i <= n; ++i){
        if(n%i==0){
            res.push_back(i);
            if(i!=n/i)res.push_back(n/i);
        }
    }
    return res;
}

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >>n;
    int cnt=0;
    for (int i = 1; i <= n; i+=2)
    {
        if(divisor(i).size()==8)cnt++;
    }
    cout<< cnt<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int N,K,U,L,V,T;
double cnt;
bool mp[10010];

int main(){
  cin>>N>>K>>T>>U>>V>>L;
  for(int i=0,a,A;i<N;i++){
    cin>>a;A=a;
    while(mp[a]&&(1.0*a-A)/V/T<K)a++;
    for(int j=a;j<L&&j<a+T*V;j++)cnt+=!mp[j],mp[j]=1;
  }

  printf("%.8f\n",cnt/V+(L-cnt)/U);
  return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
int b[810];
int a[810][810];
int main(){
  int n,m,c;
  cin>>n>>m>>c;
  int sum=0;
  int ans=0;
  for(int j=0;j<m;j++){
    cin>>b[j];
  }
  for(int l=0;l<n;l++){
      for(int s=0;s<m;s++){
          cin>>a[l][s];
      }
  }
  for(int i=0;i<n;i++){
      sum=0;
    for(int k=0;k<m;k++){
      sum+=a[i][k]*b[k];
    }
    if(sum+c>0){
        ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import math
S = int(input())

a = int(math.sqrt(S))
if S - a**2 > 0:
  a += 1
b = a**2 - S
c = 1
if b >= 10**8:
  s = int(math.sqrt(b))
  for i in range(s):
    if b % (s-i) == 0:
      b //= (s-i)
      c *= (s-i)
      break
print(0, 0, a, b, c, a)

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


int main(){
    string s;
    cin >> s;
    int bit;
    for (bit = 0; bit < (1 << 3); bit++)
    {   
        int sum = s[0] - '0';
        for (int i = 0; i < 3; i++)
        {
            if (bit & (1 << i)){
                sum += (int)(s[i+1] - '0');
            }
            else
            {
                sum -= (int)(s[i+1] - '0');
            }
            
        }
        
        if (sum == 7)
        {
            break;
        }
    }
    vector<char> op(3, '-');
    for (int i = 0; i < op.size(); i++)
    {
        if (bit & (1 << i)){
            op[i] = '+';
        }
    }
    cout << s[0] << op[0] << s[1] << op[1] << s[2] << op[2] << s[3] << "=7" << endl;    
    return 0;
}


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

int main() {
	int N, x; cin >> N >> x;
	if (x == 1 || x == 2 * N - 1) {
		puts("No");
		return 0;
	}
	vector<int> ans(2 * N - 1); for (int i = 0; i < 2 * N - 1; i++) ans[i] = i + 1;
	if (x > N) rotate(ans.begin(), ans.begin() + x - N, ans.end());
	else if (x < N) rotate(ans.rbegin(), ans.rbegin() + N - x, ans.rend());

	puts("Yes");
	for (int i = 0; i < ans.size(); i++) {
		if (i) cout << ' ';
		cout << ans[i];
	}
	cout << endl;

	return 0;
}

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

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

    int a, b;
    cin >> a >> b;
    cout << (a * b) << " " << (a * 2 + b * 2) << endl;
}


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

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;

template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
	int N; cin >> N;
	vector<vector<int>> c(N,vector<int>(N,0));
	for(int i = 0; i < N; ++i) {
		for(int j = i+1; j < N; ++j) {
			int k = i^j;
			for(int l = 0; l < 10; ++l) {
				if((k>>l)&1) c[i][j] = c[j][i] = l+1;
			}
		}
	}

	for(int i = 0; i < N; ++i) {
		for(int j = i+1; j < N; ++j) {
			cout << c[i][j] << " ";
		}
		cout << endl;
	}

		
	return 0;
}


Measured memory_bytes: 1536
import copy, math

def f(n, d, D, res, buil):
    global sd, ans
    d += D
    res.append(n)
    if sd is not None and sd <= d:
        return
    elif n == g:
        ans = res
        sd = d
        return
    else:
        new_buil = copy.deepcopy(buil)
        A = new_buil[n]
        del new_buil[n]
        for m, B in new_buil.items():
            D = py(A, B)
            if D:
                f(m, d, D, res[:], new_buil)
            
def py(A, B):
    x = 0
    y = 1
    D = math.sqrt((B[x]-A[x])**2+(B[y]-A[y])**2)
    if D <= 50:
        return D

while True:
    N = input()
    if N == 0: break
    buil = {}
    for i in range(N):
        n, x, y = map(int, raw_input().split())
        buil[n] = (x, y)
    for i in range(input()):
        s, g = map(int, raw_input().split())
        sd = None
        ans = None
        f(s, 0, 0, [], buil)
        if ans:
            print ' '.join(map(str, ans))
        else:
            print 'NA'

Measured memory_bytes: 4708
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[][] a = new int[N][2];
		for(int i = 0; i < N; i++) {
			a[i][0] = i;
			a[i][1] = sc.nextInt();
		}
		Arrays.sort(a, (x, y) -> x[1] - y[1]);
		System.out.println(2 * N - 1);
		if(Math.abs(a[0][1]) > a[N-1][1]) {
			for(int i = 0; i < N; i++)
				System.out.println((a[0][0]+1) + " " + (i + 1));
			for(int i = N-1; i > 0; i--)
				System.out.println((i+1) + " " + i);
		}
		else {
			for(int i = 0; i < N; i++)
				System.out.println((a[N-1][0]+1) + " " + (i + 1));
			for(int i = 1; i <= N-1; i++)
				System.out.println(i + " " + (i+1));
		}
	}

}

Measured memory_bytes: 28372
#include<iostream>
#include<cstring>
using namespace std;
string s;
int cnt,ans;
 
int main() {
	cin >> s;
	for(int i = 0;i < s.size();i++)
		if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T')
			cnt++;
		else {
			ans = max(ans,cnt);			
			cnt = 0;
		}
	ans = max(ans,cnt);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.LinkedHashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args){
		Set<String> lottery = new LinkedHashSet<String>();
		Scanner scan = new Scanner(System.in);

		int N = Integer.parseInt(scan.nextLine());

		for(int i = 0; i < N; i++){
			String S = scan.nextLine();
			lottery.add(S);
		}

		System.out.println(lottery.size());
	}
}


Measured memory_bytes: 82164
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int a;
  cin>>a;
  if(a==22){
    cout<<"Christmas Eve Eve Eve\n";
  }if(a==23){
    cout<<"Christmas Eve Eve\n";
  }if(a==24){
    cout<<"Christmas Eve\n";
  }if(a==25){
    cout<<"Christmas\n";
  }
}


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

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


int main(){
	int n,k;
	cin >> n >> k;
	double p[n];
	for(int i=0;i<n;i++)  cin >> p[i];
	double sum[n+1];
	sum[0] = 0;
	for(int i=1;i<=n;i++){
		sum[i] = sum[i-1] + (p[i-1]+1.0)/2;
	}

	double ans = sum[k];
	for(int i=k+1;i<=n;i++){
		ans = max(ans, sum[i]-sum[i-k]);
	}

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


	return 0;
}


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

typedef long long ll;

#define int ll
#define all(v) v.begin(), v.end()
#define reps(__i, a, b) for (int __i = a; i < b; i++)
#define rep(__i, n) reps(__i, 0, n)

const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;

#define __SIZE 101
int dp[__SIZE][__SIZE];
void init()
{
    for (int i = 0; i < __SIZE; i++)
        for (int j = 0; j < __SIZE; j++)
            dp[i][j] = INF;

    for (int i = 0; i < __SIZE; i++)
        dp[i][1] = i;
}
int comb(int n, int r)
{
    if (dp[n][r] != INF)
    {
        cout << n << "," << r << endl;
        return dp[n][r];
    }
    else if (n == r)
    {
        dp[n][r] = 1;
        return 1;
    }
    else
    {
        dp[n][r] = comb(n - 1, r) + comb(n - 1, r - 1);
        return dp[n][r];
    }
}
signed main()
{
    int n, m;
    cin >> n >> m;

    int s1 = m * 1900 + (n - m) * 100;
    double sum = 0, pp = 1, p3 = 1, pt = 1;

    int idx = 1;
    init();
    for (int i = 0; i < m; i++)
        pt /= 2;
    // cout << pt << endl;
    while (abs(sum - pp) > 1e-25)
    {
        // cout << idx << endl;
        pp = sum;
        sum += p3 * pt * idx++ * s1;
        p3 *= (1 - pt);
    }
    cout << sum << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecb vector<bool>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}

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

Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <iomanip>
#include <tuple>

using namespace std;
const long long mod=1e9+7;
const long long INF=1LL<<60;

int main(){
    long long l,r;
    cin>>l>>r;
    if(r-l>=2019)cout<<0<<endl;
    else {
        long long ans=INF;
        for(long long i=l;i<r;i++){
            for(long long j=i+1;j<=r;j++){
                if(ans>(i*j)%2019)ans=(i*j)%2019;
            }
        }
        cout<<ans<<endl;
    }

    
}
 
   

Measured memory_bytes: 256
//agrawal117
//chahatagrawal117
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
typedef long long int ll;
using namespace std;
#define MAX 100005
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t; cin>>t;
    while(t--)
    {
        int n; cin>>n;
        vector<pair<ll,ll>> v1[n+2],v2[n+3];
        for(int i=1;i<=n;i++){
            int k,l,r; cin>>k>>l>>r;
            if(l>=r) v1[k].emplace_back(l,r);
            else v2[n-k].emplace_back(l,r);
        }
        multiset<pair<ll,ll>> st;
        int left=0;
        ll ans=0;
        for(int i=n;i>=1;i--)
        {
            for(auto j : v1 [i]) {
                st.insert({j.first-j.second,j.second});
            }
            if(st.size()!=0)
            {
                auto it=st.end();
                it--;
                left++;
                ans+=(*it).first+(*it).second;
                st.erase(it);
            }
        }
        for(auto i: st) {
            left++;
            ans+=i.second;
        }
        st.clear();
        // cout<<left<<endl;
        int start=n-left;
        for(int i=n;i>start;i--){
            for(auto j: v2[i]) st.insert({j.second-j.first,j.first});
        }
        for(int i=left+1;i<=n;i++){
            for(auto j: v2[start]) st.insert({j.second-j.first,j.first});
            start--;
            if(st.size()!=0)
            {
                auto it=st.end();
                it--;
                ans+=(*it).first+(*it).second;
                st.erase(it);
            }
        }
        for(auto i: st) ans+=i.second;
        for(auto i: v2[0]) ans+=i.first;
        cout<<ans<<endl;
        
    }
    
}

Measured memory_bytes: 24064
#include <iostream>

using namespace std;
typedef long long ll;
const int MAXN = 1e5+10;

int n;
ll a[MAXN], b[MAXN];

void solve() {
  ll sum = 0;
  for (int i=0;i<n;i++) {
    if (a[i] < b[i]) {
      b[i] -= a[i];
      sum += a[i];
      int tmp = min(a[i+1], b[i]);
      sum += tmp;
      a[i+1] -= tmp;
    } else {
      sum += b[i];
    }
  }
  cout << sum << endl;
}

int main() {
  cin >> n;
  for (int i=0;i<n+1;i++) {
    cin >> a[i];
  }
  for (int i=0;i<n;i++) {
    cin >> b[i];
  }
  solve();
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int n,m,a[100][100],f[100][100];
int main(){
    cin>>m;
    for(int i=1;i<=2;i++){
        for(int j=1;j<=m;j++){
            cin>>a[i][j];
        }
    }
    int i=1;
    f[1][1]=a[1][1];
    //cout<<f[1][1]<<" ";
    for(int j=2;j<=m;j++){
        f[i][j]=max(f[i][j-1]+a[i][j],a[i][j]);
        //cout<<f[i][j]<<" ";
    }
    //cout<<endl;
    i=2;
    f[2][1]=f[1][1]+a[2][1];
   // cout<<f[2][1]<<" ";
    for(int j=2;j<=m;j++){
        f[i][j]=max(f[i-1][j]+a[i][j],f[i][j-1]+a[i][j]);
        //cout<<f[i][j]<<" ";
    }
    //cout<<endl;
    cout<<f[2][m];
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
using namespace std;
#define G() Cr = getchar()
#define LL long long
int Xr, Fr; char Cr;
inline int rd() {
	Xr = 0, Fr = 1, G();
	while(Cr < '0' || Cr > '9') {if(Cr == '-') Fr = -1; G();}
	while(Cr >= '0' && Cr <= '9') Xr = (Xr<<1) + (Xr<<3) + (Cr&15), G();
	return Xr * Fr;
}
#define MAX_N 200005
#define mod 1000000007
LL va[MAX_N], ans = 1;
int n, k, sum;
int chi[2];
bool cho[MAX_N];
struct node {
	LL va, f;
}dat[MAX_N];

bool comp(node x, node y) {
	return x.va < y.va;
}

int main() { 
	n = rd(), k = rd();
	for(int i = 1; i <= n; i++) {
		va[i] = rd(), dat[i].va = abs(va[i]);
		if(va[i] >= 0) dat[i].f = 1, sum++;
	}
	sort(dat+1, dat+1+n, comp);
	if( ( k == n & (n - sum) % 2 == 1) || ( sum == 0 && k % 2 == 1) ) {
		for(int i = 1; i <= k; i++) ans = ans * dat[i].va % mod;
		cout << (-ans + mod) % mod;
		return 0 ;
	}
	for(int i = n; i > n - k; i--) chi[dat[i].f]++,cho[i] = 1;
	if(chi[0]&1) {
		int x = 0, y = 0, a = 0, b = 0;
		double s1 = 0, s2 = 0;
		for(int i = n - k; i >= 1; i--) if(dat[i].f) {
			y = i;
			break;
		}
		for(int i = n - k; i >= 1; i--) if(!dat[i].f) {
			x = i;
			break;
		}
		for(int i = n - k + 1; i <= n; i++) if(dat[i].f) {
			b = i;
			break;
		}
		for(int i = n - k + 1; i <= n; i++) if(!dat[i].f) {
			a = i;
			break;
		}
//		cout << x << y << a <<b;
		if(a && y ) s1 = dat[y].va * 1.0 / dat[a].va;
		if(b && x ) s2 = dat[x].va * 1.0 / dat[b].va;
		
		if( a && y && b && x ) {
			if(dat[y].va * dat[b].va < dat[x].va * dat[a].va ) cho[x] = 1, cho[b] = 0;
			else cho[y] = 1, cho[a] = 0;
		}
		
		else if(s1 < s2) cho[x] = 1, cho[b] = 0;
		else cho[y] = 1, cho[a] = 0;
	}
	for(int i = 1; i <= n; i++) if(cho[i]) ans = ans * dat[i].va % mod;
	cout << ans;
}

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

int main(){
	int64_t x;
	int64_t moto = 100;
	cin >> x;

	int step = 0;
	while(moto < x){
		moto += moto/100;
		step++;
	}

	cout << step << endl;
}

Measured memory_bytes: 3600
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());
        int[] vs = new int[n];

        String[] line = scanner.nextLine().split(" ", -1);
        for (int i = 0; i < n; i++) {
            vs[i] = Integer.parseInt(line[i]);
        }

        int v1max = 0;
        int[] v1count = new int[100001];
        int v2max = 0;
        int[] v2count = new int[100001];

        for (int i = 0; i < n / 2; i++) {
            int v = vs[i * 2];
            if (v > v1max) {
                v1max = v;
            }
            v1count[v]++;
        }
        for (int i = 0; i < (n / 2); i++) {
            int v = vs[i * 2 + 1];
            if (v > v2max) {
                v2max = v;
            }
            v2count[v]++;
        }

        int v1top1num = 0;
        int v1top1count = 0;
        int v1top2num = 0;
        int v1top2count = 0;
        for (int i = 0; i <= v1max; i++) {
            if (v1count[i] > v1top1count) {
                v1top1num = i;
                v1top1count = v1count[i];
            }
        }
        for (int i = 0; i <= v1max; i++) {
            if (i != v1top1num && v1count[i] > v1top2count) {
                v1top2num = i;
                v1top2count = v1count[i];
            }
        }

        int v2top1num = 0;
        int v2top1count = 0;
        int v2top2num = 0;
        int v2top2count = 0;
        for (int i = 0; i <= v2max; i++) {
            if (v2count[i] > v2top1count) {
                v2top1num = i;
                v2top1count = v2count[i];
            }
        }
        for (int i = 0; i <= v2max; i++) {
            if (i != v2top1num && v2count[i] > v2top2count) {
                v2top2num = i;
                v2top2count = v2count[i];
            }
        }

        int n2 = n / 2;
        if (v1top1num == v2top1num) {
            int a = (n2 - v1top1count) + (n2 - v2top2count);
            int b = (n2 - v1top2count) + (n2 - v2top1count);
            System.out.println(Math.min(a, b));
        }
        else {
            System.out.println((n2 - v1top1count) + (n2 - v2top1count));
        }
    }
}


Measured memory_bytes: 50800
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
ll a,b;
cin>>a>>b;
if(a<=0&&b>=0)
    {cout<<"Zero"<<endl;
    return 0;}
ll l=b-a+1;
if(a<0&&b<0&&(l%2))
    cout<<"Negative"<<endl;
else
    cout<<"Positive"<<endl;





return 0;}


Measured memory_bytes: 256
/*
 * 	Roses are red
 * 		Violets are blue
 * 			I cried
 * 				And so did you
 */
// #pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#ifndef rd
#define endl '\n'
#endif
#ifdef rd
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
#else
#define trace(...)
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double f80;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=2e18;
const int infi=1e9;
//const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
typedef tree<int, null_type, less<int>, rb_tree_tag,
		tree_order_statistics_node_update> oset;
mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
auto clk=clock();
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}

void solve() {
	int n,k;
	cin>>n>>k;
	cout<<n-k+1<<endl;
}
signed main() {
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout<<fixed<<setprecision(10);
	int t=1;
//	cin>>t;
	while(t--)
		solve();
#ifdef rd
	cout<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}


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

int main(){
	int a,b,m,ma=1e9,mb=1e9;
	scanf("%d%d%d",&a,&b,&m);
	vector<int>aa(a),bb(b);
	for(int i=0;i<a;++i){
		scanf("%d",&aa.at(i));
		ma=min(aa.at(i),ma);
	}
	for(int i=0;i<b;++i){
		scanf("%d",&bb.at(i));
		mb=min(bb.at(i),mb);
	}
	int ans=ma+mb;
	for(int i=0,pa,pb,minus;i<m;++i){
		scanf("%d%d%d",&pa,&pb,&minus);
		ans=min(ans,aa.at(pa-1)+bb.at(pb-1)-minus);
	}
	printf("%d\n",ans);
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e16+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n;
    cin>>n;
    string s;
    cin>>s;
    if(n%2!=0){
        Yes(false);
        return 0;
    }
    rep(i,n/2){
        if(s[i]!=s[i+n/2]){
            Yes(false);
            return 0;
        }
    }

    Yes(true);
    return  0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define sf(n) scanf("%d", &n)
#define pd(n) printf("%.10lf", n)
#define pf(n) printf("%d", n)
#define p() printf("\n")
#define ps() printf(" ")
#define ll long long
#define ull unsigned long long
#define MAX 1e9
const int mod = 1000 * 1000 * 1000 + 7;
#define ex 1e18
#define dbl 2e09
#define qu(q) queue<int> q
#define pqu(q) priority_queue<int> q
#define len(s) s.length()
#define sz(x) int(x.size())
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second
#define clr(x) x.clear()
#define LOG(x) std::cout << x << std::endl;
 
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = 3.14159265359;
 
int dx[6] = {-1,-1,0,0,1,1};
int dy[6] = {-1,0,-1,1,0,1};



int main(){
    string s;
    cin>>s;
    for(int i=0;i<s.size();++i){
        if(s[i]=='7')
            return cout<<"Yes"<<endl,0;
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

using namespace std;
//#inculude <bits/stdc++.h>
//#define int long long

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

Measured memory_bytes: 5440
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(d<=a||b<=c)
	{
		cout<<0;
	}
	else cout<<(min(b,d)-max(a,c));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ctime>
#include <unordered_map>
#include <stdlib.h>
using namespace std;
#define ll  long long int
#define mod 1000000007
#define modd 998244353
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
// #include<boost/multiprecision/cpp_int.hpp>
// using boost ::multiprecision::cpp_int;
/*__builtin_clz();
__builtin_ctz();
__builtin_popcount();*/
ll n;
ll a[100000],b[100000];
ll dp[101][100001];
ll fun(ll cur, ll w)
{
    if(cur > n)
    return 0;
    if(w <=0)
    return 0;
    if(dp[cur][w] != -1)
    return dp[cur][w];
    if(a[cur] <= w){
    ll k1 = b[cur] + fun(cur+1,w-a[cur]);
    ll k2 = fun(cur +1 ,w);
    return dp[cur][w] = max(k1,k2);
    }
    else 
    {
        return dp[cur][w] =  fun(cur+1,w);
    }
}
int main()
{
    boost;
    memset(dp,-1,sizeof dp);
    ll w;
    cin>>n>>w;
    for(ll i=1;i<=n;i++)
    cin>>a[i]>>b[i];
    cout<<fun(1,w)<<"\n";

    cerr << "\nTime elapsed: " << 1000 * clock()/CLOCKS_PER_SEC << "ms\n";
}
/* AnsHuman_7 || Anshuman Gaur */


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

using ll = long long;
using ld  = long double;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=9223372036854775807;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-10; //微調整用（EPSより小さいと0と判定など）

int ii() { int x; if (scanf("%d", &x)==1) return x; else return 0; }
long long il() { long long x; if (scanf("%lld", &x)==1) return x; else return 0; }
string is() { string x; cin >> x; return x; }
char ic() { char x; cin >> x; return x; }
void oi(int x) { printf("%d ", x); }
void ol(long long x) { printf("%lld ", x); }
void od_nosp(double x) { printf("%.15f", x); } // 古い問題用
void od(double x) { printf("%.15f ", x); }
// long doubleで受け取り、fをLfなどに変えて出力すると、変な数値が出る
// それをなんとかするには独自の出力を作らなければならなそう
void os(const string &s) { printf("%s ", s.c_str()); }
void oc(const char &c) { printf("%c ", c); }
#define o_map(v){cerr << #v << endl; for(const auto& xxx: v){cout << xxx.first << " " << xxx.second << "\n";}} //動作未確認
void br() { putchar('\n'); }

// #define gcd __gcd //llは受け取らない C++17~のgcdと違うので注意
// int lcm(int a, int b){return a / gcd(a, b) * b;}
#define b_e(a) a.begin(),a.end() //sort(b_e(vec));
#define REP(i,m,n) for(ll i=(ll)(m) ; i < (ll)(n) ; i++ )
#define DREP(i,m,n) for(ll i=(ll)(m) ; i > (ll)(n) ; i-- )
#define rep(i,n) REP(i,0,n)
#define m_p(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define p_b push_back
#define SZ(x) ((ll)(x).size()) //size()がunsignedなのでエラー避けに
#define endk '\n'


// coutによるpairの出力（空白区切り）
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << " " << p.second << ")";}
// coutによるvectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " "; //"\t"に変えるとTabで見やすく区切る
  }
  return s;
}
// coutによる多次元vectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i] << endl;
  }
  return s;
}

//最大値、最小値の更新。更新したor等しければtrueを返す
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

//4近傍（上下左右） rep(i, 2) にすると右・下だけに進む
vector<int> dx_4 = {1, 0, -1, 0};
vector<int> dy_4 = {0, 1, 0, -1};

// -------- template end - //


// - library ------------- //




// --------- library end - //


int main(){

  ll d, t, s;
  cin >> d >> t >> s;

  if (s * t >= d) cout << "Yes" << endk;
  else cout << "No" << endk;


}

Measured memory_bytes: 3592
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<utility>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define stop char nyaa;cin>>nyaa;

void Z_algorithm(const string &s, vector<int> &a) {
	int sz = s.size();
	a.resize(sz);
	a[0] = sz;
	int i = 1, j = 0;
	while (i < sz) {
		while (i + j < sz&&s[j] == s[i + j])++j;
		a[i] = j;
		if (j == 0) { ++i; continue; }
		int k = 1;
		while (i + k < sz&&k + a[k] < j)a[i + k] = a[k], ++k;
		i += k; j -= k;
	}
}
void solve() {
	int n; cin >> n; string s; cin >> s;
	int ans = 0;
	rep(i, n) {
		int len = n - i;
		vector<int> ra;
		Z_algorithm(s, ra);
		rep(j, len) {
			int num = min(ra[j], j);
			ans = max(ans, num);
		}
		s.erase(s.begin());
	}
	cout << ans << endl;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
// #include<assert.h>
#include<random>
using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD1 998244353 
#define MEM_SIZE 100010
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void solve(void)
{
  int H,W,K; cin>>H; cin>>W;cin>>K;
  vector<vector<char> >  mat (H,vector<char>(W,0));
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
       cin>>mat[i][j];
    }
  }
  vector<vector<int> > vv (H,vector<int>(W,0));
  int cnt = 0;
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      if(mat[i][j] == '#')
      {
        cnt ++;
        vv[i][j] = cnt;
      }
    }
  }
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W-1; j++)
    {
      if(vv[i][j+1] == 0)
      {
        vv[i][j+1] = vv[i][j];
      }
    }
    for (int j = W-1; j >= 1; j--) 
    {
      if(vv[i][j-1] == 0)
      {
        vv[i][j-1] = vv[i][j];
      }
    }
  }

  for (int i = 1; i < H; i++)
  {
    if(vv[i][0] == 0)
    {
      for (int j = 0; j < W; j++)
      {
        vv[i][j] = vv[i-1][j];
      }
      
    }
  }


  for (int i = H-2; i >=0; i--)
  {
    if(vv[i][0] == 0)
    {
      for (int j = 0; j < W; j++)
      {
        vv[i][j] = vv[i+1][j];
      }
      
    }
  }
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      if(j != 0)cout<<" ";
      cout<<vv[i][j];
    }
    cout<<endl;
    
  }
  
  return;

}

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

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 3996
n = int(input())
a_list = list(map(int,input().split()))

def gcd(m,n):
    x = max(m,n)
    y = min(m,n)
    if y==0:
        return x
    else:
        while x%y!=0:
            x,y = y,x%y
        return y

res = []
l_gcd = [0]*(n+2)
r_gcd = [0]*(n+2)
for i in range(n+1):
    if i ==0:
        l_gcd[i] = 0
        r_gcd[n-i+1] = 0
        continue
    l_gcd[i] = gcd(l_gcd[i-1], a_list[i-1])
    r_gcd[n-i] = gcd(r_gcd[n-i+1], a_list[n-i])

for i in range(n+1):
    res.append(gcd(l_gcd[i],r_gcd[i+1]))

print(max(res))

Measured memory_bytes: 14452
def check(a):
  if a < 0:
    return a * -1
  else:
    return a

def main():
  K, N = map(int, input().split())
  As = list(map(int, input().split()))
  r = []
  r.append(K-As[-1]+As[0])
  for x in range(N-1, -1, -1):
    solve = As[x] - As[x-1]
    r.append(check(solve))
  ans = sorted(r)
  ans.remove(ans[-1])
  print(K-ans[-1])

if __name__ == "__main__":
  main()

Measured memory_bytes: 89292
H,W,K = map(int,input().split())
C = [list(input()) for i in range(H)]

ans = 0
for i in range(1<<H):
    for j in range(1<<W):
        count = 0
        for h in range(H):
            for w in range(W):
                if ((i>>h)& 1) or ((j>>w)& 1) or C[h][w] == ".":
                    continue
                count += 1
        if count == K:
            ans += 1
print(ans)

Measured memory_bytes: 9240
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
using namespace std;
int main() {
  string s;
  stringstream ss;
  int n,m;
  long* x = new long[100000];
  cin >> n >> m;
  if(n>m){
    cout << 0 << endl;
    return 0;
  }
  for(int i=0;i<m;i++) cin >> x[i];
  sort(x,x+m);
  long* y = new long[100000];
  for(int i=0;i<m-1;i++) y[i] = x[i+1] - x[i];
  sort(y,y+m-1);
  long sum = x[m-1] - x[0];
  for(int i=m-2;i>=m-n;i--) sum -= y[i];
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

int pedras[100100];
long long dp[100100]; ///Guardo os valores da funcao frog;

int numeroPedras,kPulos;
const int inf =1e9;

int frog2(int pos){
    int menor=inf;
    
    if(dp[pos]!=-1){
        return dp[pos];
    }

    if(pos==numeroPedras-1){
        return 0;
    }
    for(int i=1;i<=kPulos and pos+i<numeroPedras;i++){
        int dif= abs(pedras[pos]-pedras[pos+i])+frog2(pos+i);
        menor= min(menor,dif);
    }

    return dp[pos]=menor;
}

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

    cin>>numeroPedras>>kPulos;
    for (int i = 0; i <numeroPedras; i++){
        cin>>pedras[i];
    }
    
    cout<<frog2(0);
     
}



Measured memory_bytes: 12492
//Bismillahir Rahmanir Rahim
#include <bits/stdc++.h>
using namespace std;

typedef long long              ll;
typedef long double            ld;
typedef pair<int, int>         pi;
typedef vector<int>            vi;
typedef vector<pair<int, int>> vpi;

#define pb       push_back
#define all(x)   begin(x), end(x)
#define sz(x)    (int)(x).size()
#define ff       first
#define ss       second
#define mp       make_pair
#define lb       lower_bound
#define ub       upper_bound
#define tcase()  int t; cin >> t; while(t--)

const int MOD = 1e9 + 7; // 998244353;
const int MX  = 2e5 + 5;
const ll  INF = 1e18;
const ld  PI  = acos((ld) -1);

void setIO(string name = "") {
    ios_base::sync_with_stdio(0); cin.tie(0);
    if(sz(name)){
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".out").c_str(), "w", stdout);
    }
}

vi primes(1000002, 0);
bool flag = true;

void primefactor(int x){

    if(flag == false) return;

    for(int i = 1; i * i <= x; i++){

        if(x % i == 0){
            primes[i]++;

            if(primes[x] > 1 && x != 1) flag = false;

            if(i != (x / i)){
                primes[x / i]++;

                if(primes[x / i] > 1 && (x / i) != 1) flag = false;
            }
        }
    }
}


int main(){

    setIO();

    int n;
    cin >> n;

    vi arr(n);

    for(int i = 0; i < n; i++){
        cin >> arr[i];

        primefactor(arr[i]);
    }

    for(int i = 2; i < 1000002; i++){

        if(primes[i] > 1) flag = false;
    }

    if(flag){
        cout << "pairwise coprime";
        return 0;
    }

    int gcd = arr[0];

    for(int i = 0; i < n; i++){

        gcd = __gcd(gcd, arr[i]);
    }

    if(gcd == 1){
        cout << "setwise coprime";
        return 0;
    }

    cout << "not coprime";
}


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

int main() {
	int N;
	bool is_prime[1000000];
	is_prime[0]=0; is_prime[1]=0;
	for(int i=2;i<1000000; i++){
		is_prime[i]=1;
	}
			
	for(long long s=2; s<1000000; s++){
		if(is_prime[s]==1){	
		for(long long i=s*s; i<1000000; i+=s){
		is_prime[i]=0;	
			
		}
		}
	}
	
	while(cin >> N){
	
		int ans=0;
		for(int i=2; i<N+1; i++){
			ans+=is_prime[i];
		}
		cout << ans <<endl;
		
	}
return 0;
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
int main(){
long long a,b,k,t;
  cin>>a>>b>>k;
  t=k-a;
  if(k<=a)a-=k;
  else {
    a=0;
  	if(t<=b) b-=t;
    else b=0;
  }
  cout<<a<<" "<<b<<endl;
return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>

using namespace std;

typedef long long ll;

ll gcd(ll a, ll b){
    if(a<b){
        ll tmp = a;
        a = b;
        b = tmp;
    }
    
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,ain;
    cin>>n;
    int m=0,mi=10e9;
    ll sum=0;
    for(int i=0;i<n;i++){
        cin>>ain;
        if(ain<0){
            m++;
            ain*=-1;
        }
        sum+=ain;
        if(ain<mi) mi=ain;
    }
    if (m%2==0) cout<<sum<<endl;
    else cout<<sum-2*mi<<endl;
}

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

typedef tuple<int, int, int> Date;

struct book {
	string title, author;
	Date date;

	book(const string &title_, const string &author_, const Date &date_):title(title_), author(author_), date(date_) {}
	bool match(const string &q_title, const string &q_author, const Date &from, const Date &to) const {
		if(title.find(q_title) == string::npos) return false;
		if(author.find(q_author) == string::npos) return false;
		if(date < from) return false;
		if(to < date) return false;
		return true;
	}
};

Date string_to_date(const string &s) {
	int y, m, d;
	sscanf(s.c_str(), "%d/%d/%d", &y, &m, &d);
	return Date(y, m, d);
}

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

	int n;
	cin >> n;

	vector<book> books;
	books.reserve(n);

	for(int i = 0; i < n; ++i) {
		string title, author, date;
		cin >> title >> author >> date;
		books.emplace_back(title, author, string_to_date(date));
	}

	int q;
	cin >> q;

	while(true) {
		string q_title, q_author, q_date_from, q_date_to;
		cin >> q_title >> q_author >> q_date_from >> q_date_to;

		if(q_title == "*") q_title = "";
		if(q_author == "*") q_author = "";

		const Date from = (q_date_from == "*" ? Date(0, 0, 0) : string_to_date(q_date_from));
		const Date to = (q_date_to == "*" ? Date(10000, 0, 0) : string_to_date(q_date_to));

		for(const auto &book : books) {
			if(book.match(q_title, q_author, from, to)) {
				cout << book.title << '\n';
			}
		}

		if(--q) {
			cout << '\n';
		}
		else {
			break;
		}
	}

	return EXIT_SUCCESS;
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int n ;
  cin >> n ;
  vector<intll> v(n);
  rep(i,n)
    cin >> v.at(i);
  
  sort(all(v));
  string ans = "YES";
  
  rep(i,n-1){
    if(v.at(i) == v.at(i+1))
      ans = "NO";
  }
  
  cout <<ans ;


}


Measured memory_bytes: 1920
#include <iostream>
#include <string>
#include <queue>
int a[1005][1005];
bool tf[1005][1005];
int p[10][2];
int dirc[4][2] = {{-1 , 0} , {1 , 0} , {0 , -1} , {0 , 1}};
int w , h , n;
struct node{
    int x , y , step;
};
int bfs(int st_y , int st_x , int en_y , int en_x){
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            tf[i][j] = false;
        }
    }
    tf[st_y][st_x] = true;    
    std::queue <node> que;
    node node0;
    node0.x = st_x , node0.y = st_y , node0.step = 0;
    que.push(node0);
    while(!que.empty()){
        node0 = que.front();
        que.pop();
        if(node0.x == en_x && node0.y == en_y){
            return node0.step;
        }
        for(int i = 0;i < 4;i++){
            node node1;
            node1.y = node0.y + dirc[i][0] , node1.x = node0.x + dirc[i][1] , node1.step = node0.step + 1;
            if(node1.x >= 0 && node1.x < w && node1.y >= 0 && node1.y < h && a[node1.y][node1.x] >= 0 && tf[node1.y][node1.x] == false){
                tf[node1.y][node1.x] = true;
                que.push(node1);
            }
        }
    }
    return 0;
}
int main(){
    std::cin >> h >> w >> n;
    for(int i = 0;i < h;i++){
        std::string s;
        std::cin >> s;
        for(int j = 0;j < w;j++){
            switch(s[j]){
                case 'S':
                    a[i][j] = 0 , p[0][0] = i , p[0][1] = j;
                    break;
                case '.':
                    a[i][j] = 0;
                    break;
                case '1':
                    a[i][j] = 1; p[1][0] = i , p[1][1] = j;
                    break;
                case '2':
                    a[i][j] = 2; p[2][0] = i , p[2][1] = j;
                    break;
                case '3':
                    a[i][j] = 3; p[3][0] = i , p[3][1] = j;
                    break;
                case '4':
                    a[i][j] = 4; p[4][0] = i , p[4][1] = j;
                    break;
                case '5':
                    a[i][j] = 5; p[5][0] = i , p[5][1] = j;
                    break;
                case '6':
                    a[i][j] = 6; p[6][0] = i , p[6][1] = j;
                    break;
                case '7':
                    a[i][j] = 7; p[7][0] = i , p[7][1] = j;
                    break;
                case '8':
                    a[i][j] = 8; p[8][0] = i , p[8][1] = j;
                    break;
                case '9':
                    a[i][j] = 9; p[9][0] = i , p[9][1] = j;
                    break;
                default:
                    a[i][j] = -1;
                    break;
            }
        }
    }

    int ans = 0;
    for(int i = 1;i <= n;i++){
        ans += bfs(p[i - 1][0] , p[i - 1][1] , p[i][0] , p[i][1]);
    }
    std::cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 8048
// C++ program to comput n! % p using Wilson's Theorem 
#include <bits/stdc++.h> 
using namespace std; 
#define ll long long
int main() 
{ 
  ll ans = LONG_LONG_MAX;
  ll l,r;
  cin>>l>>r;
  for(int i=0 ; i<=2020 ; i++){
    for(int j=i+1 ; j<=2020 ; j++){
      ll n1 = l+i;
      ll n2 = l+j;
      if(n2<=r){
        ans = min(ans,(n1*n2)%2019);
      }
    }
  }
  cout<<ans;
} 


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MAX=1e5+5;
ll mod=1e9+7;
#define pb push_back
#define se second
#define fi first
#define maxe max_element
#define mine min_element
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define boost  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
vector<int> graph[205];
int color[205];
bool bipartite_jugding(int v, int c){
    color[v] = c;
    for(int i = 0; i < graph[v].size(); ++i){
        if(color[graph[v][i]] == c) return false;
        if(color[graph[v][i]] == 0 && !bipartite_jugding(graph[v][i], -c)){
            return false;
        }
    }
    return true;
}

bool compare(const pair<pair<ll,ll>,pair<ll,ll> >  &a,const pair<pair<ll,ll>,pair<ll,ll> >  &b){
        if(a.fi.fi<b.fi.fi)
            return true;
        if(a.fi.fi==b.fi.fi && a.fi.se<b.fi.se)
            return true;
        if(a.fi.fi==b.fi.fi && a.fi.se==b.fi.se && a.se.fi<b.se.fi)
            return true;
            return false;
        }
long long expo(ll x,ll n,ll M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return expo((x*x)%mod,n/2,mod);
    else                             //n is odd
        return (x*expo((x*x)%mod,(n-1)/2,mod))%mod;

}

int N;
int A[20];
int x[20][20];
int y[20][20];

int counter(int x) {
    if(x == 0) return 0;
    return counter(x >> 1) + (x & 1);
}

void solve() {
    cin >> N;
    for(int i = 1; i <= N; i++) {
        cin >> A[i];
        for(int j = 1; j <= A[i]; j++) {
            cin >> x[i][j] >> y[i][j];
        }
    }
    int ans = 0;
    for(int bits = 1; bits < (1 << N); bits++) {
        bool ok = true;
        for(int i = 1; i <= N; i++) {
            if(!(bits & (1 << (i-1)))) continue;
            for(int j = 1; j <= A[i]; j++) {
                if(((bits >> (x[i][j]-1)) & 1) ^ y[i][j]) ok = false;
            }
        }
        if(ok) ans = max(ans, counter(bits));
    }
    cout << ans << endl;
    return;
}
int main(){
boost;
  solve();
}


Measured memory_bytes: 256