akhauriyash/Code-Regression huggingface dataset:
//bismillah....
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define  boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ull unsigned long long
#define deb(x) cout<<#x<<" "<<x<<endl;
#define deb2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define deb2l(x,y,i) cout<<#x<<i<<" "<<x<<" "<<#y<<i<<" "<<y<<endl;

#define fr(i,l,r) for(ll i=l;i<r;i++)
#define mems(a,x) memset(a,x,sizeof(a))
#define mod 1000000007
#define ff first
#define ss second
#define pb(x) push_back(x)
#define vll vector<ll>
#define pbp(x,y) push_back(make_pair(x,y))
#define  mat vector<vector<ll>>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
long modPow(long a, long x, long p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}
long modInverse(long a, long p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}
long ncr(long n, long k, long p) {
// calculates C(n,k) mod p (assuming p is prime).

    long numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (int i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    long denominator = 1; // k!
    for (int i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
ll find(ll  y)  
{  
    ll res = 1;     // Initialize result  
    ll x=2;
    x = x % mod; // Update x if it is more than or  
                // equal to p  
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % mod;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % mod;  
    }  
    return res%mod;  
}  
  
void solve(){
ll n,a,b;
cin>>n>>a>>b;
ll k=(find(n)-1+mod)%mod;
cout<<(k-ncr(n,a,mod)-ncr(n,b,mod)+2*mod)%mod;

}
int main(){
    ll t=1;
   // cin>>t;
    while(t--){
        solve();
        //cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
n = gets.to_i
$s = gets.split().map(&:to_i)
q = gets.to_i
t = gets.split().map(&:to_i)

def search(target, left, right)
  return $s[left] == target || $s[right] == target if right - left == 1
  index = (left + right) / 2
  if $s[index] <= target
    search(target, index, right)
  else
    search(target, left, index)
  end
end

ans = 0

t.each do |i|
  ans += 1 if (search(i, -1, n))
end

puts ans


Measured memory_bytes: 15356
import sys
sys.setrecursionlimit(1000000000)
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())

def main():
    N = ii()
    L = lmis()
    L.sort()
    import bisect
    ans = 0
    for ia in range(N):
        a = L[ia]
        for ib in range(ia+1, N):
            b = L[ib]
            ans += max(0, bisect.bisect_left(L, a+b) - (ib+1))
    print(ans)

main()


Measured memory_bytes: 3188
#include <stdio.h>

int main(){
int a,b,c,d;
  scanf("%d %d %d %d",&a, &b, &c, &d);
  while(1){
  c-=b;
  if(c<=0){
  printf("Yes");
    return 0;
  }
  a-=d;
  if(a<=0){
  printf("No");
    return 0;
  }
  }
}



Measured memory_bytes: 1728
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

MOD = int(1e9) + 7
bi = input()
l = len(bi)

dp = makelist(l, 2)
dp[0][0] = 1
dp[0][1] = 2
for i in range(1, l):
    if bi[i] == '1':
        dp[i][0] = (dp[i-1][0] * 3 + dp[i-1][1]) % MOD
        dp[i][1] = (dp[i-1][1] * 2) % MOD
    else:
        dp[i][0] = (dp[i-1][0] * 3) % MOD
        dp[i][1] = dp[i-1][1]

ans = (dp[-1][0] + dp[-1][1]) % MOD
print(ans)


Measured memory_bytes: 53980
from collections import deque
n,m = map(int,input().split())
ab=[[] for _ in range(n+1)]
for _ in range(m):
    a,b=map(int,input().split())
    ab[a].append(b) 
    ab[b].append(a)
ans=[0]*(n+1)
ans[1]=1
que=deque()
que.append(1)
while que:
    x=que.popleft()
    for i in ab[x]:
        if ans[i]==0:
            ans[i]=x
            que.append(i)
print("Yes")
for j in range(2,n+1):
  print(ans[j])

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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
#define mem(a,b) memset(a,b,sizeof(a))
#define shutdown ios::sync_with_stdio(false)
#define MAX 10e18+1000

int x[105];
int main() {
    shutdown;
    int n,k,sum=0;
    cin>>n>>k;
    for(int i=0;i<n;i++)cin>>x[i];
    for(int i=0;i<n;i++){
        if(2*x[i]-k>0)
            sum+=(k-x[i])*2;
        else
            sum+=x[i]*2;
    }
    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

long long int comb[200001][3] = {};

long long int getcomb(int n, int k){
	if(k == 0) return 1;
	else if(n == 0) return 0;
	if(comb[n][k] > 0) return comb[n][k];
	return comb[n][k] = getcomb(n - 1, k) + getcomb(n - 1, k - 1);
}

int main()
{
	string s;
	cin >> s;
	int cnt[26] = {};
	for(int i = 0; i < s.length(); i++){
		cnt[s[i] - 'a']++;
	}
	long long int ans = getcomb(s.length(), 2) + 1;
	for(int i = 0; i < 26; i++){
		ans -= getcomb(cnt[i], 2);
	}
	cout << ans << endl;
}

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

int main(){
    while(1){
        int N,L,R;
        cin>>N>>L>>R;
        if(N == 0 && L == 0 && R == 0) break;
        vector<int> A(N);
        for(int i=0; i<N; i++) cin>>A[i];

        int cnt = 0;

        for(int x=L; x<=R; x++){
        
            bool flag = false;
            bool exist = false;

            for(int i=0; i<N; i++){
                if(x % A[i] == 0){
                    if((i+1) % 2 != 0) flag = true;
                    exist = true;
                    break;
                }
            }
 
            if(!exist && N % 2 == 0) flag = true;
            if(flag) cnt++;
        }

        cout<<cnt<<endl;
    }

    return 0;
}


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

using namespace std;


void solve() {
    int n; cin >> n;
    int sum = 0;
    for (int i = 0; i < n; i++) {
        int x; cin >> x;
        sum ^= x;
    }
    cout << (sum ==0? "Yes": "No");
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Phuong_ ios_base::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define mp make_pair

/// easy access -------------
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<int,int> pii;
///-------------------------

/// problem's variable---------------



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

int main()
{
    Phuong_;
    ll h;
    cin >> h;
    h= floor(log2(h))+1;
    ll len=1;
    for(int i=1; i<=h; ++i) len*=2;
    cout << len-1;
    return 0;
}



Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
typedef long long ll;
#include <bits/stdc++.h>

using namespace std;

int gcd(int x, int y)
{
	if (x < y)
	{
		swap(x, y);
	}
	while (0 < y)
	{
		int tmp = x;
		x = y;
		y = tmp % y;
	}
	return x;
}

int main()
{
	int x, y;
	cin >> x >> y;
	cout << gcd(x, y) << endl;
}


Measured memory_bytes: 3116
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
using namespace std;
#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 ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define print_vec(v) rep(i,v.size()){if(i!=0)cout<<" ";cout<<v[i];}cout<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<'\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pi=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
using vstr=vector<string>;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
void yes(bool c) { if (c)print("Yes"); else print("No"); };

void solve() {
    ll N, M, X; cin >> N >> M >> X;
    vll C(N);
    vector<vll> A(N);
    rep(i,N){
        cin >> C[i];
        rep(j,M){
            ll tmp;
            cin >> tmp;
            A[i].pb(tmp);
        }
    }
    bool nasi = true;
    ll ans = 10000000;
    rng(i,1,pow(2,N)){
        vll rikaido(M,0);
        ll onedan = 0;
        rep(j,N){
            if(i>>j&1){
                onedan += C[j];
                // for(ll a:A[i]) rikaido[j] += a;
                rep(k,M){
                    rikaido[k] += A[j][k];
                }
            }
        }
        // DEBUG_VEC(rikaido);
        bool ok = true;
        rep(j,M){
            if(rikaido[j] < X){
                ok = false;
                break;
            }
        }
        if(ok) {
            ans = min(ans, onedan);
            nasi = false;
        }
    }
    print(nasi?-1:ans);
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}


Measured memory_bytes: 4096
#include <iostream>
#include <string>
#include <set>
#include <cstdlib>
#include <vector>
#include <algorithm>

using namespace std;
int main() {
    int A, B;
    cin >> A >> B;
    string a = "+", b = "*";
    if(A + B == 15) cout << a << endl;
    else if(A * B == 15) cout << b << endl;
    else cout << "x" << endl;
}

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

using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
int dp[2][100];
int A[2][100];
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < 2; i++) for (int j = 0; j < N; j++) cin >> A[i][j];
	dp[0][0] = A[0][0];
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < N; j++) {
			if (i == 0) dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + A[i + 1][j]);
			if (j + 1 < N) dp[i][j + 1] = max(dp[i][j + 1], dp[i][j] + A[i][j + 1]);
		}
	}
	cout << dp[1][N - 1] << endl;
}

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

const int INF = 1001001001;

int main() {
	int H, N;
	cin >> H >> N;
	vector<int> dp(H + 1, INF);
	dp[0] = 0;
	for (int i = 0; i < N; i++) {
		int a, b;
		cin >> a >> b;
		for (int j = 0; j < H; j++) {
			int nj = min(j + a, H);
			dp[nj] = min(dp[nj], dp[j] + b);
		}
	}

	cout << dp[H] << endl;
	
}

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

int main(){
  int a, b;
  cin >> a >> b;
  cout << max(0,a-2*b) << endl;
  return 0;
}

Measured memory_bytes: 256
N,M,X = map(int,input().split())
A = list(map(int,input().split()))

ans1,ans2 = 0,0
for i in range(X,N):
    if i in A:
        ans1 += 1
for i in range(X,-1,-1):
    if i in A:
        ans2 += 1
print(min(ans1,ans2))

Measured memory_bytes: 3060
/*
* @Author: 王文宇
* @Date:   2017-11-18 22:35:29
* @Last Modified by:   王文宇
* @Last Modified time: 2017-11-18 22:51:06
*/
#include <iostream>
using namespace std;
int a[11][11];
int n,m;
int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	cin>>n>>m;
	for(int i=0;i<10;i++)
	{
		for(int j=0;j<10;j++)
		{
			cin>>a[i][j];
		}
	}
	for(int i=0;i<10;i++)
	{
		for(int j=0;j<10;j++)
		{
			for(int k=0;k<10;k++)
			{
				a[j][k]=min(a[j][k],a[j][i]+a[i][k]);
			}
		}
	}
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		for(int k=1;k<=m;k++)
		{
			int x;
			cin>>x;
			if(x!=-1&&x!=1)sum+=a[x][1];
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... U> void assign(V<T>& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); }

int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  int n; cin >> n;
  V<lint> a(n); for (int i = 0; i < n; i++) cin >> a[i];
  V<> e, o;
  for (int i = 0; i < n; i += 2) if (a[i] > 0) e.push_back(i);
  for (int i = 1; i < n; i += 2) if (a[i] > 0) o.push_back(i);
  if (e.size() == 0 and o.size() == 0) {
    auto itr = max_element(a.begin(), a.end());
    cout << *itr << '\n';
    cout << n - 1 << '\n';
    for (int i = 0; i < itr - a.begin(); i++) cout << 1 << '\n';
    for (int i = 0; i < a.end() - itr - 1; i++) cout << a.end() - itr - i << '\n';
    return 0;
  }
  lint se = accumulate(e.begin(), e.end(), 0LL, [&](lint s, int i) { return s + a[i]; });
  lint so = accumulate(o.begin(), o.end(), 0LL, [&](lint s, int i) { return s + a[i]; });
  cout << max(se, so) << '\n';
  V<> ii = se > so ? e : o;
  int m = ii.size();
  cout << ii[0] + (n - 1 - ii[m - 1]) + (ii[m - 1] - ii[0]) / 2 << '\n';
  for (int i = 0; i < ii[0]; i++) cout << 1 << '\n';
  for (int i = n - ii[0]; i > ii[m - 1] - ii[0] + 1; i--) cout << i << '\n';
  for (int i = m - 2; i >= 0; i--) {
    for (int j = (ii[i] + ii[i + 1]) / 2 - ii[0] + 1; j > ii[i] - ii[0] + 1; j--) cout << j << '\n';
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<l_l> vpl;
typedef vector<string> vs;
typedef pair<l_l,ll> lll;
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=1;i<=(n);i++)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=10100100100100100;
const ll dx[4]={1,-1,0,0};
const ll dy[4]={0,0,1,-1};
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;
}
vl node,lazy,lazyf;
ll size,q;
ll n;
void init(){
    n=1;
    while(n<size) n*=2;
    node.resize(2*n-1,INT_MAX);
    lazy.resize(2*n-1,0);
    lazyf.resize(2*n-1,false);
}
void eval(ll l,ll r,ll pos){
    if(lazyf[pos]){
        node[pos]=lazy[pos];
        if(r-l>1){
            lazy[2*pos+1]=lazy[2*pos+2]=lazy[pos];
            lazyf[2*pos+1]=lazyf[2*pos+2]=true;
        }
        lazyf[pos]=false;
    }
    return;
}
void add(ll l,ll r,ll val,ll bottom=0,ll top=-1,ll pos=0){
    if(top<0)top=n;
    eval(bottom,top,pos);
    if(r<=bottom||top<=l)return;
    if(l<=bottom&&top<=r){
        lazy[pos]=val;
        lazyf[pos]=true;
        eval(bottom,top,pos);
    }
    else{
        add(l,r,val,bottom,(bottom+top)/2,2*pos+1);
        add(l,r,val,(bottom+top)/2,top,2*pos+2);
        node[pos]=min(node[2*pos+1],node[2*pos+2]);
    }
    return;
}
ll get_min(ll l,ll r,ll bottom=0,ll top=-1,ll pos=0){
    if(top<0)top=n;
    eval(bottom,top,pos);
    if(r<=bottom||top<=l)return INT_MAX;
    if(l<=bottom&&top<=r)return node[pos];
    ll mid=(bottom+top)/2;
    ll vl=get_min(l,r,bottom,mid,2*pos+1);
    ll vr=get_min(l,r,mid,top,2*pos+2);
    return min(vl,vr);
}
int main(){
    cin>>size>>q;
    //cout<<size<<endl;
    init();
    vl ans;
    rep(i,q){
        ll query;cin>>query;
        if(query==0){
            ll s,t,x;cin>>s>>t>>x;
            add(s,t+1,x);
        }
        else{
            ll s,t;cin>>s>>t;
            cout<<get_min(s,t+1)<<endl;
            //ll xx=get_min(s,t+1);
            //ans.pb(xx);
        }
    }
    //rep(i,n)cout<<node[i+n-1]<<endl;
    //for(auto p:ans)cout<<p<<endl;
    return 0;
}


Measured memory_bytes: 8856
#include<iostream>
using namespace std;
int main(){

  int N,M,P,player[100];
  int sum_ticket;
  
  while(1){
    
    cin >>N>>M>>P;
    
    if(N==0 && M==0 && P==0)break;
    
    sum_ticket=0;
    
    for(int i=0 ; i < N ; i++){
      cin >>player[i];
      sum_ticket+=player[i];
    }

    if(player[M-1] != 0){
      cout <<(sum_ticket*(100-P))/player[M-1]<<endl;
    }else{
      cout <<"0"<<endl;
    }
    
  }
  
  
  return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<tuple>


#define MOD 1000000007
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back

typedef long long ll;

using namespace std;

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

int main(){
    int N,K;
    cin>>N>>K;
    vector<int> h(N);
    rep(i,0,N)cin>>h[i];
    int ans=0;
    rep(i,0,N){
        if(K<=h[i])ans++;
    }

    cout<<ans;

    

    return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) long long((x).size())
#define OUT(x) cout << (x) << endl
typedef long long ll;

int main() {
    int n;
    cin >> n;
    int ans[n];
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        ans[a - 1] = i + 1;
    }
    for (auto i : ans) OUT(i);
}


Measured memory_bytes: 1152
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 100010
using namespace std;

int n, m, t[N], w[N], a[N], l, r, lx, rx, sum, x, y, now, q;

int main(){
	scanf("%d%d", &m, &n);
	for(int i=1; i<=n; i++)scanf("%d", &t[i]);
	scanf("%d", &q);
	for(int i=1; i<=q; i++)scanf("%d%d", &w[i], &a[i]);
	t[0]=0; t[n+1]=w[q]+1; now=0;
	l=0; lx=0; r=m; rx=m; sum=0;
	while(now<q&&w[now+1]<t[1]){now++; printf("%d\n", max(0, a[now]-w[now]));}
	for(int i=1; i<=n; i++){
		x=t[i]-t[i-1];
		if(i&1){
			if(l+1<=r-1&&l+1+sum-x<=0)l=min(m, x-sum);
			if(l>=r)l=m; lx=max(0, lx-x);
			if(l==m)r=1; rx=max(0, rx-x);
			sum-=x;
		}else{
			if(l+1<=r-1&&r-1+sum+x>=m)r=max(0, m-x-sum);
			if(r<=l)r=0; rx=min(m, rx+x);
			if(!r)l=m; lx=min(m, lx+x);
			sum+=x;
		}
		while(now<q&&w[now+1]<t[i+1]){
			now++;
			if(a[now]<=l)y=lx;
			if(l<a[now]&&a[now]<r)y=a[now]+sum;
			if(a[now]>=r)y=rx;
			if(i&1)printf("%d\n", min(m, y+w[now]-t[i]));
			else printf("%d\n", max(0, y-(w[now]-t[i])));
		}
	}
	return 0;
}

Measured memory_bytes: 2304
n, d = map(int, input().split())
data = [ list(map(int, input().split())) for _ in range(n) ]

def f(list_1, list_2):
    len_ = len(list_1)
    sum_ = 0
    for i in range(len_):
        sum_ += ( list_1[i] - list_2[i] ) ** 2
    return sum_

count = 0
for i in range(n):
    for j in range(i):
        if i == j:
            continue
        # print("j_i", j, i)
        if f(data[i], data[j])**0.5 % 1 == 0.0:
            count += 1

print(count)


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

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

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

  int D=0;

  for(int i=0; i<n-1; i++){
    D=max(D,d[i]);
    if(D<10){
      cout << "no" << endl;
      return 0;
    }
    D-=10;
  }

  D=0;

  for(int i=n-1; i>0; i--){
    D=max(D,d[i]);
    if(D<10){
      cout << "no" << endl;
      return 0;
    }
    D-=10;
  }

  cout << "yes" <<endl;
  return 0;
}



Measured memory_bytes: 4256
#include <cstdio>
using namespace std;
int main()
{
	int a, b;
	scanf("%d%d", &a, &b);
	if(a < 1 || a > 9 || b < 1 || b > 9) printf("-1\n");
	else printf("%d\n", a * b);
	return 0;
} 

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

using namespace std;

typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef long double ld;

const int inf = 1e9;
const ll inf64 = 1e18;

int main() {

#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif

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

    int na, nb, m;

    cin >> na >> nb >> m;

    vector<int> a(na + 1), b(nb + 1);

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

    for (int i = 1; i <= nb; i++) {
        cin >> b[i];
    }

    int res = *min_element(a.begin() + 1, a.end()) + *min_element(b.begin() + 1, b.end());

    for (int i = 0; i < m; i++) {
        int x, y, c;
        cin >> x >> y >> c;
        res = min(res, a[x] + b[y] - c);
    }

    cout << res << "\n";

    return 0;
}


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

int main(void ){
    int N;
    std::cin >> N;
    std::vector <int> A(N,0);
    
    for (int i = 0; i < N; i++){
        std::cin >> A[i];
    }
    
    std::sort(A.begin(), A.end());
    
    std::cout << A[N-1] - A[0] << std::endl;
    
    return 0;
}


Measured memory_bytes: 256
import itertools

if __name__ == '__main__':
    n = int(input())
    x, y = [], []
    for i in range(n):
        a, b = map(float, input().split())
        x.append(a)
        y.append(b)

    dp = []
    for i in range(n):
        xy = []
        for j in range(n):
            if i != j:
                xy.append(((x[i]-x[j])**2+(y[i]-y[j])**2)**0.5)
            else:
                xy.append(0)
        dp.append(xy)

    ave = 0.
    for v in itertools.permutations(range(n), n):
        for i in range(n-1):
            ave += dp[v[i]][v[i+1]]

    for i in range(1, n+1):
        ave /= i
    print(ave)


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<queue>
#include <string>
#include <sstream>
#include <queue>
#include <complex>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;

#define ll int64_t
const long MOD = 1e9 + 7;


int main()
{
  int n;

  cin >> n;
  // 3,5,7
  // 7*15
  // 3*5*7 , 17 , 35 , 21, 135 ,1

  // 3,5,9  ,15 , 27 ,45,  135

  // 3,5,11  15 , 33 ,55 165
  // 3,7,9   21 , 63 ,27 189
  // 3,5,13  15 , 65 ,39 195



  long ans = 0;
  if (n<105){
    ans=0;
  }else if (n < 135) {
    ans=1;
  }else  if (n < 165) {
    ans=2;
  }else if (n < 189) {
    ans=3;
  }else if (n < 195) {
    ans=4;
  }else if (n >= 195) {
    ans=5;
  }


  cout << ans;


  return 0;
}


Measured memory_bytes: 256
n, M, Q = map(int, input().split())
a, b, c, d = [], [], [], []
for _ in [0]*Q:
    aa, bb, cc, dd = map(int, input().split())
    a += [aa-1]; b += [bb-1]; c += [cc]; d += [dd]
if n==2:
    AA = [[i, j] for i in range(1, M+1) for j in range(i, M+1)]
elif n==3:
    AA = [[i, j, k] for i in range(1, M+1) for j in range(i, M+1) for k in range(j, M+1)]
elif n==4:
    AA = [[i, j, k, l] for i in range(1, M+1) for j in range(i, M+1) for k in range(j, M+1) for l in range(k, M+1)]
elif n==5:
    AA = [[i, j, k, l, m] for i in range(1, M+1) for j in range(i, M+1) for k in range(j, M+1) for l in range(k, M+1) for m in range(l, M+1)]
elif n==6:
    AA = [[i, j, k, l, m, n] for i in range(1, M+1) for j in range(i, M+1) for k in range(j, M+1) for l in range(k, M+1) for m in range(l, M+1) for n in range(m, M+1)]
elif n==7:
    AA = [[i, j, k, l, m, n, o] for i in range(1, M+1) for j in range(i, M+1) for k in range(j, M+1) for l in range(k, M+1) for m in range(l, M+1) for n in range(m, M+1) for o in range(n, M+1)]
elif n==8:
    AA = [[i, j, k, l, m, n, o, p] for i in range(1, M+1) for j in range(i, M+1) for k in range(j, M+1) for l in range(k, M+1) for m in range(l, M+1) for n in range(m, M+1) for o in range(n, M+1) for p in range(o, M+1)]
elif n==9:
    AA = [[i, j, k, l, m, n, o, p, q] for i in range(1, M+1) for j in range(i, M+1) for k in range(j, M+1) for l in range(k, M+1) for m in range(l, M+1) for n in range(m, M+1) for o in range(n, M+1) for p in range(o, M+1) for q in range(p, M+1)]
elif n==10:
    AA = [[i, j, k, l, m, n, o, p, q, r] for i in range(1, M+1) for j in range(i, M+1) for k in range(j, M+1) for l in range(k, M+1) for m in range(l, M+1) for n in range(m, M+1) for o in range(n, M+1) for p in range(o, M+1) for q in range(p, M+1) for r in range(q, M+1)]
ans = 0
for A in AA:
    tmp = 0
    for i in range(Q):
        if A[b[i]] - A[a[i]] == c[i]:
            tmp += d[i]
    ans = max(ans, tmp)
print(ans)

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

int n;
int A[1000000];
int cnt = 0;
int m;
int G[100];

void inssort(int g) {
    for(int i=g; i<n; i++) {
        int v = A[i];
        int j = i - g;
        while(j >= 0 && A[j] > v) {
            A[j+g] = A[j];
            j -= g;
            cnt++;
        }
        A[j+g] = v;
    }
}

void shesort() {
    for(int i=m-1; i>=0; i--){
        inssort(G[i]);
    }
}

int main() {
    scanf("%d", &n);
    for(int i=0; i<n; i++) {
        scanf("%d", &A[i]);
    }

    m = 0;
    for(int h=1; h<=n; m++, h=3*h+1) {
        G[m] = h;
    }

    shesort();

    printf("%d\n", m);
    for(int i=m-1; i>=0; i--){
        printf("%d%c", G[i], i ? ' ' : '\n');
    }
    printf("%d\n", cnt);
    for(int i=0; i<n; i++){
        printf("%d\n", A[i]);
    }
}

Measured memory_bytes: 7068
#include "bits/stdc++.h"
using namespace std;
#define M 1000000007

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,c=0;
    cin>>n;
    for(int i=0;i<n;i++){
        int d;
        cin>>d;
        while(d%2==0)
        {
            c++;
            d=d/2;
        }
    }
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static final int MOD = 1000000007;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		String s = sc.next();
		String t = sc.next();
		int a = parseInt(sc.next());
		int b = parseInt(sc.next());
		String u = sc.next();
		sc.close();
		out.print(u.equals(s)?a-1:a);
		out.print(" ");
		out.println(u.equals(t)?b-1:b);
	}
}


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

const int INF = 1000000007;

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

int aans = 0,bans= 0;

int a[9],b[9];
void rec(int i,int asum,int bsum){
  if(i == 9){ // テァツオツづ、ツコツ?ヲツ敖。テ、ツサツカ
    if(asum > bsum ) aans++;
    else bans++;
  }
  rep(j,9){
    if(b[j] != INF){
      if(a[i] > b[j]){
	asum += a[i]+b[j];
	int tmp = b[j];	b[j] = INF;
	rec(i+1,asum,bsum);
	b[j] = tmp;
	asum -= a[i]+b[j];
      }
      else{
	bsum += a[i]+b[j];
	int tmp = b[j];	b[j] = INF;
	rec(i+1,asum,bsum);
	b[j] = tmp;
	bsum -= a[i]+b[j];
      }
    }
  }
}

int main(){

  int n;
  cin >> n;
    while(n){

      rep(i,9){
	cin >> a[i];
      }
      rep(i,9){
	cin >> b[i];
      }
      int x= 1;;
      rep(i,9){
	x *= (i+1);
      }


      aans = 0;bans = 0;
      rec(0,0,0);
      double answer = (double)aans/(double)x;
      printf("%.5lf %.5lf\n",answer,1-answer);
      //      cout <<  <<" "<< (double)bans/(double)x <<endl;

      n--;
    }
  return 0;
}

Measured memory_bytes: 1184
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    int N,X,Y; cin >> N >> X >> Y;

    X--; Y--; 
    vector<int> dist(N);

    for(int i = 0; i < N;i++){
        for(int j = i+1; j < N;j++){
            int T = INF;

            T = min(T,j-i);
            T = min(T,abs(X-i)+1+abs(Y-j));
            T = min(T,abs(Y-i)+1+abs(X-j));

            assert(T < N);
            dist[T]++;
        }
    }
    for(int k = 1; k < N;k++){
        cout << dist[k] << endl;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    solve<ll>(0);
    // cout << fixed << setprecision(12) << solve<ll>() << endl;
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

typedef long long int ll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)

const ll MOD = 1000000007;

using namespace std;

int main()
{
	string S;
	cin >> S;
	if (S.length() == 2)
	{
		if (S[0] == S[1])
		{
			cout << "1 2" << endl;
			return 0;
		}
	}
	FOR(i, S.length() - 1, 1)
	{
		if (S[i - 1] == S[i + 1] || S[i - 1] == S[i] || S[i] == S[i + 1])
		{
			cout << i << " " << i + 2 << endl;
			return 0;
		}
	}
	cout << "-1 -1" << endl;
	return 0;
}

Measured memory_bytes: 512
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <typeinfo>
#include <map>
#define INF 100000000
#define rep(i,a) for(int i=0;i<(a);i++)

using namespace std;
typedef long long ll;

bool is(string s){
    int len=s.size();
    string a="",b="";
    for(int i=0;i<len/2;i++)a+=s[i];
    for(int i=len-1;i>=(len+1)/2;i--)b+=s[i];
//    cout<<a<<" "<<b<<endl;
    
    if(a==b)return true;
    return false;
}


int main(){
    int sum=0;
    string f;
    while(cin>>f){
        if(is(f))sum++;
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 1200
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <tuple>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rep1(i, n) for(int i=1; i<=n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
#define countof(array) (sizeof(array) / sizeof(array[0]))
typedef long long ll;

#define MAX_N 100000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

string ab = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
string as = {"abcdefghijklmnopqrstuvwxyz"};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

ll lcm(ll x, ll y) {
  return (x*y)/gcd(x, y);
}

void yes() {
  cout << "Yes" << endl;
}

void no() {
  cout << "No" << endl;
}

void print_array(int array[], int len) {

  for(int i=0; i<len; ++i) {
    cout << array[i] << endl;
  }

}

ll absolute(ll x) {
  return (x<0)? (-1)*x : x;
}

//g++ AtCoder.cpp -o AtCoder
//AtCoder

//--------------------------
//提出するときC++に帰る
//--------------------------

ll h[100001];
ll a[100001][2];
ll c[100001];

int main() {

  ll n, m;
  cin >> n >> m;
  rep(i, n) cin >> h[i];
  rep(i, m) cin >> a[i][0] >> a[i][1];

  rep(i, m) {
    ll h1 = h[a[i][0]-1];
    ll h2 = h[a[i][1]-1];
    if(h1<h2) {
      if(c[a[i][1]-1]!=-1) c[a[i][1]-1] = 1;
      c[a[i][0]-1] = -1;
    }else if(h1>h2) {
      c[a[i][1]-1] = -1;
      if(c[a[i][0]-1]!=-1) c[a[i][0]-1] = 1;
    }else {
      c[a[i][1]-1] = -1;
      c[a[i][0]-1] = -1;
    }
  }

  ll cnt = 0;
  rep(i, n) {
    if(c[i]==0||c[i]==1) ++cnt;
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 6748
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
	int  a,b,c,temp;
	cin>>a>>b>>c;
	if(a > b || a < b )
	{
		if(a < b)
		{
				if(b > c || b <c)
				{
					if(b >c)
					{
						temp=c;
						c=b;
						b=temp;
					}
					if(a >b)
					{
						temp=b;
						b=a;
						a=temp;
					}
					
				}
			}
			else if(a > b)
			{
				temp=b;
				b=a;
				a=temp;
				if(b > c || b <c)
				{
					if(b >c)
					{
						temp=c;
						c=b;
						b=temp;
					}
					if(a >b)
					{
						temp=b;
						b=a;
						a=temp;
					}
				}
			}
		}
		cout<<a<<" "<<b<<" "<<c<<endl;
		return 0;
}




Measured memory_bytes: 3088
using System;
using System.Text;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using E = System.Linq.Enumerable;
using System.IO.Pipes;
using System.Threading;

class Program
{
    static char[] abc = "abcdefghijklmnopqrstuvwxyz".ToCharArray();
    static long mod = 1000000007;
    static void Main(string[] args)
    {
        //var N = long.Parse(Console.ReadLine());
        //var NK = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        var A = Console.ReadLine();
        var B = Console.ReadLine();
        var C = Console.ReadLine();

        var Anow = 0;
        var Bnow = 0;
        var Cnow = 0;
        var tmp = 'a';
        var ans = 'A';
        while (true)
        {
            if(tmp == 'a')
            {
                if(Anow == A.Length)
                {
                    ans = 'A';
                    break;
                }
                tmp = A[Anow];
                Anow++;
            }
            else if (tmp == 'b')
            {
                if (Bnow == B.Length)
                {
                    ans = 'B';
                    break;
                }
                tmp = B[Bnow];
                Bnow++;
            }
            else if (tmp == 'c')
            {
                if (Cnow == C.Length)
                {
                    ans = 'C';
                    break;
                }
                tmp = C[Cnow];
                Cnow++;
            }
        }
        Console.WriteLine(ans);

    }

}

Measured memory_bytes: 25864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
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 (a>b) { a=b; return 1; } return 0; }

ll beki(int a, int n){
    if(n == 0) return 1;
    ll ans = beki(a, n / 2);
    ans = ans * ans;
    if(n % 2 == 1) ans = ans * a;
    return ans;
}

string s;

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

    int N; cin >> N; int cnt = 0;
    for(int i = 1; i <= N; i++) {
        if(i % 2 != 0) cnt++;
    }
    cout << fixed << setprecision(10) <<  (double) cnt / N << endl;
    return 0;
}

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

int main(){
  string N;
  cin >> N;
  bool flag = false;
  for(int i=0; i<N.size(); i++){
    if(N[i]=='7'){flag = true; break;}
  }
  if(flag) cout << "Yes" << endl;
  if(!flag) cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3588
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int cardNum = scan.nextInt();
		long cardSum = 0;

		ArrayList<Long> list = new ArrayList<Long>();

		for(int i = 0; i < cardNum; i++) {
			long num = scan.nextLong();
			list.add(num);
			cardSum += num;
		}

		long sunukeSum = 0;
		long kumaSum = cardSum;
		long answer = 10000000000L;

		for(int i = 0; i < cardNum - 1; i++) {
			sunukeSum += list.get(i);
			kumaSum -= list.get(i);
			if(Math.abs(sunukeSum - kumaSum) < answer) {
				answer = Math.abs(sunukeSum - kumaSum);
			}
		}

		System.out.println(answer);
	}
}

Measured memory_bytes: 68136
N = int(input())
Hs = list(map(int, input().split()))
rs = []
r = 0
for i in range(1, N):
  if Hs[i] <= Hs[i-1]:
    r += 1
  else:
    rs.append(r)
    r = 0
rs.append(r)
#print(rs)
r = max(rs)
print(r)


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

const int N = 1e4 + 10;

int a[N];

int f (int x, int y, int z) {
	return x * x + y * y + z * z + x * y + y * z + z * x;
}

int main (void) {
	int n;
	cin >> n;
	for (int i = 1; i <= 100; i ++) {
		for (int j = 1; j <= 100; j ++) {
			for (int k = 1; k <= 100; k ++) {
				int val = f(i, j, k);
				if (val <= n)
					a[val] ++;
			}
		}
	}
	for (int i = 1; i <= n; i ++)
		cout << a[i] << endl;
}

Measured memory_bytes: 3580
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
using Pair = System.Tuple<int, int>;
using Edge = System.Tuple<int, int, long>;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var num = Input.num;
        var ar = Input.twodimL(num);
        var dist = Enumerable.Repeat(0, num).Select(v => new long[num]).ToArray();
        for (var i = 0; i < num; i++)
            for (var j = 0; j < num; j++)
                dist[i][j] = ar[i][j];
        var bo = new bool[num, num];
        for (var k = 0; k < num; k++)
            for (var i = 0; i < num; i++)
                for (var j = 0; j < num; j++)
                    if (dist[i][j] > dist[i][k] + dist[k][j])
                    {
                        WriteLine(-1);
                        return;
                    }
                    else if (i != k && j != k && dist[i][j] == dist[i][k] + dist[k][j])
                        bo[i, j] = true;
        var res = 0L;
        for (var i = 0; i < num; i++)
            for (var j = i + 1; j < num; j++)
                if (!bo[i, j]) res += dist[i][j]
   ;        WriteLine(res);
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static string[] gred(int h) 
        => Enumerable.Repeat(0, h).Select(v => read).ToArray();
    public static int[][] twodim(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] twodimL(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public const long Inf = (long)1e18;
    public const double eps = 1e-11;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 21720
#include<bits/stdc++.h>
typedef long long ll;
#define F(i,L,R) for (ll i = L; i < R; i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define re(x) scanf("%lld",&x)
using namespace std;

set<ll> adj[200005];
vector<ll> vis(200005, 0);

ll dfs(ll u){
	vis[u] = 1;
	ll ans = 1;
	for(auto i: adj[u]) if(vis[i] == 0) ans += dfs(i);

	return ans;
}
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n,m,u,v;
  cin>>n>>m;
  F(i,0,m) cin>>u>>v, adj[u].insert(v), adj[v].insert(u);
  ll maxi = INT_MIN;
  F(i,1,n+1) if(!vis[i]) maxi = max(dfs(i), maxi);

  cout<<maxi;
  
  return 0;
}

Measured memory_bytes: 39040
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define NIL -1

int c = 0,n,m;
int color[100000];
vector<int> li[100000];

void dfs(int r,int c) {
  stack<int> S;
  S.push(r);
  color[r] = c;
  while(!S.empty()) {
    int u = S.top();
    S.pop();
    for(int i = 0;i < li[u].size();i++) {
      if(color[li[u][i]] == NIL) {
        S.push(li[u].at(i));
        color[li[u][i]] = c;
      }
    }
  }
}

void assignColor() {
  for(int i = 0;i < n;i++) {
    if(color[i] == NIL) dfs(i,c++);
  }
}



int main() {

  
  cin >> n >> m;


  for(int i = 0;i < m;i++) {
    int a,b;
    cin >> a >> b;
    li[a].push_back(b);
    li[b].push_back(a);
  }

  for(int i = 0;i < n;i++) {
    color[i] = NIL;
  }

  int q;
  cin >> q;

  assignColor();

  for(int i = 0;i < q;i++) {
    int a,b;
    cin >> a >> b;
    cout << ((color[a] == color[b]) ? "yes" : "no") << endl;
  }


}





Measured memory_bytes: 8928
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;
using sl = signed long;
using sll = signed long long;
using ll = long long;

// -exec call dup2(open("input.txt", 0), 0)
int main()
{
	int a, b;
	std::cin >> a >> b;

	for(int i = b-a+1;i<b+a;i++){
		std::cout << i << " ";
	}
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> C(N - 1), S(N - 1), F(N - 1);
  for (int i = 0; i < N - 1; i++) {
    cin >> C.at(i) >> S.at(i) >> F.at(i);
  }
  
  for (int j = 0; j < N - 1; j++) {
    int T = 0;
    for (int i = j; i < N - 1; i++) {
      T = max(S.at(i), (T + F.at(i) - 1 ) / F.at(i) * F.at(i));
      T += C.at(i);
    }
    cout << T << endl;
  }
  cout << 0 << endl;
}

Measured memory_bytes: 256
class Modulo
  attr_accessor :num, :mod
 
  def initialize(mod, init = 0)
    @mod = mod
    @num = init % @mod
    @com_init_max = 0
  end
 
  def mod_inv(num)
    num2 = @mod
    u = 1
    v = 0
    while num2 > 0
      t = num / num2
      num, num2 = num2, num - t * num2
      u, v = v, u - t * v
    end
    u % @mod
  end
 
  def com(n, k, max = nil)
    max = n if max.nil?
    com_init(max) if @com_init_max < max
    return 0 if n < k
    return 0 if n < 0 || k < 0
    @fac[n] * (@finv[k] * @finv[n - k] % @mod) % @mod
  end
 
  def to_s
    @num.to_s
  end
 
  def to_i
    @num.to_i
  end
 
  private
 
  def com_init(max)
    @com_init_max = max
    @fac = [0] * (max + 1)
    @finv = [0] * (max + 1)
    inv = [0] * (max + 1)
    @fac[0] = 1
    @fac[1] = 1
    @finv[0] = 1
    @finv[1] = 1
    inv[1] = 1;
    2.upto(max) do |i|
      @fac[i] = (@fac[i - 1] * i) % @mod
      inv[i] = @mod - inv[@mod % i] * (@mod / i) % @mod
      @finv[i] = @finv[i - 1] * inv[i] % @mod
    end
  end
end
 
MOD = 10**9 + 7
 
N, M, K = gets.chomp.split.map(&:to_i)
 
i = ([*(1..N - 1)].map { |j| j * (N - j) }.inject(0, &:+) * M**2) % MOD
i += ([*(1..M - 1)].map { |j| j * (M - j) }.inject(0, &:+) * N**2) % MOD
modulo = Modulo.new(MOD)
com = modulo.com(N * M - 2, K - 2)
 
puts (i * com) % MOD

Measured memory_bytes: 11260
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>


#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;

const ll mod = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i = 0; i < N; i++) cin >> a[i];

  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      if(i == j) continue;
      if(abs(a[i] - a[j]) % (N - 1) == 0){
	cout << a[i] << " " << a[j] << endl;
	return 0;
      }
    }
  }
  return 0;
}



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

int gcd(int a, int b) {
  if (a < b) swap(a,b);
  if (b == 0) return a;
  return gcd(b, a % b);
}

int main() {
  int a, b;
  cin >> a >> b;
  cout << gcd(a,b) << endl;
}


Measured memory_bytes: 3104