akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll H, W;
  cin >> H >> W;
  if (H == 1 || W == 1) {
    cout << 1 << endl;
  } else if (H % 2 == 0) {
    cout << (H / 2) * W << endl;
  } else {
    ll po = W / 2;
    ll yo = W - po;
    ll ans = ((H + 1) / 2) * yo;
    ans += (H / 2) * po;
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n = int(input())
ac, wa, tle, re = 0, 0, 0, 0;

for i in range(n):
    s = input()
    if s == 'AC':
        ac += 1
    elif s == 'WA':
        wa += 1
    elif s == 'TLE':
        tle += 1
    else:
        re += 1

print('AC', 'x', ac)
print('WA', 'x', wa)
print('TLE', 'x', tle)
print('RE', 'x', re)

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

int main(){
	int M1, D1, M2, D2;
	scanf("%d%d", &M1, &D1);
	scanf("%d%d", &M2, &D2);
	if(M1 == M2){
		printf("0\n");
	}
	else{
		printf("1\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <assert.h>
#include <ctype.h>
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>

#include <algorithm>
#include <complex>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define SZ(a) (int)(a).size()
#define FOR(i,a,b) for (int i=(a); i<=(b); ++i)
#define REP(i,n) for (int i=0; i<(n); ++i)
#define ALL(c) c.begin(), c.end()
#define CLR(c,n) memset(c, n, sizeof(c))
#define TR(it, c) for(typeof(c.begin()) it = c.begin();it != c.end(); ++it)
#define CONTAIN(it, c) (c.find(it) != c.end())
typedef vector<int> VI;
typedef pair<int, int> PII;
template <class T> void checkmin(T &a, T b) { if (b<a) a=b; }
template <class T> void checkmax(T &a, T b) { if (b>a) a=b; }

const int N=10<<10;
const int INF=0x3F3F3F3F;
struct Edge {
  int to, d, c;
  Edge(int to, int d, int c) : to(to), d(d), c(c) { }
};

int n, m;
vector<Edge> edge[N];
int dist[N], cost[N];

int main(int argc, char *argv[]) {
  int u, v, d, c;
  while (scanf("%d %d", &n, &m) == 2 && n + m > 0) {
    REP(i, n) edge[i].clear();
    REP(i, m) {
      scanf("%d %d %d %d", &u, &v, &d, &c);
      --u;
      --v;
      edge[u].push_back(Edge(v, d, c));
      edge[v].push_back(Edge(u, d, c));
    }
    CLR(dist, INF);
    dist[0] = 0;
    priority_queue<PII, vector<PII>, greater<PII> > q;
    q.push(PII(0, 0));
    while (!q.empty()) {
      int current_dist = q.top().first, current_idx = q.top().second;
      q.pop();
      if (dist[current_idx] != current_dist) continue;
      REP(i, SZ(edge[current_idx])) {
        int next_idx = edge[current_idx][i].to;
        int next_dist = current_dist + edge[current_idx][i].d;
        if (dist[next_idx] > next_dist) {
          dist[next_idx] = next_dist;
          q.push(PII(next_dist, next_idx));
        }
      }
    }
    CLR(cost, INF);
    cost[0] = 0;
    REP(i, n) REP(j, SZ(edge[i])) {
      if (dist[i] + edge[i][j].d == dist[edge[i][j].to]) {
        checkmin(cost[edge[i][j].to], edge[i][j].c);
      }
    }
    printf("%d\n", accumulate(cost, cost + n, 0));
  }
}

Measured memory_bytes: 3288
import sys
import numpy as np
from numba import njit, i4
read = sys.stdin.readline


@njit((i4, i4, i4[:]), cache=True)
def main(n, k, a):
    for i in np.arange(n, 100000):
        ok = 1
        j = i
        while j:
            m = j % 10
            for l in a:
                if m == l:
                    ok = 0
            j //= 10
        if ok:
            print(i)
            break


if __name__ == '__main__':
    n, k = np.fromstring(read(), dtype=np.int32, sep=' ')
    a = np.fromstring(read(), dtype=np.int32, sep=' ')
    main(n, k, a)


Measured memory_bytes: 107288
#include <bits/stdc++.h>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy -2147382637
#define bql 2147483647
#define ll long long
#define ull unsigned long long
#define ld long double
#define il inline
#define sz(x) x.size()
#define maxn 100010
#define rp(i, l, r) for (int i = l; i <= r; i++)
#define rb(i, r, l) for (int i = r; i >= l; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;
ll max(ll a,ll b){if(a>b)return a;else return b;}
ll min(ll a,ll b){if(a<b)return a;else return b;}
ll lowbit(ll x){return x&(-x);}
ll prime(ll x){
   if(x<=1)return false;
   for(int i=2;i<=int(sqrt(x));i++){
	   if(x%i==0)return false;
   }return true;
}
bool cmp(ll a,ll b){return a>b;}
ll gcd(ll a,ll b){ll r;while(b>0){r=a%b;a=b;b=r;}return a;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
inline ll read() {
	char c = getchar(); ll w = 1; ll x = 0;
	while (!isdigit(c))
		(c == '-') && (w = -w), c = getchar();
	while (isdigit(c))
		x = (x << 1) + (x << 3) + (c ^ '0'), c = getchar();
	x *= w;
}
void fl(string name){
	freopen((name+".in").c_str(),"r",stdin);
	freopen((name+".out").c_str(),"w",stdout);
}
const int dx[8] = {-1, 1, 0, 0, -1, 1, -1, 1},
		  dy[8] = {0, 0, -1, 1, -1, -1, 1, 1};
int main(){
	fast;
	ll a[4];
	cin>>a[1]>>a[2]>>a[3];
	sort(a+1,a+3+1);
	if((a[1]==a[2]||a[2]==a[3])&&a[1]!=a[3])cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}/*『你强归你强，Siyuan比你强』*/





Measured memory_bytes: 256
//競技プログラミング用のテンプレート
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <math.h>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

using namespace std;
using ll = long long int;
using p = pair<int, int>;
using pl = pair<ll, ll>;
using v = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vl = vector<ll>;
using vp = vector<p>;
using vpp = vector<vp>;

//数値から証言者の状態に変換
void convert(uint number, v &state){
    int index = 0;
    for(uint j = 1; j <= number; j = j << 1){
        if(j & number){
            state[index] = 1;
        }else{
            state[index] = 0;
        }
        index++;
    }
}

int main()
{
    int n;
    cin >> n;
    vpp a(n);
    rep(i, n)
    {
        int ai;
        cin >> ai;
        rep(j, ai)
        {
            int x, y;
            cin >> x >> y;
            x--;
            a[i].push_back({x, y});
        }
    }
    int ans = 0;
    rep(i, pow(2, n) ){
        v state(n, 0);
        convert(i, state);
        int temp = 0;
        bool flag = true;
        for(int j = 0; j < n; j++)
        {
            if(state[j] == 0) continue;
            temp++;
            for(int k = 0; k < a[j].size(); k++)
            {
                if(state[a[j][k].first] != a[j][k].second)
                {
                    flag = false;
                }
            }
        }
        if(flag){
            ans = max(ans, temp);
        }
    }
    cout << ans << endl;
}

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

using namespace std;
typedef long long ll;
ll a, b, c, k;
int main(){
	cin >> a >> b >> c >> k;
	if(k % 2 == 0){
		cout << a - b << endl;
	}else{
		cout << b - a << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define PDD pair<double, double>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
#define BIT(x) (1 << (x))
using namespace std;

LL modinv(LL a){
    LL b = MOD, u = 1, v = 0;
    while(b){
        LL t = a / b;
        a -= t * b;swap(a, b);
        u -= t * v;swap(u, v);
    }
    u%=MOD;
    if(u < 0) u += MOD;
    return u;

}

LL exp(LL a, LL b){
    LL res = 1;
    LL sum = a;
    while(b){
        if(b&1)res = (res * sum);
        sum = (sum * sum);
        b>>=1;
    }
    return res;
}

double exp(double a, LL b){
    double res = 1;
    double sum = a;
    while(b){
        if(b&1)res = (res * sum);
        sum = (sum * sum);
        b>>=1;
    }
    return res;
}

signed  main(){
    int H, W;
    int h, w;
    cin >> H >> W;
    cin >> h >> w;
    cout << (H - h) * (W - w) << endl;
    return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<vector>
#include<cstring>
#include<cmath>
#include<cstdlib>
using namespace std;
int n,tot,prime[11000000],nprime[11000000];
int ans,cnt1,cnt2,s[11000000];
int a[210],b[210],vis[410],match[410];
vector<int> vec[410];
char Getchar(){
    static char now[1<<20],*S,*T;
    if (T==S){
        T=(S=now)+fread(now,1,1<<20,stdin);
        if (T==S) return EOF;
    }
    return *S++;
}
int read(){
    int x=0,f=1;
    char ch=Getchar();
    while (ch<'0'||ch>'9'){
        if (ch=='-') f=-1;
        ch=Getchar();
    }
    while (ch<='9'&&ch>='0') x=x*10+ch-'0',ch=Getchar();
    return x*f;
}
bool dfs(int x){
	int y;
	for (int i=0;i<(int)vec[x].size();i++){
		y=vec[x][i];
		if (!vis[y]){
			vis[y]=true;
			if (!match[y]||dfs(match[y])){
				match[y]=x;
				return true;
			}
		}
	}
	return false;
}
int main(){
	for (int i=2;i<=10000001;i++){
		if (!nprime[i]) prime[++tot]=i;
		for (int j=1;j<=tot&&i*prime[j]<=10000001;j++){
			nprime[i*prime[j]]=true;
			if (i%prime[j]==0) break;
		}
	}
	n=read(); nprime[1]=1;
	for (int i=1;i<=n;i++) s[read()]=1;
	for (int i=1;i<=10000001;i++)
		if (s[i]!=s[i-1]){
			if (i&1) a[++cnt1]=i;
			else b[++cnt2]=i;
		}
	for (int i=1;i<=cnt1;i++)
		for (int j=1;j<=cnt2;j++)
			if (!nprime[abs(a[i]-b[j])])
				vec[i].push_back(j);
	for (int i=1;i<=cnt1;i++){
		memset(vis,false,sizeof(vis));
		ans+=dfs(i);
	}
	printf("%d\n",ans+(cnt1-ans)/2*2+(cnt2-ans)/2*2+((cnt1-ans)&1)*3);
	return 0;
}


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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

template<typename T>
void print1(T begin, T end) {
	while (begin != end) {
		cerr << (*begin) << " ";
		*begin++;
	}
	cerr << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
	for (int i = 0; i < height; i++) {
		for (int j = 0; j < width; j++) {
			cerr << " " << Array[i][j];
		}
		cerr << endl;
	}
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
	std::cerr << head << " ";
	print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

// ------------------------------------------------------------------------------------------

using pii = pair<int, int>;

int N;
vector<pii> G[111111];
int color[111111];

void dfs(int parent, int current, int sum) {
	color[current] = (sum % 2 == 0 ? 0 : 1);
	for (pii v : G[current]) {
		int nv = v.first;
		int nw = v.second;
		if (nv == current or nv == parent) continue;
		// dbg3(parent, current, nv)
		dfs(current, nv, sum + nw);
	}
}

signed main() {
	cin >> N;
	rep (i, N-1) {
		int u, v, w;
		cin >> u >> v >> w;
		u--, v--;
		G[u].push_back({v, w});
		G[v].push_back({u, w});
	}

	fill(color, color + N + 10, -1);
	color[0] = 0;
	dfs(-1, 0, 0);
	// rep (i, N) {
	// 	if (color[i] != -1) continue;
	// 	dfs(-1, i, 0);
	// }

	rep (i, N) {
		cout << color[i] << endl;
	}

	return 0;
}


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

void Main()
{
    long n, m, a, sum=0;
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        cin >> a;
        sum += a;
    }
    long p = n - sum;
    
    if(p < 0){
        cout << -1 << endl;
    }else{
        cout << p << endl;
    }
}

int main(int argc, char **argv)
{
    Main();
    return 0;
}


Measured memory_bytes: 3636
#![allow(unused_imports)]

use std::cmp;
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::fmt;
use std::io::{self, BufWriter, Read, Write};
use std::ops::{Add, Div, Mul, Sub};
use std::str::{self, FromStr};


fn solve(s1: String, s2: String) -> bool {
    let (s1, s2) = (s1.as_bytes(), s2.as_bytes());
    s1[0] == s2[2] && s1[1] == s2[1] && s1[2] == s2[0]
}


fn main() {
    let stdin = io::stdin();
    let mut sc = Scanner::new(stdin.lock().bytes());
    println!(
        "{}",
        if solve(sc.next(), sc.next()) {
            "YES"
        } else {
            "NO"
        }
    );
}


struct Scanner<R: Read> {
    buf: Vec<u8>,
    bytes: io::Bytes<R>,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(bytes: io::Bytes<R>) -> Self {
        Scanner {
            buf: Vec::with_capacity(1024),
            bytes: bytes,
        }
    }

    fn next<T: FromStr>(&mut self) -> T
    where
        <T as FromStr>::Err: fmt::Debug,
    {
        let buf = &mut self.buf;
        buf.clear();
        self.bytes
            .by_ref()
            .map(Result::unwrap)
            .skip_while(|&c| c == ' ' as u8 || c == '\n' as u8)
            .take_while(|&c| !(c == ' ' as u8 || c == '\n' as u8))
            .foreach(|c| buf.push(c));
        str::from_utf8(&buf).unwrap().parse().unwrap()
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T>
    where
        <T as FromStr>::Err: fmt::Debug,
    {
        (0..n).map(|_| self.next()).collect()
    }

    fn pairs<T1: FromStr, T2: FromStr>(&mut self, n: usize) -> Vec<(T1, T2)>
    where
        <T1 as FromStr>::Err: fmt::Debug,
        <T2 as FromStr>::Err: fmt::Debug,
    {
        (0..n).map(|_| (self.next(), self.next())).collect()
    }

    fn trios<T1: FromStr, T2: FromStr, T3: FromStr>(&mut self, n: usize) -> Vec<(T1, T2, T3)>
    where
        <T1 as FromStr>::Err: fmt::Debug,
        <T2 as FromStr>::Err: fmt::Debug,
        <T3 as FromStr>::Err: fmt::Debug,
    {
        (0..n)
            .map(|_| (self.next(), self.next(), self.next()))
            .collect()
    }

    fn mat<T: FromStr>(&mut self, m: usize, n: usize) -> Vec<Vec<T>>
    where
        <T as FromStr>::Err: fmt::Debug,
    {
        (0..m).map(|_| self.vec(n)).collect()
    }
}


trait Foreach {
    type Item;
    fn foreach<F: FnMut(Self::Item)>(self, f: F);
}

impl<T, I: Iterator<Item = T>> Foreach for I {
    type Item = T;

    fn foreach<F: FnMut(T)>(self, mut f: F) {
        self.fold((), move |(), x| f(x));
    }
}


#[allow(dead_code)]
fn print_yesno(x: bool, yes: &'static str, no: &'static str) {
    println!("{}", if x { yes } else { no });
}


#[allow(dead_code)]
fn print_foreach<T: fmt::Display, I: IntoIterator<Item = T>>(xs: I) {
    let stdout = io::stdout();
    let mut stdout = BufWriter::new(stdout.lock());
    for x in xs.into_iter() {
        writeln!(stdout, "{}", x).unwrap();
    }
    stdout.flush().unwrap();
}


#[allow(dead_code)]
fn print_or<T: fmt::Display>(x: Option<T>, or: &'static str) {
    if let Some(x) = x {
        println!("{}", x);
    } else {
        println!("{}", or);
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	int d, t, s; scanf("%d%d%d", &d, &t, &s);
	if(t * s >= d) printf("Yes\n");
	else printf("No\n");
}


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

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define debug2(x) cerr << #x << " = [";REP(__ind,(x).size()){cerr << (x)[__ind] << ", ";}cerr << "] (L" << __LINE__ << ")" << endl;

const int INF=0x3f3f3f3f;

typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;

typedef pair<int,int> pii;

/*
#ifdef MYDEBUG
#include"debug.h"
#include"print.h"
#endif
*/
// }}}

Int N,K;
map<Int,Int> mp;

int main(){
	cin>>N>>K;
	REP(i,N){
		Int a,b;
		cin>>a>>b;
		mp[a]+=b;
	}
	K--;
	for(auto &it:mp){
//		cout<<it.first<<" "<<it.second<<endl;
		if(K<it.second){
			cout<<it.first<<endl;
			return 0;
		}
		K-=it.second;
	}

}


Measured memory_bytes: 4224
import std.algorithm;
import std.array;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

immutable int mod = 1_000_000_007;

int solve (int n, int x, int [] s)
{
	sort (s);
	auto f = new int [] [] (2, x + 1);
	int b = 0;
	f[b][] = 0;
	f[b][x] = 1;
	foreach_reverse (k; 0..n)
	{
		b ^= 1;
		f[b][] = 0;
		foreach (a; 0..x + 1)
		{
			f[b][a % s[k]] = (f[b][a % s[k]] + f[!b][a]) % mod;
			f[b][a] = (f[b][a] + f[!b][a] * 1L * k) % mod;
		}
	}

	int res = 0;
	foreach (a; 0..x + 1)
	{
		res = (res + f[b][a] * 1L * a) % mod;
	}
	return res;
}

void main ()
{
	int n, x;
	while (readf (" %s %s", &n, &x) > 0)
	{
		readln;
		auto s = readln.splitter.map !(to !(int)).array;
		writeln (solve (n, x, s));
	}
}


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

int main(){
    int A,B,C,D;
    cin>>A>>B>>C>>D;
    if(B<C){
        cout<<0<<endl;
    }else if(D<A){
        cout<<0<<endl;
    }else if(A<=C&&C<=B&&B<=D){
        cout<<B-C<<endl;
    }else if(A<=C&&C<=D&&D<=B){
        cout<<D-C<<endl;
    }else if(C<=A&&A<=D&&D<=B){
        cout<<D-A<<endl;
    }else if(C<=A&&A<=B&&B<=D){
        cout<<B-A<<endl;
    }
}


Measured memory_bytes: 256
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=n-1;i>=a;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define		vii 			vector<pair<ll,ll>>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
#define     test(i)        cout<<i<<endl
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
const int mxN=3e3+5,oo=0x3f3f3f3f,mod=1e9+7;
int h,w;
ll dp[mxN][mxN];
char grid[mxN][mxN];
bool valid(int i,int j){
    return i>=0&&i<h&&j>=0&&j<w&&grid[i][j]!='#';
}
ll go(int i,int j){
    if(i==h-1&&j==w-1)
        return 1;
    ll &ret=dp[i][j];
    if(~ret)
        return ret;
    ret=0;
    loop(2,k,0){
        int ti=i+dx[k],tj=j+dy[k];
        if(valid(ti,tj)){
            ret=((ret%mod)+(go(ti,tj)%mod))%mod;
        }
    }
    return ret;
}
void solve(){
   cin>>h>>w;
   loop(h,i,0)
        loop(w,j,0)
            cin>>grid[i][j];
   mem(dp,-1);
   cout<<go(0,0)<<endl;
}
int main() {
    fast();
    solve();
}


Measured memory_bytes: 75648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    string s,t;
    cin>>s>>t;
    if(s==t.substr(0,s.length())){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    
}

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

int	main()
{
	int	N, T, A;
	cin >> N >> T >> A;
	double	key = (T - A) / 0.006;
	int		H;
	double	dist;
	double	min_dist;
	int		argmin;
	cin >> H;
	min_dist = H > key ? H - key : key - H;
	argmin = 0;
	for (int i = 1; i < N; ++i) {
		cin >> H;
		dist = H > key ? H - key : key - H;
		if (dist < min_dist) {
			min_dist = dist;
			argmin = i;
		}
	}
	cout << argmin + 1 << endl;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  
  int ans = 0;
  rep(i,n) {
    if (i%2==0) ans += a[i];
    else ans -= a[i];
  }
  
  cout << ans << endl;
}

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

using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REPO(i,n) for(int (i)=1; (i)<=(int)(n); (i)++)
#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
typedef long long ll;
typedef pair<int, int> pi;
const int INF = 0x3f2f1f0f;
const ll LINF = 1ll * INF * INF;

ll N, M;
int main() {
	cin >> N >> M;
	ll x = max((M - 2*N)/4, 0ll);
	N += x; M -= 2 * x;
	printf("%lld\n", min(M/2, N));
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int d;
	scanf("%d", &d);
	int c[26];
	int s[365][26];
	for (int i = 0; i < 26; i++) {
		scanf("%d", &c[i]);
	}
	for (int i = 0; i < d; i++) {
		for (int j = 0; j < 26; j++) {
			scanf("%d", &s[i][j]);
		}
	}

	int last[26] = {};
	int yesterday = 0;
	long long mx = -101010101010101010;
	int tmp;
	for (int i = 0; i < 26; i++) {
		long long now = s[0][i];
		for (int j = 0; j < 26; j++) {
			now -= (i == j ? 0 : c[j]);
		}

		if (mx < now) {
			mx = now;
			tmp = i;
		}
	}
	printf("%d\n", tmp + 1);
	last[tmp] = 1;

	for (int i = 1; i < d; i++) {
		mx = -101010101010101010;
		for (int j = 0; j < 26; j++) {
			long long now = s[i][j];
			for (int k = 0; k < 26; k++) {
				now -= (j == k ? 0 : (i + 1 - last[k]) * c[k]);
			}

			if (mx < now) {
				mx = now;
				tmp = j;
			}
		}
		printf("%d\n", tmp + 1);
		last[tmp] = i + 1;
	}

	return 0;
}

Measured memory_bytes: 3856
#include <bits/stdc++.h>
#define MAXN 200005
#define MOD 1000000007
using namespace std;
long long fac[MAXN],inv[MAXN];
long long quickpow(long long a,long long b)
{
    long long ans=1,temp=a;
    while(b)
    {
        if(b&1)
            ans=ans*temp%MOD;
        temp=temp*temp%MOD;
        b/=2;
    }
    return ans;
}
void init()
{
    fac[0]=fac[1]=1;
    for(long long i=2;i<MAXN;i++)
        fac[i]=fac[i-1]*i%MOD;
    inv[MAXN-1]=quickpow(fac[MAXN-1],MOD-2);
    for(long long i=MAXN-2;i>0;i--)
        inv[i]=inv[i+1]*(i+1)%MOD;
}
int main()
{
    init();
    long long n,a,b;
    cin>>n>>a>>b;
    long long faca=1,facb=1;
    for(long long i=n;i>n-a;i--)
        faca=faca*i%MOD;
    for(long long i=n;i>n-b;i--)
        facb=facb*i%MOD;
    long long ans=(quickpow(2,n)-faca*inv[a]%MOD-facb*inv[b]%MOD-1)%MOD;
    if(ans<0)
        ans+=MOD;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define ll long long
using namespace std;
#define N 10000000
ll primes[N];

//int seive()
//{
//	ll i,j,t=0,sq;
//	bool flag[N];
//	for(i=2;i<=N;i++) flag[i]=1;
//	sq=sqrt(N)+1;
//	for(i=2;i<sq;i++)
//		if(flag[i])
//			for(j=i;j*i<=N;j++)
//				flag[i*j]=0;
//	for(i=2;i<=N;i++)
//		if(flag[i])
//			primes[t++]=i;
//	return t;
//}

//     for(i=0;i<n;i++)
//     for(j=0;j<n;j++)

//int GCD(ll a, ll b)
//{
//    if(a==0)return b;
//    if(b==0)return a;
//    else return GCD(b,a%b);
//}




int main()
{
    ll i,j,k,m,n,q,t,c,a;
    string s;
//    seive();
    cin>>a>>s;
    if(a>=3200)
        cout<<s<<endl;
    else if(a<3200)
        cout<<"red"<<endl;

    cout<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
 
int main(void){
  int n, r, b;
  char str[1000];
  int i;
  r = 0;
  b = 0;
  scanf("%d", &n);
  scanf("%s", str);
  for(i = 0; i < n; i++){
    if(str[i] == 'R'){
      r++;
    }else if(str[i] == 'B'){
      b++;
    }
  }

  if (r > b){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 128
import std.stdio, std.string, std.conv, std.range, std.array, std.algorithm;
import std.uni, std.math, std.container, std.typecons, std.typetuple;
import core.bitop, std.datetime;

void main(){
    int q = readln.chomp.to!int;
    string x, y;

    int ans;

    foreach(qi ; 0 .. q){
        x = readln.chomp;
        y = readln.chomp;

        ans = computeLCS(x, y);

        writeln(ans);
    }
}

int computeLCS(string x, string y){
    int n = x.length.to!int;
    int m = y.length.to!int;

    auto dp = new int[][](n + 1, m + 1);

    foreach(i ; 1 .. n + 1){
        foreach(j ; 1 .. m + 1){
            dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);

            if (x[i - 1] == y[j - 1]){
                dp[i][j] = dp[i - 1][j - 1] + 1;
            }
        }
    }

    return dp[n][m];
}

void readVars(T...)(auto ref T args){
    auto line = readln.split;
    foreach(ref arg ; args){
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    if(!line.empty){
        writeln(line);
        throw new Exception("args num < input num");
    }
}

Measured memory_bytes: 16820
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;
const int N = 600;
int n, m;
V<int> e[N];
double A[N], B[N];

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m;
  FOR(_, 0, m){
    int s, t;
    cin >> s >> t;
    s--; t--;
    e[s].pb(t);
  }
  V<P<int, int>> v;
  FORR(i, n-2, 0){
    A[i] = 0.0;
    double ma = -LINF;
    int j;
    for(int a:e[i]){
      A[i] += A[a];
      if(A[a] > ma){
        ma = A[a];
        j = a;
      }
    }
    if(sz(e[i]) > 1) v.emplace_back(i, j);
    A[i] = A[i]/sz(e[i]) + 1.0;
  }
  double ans = A[0];
  for(auto p:v){
    int s=p.fi, t=p.se;
    FORR(i, n-2, 0){
      A[i] = 0.0;
      for(int a:e[i]) if(s!=i || t!=a) A[i] += A[a];
      A[i] = A[i]/(sz(e[i])-(s==i)) + 1.0;
    }
    mins(ans, A[0]);
  }
  printf("%.12f\n", ans);
}

Measured memory_bytes: 1408
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
///////////////////////___combination___////////////////////
vector<ll> fac, finv, inv;
void COMinit(const int MAX = 5000000, const ll &MOD = MOD){
  fac.resize(MAX);finv.resize(MAX);inv.resize(MAX);
  fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
  repd(i,2,MAX){
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}
ll 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;
}

///////////////////////////////////////////////////////////


signed main(){
  int n,m;cin>>n>>m;
  int l = 1, r = n;
  rep(i,m){
    int a, b;cin>>a>>b;
    chmin(r,b);
    chmax(l, a);
  }
  cout << max(r-l+1,0LL) << endl;
}



Measured memory_bytes: 256
from queue import Queue

#入力
H, W = map(int, input().split())

#lst = [['a']*W for _ in range(H)]
count = 0 #白色のマスの総数
lst = []
row = []
for i in range(H):
    row = list(input())
    count += row.count('.')
    lst += [row]
 
#for i in range(H):
#    for j in range(W):
#        if lst[i][j] == '.':
#            count += 1

#sx, sy = 1, 1 #スタート位置
#gx, gy = H, W #ゴール位置

move = [[-1, 0], [1,0], [0, -1], [0, 1]]

def bfs():
    q = Queue()
    INF = 10 ** 9
    d = [[INF]* W for _ in range(H)]
    q.put(0)
    q.put(0)
    d[0][0] = 0

    while True:
        if q.empty():
            break
        else:
            px = q.get()
            py = q.get()
            if px == H-1 and py == W-1:
                break
            else:
                for dx, dy in move:
                    nx = px + dx
                    ny = py + dy

                    if 0 <= nx and nx < H and 0 <= ny and ny < W and lst[nx][ny] == '.' and d[nx][ny] == INF:
                        q.put(nx)
                        q.put(ny)
                        d[nx][ny] = d[px][py] + 1
    return d[H-1][W-1]

a = bfs()

if a == 10 **9:
    print (-1)
else:
    print (count - a - 1)



Measured memory_bytes: 3952
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  if(n%2==1){
    std::cout << 0 << '\n';
    return 0;
  }
  vll a;
  ll now = 10;
  while(now<=1000000000000000000){
    a.push_back(now);
    now*=5;
  }
  ll ans = 0;
  for(int i=0;i<a.size();i++){
    ans += n/a[i];
  }
  std::cout << ans << '\n';
  //for(int i=0;i<10;i++) std::cout << a[i] << '\n';
  return 0;
}


Measured memory_bytes: 888
package main

import "fmt"

func main() {
	var n, m, x int
	fmt.Scan(&n, &m, &x)

	a := make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&a[i])
	}

	left, right := 0, 0
	for _, v := range a {
		if v < x {
			left++
		} else {
			right++
		}
	}

	if left < right {
		fmt.Println(left)
	} else {
		fmt.Println(right)
	}
}


Measured memory_bytes: 512
//abc067_a.cpp
//Sun Sep 30 15:58:50 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int n,m;
	cin >> n >> m;

	if (n%3==0 || m%3==0 || (n+m)%3==0){
		cout << "Possible" << endl;
	}else {
		cout << "Impossible" << endl;
	}
}

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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


signed main() {

    int n;
    cin>>n;
    vector<int> L(86+1,0);
    
    L[0] = 2;
    L[1]=1;
    for(int i=2; i<=n; i++){
        L[i] = L[i-1] + L[i-2];
    }
    cout << L[n] << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define pf push_front
#define F first
#define S second
#define ll long long
#define f(i) return cout<<i<<"\n",0;
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define lp(i,a,b) for (int i=(a);i<=(int)(b);++i)
#define lp2(i,a,b) for (int i=(a);i>=(b);--i)
#define clr(c,x) memset(c,x,sizeof(c))
#define allr(v) v.rbegin(),v.rend()
#define all(v) v.begin(),v.end()
const int N=2e5+5,mod=(int)1e9+7;
vi v[N];
map<int,int>mp;
set<pii>freq;
bool vis[N]= {};
inline void dfs(int node)
{
    vis[node]=true;
    freq.erase({mp[node],node});
    for (auto u:v[node])
        if (!vis[u])
            dfs(u);
}
int main()
{
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int n,m;
    cin>>n>>m;
    lp(i,1,m)
    {
        int x,y,z;
        cin>>x>>y>>z;
        v[x].pb(y);
        v[y].pb(x);
        mp[x]++;
        if (x!=y) mp[y]++;
    }
    for (auto u:mp) freq.insert({u.S,u.F});
    int cnt=0;
    while(!freq.empty())
    {
        pii it=*freq.rbegin();
        int x=it.S;
        cnt++;
        dfs(x);
    }
    lp(i,1,n) if (!vis[i]) cnt++;
    cout<<cnt<<"\n";
    return 0;
}

Measured memory_bytes: 20992
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
const int dx[4]={1, 0, -1, 0};
const int dy[4]={0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    ll sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    rep(i,ty-sy){
        cout << "U";
    }
    rep(i,tx-sx){
        cout << "R";
    }
    rep(i,ty-sy){
        cout << "D";
    }
    rep(i,tx-sx){
        cout << "L";
    }
    cout << "L";
    rep(i,ty-sy+1){
        cout << "U";
    }
    rep(i,tx-sx+1){
        cout << "R";
    }
    cout << "D";
    cout << "R";
    rep(i,ty-sy+1){
        cout << "D";
    }
    rep(i,tx-sx+1){
        cout << "L";
    }
    cout << "U";
    cout << endl;
}

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

int main(){
    int n;cin>>n;
    vvin a(2,vin(n));
    rep(i,2)rep(j,n)cin>>a[i][j];
    int up=a[0][0];
    int under=0;
    rep(i,n)under+=a[1][i];
    int m=0;
    rep(i,n){
        m=max(m,up+under);
        if(i==n-1)break;
        up+=a[0][i+1];
        under-=a[1][i];
    }
    cout<<m<<endl;
}

Measured memory_bytes: 3628
//FIRST THINK THEN CODE.

  #include <bits/stdc++.h>


  using namespace std;

  typedef long long ll;

  #define rep(i,a,b) for(ll i=a;i<b;++i)
  #define rrep(i,a,b) for(ll i=a;i>b;--i)
  #define FOR(i,n)  for(ll i=0;i<n;i++)
  #define vi vector<int>
  #define vl vector<ll>
  #define ld long double
  #define vld vector<ld>
  #define vvi vector<vector<int>>
  #define vvl vector<vector<long long>>
  #define vvld vector<vector<ld>>
  #define pii pair<int,int>
  #define pll pair<long,long>
  #define vpii vector<pii>
  #define vpll vector<pll>
  #define ff first
  #define ss second
  #define pb push_back
  #define pf push_front
  #define mp make_pair
  #define lb lower_bound
  #define ub upper_bound
  #define bs binary_search
  #define d1(x) cout<<(x)<<endl
  #define d2(x,y) cout<<(x)<<" "<<(y)<<endl
  #define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
  #define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
  #define PI 3.1415926535897932384626433832795
  #define fix(f,n) fixed<<setprecision(n)<<f
  #define all(x) x.begin(),x.end()
  #define rev(p) reverse(p.begin(),p.end());
  #define endl "\n"
  #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  #define popcount(x) __builtin_popcountll(x)
  #define sz(x) ((ll)x.size())
  const ll M=1000000007;
  const ll MM=998244353;
  ll begtime = clock();
  #define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
  //#define _Find_next 
  //#define _Find_first 



  ll newmod(ll a,ll b)
  {
  return ((a%b)+b)%b;
  }


  ll powM(ll a,ll b,ll m )
  { 
  if(a<=0)return 0;
  a%=m;
  if(!b)return 1;
  ll ans=1LL;
  while(b)
  {
  if(b&1)ans=ans*a%m;
  a=a*a%m;
  b>>=1;
  }

  return ans;
  }



  ll poww(ll a,ll b)
  { 

  ll ans=1;
  while(b)
  {
  if(b&1)ans=ans*a;
  a=a*a;
  b>>=1;
  }

  return ans;

  }

  template<typename T,typename F>
  void chmax( T &a,F b){
  if(b>a)a=b;
  }

  template<typename T,typename F>
  void chmin( T &a,F b){
  if(b<a)a=b;
  }

string tostring(ll x){
  stringstream sss;
  sss<<x;
  string ans=sss.str();
  return ans;
}


  const ll N=1e6+5;

ll sp[N];

void sieve(ll N){
  for(ll i=1;i<N;i++)sp[i]=i;

    for(ll i=2;i*i<N;i++){
      if(sp[i]==i){
        for(ll j=i*i;j<N;j+=i){
          if(sp[j]==j)sp[j]=i;
        }
      }
    }
}


  int main()
  { 

    IOS;


ll n;cin>>n;

ll g=0;

sieve(N);

vl a(n+1);
for(ll i=1;i<=n;i++){
cin>>a[i];
  g=__gcd(g,a[i]);
}

vl f(N);

//d1(sp[10]);


for(ll i=1;i<=n;i++){
  ll x=a[i];
  set<ll>s;
  while(x-1){
    ll y=sp[x];
    s.insert(y);
    x/=y;
  }
  for(auto d:s)f[d]++;
}

ll c=0;

for(ll i=1;i<N;i++){
  if(f[i]>1){
    c=1;
    break;
  }
}

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

if(c&&g==1){
  cout<<"setwise coprime";
  return 0;
}
cout<<"not coprime";


//end_routine();

  return 0;

  }

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

    # divisors.sort()
    return divisors
li = make_divisors(m) 
#print(make_divisors(m)) [1, 14, 2, 7]
ans = 1
for l in li:
    if l>ans and l*n <= m:
        ans = l
print(ans)

Measured memory_bytes: 3064