akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1001001001;


int main(){
  string s;
  cin>>s;
  int n,cnt,sc;
  n=s.size();
  cnt=0;sc=0;
  rep(i,n){
    if (cnt>0){
      if (s[i]=='g')sc++;
      cnt--;
    }
    else{
      if (s[i]=='p')sc--;
      cnt++;
    }
    //cout<<sc<<endl;
  }
cout<<sc;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
//#pragma GCC optimize ("Ofast")
//#pragma GCC target ("avx,avx2")
#define rep(i, n)    for(ll i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define pb push_back
#define X first
#define Y second
typedef long long int ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vii;
const ll INF = 1e18+1;
const ll MOD = 1000000007L;
#ifdef umang99m
    #include "/home/umang/Desktop/folder/home/.templates/header.h"
#else
    #define dbg(args...)
    #define timer()
#endif
ll mod(ll a) {return abs(a);}
int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll n,k;
    cin>>n>>k;
    vi h(n);
    rep(i,n) cin>>h[i];
    vi ans(n);
    ans[n-1] = 0;
    for(int i=n-2; i>=0; i--){
        ans[i] = ans[i+1] + mod(h[i+1]-h[i]);
        
        for(int j=1; j<=k; j++){
            if(i+j>=n) break;
            ans[i] = min(ans[i] , ans[i+j] + mod(h[i+j] - h[i]));
        }
    }
    cout<<ans[0]<<endl;

    timer();
    return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <vector>

#ifdef DEBUG
#include <fmt/format.h>
#include <fmt/ranges.h>
#define __debug(...) fmt::print(__VA_ARGS__)
#else 
#define __debug(...)
#endif

constexpr int maxN = (int)1e5 + 10; 

int A[3][maxN];
int N;

int bit[maxN]; 

inline int lowbit(int x) { return x & -x; }

inline int query(int p) //0-based
{
	int res = 0;
	for (p += 1; p; p -= lowbit(p))
		res += bit[p];
	return res;
}
inline void modify(int p, int delta) //0-based
{
	for (p += 1; p <= N; p += lowbit(p))
		bit[p] += delta;
}

long long calc(const std::vector<int>& seq)
{
	memset(bit, 0, sizeof(bit));
	for (int i = 0; i < seq.size(); i++)
		modify(i, 1);

	struct Node { int pos, value; };
	std::vector<Node> node(seq.size());
	for (size_t i = 0; i < seq.size(); i++)
		node[i] = {.pos = (int)i, .value = seq[i]}; 

	std::sort(node.begin(), node.end(), [] (Node A, Node B) {
			return A.value < B.value;
			}); 
	
	long long res = 0;
	for (size_t i = 0; i < node.size(); i++)
	{
		Node n = node[i]; 
		modify(n.pos, -1);
		res += query(n.pos - 1); 
	}
	__debug("seq = {0}, calc(seq) = {1}\n", seq, res);
	return res;
}

bool solve()
{
	for (int c = 0; c < N; c++)
	{
		if (A[1][c] % 3 != 2)
			return false;
		int k = A[1][c] / 3; 
		if (std::abs(k - c) & 1)
			return false;
		if (!((A[0][c] == A[1][c] - 1 && A[2][c] == A[1][c] + 1) || 
			  (A[0][c] == A[1][c] + 1 || A[2][c] == A[1][c] - 1)))
			return false; 
	}

	int n0 = 0, n1 = 0;
	long long k0 = 0, k1 = 0;
	for (int c = 0; c < N; c++)
	{
		if (A[0][c] == A[1][c] + 1) 
			(c & 1) ? (n1 += 1) : (n0 += 1); 
	}
	for (int i: {0, 1})
	{
		std::vector<int> seq; 
		for (int c = i; c < N; c += 2)
			seq.push_back(A[1][c] / 6); 
		long long temp = calc(seq);
		(i == 0) ? (k0 = temp) : (k1 = temp); 
	}
	return (k0 + n1) % 2 == 0 && (n0 + k1) % 2 == 0;
}

int main()
{
	scanf("%d", &N);
	for (int i: {0, 1, 2})
		for (int j = 0; j < N; j++)
			scanf("%d", A[i] + j);

	printf("%s\n", solve() ? "Yes" : "No");
	return 0;
}


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

#define pb push_back
#define ll long long
#define inf 1e9

using namespace std;


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

	int n;
	cin>>n;
	vector<int>a(n+1, 0);
	for (int i = 1; i <= n; ++i)
	{
		cin>>a[i];
	}

	long long dp[n+1];
	memset(dp, 0, sizeof(dp));

	dp[n] = 0;
	dp[n-1] =abs(a[n] - a[n-1]);
	for(int i = n-2; i>=1; i--){
		dp[i] = min(abs(a[i+1] - a[i]) +dp[i+1], abs(a[i+2]-a[i])+dp[i+2]);
	}
	printf("%lld\n", dp[1]);
}




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

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	ll ans = 0;
	for (int i = 0; i < s.length(); i++) {
		if (s.at(i) == 'R')ans++;
		else ans--;
	}
	if (ans > 0)cout << "Yes" << endl;
	else cout << "No" << endl;

}

Measured memory_bytes: 256
using System;

namespace abc117_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] array = Console.ReadLine().Split(' ');
            double time = int.Parse(array[0]);
            double multi = int.Parse(array[1]);
            double t = time / multi;
            Console.WriteLine(t);

        }
    }
}


Measured memory_bytes: 11092
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!

#include <bits/stdc++.h>
using namespace std;

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;

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

string s;

void func() {
    cin >> s;
    sort(s.begin(), s.end());
    if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

int main() {
    fast_io; cout.precision(32);
    ll t = 1; // cin >> t;
    for (ll i = 1; i <= t; i++) {
        func();
    }
}


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

int main() {
  string S;
  cin >> S;
  int N = S.size() - 7;
  for (int i = 0; i < S.size() - N + 1; i++) {
    string s1 = S.substr(0, i);
    string s2 = S.substr(i + N);
    if (s1 + s2 == "keyence") {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
ll uni[400000];
ll root(ll u){
    if(uni[u]<0)return u;
    return uni[u]=root(uni[u]);
}

void connect(int a,int b){
    a=root(a);
    b=root(b);
    if(a==b)return;
    if(a>b){
        a^=b;
        b^=a;
        a^=b;
    }
    uni[a]+=uni[b];
    uni[b]=a;
    return;
}
ll size(ll u){
    return -uni[root(u)];
}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    memset(uni,-1,sizeof(uni));
    ll n,k,l;
    cin>>n>>k>>l;
    ll p,q,r,s;
    
    for(int i=0;i<k;i++){
        cin>>p>>q;
        p--;q--;
        connect(p,q);
    }
    for(int i=0;i<l;i++){
        cin>>r>>s;
        r--;s--;
        connect(r+200000,s+200000);
    }
    vector<pair<ll,ll> > v(n),v1(n);

    for(int i=0;i<n;i++){
        v1[i]=v[i]=make_pair(root(i),root(i+200000)-200000);
    }
    sort(be(v));
    for(int i=0;i<n;i++){
        cout << (upper_bound(be(v),v1[i])-lower_bound(be(v),v1[i]))<<" ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 10112
S = input()

s1 = S[0:int((len(S)-1)/2)]
s2 = S[int((len(S)/2))+1:len(S)+1]
if S == S[::-1] and s1 == s1[::-1] and s2 == s2[::-1]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9020
import itertools

n, m, q = map(int, input().split())
q_list = [list(map(int, input().split())) for _ in range(q)]
ans = 0

seleted = [x for x in range(1, m+1)]
A_list = list(itertools.combinations_with_replacement(seleted, n))
for A in A_list:
    tmp = 0
    for q in q_list:
        if A[q[1]-1] - A[q[0]-1] == q[2]:
            tmp += q[3]
    ans = max(ans, tmp)
print(ans)


Measured memory_bytes: 21612
#pragma comment(linker, "/STACK:102400000,102400000")
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define inf 1000000007
#define mod 1000000007
#define x first
#define y second
#define pi acos(-1.0)
#define DBG(x) cerr<<(#x)<<"="<<x<<"\n";
//#define dprintf(...) 
#define hash _hash
//#define dprintf(...) fprintf(outFile,__VA_ARGS__)
 
#define FOREACH(it,x) for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define ull unsigned long long
#define ll long long
#define N 100010
 
template <class T,class U>inline void Max(T &a,U b){if(a<b)a=b;}
template <class T,class U>inline void Min(T &a,U b){if(a>b)a=b;}
 
//FILE* outFile;
 
inline void add(int &a,int b){a+=b;while(a>=mod)a-=mod;}
 
 
int pow(int a,int b){
    int ans=1;
    while(b){
        if(b&1)ans=ans*(ll)a%mod;
        a=(ll)a*a%mod;b>>=1;
    }
    return ans;
}
 
int f[N],sz[N],a[N];
int find(int a){return a==f[a]?a:f[a]=find(f[a]);}
void merge(int a,int b){
    if(sz[a]<sz[b])swap(a,b);
    sz[a]+=sz[b];
    f[b]=a;
}
vi v[N];
int main(){
    //freopen("atlarge.in","r",stdin);
    //freopen("atlarge.out","w",stdout);
    //cout<<setprecision(9)<<fixed;
    int T,j,i,k,ca=0,K=0,n,m;
    scanf("%d%d",&n,&m);
    rep(i,0,n)scanf("%d",&a[i]);
    rep(i,0,n)f[i]=i,sz[i]=1;
    ll s=0;
    while(m--){
        scanf("%d%d",&i,&j);
        i=find(i),j=find(j);
        if(i!=j)merge(i,j);
    }
    m=0;
    rep(i,0,n)if(find(i)==i){
        if(sz[i]==1)K++,s+=a[i];
        else v[i].pb(a[i]),m++;
    }
    else{
        v[find(i)].pb(a[i]);
    }
    if(K>n-K-2*(m-1)){
        puts("Impossible");return 0;
    }
    if(m+K==1){
        puts("0");return 0;
    }
    int rem=K+2*(m-1);
    vi e;
    rep(i,0,n)if(f[i]==i&&sz[i]>1){
        sort(all(v[i]));
        s+=v[i][0];rem--;
        rep(j,1,SZ(v[i]))e.pb(v[i][j]);
    }
    if(rem){
        sort(all(e));
        rep(i,0,rem)s+=e[i];
    }
    printf("%lld\n",s);
    //cerr<<1.*clock()/CLOCKS_PER_SEC<<"ms"<<"\n";
    return 0;
}   

Measured memory_bytes: 4988
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(long long (i)=0;(i)<(n);(i)++)
#define ll long long
#define pr_qu priority_queue
#define vec(name,size,common) vector<ll> (name)((size),(common))
 
 
 
 
 
int main(){
  int n;
  cin>>n;
  int x,y;
  x= n*800;
  y= (n/15)*200;

  cout<<x-y<<endl;
}

Measured memory_bytes: 256
// Author: wlzhouzhuan
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rint register int
#define rep(i, l, r) for (rint i = l; i <= r; i++)
#define per(i, l, r) for (rint i = l; i >= r; i--)
#define mset(s, _) memset(s, _, sizeof(s))
#define pb push_back
#define pii pair <int, int>
#define mp(a, b) make_pair(a, b)
#define debug(x) cerr << #x << " = " << x << '\n';
#define pll pair <ll, ll>
#define fir first
#define sec second

inline int read() {
  int x = 0, neg = 1; char op = getchar();
  while (!isdigit(op)) { if (op == '-') neg = -1; op = getchar(); }
  while (isdigit(op)) { x = 10 * x + op - '0'; op = getchar(); }
  return neg * x;
}
inline void print(int x) {
  if (x < 0) { putchar('-'); x = -x; }
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}

int n;

int main() {
  cin >> n;
  int a1 = 0, a2 = 0, a3 = 0, a4 = 0;
  while (n--) {
    string x;
    cin >> x;
    if (x == "AC") a1++;
    if (x == "WA") a2++;
    if (x == "TLE") a3++;
    if (x == "RE") a4++;
  }
  printf("AC x %d\n", a1);
  printf("WA x %d\n", a2);
  printf("TLE x %d\n", a3);
  printf("RE x %d\n", a4);
}

Measured memory_bytes: 3720
import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

immutable inf = 10^^9 + 7;
alias Edge = Tuple!(int, "to", int, "cost");

void main() {
    int n, m, s;
    scan(n, m, s);

    auto adj = new Edge[][](n, 0);

    foreach (i ; 0 .. m) {
        int a, b, c;
        scan(a, b, c);
        adj[a] ~= Edge(b, c);
    }

    auto d = dijkstra(adj, s);

    foreach (i ; 0 .. n) {
        if (d[i] == inf) writeln("INF");
        else writeln(d[i]);
    }
}

int[] dijkstra(Edge[][] adj, int s) {
    alias Node = Tuple!(int, "num", int, "dist");

    auto n = adj.length.to!int;
    auto minhp = new BinaryHeap!(Array!Node, "a.dist > b.dist")();
    auto d = new int[](n);
    d[] = inf;
    d[s] = 0;
    minhp.insert(Node(s, 0));

    while (!minhp.empty) {
        auto v = minhp.front;
        minhp.popFront();

        if (d[v.num] < v.dist) continue;
        
        foreach (e ; adj[v.num]) {
            if (d[v.num] + e.cost < d[e.to]) {
                d[e.to] = d[v.num] + e.cost;
                minhp.insert(Node(e.to, d[e.to]));
            }
        }
    }

    return d;
}


void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 53636
#include <iostream>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <map>
using namespace std;


map<int,int> cnt;
int main(){
	int N;
	cin>> N;
	int v;
	for(int i = 0; i < N-1; i++){
		cin >> v;
		cnt[v]++;
	}
	for(int i = 1; i <= N; i++){
		cout << cnt[i] << endl;
	}
}





Measured memory_bytes: 13020
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<long long,long long> P;
const int max_n=101;
int a1[max_n],a2[max_n];
int n;
int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a1[i+1];
  }
  for(int i=0;i<n;i++){
    cin>>a2[i+1];
  }
  for(int i=1;i<=n;i++){
    a1[i]+=a1[i-1];
    a2[i]+=a2[i-1];
  }
  int res=-1;
  for(int i=1;i<=n;i++){
    res=max(res,a1[i]+a2[n]-a2[i-1]);
  }
  cout<<res<<endl;

}

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

using namespace std;

int main(){
    long long A=0,B=0,C=0,D=0,N=0,ans=0;
    string S;



    vector<long long> vec(2);

    cin>>vec[0]>>vec[1];

    sort(vec.begin(),vec.end());

    ans+=vec[1];

    vec[1]--;
    sort(vec.begin(),vec.end());

    ans+=vec[1];


    cout<<ans<<endl;

}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cmath>
using namespace std;

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


const int BIG_NUM = 1e8;
const ll INF = 1000000000000000000;

int main() {

	int n;
	cin >> n;

	vector<ll> a(n);

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

	sort(a.begin(), a.end());

	if (a[0] == 0) {
		cout << 0 << endl;
		return 0;
	}

	ll ans = 1;

	ll max = INF;


	for (int i = 0; i < n; i++) {
		if (a[i] > max) {
			cout << -1 << endl;
			return 0;
		}

		max = INF / a[i];
	
		ans *= a[i];

		if (ans > INF) {
			cout << -1 << endl;
			return 0;
		}
	}

	cout << ans << endl;

	

}

Measured memory_bytes: 4056
#include<iostream>
#include<queue>
#include<cstdio>
#include<cstring>
#include<string>
#include <stdlib.h>
#include <time.h>
#include<algorithm>
#include<set>
#include<vector>
using namespace std;
int a[2005];
int main(){
    int n,x,y;
    cin>>n>>x>>y;
    int ans=0;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    if(n==1)
        cout<<abs(a[n]-y)<<endl;
    else cout<<max(abs(y-a[n]),abs(a[n]-a[n-1]));

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define All(v) v.begin(), v.end()
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;

int P[20];

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int N, ans=0;
    cin>>N;
    for(int i=0;i<N;i++)cin>>P[i];
    for(int i=1;i<N-1;i++){
        if(P[i-1]<P[i] and P[i]<P[i+1]) ans++;
        else if(P[i+1]<P[i] and P[i]<P[i-1]) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    while(1){
        int a, b;
        scanf("%d %d", &a, &b);
        if(a == 0 && b == 0){
            break;
        }
        if(a < b){
            printf("%d %d\n", a, b);
        }else{
            printf("%d %d\n", b, a);
        }
    }
    return 0;
}


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

using namespace std;

int main() {
  int k, n;
  cin >> n >> k;
  vector<int> a(n+1, 0);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[x]++;
  }
  sort(a.begin(), a.end());
  long long sum = 0;
  for (int i = 0; i < n+1-k; i++)
    sum += a[i];
  cout << sum << endl;
  return 0;
}



Measured memory_bytes: 1024
H,W,A,B=map(int,input().split())
ans=[['0']*W for _ in range(H)]
for a in range(B):
    ans[a][:A]=['1']*A
for a in range(B,H):
    ans[a][A:]=['1']*(W-A)
for a in ans:
    print(''.join(a))

Measured memory_bytes: 16632
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <math.h>

using namespace std;

long f(long n){
	long r;
	if(n%4 == 0)
		r = n;
	else if(n%4 == 1)
		r = 1;
	else if(n%4 == 2)
		r = n+1;
	else if(n%4 == 3)
		r = 0;

	return r;
}

int main(){
	
	long A,B;
	cin >> A >> B;

	long a,b,ans;
	a = f(A-1);
	b = f(B);
	ans = a^b;

	cout << ans << "\n";


	return 0;
}

Measured memory_bytes: 256
<?php
class Scanner {
    private $arr = [];
    private $count = 0;
    private $pointer = 0;
    public function next() {
        if($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(' ', $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        $this->pointer++;
        return $result;
    }
    public function hasNext() {
        return $this->pointer < $this->count;
    }
    public function nextInt() {
        return (int)$this->next();
    }
    public function nextDouble() {
        return (double)$this->next();
    }
}

class out {
    public static function println($str = "") {
        echo $str . PHP_EOL;
    }
}

$sc = new Scanner();
$n = $sc->nextInt();
$k = $sc->nextInt();

$result = 0.0;
for ($i = 1; $i <= $n; $i++) {
    $tempResult = 1;
    $tokuten = $i;
    while($tokuten < $k) {
        $tokuten *= 2;
        $tempResult *= 2;
    }
    $result += 1. / $tempResult;
}
$result /= $n;

out::println($result);

Measured memory_bytes: 3828
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fast_input() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int imos[100005];

int main(void) {
    int N; cin >> N;
    imos[0]++;
    imos[100002]--;

    for (int i = 0; i < N; i++) {
        int a, b; cin >> a >> b;
        imos[a]++;
        imos[b+1]--;
    }
    for (int i = 1; i <= 100001; i++) {
        imos[i] += imos[i-1];
    }
    int ans = -1;
    for (int i = 0; i <= 100001; i++) {
        if (imos[i] >= i) ans = max(i, ans);
    }
    cout << ans-1 << endl;
}   



Measured memory_bytes: 3492
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M=1000000007;
int n,m,l,r,i;
ll p[600005],inv[600005],ans;
ll C(int n,int m)
{
	if(n<0|m<0||n<m)
		return 0;
	return p[n]*inv[m]%M*inv[n-m]%M;
}
ll Ans(int y)
{
	int i,j;
	ll ans=0;
	for(i=0;i*m<=y;i++)
	{
		int u=y-i*m;
		ll s=0;
		for(j=0;j<=n-m&&u+n-m-j*i>=n;j++)
			if(j%2==0)
				s=(s+C(n-m,j)*C(u+n-m-j-j*i,n))%M;
			else
				s=(s-C(n-m,j)*C(u+n-m-j-j*i,n))%M;
		ans=(ans+s)%M;
		s=0;
		for(j=0;j<=n-m&&u+n-m-j*(i-1)>=n;j++)
			if(j%2==0)
				s=(s+C(n-m,j)*C(u+n-m-j-j*(i-1),n))%M;
			else
				s=(s-C(n-m,j)*C(u+n-m-j-j*(i-1),n))%M;
		ans=(ans-s)%M;
	}
	return ans*C(n,m)%M;
}
int main()
{
	scanf("%d %d %d %d",&n,&m,&l,&r);
	p[0]=inv[0]=inv[1]=1;
	for(i=2;i<=600000;i++)
		inv[i]=inv[M%i]*(M-M/i)%M;
	for(i=1;i<=600000;i++)
	{
		p[i]=p[i-1]*i%M;
		inv[i]=inv[i-1]*inv[i]%M;
	}
	ans=Ans(r)-Ans(l-1);
	cout<<((C(r+n,n)-C(l+n-1,n)-ans)%M+M)%M;
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define reps(i, start, end) for(int i = start; i < (int)(end); ++i)

int main(){
    int n;
    pair<int, int> xy[10];
    cin >> n;
    vector<int> p(n);
    
    rep(i, n){
        cin >> xy[i].first >> xy[i].second;
        p[i] = i;
    } 
    double ans = 0;
    int cnt = 0;
    do {
        for (int i = 1; i < n; i++) {
            ans += sqrt(pow(xy[p[i]].first - xy[p[i - 1]].first, 2) + pow(xy[p[i]].second - xy[p[i - 1]].second, 2));
        }
        cnt++;
    } while(next_permutation(p.begin(), p.end()));
    cout <<setprecision(15)<< ans / cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define moder (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/


signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b && b == c)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
from collections import Counter

S = input()
MOD = 2019
div10 = 202  # modInverse(10, MOD). Note MOD is not prime so can't use FLT!


def solve1(S):
    # Naive implementation
    counts = [0 for i in range(MOD)]
    total = 0
    for d in S:
        d = int(d)
        nextCounts = [0 for i in range(MOD)]
        nextCounts[d] += 1
        for k, v in enumerate(counts):
            nextCounts[(10 * k + d) % MOD] += v
        counts = nextCounts
        total += counts[0]
    return total


def solve2(S):
    # Instead of shuffling the entire counts, update how we index into counts instead
    # The cumulative shuffle function forward is something like a * index + b for some calculable a, b
    # Then indexing into counts[t][x] is same as indexing into counts[0][(x - b) / a]

    negPowTen = 1  # our a
    prefix = 0  # our b
    counts = [0 for i in range(MOD)]
    total = 0
    for d in S:
        d = int(d)
        prefix = (10 * prefix + d) % MOD
        negPowTen = (negPowTen * div10) % MOD
        counts[((d - prefix) * negPowTen) % MOD] += 1
        total += counts[((0 - prefix) * negPowTen) % MOD]
    return total


def solve3(S):
    # Alternative solution, precompute prefixes, p[i+1] == (10 * p[i] + S[i]) % MOD
    # Then you have for S = '1817181712114'
    # p[1] = 1
    # p[2] = 18
    # p[3] = 181
    # p[4] = 1817
    # etc
    # Then want to count all i j such that:
    # (p[j] - p[i] * pow(10, j - i)) % M == 0
    # Which is equivalent to
    # (p[j] * pow(10, -j) - p[i] * pow(10, -i) % M == 0
    negPowTen = 1
    total = 0
    prefix = 0
    counts = [0 for i in range(MOD)]
    counts[0] = 1
    for d in S:
        prefix = (prefix * 10 + int(d)) % MOD
        key = (prefix * negPowTen) % MOD
        total += counts[key]
        counts[key] += 1
        negPowTen = (negPowTen * div10) % MOD

    return total


def solve4(S):
    # Compute all suffixes instead
    # S     = '1817181712114'
    # suf[1] =             4
    # suf[2] =            14
    # suf[3] =           114
    # suf[4] =          2114
    #
    # Difference of suffixes is almost correct but has extra 10s.
    # For example 2114 to 114 is the string 2 but our difference returns 2000.
    # Luckily 2 and 5 aren't divisible by 2019 so the extra 10s don't matter when counting.
    N = len(S)
    suf = 0
    powTen = 1
    counts = [0 for i in range(MOD)]
    total = 0
    counts[0] = 1
    for i in range(N):
        d = int(S[N - 1 - i])
        suf = (powTen * d + suf) % MOD
        total += counts[suf]
        counts[suf] += 1
        powTen *= 10
    return total


#assert solve1(S) == solve2(S) == solve3(S) == solve4(S)
ans = solve2(S)
print(ans)


Measured memory_bytes: 68836
using System;
using System.Linq;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            while(Console.In.Peek() != -1)
            {
                var a = Console.ReadLine().Split(' ').ToArray();
                var b = Console.ReadLine().Split(' ').ToArray();
                int c = 0;
                for(int i = 0; i < 4; i++)
                {
                    if (a[i] == b[i])
                        c++;
                }
                Console.WriteLine("{0} {1}",
                    c,
                    a.Intersect(b).Count() - c);
            }
        }
    }
}

Measured memory_bytes: 6032
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class EFrequency {
public:
    static constexpr int kStressIterations = 0;
    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        map<int, int> m, pos;
        REP(i, N) {
            int a;
            cin >> a;
            m[a]++;
            if (pos.count(a) == 0) pos[a] = i;
        }

        priority_queue<pair<int, int>> q;
        for (auto kv : m) {
            q.push({kv.first, kv.second});
        }

        vector<int> res(N);
        int cur = 0;
        int minPos = INF;
        while (!q.empty()) {
            auto kv = q.top();
            q.pop();
            cur += kv.second;
            minPos = min(minPos, pos[kv.first]);
            if (q.empty()) {
                res[minPos] += kv.first * cur;
                break;
            }
            auto nkv = q.top();
            res[minPos] += (kv.first - nkv.first) * cur;
        }
        REP(i, N) cout << res[i] << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    EFrequency solver;
    solver.solve(in, out);
    return 0;
}


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

int main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++)
  {
    cin >> A.at(i);
  }

  int cnt = 0;
  for (int i = 0; i < N; i++)
  {
    int minj = i;
    for (int j = i; j < N; j++)
    {
      if (A.at(j) < A.at(minj))
      {
        minj = j;
      }
    }
    if (i != minj)
    {
      cnt++;
      swap(A.at(i), A.at(minj));
    }
  }

  for (int i = 0; i < N; i++)
  {
    if (i)
    {
      cout << " ";
    }
    cout << A.at(i);
  }
  cout << endl;

  cout << cnt << endl;
}


Measured memory_bytes: 3088
/**
*	created: 26.09.2020 21:00:13
**/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
// #define endl '\n'
#define int long long
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define rrep(i,n) for (int i = (int)(n - 1); i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (int)(n); i++)
#define len(x) ll(x.size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
using ll = long long;
using P = pair<int,int>;
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1ll << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;
template<typename T> inline bool chmax(T &a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T> inline bool chmin(T &a, T b) {if (b < a) {a = b; return 1;} return 0;}
inline void print(P a) {cout << a.first << " " << a.second << endl;}
template<typename T> T bpow(T a, ll n) {T r(1); while(n) {if (n & 1) r *= a; a *= a; n >>= 1;} return r;}
struct faster_io {faster_io() {cin.tie(0); ios_base::sync_with_stdio(false);}} faster_io_;

signed main() {
    int k; cin >> k;
    string s = "ACL";
    rep(i,k) cout << s;
    cout << endl;
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>
#include <set>
#include <sstream>
using namespace std;
typedef long long ll;

int x[200001], y[200001];

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

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

  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (sqrt(pow(x[i], 2) + pow(y[i], 2)) <= d) {
      ans++;
    }
  }

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

Measured memory_bytes: 5184
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

vector<int> v;
int a[55];

int main(void)
{
	int n, k, i, j, p, q, ans = 0;

	scanf("%d %d" ,&n, &k);
	for (i = 0; i < n; i++)
		scanf("%d" ,&a[i]);

	for (i = 0; i <= min(n, k); i++)
		for (j = 0; i + j <= min(n, k); j++)
		{
			v.clear();
			for (p = 0; p < i; p++)
				v.push_back(a[p]);
			for (q = 0; q < j; q++)
				v.push_back(a[n - q - 1]);

			sort(v.begin(), v.end());

			int sum = 0;
			for (p = 0; p < v.size(); p++)
				sum += v[p];

			for (p = 0; p < min(k - i - j, (int)v.size()); p++)
				if (v[p] < 0)
					sum -= v[p];


			ans = max(ans, sum);
		}

	printf("%d" ,ans);
	return 0;
}

Measured memory_bytes: 256
from functools import reduce
from itertools import *

def read():
    return list(map(int, input().split()))

l= [read(), read(), read()]

a = len(list(set([l[1][i]-l[0][i] for i in range(3)])))
b = len(list(set([l[2][i]-l[1][i] for i in range(3)])))
c = len(list(set([l[i][1]-l[i][0] for i in range(3)])))
d = len(list(set([l[i][2]-l[i][1] for i in range(3)])))

if a==1 and b==1 and c==1 and d ==1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3828
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int num;
		num = scan.nextInt()*100;
		num += scan.nextInt()*10;
		num += scan.nextInt();
		System.out.println((num%4==0 ? "YES" : "NO"));
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i, x, N) for (int i = x; i < (N); i++)
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> x(N), y(N), p(N);
    vector<pair<int, int> > s(N);
    int sum = 1;
    rep(i, 1, N + 1)
    {
        sum *= i;
    }
    vector<int> a(N);
    rep(i, 0, N)
    {
        cin >> x[i] >> y[i];
        s[i] = make_pair(x[i], y[i]);
    }
    rep(i, 0, N)
    {
        a[i] = i;
    }
    double ans = 0;
    rep(i, 0, sum)
    {
        next_permutation(a.begin(), a.end());

        rep(j, 0, N - 1)
        {
            ans += sqrt(pow((s[a[j]].first - s[a[j + 1]].first), 2) + pow((s[a[j]].second - s[a[j + 1]].second), 2));
        }
    }
    printf("%.10f\n", ans / sum);
}


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

int main()
{
	int num, integer[10001];
	int i, min, MAX;
	long int sum;

	//整数の数が与えられる
	scanf("%d", &num);

	//実際の整数を読み込む
	for(i=0;i<num;i++){
		scanf("%d", &integer[i]);
	}

	//代入
	min = integer[0];
	MAX = integer[0];
	sum = integer[0];

	//計算
	for(i=1;i<num;i++){

		if(integer[i]<min){
			min = integer[i];
		}

		if(integer[i]>MAX){
			MAX = integer[i];
		}

		sum = sum + integer[i];
	}

	printf("%d %d %ld\n", min, MAX, sum);

	return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (long long i = 0; i < n; i++)
#define FOR(i, start, end) for (long long i = start; i < end; i++)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}

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

    int a, b, c;
    cin >> a >> b >> c;

    int sum = a - (b + c);
    if (sum < 0) {
        print(-sum);
    } else {
        print(0);
    }

    return 0;
}

Measured memory_bytes: 256
<?php

$sc = new Scanner();

$n = $sc->nextInt();

echo dfs('') . PHP_EOL;

function dfs($str) {
    global $n;
    if ($str > $n) {
        return 0;
    }
    $ret = 0;
    if (strpos($str, '3') !== false && strpos($str, '5') !== false && strpos($str, '7') !== false) {
        $ret = 1;
    }
    foreach(['3', '5', '7'] as $v) {
        $ret += dfs($str . $v);
    }
    return $ret;
}

class Scanner {
    private $arr = [];
    private $count = 0;
    private $pointer = 0;
    public function next() {
        if($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(' ', $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        $this->pointer++;
        return $result;
    }
    public function hasNext() {
        return $this->pointer < $this->count;
    }
    public function nextInt() {
        return (int)$this->next();
    }
    public function nextDouble() {
        return (double)$this->next();
    }
}


Measured memory_bytes: 4728
S = input()
x, y = map(int, input().split())

a = []
t = 0
for s in S:
    if s == "F":
        t += 1
    else:
        a.append(t)
        t = 0
a.append(t)

if a == []:
    if x == y == 0:
        print("Yes")
        exit(0)
    else:
        print("No")
        exit(0)

X = [a[0]]
Y = [0]

for k in range(1,len(a)):
    if k%2 == 0:
        nx = []
        for e in X:
            nx.append(e+a[k])
            nx.append(e-a[k])
        X = list(set(nx))
    else:
        ny = []
        for e in Y:
            ny.append(e+a[k])
            ny.append(e-a[k])
        Y = list(set(ny))

print("Yes" if x in X and y in Y else "No")


Measured memory_bytes: 54620
N, K = map(int, input().split())
count = 0
num_people = []
num_people_snacks = []
for i in range(1, N + 1):
    num_people.append(i)

while K > count:
    d = int(input())
    A = list(map(int, input().split()))
    for k in A:
        num_people_snacks.append(k)
    count += 1

ans = 0
for j in range(N):
    if num_people[j] not in num_people_snacks:
        ans += 1
        
print(ans)

Measured memory_bytes: 8924
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

// 0indexed-RMQ[]
class RMQ{
    public:
    ll N;
    vector<ll>mn, mx, L, R;
    RMQ(ll n, ll x = 0){
        for(N = 1; N < n + 5;)N *= 2;
        mn.resize(2 * N, x);
        mx.resize(2 * N, x);
        L.resize(2 * N, -1);
        R.resize(2 * N, -1);
        for(ll i = 0; i < N; i++)L[i + N] = R[i + N] = i;
        for(ll i = N - 1; i > 0; i--){
            L[i] = L[i * 2];
            R[i] = R[i * 2 + 1];
        }
    }
    void update(ll idx, ll x){
        idx += N;
        mn[idx] = mx[idx] = x;
        for(idx /= 2; idx > 0; idx /= 2){
            mn[idx] = min(mn[idx * 2], mn[idx * 2 + 1]);
            mx[idx] = max(mx[idx * 2], mx[idx * 2 + 1]);
        }
    }
    ll get_min(ll l, ll r, ll idx = 1){
        if(l <= L[idx] && R[idx] <= r)return mn[idx];
        if(R[idx * 2] < l)return get_min(l, r, idx * 2 + 1);
        if(r < L[idx * 2 + 1])return get_min(l, r, idx * 2);
        return min(get_min(l, r, idx * 2), get_min(l, r, idx * 2 + 1));
    }
    ll get_max(ll l, ll r, ll idx = 1){
        if(l <= L[idx] && R[idx] <= r)return mx[idx];
        if(R[idx * 2] < l)return get_max(l, r, idx * 2 + 1);
        if(r < L[idx * 2 + 1])return get_max(l, r, idx * 2);
        return max(get_max(l, r, idx * 2), get_max(l, r, idx * 2 + 1));
    }
    void show(){
        for(ll i = 1; i < 2 * N; i++){
            cout << i << " : " << L[i] << " - " << R[i] << " = " << mn[i] << ", " << mx[i] << endl;
        }
    }
};

int main(){

    ll N, Q;
    cin >> N >> Q;
    RMQ rmq(N, 2147483647);
    rep(i, Q){
        ll a, b, c;
        cin >> a >> b >> c;
        if(a == 0)rmq.update(b, c);
        else cout << rmq.get_min(b, c) << endl;
        // rmq.show();
    }
    return 0;
    // ll N;
    // cin >> N;
    // vector<ll>v(101010, 0);
    // rep(i, N){
    //     ll a, b;
    //     cin >> a >> b;
    //     if(a > b)swap(a, b);
    //     chmax(v[a], b);
    // }
    // rep(i, 101000){
    //     if(v[i] == 0)continue;

    // }


    return 0;
}


Measured memory_bytes: 10916
import java.math.BigInteger;
import java.util.Scanner;
import java.util.*;
public class Main {
	public static void main(String[] args) {
		BigInteger a,b;
		Scanner cin=new Scanner(System.in);
		a=cin.nextBigInteger();
		b=cin.nextBigInteger();
		System.out.println(a.add(b));
	}
}



Measured memory_bytes: 75248
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int N,T,A;
cin >> N >> T >> A;

int mini = INF;
int ans= 0,atai = 0;
for (int i = 0;i < N;i++) {
    int x;
    cin >> x;
    atai = abs((T*1000 - x*6)-A*1000);
if (atai < mini) {
    mini = atai;
    ans = i+1;
}
}

cout << ans << endl;

return 0;
}


Measured memory_bytes: 256
///////////////////////////////////////////////////////////////////////////////

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

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

#define pb push_back

void longin(long &a)
{
        cin >> a;
}

void longinl1(auto &v, long count)
{
        for (long i = 0; i < count ; ++i) {
                long a;
                cin >> a;
                v.push_back(a);
        }
}

void longinl2(auto &v, long count)
{
        for (long i = 0; i < count ; ++i) {
                long a, b;
                cin >> a >> b;
                v.push_back({a, b});
        }
}

void longinl3(auto &v, long count)
{
        for (long i = 0; i < count ; ++i) {
                long a, b, c;
                cin >> a >> b >> c;
                v.push_back({a, b, c});
        }
}

void longina(auto &v, long count)
{
        longinl1(v, count);
}

long min(const vector<long> v)
{
        long ret = (long)numeric_limits<double>::infinity();
        for (auto i : v) ret = min(ret, i);
        return ret;
}

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

int main()
{
        char b;
        cin >> b;

        if (b == 'A') cout << "T";
        if (b == 'T') cout << "A";
        if (b == 'C') cout << "G";
        if (b == 'G') cout << "C";

        return 0;
}

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


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<iomanip>
#include<stdio.h>
using namespace std;

int main(){

  int n, d[200000], m, t[200000];
  bool flag = false;

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

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

  sort(d, d+n);
  sort(t, t+m);

  int j=0, k=0;
  while(k<=m){
    if(d[j]<t[k]){
      j++;
    }
    if(d[j]==t[k]){
      if(k==m-1){
        flag=true;
        break;
      }
      j++;
      k++;
      if(d[j]>t[k]){
        flag=false;
        break;
      }
    }
    if(d[j]>t[k]){
      break;
    }
  }

  if(flag){
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>

using namespace std;

int a[100010];
int N;

int main()
{
	scanf("%d", &N);
	
	for (int i = 1; i <= N; i++)
	{
		long long t;
		scanf("%lld", &t);
		a[i] = t & 1;
	}
	
	int sum = 0;
	for (int i = 1; i <= N; i++)
	{
		sum += a[i];
	}
	
	if(sum & 1)
	{
		printf("NO");
	}
	else
	{
		printf("YES");
	}
	
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
 
const int N=110;
typedef long long ll;
const ll inf=1e18;
struct Edge{
	int from,to;ll cap;
	Edge(int from=0,int to=0,ll cap=0):from(from),to(to),cap(cap){}
};
vector<Edge>edges;
vector<int>G[N];
int cur[N],d[N],q[N],S,T;
void add_edge(int x,int y,ll z){
	G[x].push_back(edges.size());edges.emplace_back(x,y,z);
	G[y].push_back(edges.size());edges.emplace_back(y,x,0);
}
 
bool bfs(){
	memset(d,-1,sizeof d);d[T]=0;
	int t=-1,w=-1;q[++w]=T;
	for(int x=q[++t];t<=w;x=q[++t])
		for(int i:G[x])
			if(!~d[edges[i].to]&&edges[i^1].cap)
				d[q[++w]=edges[i].to]=d[x]+1;
	return~d[S];
}
ll dfs(int x,ll a){
	if(x==T||!a)return a;
	ll fw=0,f;
	for(int&I=cur[x],i;I<(int)G[x].size();++I)
		if(d[x]==d[edges[i=G[x][I]].to]+1&&(f=dfs(edges[i].to,min(a,edges[i].cap)))){
			edges[i].cap-=f;edges[i^1].cap+=f;fw+=f;a-=f;
			if(!a)break;
		}
	return fw;
}
 
ll maxflow(){
	ll fw=0;
	for(;bfs();fw+=dfs(S,inf))memset(cur,0,sizeof cur);
	return fw;
}
 
 
int n,a[N];
ll ans;
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;S=0;T=n+1;
	for(int i=1;i<=n;++i)cin>>a[i];
	for(int i=1;i<=n;++i)
		if(a[i]>0)add_edge(S,i,a[i]),ans+=a[i];
		else{
			add_edge(i,T,-a[i]);
			for(int j=i+i;j<=n;j+=i)add_edge(j,i,inf);
		}
	ans-=maxflow();
	cout<<ans<<'\n';
	return 0;
}

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

int main() {
    int N, H, W;
    cin >> N >> H >> W;
    int ans = 0;
    rep(y, N) rep(x, N) {
        if (y+H <= N and x+W <= N) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main()
{
    int A, B, C, X, Y;
    long long ans = 0;
    scanf("%d%d%d%d%d", &A, &B, &C, &X, &Y);
    if (A + B >= 2LL * C)
    {
        int d = min(X, Y);
        ans += 2LL * d * C, X -= d, Y -= d;
    }
    if (X > 0)
    {
        if (A > 2LL * C)
            ans += 2LL * X * C;
        else
            ans += X * A;
        X = 0;
    }
    if (Y > 0)
    {
        if (B > 2LL * C)
            ans += 2LL * Y * C;
        else
            ans += Y * B;
        Y = 0;
    }

    printf("%lld\n", ans);
    return 0;
}

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

int main()
{
    long long k, n;
    
    cin >> k >> n;

    // 先頭
    int s;
    cin >> s;
    int v1, v2;
    v1 = s;
    int max = s;
    for (int i = 1; i < n; i++) {
        cin >> v2;
        max = (v2 - v1) > max ? (v2-v1) : max;
        v1 = v2;
    }
    max = (k - v2 + s) > max ? (k - v2 + s) : max;
    cout << k - max << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();

		if (a + b - c < 0) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}

	}

}


Measured memory_bytes: 21716