akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

ll gcd(ll n, ll m) {
    if (n < m) swap(n, m);
    while (m != 0) {
        ll r = n % m;
        n = m;
        m = r;
    }
    return n;
}

int main() {
    ll a, b;
    cin >> a >> b;

    ll c = gcd(a, b);

    int r = 1;
    for (ll i = 2; i * i <= c; i++) {
        if (c % i == 0) {
            while (c % i == 0) c /= i;
            r++;
        }
    }
    if (c > 1) {
        r++;
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int x[100000];
int y[100000];

int par[100000];

int find(int x) {
    if (par[x] == x) return x;
    return par[x] = find(par[x]);
}

void unite(int x, int y) {
    x = find(x);
    y = find(y);
    
    if (x == y) return;
    
    par[x] = y;
}

int main() {
    int n, i;
    long long ans = 0;
    vector <pair<int, int> > v, w;
    vector <pair<int, pair<int, int> > > z;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) scanf("%d %d", &x[i], &y[i]);
    
    for (i = 0; i < n; i++) {
        v.push_back(make_pair(x[i], i));
        w.push_back(make_pair(y[i], i));
    }
    
    sort(v.begin(), v.end());
    sort(w.begin(), w.end());
    
    for (i = 0; i + 1 < n; i++) {
        z.push_back(make_pair(v[i + 1].first - v[i].first, make_pair(v[i].second, v[i + 1].second)));
        z.push_back(make_pair(w[i + 1].first - w[i].first, make_pair(w[i].second, w[i + 1].second)));
    }
    
    sort(z.begin(), z.end());
    
    for (i = 0; i < n; i++) par[i] = i;
    
    for (i = 0; i < z.size(); i++) {
        int x = z[i].second.first;
        int y = z[i].second.second;
        
        if (find(x) == find(y)) continue;
        
        unite(x, y);
        ans += z[i].first;
    }
    
    printf("%lld\n", ans);
    
    return 0;
}


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

int main(void){
	int r0, w0, c, r;
	while(true){
		cin >> r0 >> w0 >> c >> r;
		if(!r0&&!w0&&!c&&!r) break;
		if(c * w0 <= r0){
			cout << 0 << endl;
		}else{
			cout << (c*w0-r0+r-1)/r << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3076
#include <iostream>
#include <algorithm>
#include <string>

int main()
{
    std::string S, T;
    std::cin >> S >> T;

    size_t count = 0;
    for (size_t idx = 0; idx < S.size(); idx++) {
        if (S.at(idx) != T.at(idx)) {
            count++;
        }
    }

    std::cout << count << std::endl;

    return 0;
}


Measured memory_bytes: 3912
#include<stdio.h>

int main(void){

	int h, w,i,j;

	scanf("%d %d",&h,&w);

	while (w!=0&&h!=0){

	for (i = 0; i < h; i++){
		for (j = 0; j < w; j++){
			printf("#");
		}
		printf("\n");
	}
        printf("\n");
	scanf("%d %d", &h, &w);
}
return 0;
}

Measured memory_bytes: 572
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int H, W;
    cin >> H >> W;
    
    vector<vector<long long int> > C(10, vector<long long int>(10));
    for(int i=0; i<10; i++) {
        for(int j=0; j<10; j++) {
            cin >> C[i][j];
        }
    }
    
    for(int v=0; v<10; v++) {
        for(int i=0; i<10; i++) {
            for(int j=0; j<10; j++) {
                C[i][j] = min(C[i][j], C[i][v]+C[v][j]);
            }
        }
    }

    long long int ans=0;
    for(int h=0; h<H; h++) {
        for(int w=0; w<W; w++) {
            int A;
            cin >> A;
            if(A!=-1) {
                ans += C[A][1];
            }
        }
    }

    cout << ans << endl;

    return 0;
    
}

Measured memory_bytes: 256
X = input()
x = int(X)

def trans(x):
    if x<=26:
        return chr(64+x)
    elif x%26==0:
        return trans(x//26-1)+chr(90)
    else:
        return trans(x//26)+chr(64+x%26)

ans = trans(x)
answer = ans.lower()
print(answer)

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

int main()
{
	int x = 1;
	int y = 1;

	cin >> x >> y;

	while(x != 0 || y != 0) {
		if (x < y) {
			cout << x << ' ' << y << '\n';
		} else {	
			cout << y << ' ' << x << '\n'; 
		}

		cin >> x >> y;
	}
	return 0;
}


Measured memory_bytes: 2996
const lines=readlines(open("/dev/fd/0"))
input()=shift!(lines)
int(s::String)=parse(Int32,s)
intSub(s::SubString{String})=parse(Int32,s)
intLine()=map(intSub,split(input()))
function nextLine(i::Int)
    s,p=split(input())
    s,intSub(p),i
end
function isless(a,b)
    if a[1]<b[1]
        return true
    elseif b[1]<a[1]
        return false
    else
        return a[2]>b[2]
    end
end
function main()
    n=int(input())
    a=[nextLine(i) for i in 1:n]
    sort!(a,lt=isless)
    for (s,p,i) in a
        println(i)
    end
end
main()

Measured memory_bytes: 123828
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<ll,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int N;
ll A[100009], B[100009];
pii sum[100009];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>N;
    rep(i,N) cin>>A[i]>>B[i];
    rep(i,N){
        sum[i].first = A[i]+B[i];
        sum[i].second = i;
    }
    
    sort(sum,sum+N);
    reverse(sum,sum+N);
    
    ll taka=0, aoki=0;
    rep(i,N){
        if(i%2==0){
            taka+=A[sum[i].second];
        }else{
            aoki+=B[sum[i].second];
        }
    }
    
    cout1(taka-aoki)
}

Measured memory_bytes: 3328
v[]={0,4,2,5,0,5,2,4,0,3,2,1,0,1,2,3,4,3,5,1,1,5,3,4};main(n,c,i,s){while(scanf("%d",&n)&&n){int d[]={1,3,6,4,2,5};for(s=1;n--&&scanf("%s",&c);){c&=255;i=c-78?c-83?c-69?c-87?c-76?20:16:12:8:4:0;c=d[v[i]];for(;++i&3;)d[v[i-1]]=d[v[i]];d[v[i-1]]=c;s+=*d;}printf("%d\n",s);}}

Measured memory_bytes: 0
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let s = sc.chars();
    let n = s.len();

    let mut candidates = vec![];
    for i in 0..(n - 1) {
        if s[i] == 'R' && s[i + 1] == 'L' {
            candidates.push(i);
        }
    }

    let x = candidates.len();
    let mut ans = vec![0; n];
    for i in 0..x {
        let mut left = candidates[i];
        let mut right = candidates[i] + 1;
        while left > 0 && s[left - 1] == 'R' {
            left -= 1;
        }
        while right + 1 < n && s[right + 1] == 'L' {
            right += 1;
        }
        let mut odd = 0;
        let mut even = 0;
        let i = candidates[i];
        for j in left..i {
            if (i - j) % 2 == 0 {
                even += 1;
            } else {
                odd += 1;
            }
        }
        for j in i..(right + 1) {
            if (j - i) % 2 == 0 {
                even += 1;
            } else {
                odd += 1;
            }
        }
        ans[i] += even;
        ans[i + 1] += odd;
    }
    for i in 0..n {
        if i > 0 {
            print!(" ");
        }
        print!("{}", ans[i]);
    }
    println!();
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 6524
#include <bits/stdc++.h>
#define show(x) std::cerr << #x << " = " << (x) << std::endl
using ll = long long;
using ld = long double;
constexpr ll MOD = 1000000007LL;
template <typename T>
constexpr T INF() { return std::numeric_limits<T>::max() / 16; }
std::mt19937 mt{std::random_device{}()};
int main()
{
    ll X, Y;
    std::cin >> X >> Y;
    std::cout << (std::abs(X - Y) <= 1 ? "Brown" : "Alice") << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

const int MOD = 1e9 + 7;
int N;
vector<map<string, ll> > cnt;
string S[4] = {"A", "C", "G", "T"};

bool is_valid(string s) {
    REP(i, 4) {
        string t = s;
        if (i > 0) {
            swap(t[i - 1], t[i]);
        }
        if (t.find("AGC") != string::npos) {
            return false;
        }
    }
    return true;
}

ll dfs(int i, string s) {
    if (cnt[i].count(s) > 0) {
        return cnt[i][s];
    }
    if (i == N) {
        return 1;
    }
    ll res = 0;
    REP(j, 4) {
        string t = s + S[j];
        if (is_valid(t)) {
            res = (res + dfs(i + 1, t.substr(1))) % MOD;
        }
    }
    cnt[i][s] = res;
    return res;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    cnt = vector<map<string, ll> >(N + 1);
    cout << dfs(0, "ZZZ") << endl;
    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vl a(n+1,0);
	rep(i,n)cin>>a[i+1];
	vl ans(n+1,0);

	vvl edge(n+1);
	range(i,1,n+1){
		ll p=i;
		while(p<=n){
			p+=i;
			if(p<=n) edge[p].push_back(i);
		}
	}
	vl res;
	rrep(i,n){
		int p=i+1;
		// puta(p,":",ans[p]);
		if(ans[p]!=a[p]){
			res.push_back(p);
			ans[p]=a[p];
			for(auto&e:edge[p])ans[e]=1-ans[e];
		}
	}
	// range(i,1,n+1)cout<<ans[i]<<(i==n?"\n":" ");
	// rep(i,n)puta(i+1,":",edge[i+1]);
	puta(res.size());
	if(res.size())puta(res);
	return 0;
}

Measured memory_bytes: 38648
#include <iostream>
#include <fstream>
#include <unistd.h>
#include <sys/stat.h>
#include <stdio.h>
#include <vector>
#include <cmath>
#include <random>
#include <string.h>      //文字列の代入に使う
#include <bits/stdc++.h> //piの利用で必要(M_PI)
#include <algorithm>
#include <climits>
#define rep(i, c) for (int i = 0; i < (int)c; i++) //atcoderの解説コードに利用されていたので，ある程度一般生があるかと思われる．

int main()
{
    int N;
    std::cin >> N;

    std::vector<int> P(N), Q(N);
    for (int i = 0; i < N; i++)
    {
        std::cin >> P.at(i);
    }

    for (int i = 0; i < N; i++)
    {
        std::cin >> Q.at(i);
    }

    std::vector<int> temp;
    for (int i = 1; i <= N; i++)
    {
        temp.push_back(i);
    }
    int count = 0, P_count, Q_count;
    do
    {
        count++;
        if (temp == P)
        {
            break;
        }
    } while (std::next_permutation(temp.begin(), temp.end()));
    P_count = count;
    count = 0;
    std::vector<int> temp1;
    for (int i = 1; i <= N; i++)
    {
        temp1.push_back(i);
    }

    do
    {
        count++;
        if (temp1 == Q)
        {
            break;
        }
    } while (std::next_permutation(temp1.begin(), temp1.end()));
    Q_count = count;

    std::cout << abs(P_count - Q_count) << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <string>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,s,e) for(int i=s; i<=e; i++)
#define repd(i,s,e) for(int i=s; i>=e; i--)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;

char mcxi[4] = { 'm', 'c', 'x', 'i' };

int mcxi2num(string s) {
	int n = 0;
	int dig = 1000;

	for(int i=0; i<4; i++) {
		int c = s.find_first_of(mcxi[i]);
		if(c != string::npos) {
			if(c == 0) {
				n += dig;
			} else {
				n += s[c-1] <= '9' ? dig * (int)(s[c-1] - '0') : dig; 
			}
		}
		dig = dig / 10;
	}

	return n;
}

string num2mcxi(int m) {
	string s = "";
	for(int i=0; i<4; i++) {
		char c = (char)(m % 10);
		if(c != 0) {
			s = mcxi[4-i-1] + s;
		}

		if(c >= 2) {
			s = " " + s;
			s[0] = c + '0';
		}

		m = m / 10;
	}
	return s;
}

int main() {
	int n, x, y;
	string a, b;

	cin >> n;
	rep(i,n) {
		cin >> a >> b;
		x = mcxi2num(a);
		y = mcxi2num(b);
		cout << num2mcxi(x + y) << endl;
	}
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimization ("Ofast")
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define siz(s) (int)s.size()

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> inline int getidx(vector<T> &v, T a) {
	return lower_bound(all(v), a) - v.begin();
}

constexpr int mod=1e9+7;
constexpr int inf=3e18;

int N;
P p[2005];
int dp[2005][2005];
signed main(){
	cin.tie(0);ios::sync_with_stdio(false);
	cin>>N;
	rep(i,N){
		cin>>p[i].first;p[i].second=i;
	}
	sort(p,p+N,greater<>());
	rep(i,N+1)rep(j,N+1)dp[i][j]=-inf;
	dp[0][0]=0;
	rep(i,N){
		rep(j,i+1){
			int k=N-(i-j)-1;
			chmax(dp[i+1][j+1],dp[i][j]+p[i].first*abs(j-p[i].second));
			chmax(dp[i+1][j],dp[i][j]+p[i].first*abs(k-p[i].second));
		}
	}
	int ans=0;
	rep(i,N+1)chmax(ans,dp[N][i]);
	cout<<ans<<endl;
}


Measured memory_bytes: 35040
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const ll INF = 1e9;
const ll LINF = ll(1e18) + 1;
const ll MOD = 1000000007;
const ll dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const ll Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (ll i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll n;
vector<ll> a, b, c;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    map<ll, ll> m;
    for (ll i = 0; i < n; i++)
    {
        ll temp;
        cin >> temp;
        a.push_back(temp);
        m[temp] = i + 1;
    }
    set<ll> s;
    s.insert(0);
    s.insert(n + 1);
    ll ans = 0;
    for (ll i = n; i >= 1; i--)
    {
        ll idx = m[i]; //iのインデックス
        auto itr = s.lower_bound(idx);
        auto copy = itr;
        vector<ll> l(2, -1), r(2, -1);
        for (ll i = 0; i < 2; i++)
        {
            if (itr == s.begin())
            {
                break;
            }
            else
            {
                itr--;
                l[i] = *itr;
            }
        }
        for (ll i = 0; i < 2; i++)
        {
            if (copy == s.end())
            {
                break;
            }
            else
            {
                r[i] = *copy;
                copy++;
            }
        }
        //debug(l);
        //debug(r);
        if (l[1] != -1 && r[0] != -1)
        {
            ans += i * (r[0] - idx) * (l[0] - l[1]);
        }
        if (l[0] != -1 && r[1] != -1)
        {
            ans += i * (r[1] - r[0]) * (idx - l[0]);
        }
        s.insert(idx);
    }
    cout << ans << "\n";
}


Measured memory_bytes: 12020
import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    N, M = NMI()
    ab = [NLI() for _ in range(M)]
    
    ENDsorted_sections= sorted(ab, key=lambda x: x[1])
    
    ans = 1
    dropped_bridge = ENDsorted_sections[0][1]

    for m in range(M):
        if ENDsorted_sections[m][0] >= dropped_bridge:#新しく橋を落とさないといけない
            ans += 1
            dropped_bridge = ENDsorted_sections[m][1]
    print(ans)    

if __name__ == '__main__':
    main()

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

int main() {
	char str1[8], str2[8];
	for(int i = 0; i < 3; i++) scanf(" %c", &str1[i]);
	for(int j = 0; j < 3; j++) scanf(" %c", &str2[j]);
	if(str1[0] == str2[2] && str1[1] == str2[1] && str1[2] == str2[0]) {
		printf("YES\n");
	}
	else printf("NO\n");
}

Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func paint(currentNode, usedColor, parentNode int, edges [][]int, colors map[int]int) {
	color := 1
	for _, childNode := range edges[currentNode] {
		if childNode == parentNode {
			continue
		}
		if color == usedColor {
			color++
		}
		colors[genid(currentNode, childNode)] = color
		paint(childNode, color, currentNode, edges, colors)
		color++
	}
}

func genid(a, b int) int {
	if b < a {
		a, b = b, a
	}
	return a*100000 + b
}

func main() {
	N := readInt()

	ab := make([][2]int, N-1)
	edges := make([][]int, N)
	for i := 0; i < N-1; i++ {
		a := readInt() - 1
		b := readInt() - 1
		ab[i][0], ab[i][1] = a, b
		edges[a] = append(edges[a], b)
		edges[b] = append(edges[b], a)
	}

	colors := make(map[int]int)
	paint(0, -1, -1, edges, colors)

	K := -1
	for i := 0; i < N; i++ {
		t := len(edges[i])
		if t > K {
			K = t
		}
	}
	fmt.Println(K)

	for i := 0; i < N-1; i++ {
		fmt.Println(colors[genid(ab[i][0], ab[i][1])])
	}
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}


Measured memory_bytes: 31872
N, A = [int(_) for _ in input().split()]
X = [int(_) - A for _ in input().split()]
dp = [0] * 3000 + [1] + [0] * 3000
for x in X:
    dp_old = dp.copy()
    for i in range(max(-x, 0), min(6001, 6001 - x)):
        dp[i + x] += dp_old[i]
print(dp[3000] - 1)


Measured memory_bytes: 3188
#include <stdio.h>

// プロセスを表す構造体
typedef struct pp {
  char name[100];
  int t;
} P;

P Q[100000];
int head, tail, n, q, c;

void enqueue(P x) {
  Q[tail] = x;
  if (tail == n) {
    tail = 0;
  } else {
    tail++;
  }
}

P dequeue() {
  P x = Q[head];
  if (head == n) {
    head = 0;
  } else {
    head++;
  }
  return x;
}

int min(int a, int b) {
  if (a <= b) {
    return a;
  } else {
    return b;
  }
}

int main() {
  // 経過時間
  int elapsed = 0;

  scanf("%d %d", &n, &q);
  P u;

  for (int i = 0; i < n; i++) {
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 0;
  tail = n;

  while(head != tail) {
    u = dequeue();
    c = min(q, u.t);
    u.t -= c;
    elapsed += c;
    if (u.t > 0) {
      enqueue(u);
    } else {
      printf("%s %d\n", u.name, elapsed);
    }
  }
  return 0;
}



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

#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sc(x) scanf("%lld",&x)
#define pr(x) printf("%lld\n",x)
#define clr(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
typedef pair<ll, ll> pii;
typedef vector< ll > vl;
typedef vector< pii > vpii;

//DONT WASTE YOUR TIME
//prove yourself
//remember....fuck ps&&as hard....show them your are better then them
//Be confident.....dont lose hope.......You can do it.....
//dimaag  khoob h tere meh ....bas concentration ki kami h
//CONCENTRATE
//A,B,C dimaag nhi ...observation h .....zyaada mat sochna unme.....bas observe karna dhyaan se aur implement kar daal jitni jaldi ho sake

//capture it

const ll N= 1e6+55,mod = 1e9+7;

vl aa,bb;
int main() {
 	//freopen("task.in","r",stdin);freopen("task.out","w",stdout);
	ll ans=mod,k,n,h,i,j,a,b,c,x,y,z;	
	sc(n);sc(h);
	aa.pb(-1);bb.pb(mod);
	for(i=1;i<=n;i++){
		sc(a);sc(b);
		aa.pb(a);bb.pb(b);
	}
	sort(bb.rbegin(),bb.rend());
	bb[0]=0;
	for(i=1;i<=n;i++){
		bb[i]+=bb[i-1];
	}
	j=*max_element(aa.begin(),aa.end());
	//k=lower_bound(bb.begin(),bb.end(),h)-bb.begin();
	//if(k>n)k=n;
	c=mod;
	k=n;
	while(k>=0){
		b=h-bb[k];
		if(b<0)b=0;
		a=b/j;
		if(b%j)a++;
		ans=min(ans,a+k);
		k--;
	}
	pr(ans);
}

Measured memory_bytes: 2036
#include <bits/stdc++.h>
using namespace std;
int main()
{
    // 整数の入力
	int p, q, r;
    int a, b, c;
  	
    cin >> p >> q >> r;
  	a = p + q;
  	b = q + r;
  	c = r + p;
  
    if(a<=b&&a<=c){
        cout << a << endl;
        return 0;
    }else if(b<=a&&b<=c){
        cout << b << endl;
        return 0;
    }else {
        cout << c << endl;
        return 0;
    }        
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
    int n,k,t;
    cin>>n>>k>>t;
    int ans=0;
    while(n>0){
        n-=k;
        ans+=t;
    }
    cout<<ans<<"\n";
}

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

    int t=1;
    // cin >> t=1;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3648
n, m, l = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
b = [list(map(int, input().split())) for i in range(m)]

c = [[0] * l for i in range(n)]
for i in range(n):
    for j in range(l):
        for k in range(m):
            c[i][j] += a[i][k] * b[k][j]
    print(*c[i])


Measured memory_bytes: 7036
import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int Y = sc.nextInt();
    int Z = sc.nextInt();
    
    int n = 1;
    while(X >= n*Y + (n+1)*Z){
        n++;
    }
	System.out.println(n-1);
      }
}


Measured memory_bytes: 35672
/*
    Author:zeke

    pass System Test!
    GET AC!!
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
// cout << "Case #" << index << " :IMPOSSIBLE";
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    ll n,x,t;
    cin>>n>>x>>t;
    if(n%x==0){
        cout<<n/x*t<<endl;
    }else{
        cout<<(n/x+1)*t<<endl;
    }
}


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

typedef long long ll;

int n, m;
int x, y, z;
int ans = 0;
int a[100009];
vector<int> g[100009];

void dfs(int node) {
  a[node] = 1;
  for(auto i:g[node]) {
    if (!a[i]) {
      dfs(i);
    }
  }
}

int main() {
  memset(a, 0, sizeof(a));
  cin >> n >> m;
  for(int i=0; i<m; i++) {
    cin >> x >> y >> z;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for(int i=1; i<=n; i++) {
    if (!a[i]) {
      ans++;
      dfs(i);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 9216
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm> 
#include<string>
using namespace std;
string st;

int main(){
   cin >> st;
//   for(int i=1; i<=n; i++){
     for(int j=0; j<=st.size()-1; j++){
        if(st[j]=='1') {st[j]='9';continue;}
        if(st[j]=='9') {st[j]='1';continue;}
	 }
//   }
   cout << st;
   return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

int main() {
  int h, n;
  scanf("%d%d", &h, &n);
  int a, sum = 0;
  for (int i=0; i<n; i++) {
    scanf("%d", &a);
    sum += a;
  }
  if (sum >= h) printf("Yes\n");
  else printf("No\n");
  return 0;
}


Measured memory_bytes: 128
let rec solve patties stratos x = function
  | 0 -> x
  | l ->
      if x <= 1 then 0
      else if x - 1 <= stratos (l - 1) then
        solve patties stratos (x - 1) (l - 1)
      else if x - 1 - stratos (l - 1) <= 1 then
        patties (l - 1) + 1
      else if x - 2 - stratos (l - 1) <= stratos (l - 1) then
        patties (l - 1) + 1 + solve patties stratos (x - 2 - stratos (l - 1)) (l - 1)
      else patties l

let () = Scanf.scanf "%d %d" @@ fun n x ->
  let patties = Array.make (n + 1) 1 in
  for i = 1 to n do
    patties.(i) <- 2 * patties.(i - 1) + 1
  done;
  let stratos = Array.make (n + 1) 1 in
  for i = 1 to n do
    stratos.(i) <- 2 * stratos.(i - 1) + 3
  done;
  Printf.printf "%d\n" @@ solve (Array.get patties) (Array.get stratos) x n


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

using namespace std;

int main() {

    long long int a,b,n;
    cin>>a>>b>>n;
    long long int res = 0;

    if(n >= b)
    {
        res = (a * (b-1));
        res = res/b;
    }
    else
    {
        res = a * n;
        res = res/b;
    }

    cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 3636
# snuke解説板
from heapq import heappush, heappop

infi = 10 ** 20
n, m, s = map(int, input().split())

s = min(s, n * 50)

edges = [[] for _ in range(n + 1)]
# edge:1-50, max silver=0-2500

for _ in range(m):  # a円, b分
    u, v, a, b = map(int, input().split())
    edges[v].append((u, a, b))
    edges[u].append((v, a, b))

exchange = [(0, 0)] * (n + 1)

for edge_num in range(1, n + 1):  # c円, d分
    c, d = map(int, input().split())
    exchange[edge_num] = (c, d)

start = 1
# dp[i][j], 頂点iにお金jを持って到達する最低時間→時間に関してDAG
dp = [[infi] * (n * 50 + 1) for _ in range(n + 1)]


def dijkstra(edges, start, s, dp):
    dp[start][s] = 0
    edgelist = []
    heappush(edgelist, (0, s, start))  # 時間, お金, 頂点
    while edgelist:
        nowtime, nowmoney, nowedge = heappop(edgelist)
        # 遷移させる条件はedge,moneyの組み合わせに対してその時の最小値が出てきたときのみ→最小値以外は飛ばす。
        if dp[nowedge][nowmoney] != nowtime:
            continue
        # 両替
        deltamoney, deltatime = exchange[nowedge]
        nextmoney = min(nowmoney + deltamoney, n * 50)
        nexttime = nowtime + deltatime
        if dp[nowedge][nextmoney] > nexttime:
            dp[nowedge][nextmoney] = nexttime
            heappush(edgelist, (nexttime, nextmoney, nowedge))
        # 移動
        for v, vmoney, vtime in edges[nowedge]:
            nexttime = nowtime + vtime
            nextmoney = nowmoney - vmoney
            if nextmoney < 0:
                continue
            if dp[v][nextmoney] > nexttime:
                dp[v][nextmoney] = nexttime
                heappush(edgelist, (nexttime, nextmoney, v))
    return dp


time = dijkstra(edges, start, s, dp)

ans = [infi] * (n + 1)
for i in range(1, n + 1):
    for j in range(n * 50 + 1):
        ans[i] = min(ans[i], dp[i][j])

print(*ans[2 : (n + 1)], sep="\n")


Measured memory_bytes: 24364
att = []
ab = []

for i in range(28):
    s = int(input())
    att.append(s)

att.append(0)
att.append(0)

for i in range(28):
    for j in range(27,i,-1):
        if att[j] < att[j-1]:
            att[j],att[j-1] = att[j-1],att[j]
           

for i in range(30):
    if att[i] != i+1:
        att.insert(i,0)
        ab.append(i+1)
        
print(ab[0])
print(ab[1])


Measured memory_bytes: 5600
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
using namespace std;
typedef long long int ll;

#define MOD 998244353

int main(){
    ll n,ans=0;
    cin >> n;
    for (ll i=105;i<=n;i++){
        ll count=0;
        if (i%2==0)continue;
        for (ll j=1;j<=i;j++){
            if (i%j==0)count++;
        }
        if (count==8)ans++;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const ll MOD = 1e9 + 7;

int main() {
    int n;
    cin >> n;
    vector<ll> as(n+1);
    rep(i, n) {
        ll a; cin >> a;
        as[i+1] = as[i] + a; 
    }  
    unordered_map<ll, ll> mp;
    for(auto c :as) mp[c]++;
    ll cnt = 0;
    for (auto& p : mp) {
        ll c = p.second;
        cnt += c*(c-1)/2;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 10056
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ld = long double;
const int INF = 1 << 29;
const ll LINF = 1l << 61;
const ld PI = abs(acos(-1));
#define pq priotity_queue
#define mp make_pair
#define P pair
#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 cbuf(buf, init) memset(buf, init, sizeof(buf))
#define modp(x, y) (((y) + (x) % (y)) % (y))
#define divd(x, y) (static_cast<double>(x) / static_cast<double>(y))

ll N, a[100], b[100];

void print(ll a, ll b)
{
    cout << a + 1 << " " << b + 1 << endl;
}

int main()
{
    //
    cin >> N;
    rep(i, 0, N) { cin >> a[i]; }

    ll Mi = max_element(a, a + N) - a;
    ll mi = min_element(a, a + N) - a;
    ll AMi = abs(a[Mi]) > abs(a[mi]) ? Mi : mi;

    cout << N + N - 1 << endl;
    rep(i, 0, N){
        print(AMi, i);
        a[i] += a[AMi];
    }
    if(a[0] > 0){
        rep(i, 0, N - 1){
            print(i, i + 1);
        }
    }else{
        rrep(i, N-1, 1){
            print(i, i - 1);
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define _rep(i,m,n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};


int main(){
    ll x; cin >> x;
    if(0 <= (x - 1) % 11 && (x - 1) % 11 <= 5)cout << (x + 4) / 11 * 2 + 1;
    else cout << (x + 4) / 11 * 2;
}

Measured memory_bytes: 256
<?php  
  list($s) = explode(" ", trim(fgets(STDIN)));
  list($gx,$gy) = explode(" ", trim(fgets(STDIN)));

  $x=0;
  $y=0;
  $n=strlen($s);
  // 最初は必ず右に行くので初期座標をずらす
  for($i=0;$i<$n;$i++){
    if($s[$i]=="T"){
      $x+=$i;
      break;
    }
  }
  // 右への移動だけで終わる場合
  if($i==$n){
    if($gx==$x+$i && $y==0){
      echo "Yes";
    }else{
      echo "No";
    }
    exit;
  }

  $UD=[];
  $LR=[];
  $s=substr($s,$i);
  $n=strlen($s);
  $dire="LR";
  $dist=0;
  for($i=0;$i<$n;$i++){
    if($s[$i]=="T"){
      if($dire=="UD"){
        $UD[]=$dist;
        $dire="LR";
      }else{
        $LR[]=$dist;
        $dire="UD";
      }
      $dist=0;
    }else{
      $dist++;
    }
  }
  if($dire=="UD") $UD[]=$dist;
  else $LR[]=$dist;

  rsort($UD);  
  for($i=0;$i<count($UD);$i++){
    if($y > $gy) $y-=$UD[$i];
    else $y+=$UD[$i]; 
  }
  if($y != $gy){
    echo "No";
    exit;
  }

  rsort($LR);  
  for($i=0;$i<count($LR);$i++){
    if($x > $gx) $x-=$LR[$i];
    else $x+=$LR[$i]; 
  }

  if($x != $gx){
    echo "No";
    exit;
  }

  echo "Yes";


Measured memory_bytes: 16564
/*********************
*  Author: xuziyuan  * 
*********************/
 
#include <bits/stdc++.h>

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

int n,t,a[200010];
double sum[1010],res=0,ans=0;

int main()
{
	cin>>n>>t;
	rep(i,n) cin>>a[i];
	repn(i,1005) sum[i]=sum[i-1]+i;
	rep(i,t) res+=sum[a[i]]/(double)a[i];
	ans=res;
	for(int i=t;i<n;i++)
	{
		res+=sum[a[i]]/(double)a[i];
		res-=sum[a[i-t]]/(double)a[i-t];
		ans=max(ans,res);
	}
	printf("%.10lf\n",ans);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>

#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n;i++)
#define repf(i, a, b) for (int i = (int)a; i < (int)b;i++)
#define repv(x, arr) for (auto& x:arr)
#define all(v) (v).begin(), (v).end()
#define vec(name, num) vector<ll> name((num), 0);
#define mp(a,b) make_pair(a,b)
#define op(i) cout << (i) << endl;
#define F first
#define S second

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;

const ll mod = 1e9 + 7;


int main(){
    ll N, A, B;
    cin >> N >> A >> B;
    vector<ll> X(N);
    rep(i,N){
        cin >> X[i];
    }
    ll ans = 0;
    ll now = X[0];
    repf(i,1,N){
        if ((X[i]-now)*A>B){
            ans += B;
        }
        else
            ans += (X[i] - now) * A;
        now = X[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <limits.h>

#define N 101

int main(){
  int n,i,j,k,l,q,m[N][N]={0},p[N]={0};
  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%d %d",&p[i],&k);
  }
  p[i]=k;
  //for(i=0; i<n+1; i++) printf("p[%d]=%d\n",i,p[i]);
  //printf("DEBUG1\n");
  for(i=1; i<=n; i++) m[i][i]=0;
  //printf("DEBUG2\n");
  for(l=2; l<=n; l++){
    //printf("DEBUG3\n");
    for(i=1; i<=n-l+1; i++){
      j=i+l-1;
      m[i][j]=INT_MAX;
      for(k=i; k<=j-1; k++){
	q=m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j];
	if(q<m[i][j]) m[i][j]=q;
      }
    }
  }
  /*for(i=1; i<=n; i++){
    for(j=1; j<=n; j++){
      printf(" %d",m[i][j]);
    }
    printf("\n");
    }*/
  
  printf("%d\n",m[1][n]);
  return 0;
}



Measured memory_bytes: 2108
#include<stdio.h>
#include<math.h>
int main(void) {
	long long x;
	scanf("%lld", &x);

	if (x % 11 == 0)printf("%lld\n", ((x / 11) * 2));
	else if (x % 11 < 7)printf("%lld\n",(x/11)*2+1);
	else
		printf("%lld\n", ((x / 11) * 2 + 2));

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int cd,k,a,q,g[1000000];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> cd >> k >> q;
	for (int i = 1 ; i <= q ; i++)
	{
		cin >> a;
		g[a]++;
	}
	for (int i = 1 ; i <= cd ; i++)
	{
		if (k - (q - g[i]) > 0) cout <<"Yes"<<'\n';
		else cout <<"No"<<'\n';
	}
}

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

int main()
{
	int N;
	cin >> N;
	vector<long long int> As(N);
	for (int i = 0; i < N; i++)
	{
		cin >> As.at(i);
		As.at(i) -= (i + 1);
	}
	sort(As.begin(), As.end());
	long long int sum = 0, b;
	if (N % 2 == 1)
	{
		b = As.at(N / 2);
	}
	else
	{
		b = (As.at(N / 2) + As.at(N / 2 - 1)) / 2;
	}
	for (int i = 0; i < N; i++)
	{
		sum += abs(As.at(i) - b);
	}
	cout << sum << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
#define PB push_back
#define MP make_pair
#define Mod 998244353
using namespace std;
using lint = long long;
using vi = vector<lint>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;

// cout << fixed << setprecision(12)

int main(){
  lint N;
  cin >> N;
  vi a(N);
  
  lint all = 0;
  
  for(lint i=0; i<N; i++){
    cin >> a[i];
    all = (all ^ a[i]);
  }
  
  for(lint i=0; i<N-1; i++){
    cout << (all ^ a[i]) << ' ';
  }
  cout << (all ^ a[N-1]) << endl;
}
  

  

  
  
  

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

int main() {
	int a, b;
	cin >> a >> b;
	int h[1000];
	h[0] = 0;
	for (int i = 1; i <= 999; i++)
		h[i] = h[i - 1] + i;
	cout << h[b - a] - b << endl;
	return 0;
}

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

using namespace std;

#define LIMIT 100
typedef pair<int64_t, int64_t> ii;
typedef int64_t ll;
int gcd(ll a, ll b) { return (b==0)?a:gcd(b, a%b); }
int lcm(ll a, ll b) { ll i=(a/gcd(a,b))*b; assert(i>0); return i; }

int m[10][10];


//  ***** MAIN *****
int main(){
  //ios::sync_with_stdio(false);
  cin.tie(NULL);
  int h, w;
  cin >> h >> w;

  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < 10; ++j) {
      cin >> m[i][j];
    }
  }

  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < 10; ++j) {
      for (int k = 0; k < 10; ++k) {
        m[j][k] = min(m[j][k], m[j][i]+m[i][k]);
      }
    }
  }

  int n;
  int c = 0;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      cin >> n;
      if (n>= 0)c += m[n][1];
    }
  }
  std::cout << c << std::endl;

  return 0;
}



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;
    if (n / 100 == (n % 100) % 10)  cout << "Yes" << endl;
    else  cout << "No" << endl;
}

Measured memory_bytes: 256
<?php

fscanf(STDIN, "%d %d", $n, $m);

if (abs($n - $m) > 1) {
	echo "0\n";
	return;
}

$big = pow(10, 9) + 7;

$nPattern = 1;
for ($i = 1; $i <= $n; $i++) {
	$nPattern = ($nPattern * $i) % $big;
}

$mPattern = 1;
for ($i = 1; $i <= $m; $i++) {
	$mPattern = ($mPattern * $i) % $big;
}

if ($n === $m) {
	echo $nPattern * $mPattern * 2 % $big, "\n";
	return;
}
echo $nPattern * $mPattern % $big, "\n";


Measured memory_bytes: 4856
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<long long,long long>
#define mod 1000000007
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

ll power(ll a,ll b){
	ll ans=1;
	while(b>0){
		if(b%2!=0){
			ans=(ans*a)%mod;
		}
		a=(a*a)%mod;
		b>>=1;
	}
	return ans;
}

int main() {
	IOS;
	int t=1;
	//cin>>t;
	while(t--){
		int n,k,s;
		cin>>n>>k>>s;
		if(s==1000000000){
			for(int i=0;i<k;i++){
				cout<<s<<" ";
			}
			for(int i=k;i<n;i++){
				cout<<1<<" ";
			}
		}
		else{
			for(int i=0;i<k;i++)
			cout<<s<<" ";
			for(int i=k;i<n;i++)
			cout<<1000000000<<" ";
		}
	}
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>

#include <vector>

#include <cassert>

#include <algorithm>

#include <functional>

#include <cmath>

#include <iomanip>

#include <limits>
#include <bits/stdc++.h>
#include<queue>
#include<type_traits>
#include<cstdint>
using namespace std;
using ll=long long;

int main(){
    int x;
    cin>> x;
    if(x==7 || x==5 || x==3){
        cout << "YES" <<endl;
    }else{
        cout <<"NO"<<endl;
    }
    
}

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

const double rad = 3.141592 / 180;

int main(){
	double x, y;
	int r, angle, nangle;
	x = y = r = angle = nangle = 0;
	while(true){
		scanf("%d,%d", &r, &angle);	
		if(r == 0 && angle == 0)
			break;
		x += sin(rad * nangle) * r;
		y += cos(rad * nangle) * r;
		nangle += angle;
	}
	printf("%d\n%d\n", (int)x, (int)y);
	return 0;
}

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

using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr ll mod = static_cast<ll>(1e9 + 7);

int n, v[25], c[25];
int main() {
	std::cin >> n;
	for (int i = 0; i < n; ++i)
		std::cin >> v[i];
	for (int i = 0; i < n; ++i)
		std::cin >> c[i];

	int ans = 0;
	for (int i = 0; i < n; ++i)
		if (v[i] > c[i])
			ans += v[i] - c[i];

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


Measured memory_bytes: 256
<?php

fscanf(STDIN, "%d %d", $k, $x);

$min = $x - ($k - 1);
$max = $x + ($k - 1);

$result = [];
for ($i = $min; $i <= $max; ++$i) {
    $result[] = $i;
}
echo implode(' ', $result);


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



int main()
{
    // 整数の入力
    int k;
    std::vector<int> antennas;
    antennas.resize(5);
    std::cin >> antennas[0] >> antennas[1] >> antennas[2] >> antennas[3] >> antennas[4] >>k;
    
    for(int i = 0; i < 4; ++i){
        for(int j = i+1; j < 5; ++j){
            if(std::abs(antennas[i] - antennas[j])>k){
                std::cout << ":(" << std::endl;
                return 0;
            }
        }
    }
    std::cout << "Yay!" << std::endl;

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T binarysearch(vector<T> A, T key) {
	ll left = 0;ll right = 4;ll mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (key == A[mid]) return 1;
		if (key > A[mid]) left = mid + 1;
		else if (key < A[mid]) right = mid;
	}
	return 0;
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)//階乗
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

template<typename T>
T keta(T a) {
	ll kazu = 1;
	while (1) {
		if (a / 10 != 0) { a /= 10;kazu++; }
		else break;
	}
	return kazu;
}//桁数


template<typename T>
T nCr(ll n, T r) {
	ll ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	ll N, K, d,op;cin >> N >> K;vector<ll>sum(N);
	for (int i = 0;i < K;i++) {
		cin >> d;
		for (int j = 0;j < d;j++) {
			cin >> op;
			sum[op-1]++;
		}
	}
	ll ans = 0;
	for (int i = 0;i < N;i++) if (sum[i] == 0)ans++;
	cout << ans << endl;
}


Measured memory_bytes: 3572
import java.util.Scanner;

public class Main{
    public void solve(){
		Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        System.out.println(a*b+" "+(a*2 + b*2));
    }
    
    public static void main(String args[]){
        Main obj = new Main();
        obj.solve();
    }
}

Measured memory_bytes: 17160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()

ll K,N;
VL A;
int main(){
    cin>>K>>N;
    A=VL(N+1,0);
    ll length=0;
    ll ma=0;
    rep(i,1,N+1){
        cin>>A[i];
    }
  	rep(i,2,N+2){
        if(i!=N+1)length=A[i]-A[i-1];
        if(i==N+1)length=(K-A[N])+A[1];
        ma=max(ma,length);
    }
    cout<<K-ma;
    return 0;
}

Measured memory_bytes: 1792