akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long int llint;
typedef unsigned long long int ullint;

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

//#define DEBUG

#ifdef DEBUG
#define dump(i) cout << "[*] " #i ": " << i << endl
#define line cout << "[*] --------- [*]" << endl
#else
#define dump(i)
#define line
#endif

struct Edge {
	int from;
	int to;
	int cost;
	Edge(){};
	Edge(int f, int t, int c) : from(f), to(t), cost(c) {}
};

int n;
int q, k;
llint table[100001];
vector<vector<Edge>> edges;
//vector<Edge> edges[100001];
vector<Edge> xy;

void input() {
	cin >> n;
	int a, b, c;
	memset(table, -1, sizeof(table));
	edges = vector<vector<Edge>>(n);
	rep(i, n - 1) {
		cin >> a >> b >> c;
		a--;
		b--;
		edges[a].push_back(Edge(a, b, c));
		edges[b].push_back(Edge(b, a, c));
	}
	cin >> q >> k;
	k--;
	xy = vector<Edge>(q);
	rep(i, q) {
		cin >> xy[i].from >> xy[i].to;
		xy[i].from -= 1;
		xy[i].to -= 1;
	}
}

void solve() {
	queue<Edge> que;
	rep(i, edges[k].size()) {
		que.push(edges[k][i]);
	}
	table[k] = 0;
	while (!que.empty()) {
		Edge e = que.front();
		que.pop();

		table[e.to] =  table[e.from] + e.cost;
		rep(i, edges[e.to].size()) {
			if (edges[e.to][i].to != e.from) {
				que.push(edges[e.to][i]);
			}
		}
	}

	dump(table[0]);
	dump(table[1]);
	dump(table[2]);
	dump(table[3]);
	dump(table[4]);

	rep(i, q) {
		cout << table[xy[i].from] + table[xy[i].to] << endl;
	}
}

int main() {
	input();
	line;
	solve();
	return 0;
}


Measured memory_bytes: 11188
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

H, W = MAP()
ans = []

ans.append('#' * (W + 2))
for i in range(H):
    ans.append("#" + input() +  "#")
ans.append('#' * (W + 2))

for a in ans:
    print(a)


Measured memory_bytes: 27208
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
template <typename T>
bool chmax(T &u, const T z)
{
    if (u < z)
    {
        u = z;
        return true;
    }
    else
        return false;
}
template <typename T>
bool chmin(T &u, const T z)
{
    if (u > z)
    {
        u = z;
        return true;
    }
    else
        return false;
}
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
typedef pair<ll, ll> P;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

int main()
{
    int t;
    cin >> t;
    rep(i, t)
    {
        ll n, m, a, b;
        cin >> n >> m >> a >> b;
        cout << floor_sum(n, m, a, b) << endl;
    }
    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

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

int main(int argc, char const *argv[]) {
    int a, b; cin>>a>>b;
    --a,--b;
    vector<bool> x(3,true);
    x[a] = x[b] = false;
    rep(i,3) if (x[i]) {
        cout << i+1 << '\n';
        break;
    }
    return 0;
}

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

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

  if (a % 2 == 1 && b % 2 == 1) {
    cout << "Odd" << endl;
  }
  else {
    cout << "Even" << endl;
  }
}


Measured memory_bytes: 256
unittest
{
	assert( [ "2 3 1 2" ].parse.expand.solve == "3.000000000 0" );
	assert( [ "2 2 1 1" ].parse.expand.solve == "2.000000000 1" );
}



import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto whxy = input.front.split.to!( long[] );
	return tuple( whxy[ 0 ], whxy[ 1 ], whxy[ 2 ], whxy[ 3 ] );
}

auto solve( long w, long h, long x, long y )
{
	// (x,y)と長方形の中心を通る直線で分割する（つまり面積÷2が分割後の最大サイズ）
	// (x,y) == 中心 のときだけ複数分割方法がある
	return format( "%0.9f %d", w * h / 2.0L, ( x * 2 == w && y * 2 == h ) );
}


Measured memory_bytes: 256
N = input()
N = int(N)
A = list(map(int, input().split()))
# S =[1]*N
stock = 0 #株の数
money = 1000 #所持金
for i in range(N):
  if i>0:
    if A[i-1]<A[i]: #売る
      money += stock*A[i]
      stock = 0
  if i!=N-1:
    if A[i]<A[i+1]: #買う
      stock += int(money/A[i])
      money -= stock*A[i]
print(money)


Measured memory_bytes: 9196
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;

int main() {
    int N;
    cin >> N;
    string s_in;
    vector<string> s;
    for (int i=0;i<N;++i) {
        cin >> s_in;
        sort(s_in.begin(), s_in.end());
        s.push_back(s_in);
    }
    sort(s.begin(),s.end());
    ll ans = 0;
    ll cnt = 1;
    for (int i=1; i<s.size();++i) {
        if (s[i-1] == s[i]) {
            cnt++;
        } else {
            ans += (cnt * (cnt - 1)) / 2;
            cnt = 1;
        }
    }
    ans += (cnt * (cnt - 1)) / 2;
    cout << ans << endl;
    return 0;
}

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

int main(){
    string s;
    getline(cin, s);
    for(int i=0; i < s.size(); i++){
        if('a' <= s[i] && s[i] <= 'z')s[i] -= 'a' - 'A';
        else if('A' <= s[i] && s[i] <= 'Z')s[i] += 'a' - 'A';
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3180
use proconio::input;

fn f(h: i64, s: i64) -> i64 {
    (h + s - 1) / s
}

fn main() {
    input! {
        a: i64,
        b: i64,
        c: i64,
        d: i64,
    };
    let ans = if f(c, b) <= f(a, d) { "Yes" } else { "No" };
    println!("{}", ans);
}


Measured memory_bytes: 2172
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 100005
#define tc printf("Case %d: ", cs)
#define tcn printf("Case %d:\n", cs);
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
const double PI = acos(-1.0);

#define dbg1(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define dbg4(w,x, y, z) cerr << #w << " = " << w << ", " <<#x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
	return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
	os << "{";
	for (auto it = v.begin(); it != v.end(); ++it) {
		if ( it != v.begin() ) os << ", ";
		os << *it;
	}
	return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
	os << "[";
	for (auto it = v.begin(); it != v.end(); ++it) {
		if ( it != v.begin()) os << ", ";
		os << *it;
	}
	return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
	os << "[";
	for (auto it = v.begin(); it != v.end(); ++it) {
		if ( it != v.begin() ) os << ", ";
		os << it -> first << " = " << it -> second ;
	}
	return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () { cerr << endl; }

template <typename T>
void faltu( T a[], int n ) {
	for (int i = 0; i < n; ++i) cerr << a[i] << ' ';
	cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) { cerr << arg << ' '; faltu(rest...); }
// Program showing a policy-based data structure.
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less 
#include <iostream>
using namespace __gnu_pbds;
using namespace std;
// GNU link : https://goo.gl/WVDL6g
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;

/**___________________________________________________**/



int main()
{
	FASTIO
	/*
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
//*/
	int n;
	string str;
	int ans = 0;
	cin >> n >> str;
	for (int i = 0; i < 1000; i++) {
		int x = i;
		string s = "";
		while (x) {
			s += x % 10 + '0';
			x /= 10;
		}
		while ((int)s.size() < 3)s.push_back('0');
		reverse(s.begin(), s.end());
		int idx = 0;
		for (int j = 0; j < n; j++) {
			if (s[idx] == str[j]) {
				idx++;
				if (idx == 3) {
					ans++;
					break;
				}
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long;
#define REP(i,n) for(ll i=0; i<(n); i++)
#define REP2(i,x,n) for(ll i=x; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
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;
}

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


int main()
{
    ll D;
    cin >> D;
    vector<ll> scores(D);
    
    for ( ll i = 0; i < D; ++ i){
        cin >> scores[i];
    }

    ll money = 1000;
    for ( ll i = 1; i < D; ++ i ){
        ll stock = 0;
        if ( scores[i-1] < scores[i] ){
            stock = money / scores[i-1];
        }
        money += (scores[i]-scores[i-1])*stock;
    }
    cout << money << endl;



    return 0;
}

Measured memory_bytes: 3572
#include <stdio.h>

int main(void)
{
    
    char s1[10],s2[10],s3[10];
    
    scanf("%s %s %s",s1,s2,s3);
    
    s1[0]=s1[0]-' ';
    s2[0]=s2[0]-' ';
    s3[0]=s3[0]-' ';
    
    printf("%c%c%c",s1[0],s2[0],s3[0]);
    
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#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)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define pb push_back
#define sz(x) (int)(x).size()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;


int main() {
  int n;
  cin >> n;
  vi h(n+10);
  rrep(i,n){
    cin >> h[i];
  }
  int dp[n+10];
  dp[1]=0;
  dp[2]=abs(h[2]-h[1]);
  srep(i,3,n+1){
    dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]), dp[i-1]+abs(h[i]-h[i-1]));
  }
  cout << dp[n] << endl;
  return 0;
  
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main() {
    int n;
    cin>>n;
    long long int sum = 0;
    
    for(int i=1;i<=n;i++){
        if(i%3!=0 and i%5!=0){
            sum+=i;
        }
    }
    cout<<sum<<endl;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
void ans1(bool x){
  if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){
  if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){
  if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x, ll y, ll z){
  if(x) cout<<y<<endl;else cout<<z<<endl;}   


int main(){
  ll i,j;
  ll n,m; cin>>n>>m;
  //ll a,b,c,d,e,f; cin>>a>>b;
  //ll a,b,c,d,e,f; cin>>a>>b>>c;
  //ll a,b,c,d,e,f; cin>>a>>b>>c>>d;
  //string s; cin >> s;
  ll result = 0;
  ll buf = 0;
  ll buf2 = 0;
  ll buf3 = 0;
  bool judge = true;
  //cout<<<<endl;
  ll l=0,r=INF;
  for(i=0;i<m;i++){
    cin>>buf>>buf2;
    chmax(l,buf);
    chmin(r,buf2);
  }
  cout<<max(buf3,r-l+1)<<endl;

  /*
  vector<ll> a(n);
  for(i=0;i<n;i++){
    cin>>a[i];
  }
  for(i=0;i<n;i++){

  }
  */

  return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
using namespace std;
typedef long long int ll;
const int N = 1000000;
const int mod = 1000000007;
const int INF = 1 << 30;
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
#define rep(i,n) for(ll i=(ll)0;i<(ll)n;++i)
#define vin(v,n) rep(i,n)cin>>v[i];
#define ALL(x) x.begin(),x.end()
#define pp pair<ll,ll>
#define sz size()
#define fi first
#define se second0
#define pb push_back
#define prqueue priority_queue<ll,vector<ll>,greater<ll>>
string YN(bool b) { return(b ? "YES" : "NO"); }
string yn(bool b) { return(b ? "Yes" : "No"); }
int main() {
	ll a, b, h;
	cin >> a >> b >> h;
	cout << (a + b)*h / 2 << endl;
	return 0;
}

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

using namespace std;

int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, sum = 0; 
  cin >> n >> m;
  vector<int> arr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  sort(arr.rbegin(), arr.rend());
  int val = (sum + 4 * m - 1) / (4 * m);
  if (arr[m - 1] >= val) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}

Measured memory_bytes: 256
h,w=map(int,input().split())
a=[]
for _ in range(h):
    ai = input()
    if '#' in ai:
        a.append(ai)
ans=['']*len(a)
for i in range(w):
    if sum([a[j][i]=='#' for j in range(len(a))])==0:
        continue
    for j in range(len(a)):
        ans[j]+=a[j][i]
for ansi in ans:
    print(ansi)


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

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define inN(A) cin>>n;for(i=0;i<n;++i)cin>>A[i];
#define rep(i,a,b) for(i=a;i<b;++i)
#define repn for(i=0;i<n;++i)
#define ll long long
#define pii pair<int,int>
#define pb push_back
#define sd second
#define ft first
#define vi vector<int>
#define vpii vector<pair<int,int> >
#define TC //int T;cin>>T;while(T--)
#define n_max 100001
#define mod 1000000007

int main() {
    int a,b,n,p,k,i,j,m;
    TC
    {
    	cin>>n;
    	cout<<(1000-n%1000)%1000;
    }
}



Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<map>
#include<cmath>
#define fi first
#define se second
#define ll long long
using namespace std;
ll n,s,ans;
map<ll,ll> Map,D,vis;
int main()
{
	scanf("%lld",&n);
	for(ll i=1;i<=n;i++)
	{
		scanf("%lld",&s);ll nw=1,de=1;
		for(ll j=2,p=0;j*j*j<=s;j++,p=0)
		{
			while(s%j==0) s/=j,p++;p%=3;
			if(p) nw*=pow(j,p),de*=pow(j,3-p);
		}
		int kk=sqrt(s);nw*=s;
		if(kk*kk==s) de*=kk;else de*=s*s;
		D[de]=nw,D[nw]=de,Map[nw]++;
	}
	for(auto x:Map) if(!vis[x.fi]&&x.fi!=1)
					{
						ans+=max(x.se,Map[D[x.fi]]);
						vis[x.fi]=vis[D[x.fi]]=1;
					}
	cout<<ans+(Map[1]>0)<<endl;return 0;
}

Measured memory_bytes: 37760
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

// naive timeout
ll solve(int N, string S) {
    set<string> used;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            for (int k = j + 1; k < N; k++) {
                string t;
                t.push_back(S[i]);
                t.push_back(S[j]);
                t.push_back(S[k]);
                used.insert(t);
            }
        }
    }
    return used.size();
}

// My Solution. Garbage. Not Work.
ll solve2(int N, string S) {
    set<int> res;
    set<int> sm;
    map<int,int> sr;
    for (int i = 0; i < N; i++) {
        sr[S[i] - '0']++;
    }
    int L3 = sr.size() * 100;
    int L2 = sr.size() * 10;
    for (int i = 1; i < N-1; i++) {
        if (sm.size() == 100) break;
        if (res.size() == 1000) break;
        int nm = S[i] - '0';
        for (int j = i - 1; j >= 0; j--) {
            int nl = S[j] - '0';
            if (sm.count(nl * 10 + nm) == 0) {
                sm.insert(nl * 10 + nm);
            } else continue;
            for (auto [u,v] : sr) {
                int num = nl * 100 + nm * 10 + u;
                res.insert(num);
            }
        }
        int nr = S[i+1] - '0';
        sr[nr]--;
        if (sr[nr] <= 0) sr.erase(nr);
    }
    return res.size();
}

// Editorial. Easy and Fast
ll solve3(int N, string S) {
    ll cnt = 0;
    rep(i,1000) {
        char p[4];
        sprintf(p, "%03d", i);
        int j = 0;
        rep(k,3) {
            while (j < N && S[j] != p[k]) j++;
            if (j++ == N) goto FAIL;
        }
        cnt++;
FAIL: ;
    }
    return cnt;
}

int main() {
    int N; cin >> N;
    string S; cin >> S;
    //cout << solve(N, S) << endl;
    //cout << solve2(N, S) << endl;
    cout << solve3(N, S) << endl;
}

Measured memory_bytes: 3788
//daddy's back in town, back to rolling the damn hash yoooo babeeeeees//
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define x first
#define y second
#define pi pair <int, int>
#define vi vector <int>
#define L nod<<1
#define R ((nod<<1)|1)
#define int ll
const ll mod = 998244353;
int n;
bool cnt[100010];
string s;
vi v;

int32_t main(){
	ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	cin>>s;
	n=s.size();
	for(int i=1; i<=n; i++) cnt[i]=(s[i-1]=='1');
	for(int i=1; i<=n; i++){
		if(cnt[i]){
			if(cnt[n-i]==0) return cout<<-1, 0;
		}
	}
	if(cnt[1]==0 || cnt[n-1]==0) return cout<<-1, 0;
	for(int i=1; i<=n; i++) if(cnt[i]) v.pb(i);
	for(int i=1; i<=v.size(); i++) cout<<i<<" "<<i+1<<"\n";
	int cur=v.size()+2;
	for(int i=2; i<=v.size(); i++){
		for(int j=1; j<=v[i-1]-v[i-2]-1; j++){
			cout<<i<<" "<<cur<<"\n";
			cur++;
		}
	}
}

Measured memory_bytes: 2500
import sys, re, os
from collections import deque, defaultdict, Counter
from math import gcd, ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
# from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
c = 0
K = INT()
ans = 0
 
for i in range(1, K + 1):
    for j in range(1, K + 1):
        a = gcd(i, j)
        for k in range(1, K + 1):
            b = gcd(a, k)
            ans += b
print(ans)            
 

Measured memory_bytes: 69140
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define all(x) (x).begin(),(x).end()
#define dlog(x) cerr<<#x<<'='<<x<<endl
#define f first
#define s second
#define endl '\n'
#define sq(x) (x)*(x)*1ll
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,
//      tree_order_statistics_node_update> indexed_multiset;
//typedef tree<int,null_type,less<int>,rb_tree_tag,
//      tree_order_statistics_node_update> indexed_set;
typedef long long ll;
typedef pair<int,int> pii;


int main () {
        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//        freopen("test_input.txt", "r", stdin);
        int H, W; cin >> H >> W;
        int h, w; cin >> h >> w;
        cout << (H - h) * (W - w);
        return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = replicateM 3 readInts >>= putStrLn . which "YES" "NO" . all ( <= 2 ) . map length . group . sort . concat

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

int main(){
  double A,B;
  cin>>A>>B;
  double K=(A+B)/2;
  if(ceil(K)!=floor(K)){
    cout<<"IMPOSSIBLE"<<endl;
  }
  else{
    cout<<(int)K<<endl;
  }
}

Measured memory_bytes: 3788
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN=505,MAXM=100005;
int n,m;
int a[MAXM],b[MAXM],ans=0;
bool jh[MAXN][MAXN],p[MAXN];
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d",&a[i],&b[i]);
	}
	for(int i=1;i<=n;i++)
	{
		p[i]=1;
		jh[i][i]=1;
		for(int j=m;j>=1;j--)
		{
			int x=a[j],y=b[j];
			if(!jh[i][x]&&!jh[i][y])
				continue;
			if(jh[i][x]&&jh[i][y])
			{
				p[i]=0;
				break;
			}
			jh[i][x]=jh[i][y]=1;
		}
	}
	for(int i=1;i<=n-1;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			if(p[i]&&p[j])
			{
				int key=0;
				for(int k=1;k<=n;k++)
				{
					if(jh[i][k]&&jh[j][k])
					{
						key=1;
						break;
					}
				}
				if(!key)
					ans++;
			}
		}
	}
	printf("%d\n",ans);
}

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

int main() {
    int X;
    cin >> X;
    
    bool p = false;
    
    while (p == false) {
        
        bool q = false;
        for (int i=2; i*i<=X; i++) {
            if (X % i == 0) {
                q = true;
            }
        }
        if (q == false) {
            p = true;
        }
        X++;
    }
    cout << X-1 << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    long sum[600000];
    long cumsum[1001];
    int N, K;
    long ans = 0;
    long a[1000];
    cin >> N >> K;
    cumsum[0] = 0;
    for(int i = 0; i < N; i++){
        cin >> a[i];
        cumsum[i+1] = cumsum[i]+a[i];
    }
    int tmp = 0;
    for(int i = 1; i <= N; i++){
        for(int j = 0; j < i; j++){
            sum[tmp] = cumsum[i] - cumsum[j];
            tmp++;
        }
    }
    
    for(int i = 40; i >= 0; i--){
        long n = (long)1 << i;
        int cnt = 0;
        for(int j = 0; j < (N*(N+1))/2; j++){
            if(sum[j] & n) cnt++; 
        }
        if(cnt >= K){
            ans += n;
            //cout << n << ' ' << i << endl;
            for(int j = 0; j < (N*(N+1))/2; j++){
                if(!(sum[j] & n)) sum[j] = 0; 
            }
        }
    }
    cout << ans << endl;
}

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


int main()
{
	int i,n,a[20],b[20],c[20],p=0;
	
	cin>>n;
	for(i=0;i<n;i++)
		cin>>a[i];
	for(i=0;i<n;i++)
	{
		cin>>b[i];
		p+=b[i];
	}
	for(i=0;i<n-1;i++)
		cin>>c[i];
	
	//cout<<p<<endl;
	
	for(i=0;i<n-1;i++)
		if(a[i]+1==a[i+1])
			p+=c[a[i]-1];
	
	cout<<p;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();

		String[] s = new String[h];

		int l = 0;
		for (int i = 0; i < h; i++) {
			String str = sc.next();
			if (!str.matches("[.]+")) {
				s[l++] = str;
			}
		}

		boolean[] b = new boolean[w];
		outer:
		for (int i = 0; i < w; i++) {
			for (int j = 0; j < l; j++) {
				if (s[j].charAt(i) == '#') {
					continue outer;
				}
			}
			b[i] = true;
		}

		for (int i = 0; i < l; i++) {
			for (int j = 0; j < w; j++) {
				if (b[j])
					continue;
				System.out.print(s[i].charAt(j));
			}
			System.out.println();
		}

		sc.close();
	}
}


Measured memory_bytes: 26800
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll<<60;

int main(int argc, char **argv)
{
	ll N; cin >> N;
	vector<ll> B(N);
	for (ll i = 0; i < N; ++i)
		cin >> B[i];

	vector<ll> res(N);
	for (ll i = 0; i < N; ++i)
	{
		ll d{-1};
		for (ll j = 0; j < (ll)B.size(); ++j)
		{
			if (j+1 == B[j])
				d = j;
		}
		if (d == -1)
		{
			std::cout << -1 << std::endl;
			return 0;
		}

		res[i] = d+1;
		B.erase(next(B.begin(), d));
	}
	for (auto it = res.rbegin(); it != res.rend(); ++it)
		std::cout << *it << std::endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<vector>
 
using namespace std;
int MOD=1000000007;
int main(){
    int N,X,sum=0,ans=0;
    cin >> N >> X;
    int L[N];
    for(int i=0; i<N; i++){
        cin >> L[i];
        if(sum<=X)
        ans+=1;
        else
        break;
        sum+=L[i];
        }
        if(sum<=X)
        ans+=1;
        cout << ans << endl;
}



Measured memory_bytes: 256
import java.lang.reflect.Array;
import java.util.*;

public class Main {

    static int MOD = 1000000007;


    public static void main(String[] args) {

        //int ans=Integer.MAX_VALUE;
        Scanner sc = new Scanner(System.in);
        long h=sc.nextLong();
        long ans=solve(h);

        System.out.println(ans);

    }

    private static long solve(long n){
        if(n==1)return 1;
        return 1+solve(n/2)*2;
    }


}


Measured memory_bytes: 23892
#include <stdio.h>

int d[101];
int a[10001];
int main()
{
	int n, k;
	int i, j;
	int num = 0;
	int sum = 0;
	int best = 0;
	scanf("%d %d", &n, &k);
	
	for(i = 1; i <= k; i++)
	{
		scanf("%d", &d[i]);
		
		for(j = 1; j <= d[i]; j++)
		{
			num++;
			scanf("%d", &a[num]);
		}
	}
	
	for(i = 1; i <= n; i++)
	{
		for(j = 1; j <= num; j++)
		{
			if(a[j] == i)
			{
				sum++;
			}
		}
		
		if(sum == 0)
		{
			best++;
		}
		sum = 0;
	}
	
	printf("%d", best);
	
}
	

Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  int asi[n];
  for(int i=0;i<n;i++){
    cin>>asi[i];
  }
  int dp[n];
  dp[0]=0;
  for(int i=1;i<n;i++){
    dp[i]=dp[i-1]+abs(asi[i-1]-asi[i]);
    for(int j=2;j<=k&&i-j>=0;j++){
      dp[i]=min(dp[i],dp[i-j]+abs(asi[i-j]-asi[i]));
    }
  }
  cout<<dp[n-1]<<endl;
  return(0);
}


Measured memory_bytes: 1024
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define inv(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))
#define Endl endl

using namespace std;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); }
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); }
int bpm(int x, unsigned int y) {
  if (x == 0) return 0;
  if (y == 0) return 1;
  int ans   = 1;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  x %= MOD;
  for (int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) ans = ans * x % MOD;
    x = x * x % MOD;
  }
  return ans;
}
template <class T>
void cumulative_sum(T &container) {
  for (int i = 0; i < container.size() - 1; i++) container[i + 1] += container[i];
}

class DAllYourPathsAreDifferentLengths {
public:
  static void solve(std::istream &cin, std::ostream &cout) {
    int L;
    cin >> L;
    L--;
    int N = 20;
    map<int, vector<pair<int, int>>> edge;
    rep(i, N - 1) edge[0].emplace_back(i + 1, i + 2);
    int k = 0;
    rep(i, 19) {
      if (bpm(2, i + 1) - 1 > L) {
        k = i - 1;
        break;
      } else if (i == 18) {
        k = i;
      }
    }
    rep(i, k + 1) {
      edge[bpm(2, i)].emplace_back(N - (i + 1), N - i);
    }
    int now = bpm(2, k + 1) - 1;
    while (now != L) {
      FOR(i, -1, 19) {
        if (bpm(2, i + 1) - 1 <= (L - (now + 1)) and (L - (now + 1)) < bpm(2, i + 2) - 1) {
          k = i;
          break;
        }
      }
      edge[now + 1].emplace_back(1, N - (k + 1));
      now = now + 1 + bpm(2, k + 1) - 1;
    }
    int M = 0;
    for (auto &i : edge) {
      M += i.second.size();
    }
    cout << N << " " << M << endl;
    for (auto &i : edge) {
      rep(j, i.second.size()) {
        cout << i.second[j].first << " " << i.second[j].second << " " << i.first << endl;
      }
    }
  }
};


signed main() {
  DAllYourPathsAreDifferentLengths solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 3832
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using P = pair<int,int>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}




int main()
{
    int A,B,C,D;
    cin >> A >> B >> C >> D;

    string S;
    while(A > 0 || C > 0){
        C = C - B;
        if(C <= 0){
            S = "Yes";
            break;
        }
        A = A - D;
        if(A <= 0){
            S = "No";
            break;
        }
    }

    cout << S << endl;

    return 0;
}
//Ctrl+Shift+Bでコンパイルと実行を行ってデバッグすること

Measured memory_bytes: 3596
using System;
using System.Linq;
using System.Collections.Generic;
public class Hello
{

    public static void Main()
    {
        string s = Console.ReadLine();
        string ans = "yes";
        for (int i = 0; i < s.Length; i++) {
            if (s.Count(c => c == s[i]) > 1) {
                ans = "no";
                break;
            }
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13268
from sys import stdin
input = stdin.readline

infty = 100_000_00

def dijkstra(N):
    d[0] = 0
    p[0] = -1
    u = 0

    while True:
        mincost = infty
        for i in range(N):
            if color[i] != 2 and d[i] < mincost:
                mincost = d[i]
                u = i
        color[u] = 2
        if mincost == infty:
            break

        for v in range(N):
            if M[u][v] != infty and color[v] != 2 :
                if M[u][v] + d[u] < d[v]:
                    d[v] = M[u][v] + d[u]
                    p[v] = u
                    color[v] = 1

N = int(input())
M = [[infty] * N for i in range(N)]
d = [infty] * N #V-T間の重み最小辺の記録
p = [-1] * (N)
color = [0] * N

for i in range(N):
    a = list(map(int, input().split()))
    for k in range(1, len(a)//2):
        M[i][a[2*k]] = a[2*k+1]


dijkstra(N)

for i in range(N):
    print(i, str(d[i]))



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

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

int main() {
    fast_io;
    int t;
    cin>>t;

    vector<int> arr;
    while(t--) {
        int num;
        cin>>num;
        arr.push_back(num);
    }
    sort(arr.begin(), arr.end());

    int ans=0;

    cout<<endl;

    for(int i=0;i<arr.size();i++) {
        for(int j=0;j<arr.size();j++) {
            for(int x=0;x<arr.size();x++) {
                if(arr[i]<arr[j] && arr[j]<arr[x] && (arr[i]+arr[j])>arr[x]) {
                    //cout<<arr[i]<<' '<<arr[j]<<' '<<arr[x]<<endl;
                    ans++;

                }
            }
        }
    }

    cout<<ans<<endl;

}




Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

#define int long long

#if defined(__GNUC__)
#define __int32 __int32_t
#endif // __GNUC__

#define itn __int32
#define REP(i, n) for(itn (i) = 0; (i) < (n); (i)++)
#define REP2(i, x, n) for(itn (i) = (x); (i) < (n); (i)++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SORT(x) sort(ALL(x))
#define RSORT(x, T) sort(ALL(x), greater<(T)>())
#define REVERCE(x) reverce(ALL(x))

itn main() {
	ios::sync_with_stdio(false);

	string s;

	cin >> s;

	vector<int> len;

	int res = 0;
	bool lsf = (s[0] == '<');
	int cnt = 1;
	int idx = 0;

	len.push_back(1);

	REP2(i, 1, s.length()) {
		if ((s[i] == '<') == lsf) {
			len[idx]++;
		}
		else {
			if (idx) {
				if (!lsf) {
					if (len[idx - 1] > len[idx]) {
						len[idx]--;
					}
					else {
						len[idx - 1]--;
					}
				}
			}

			len.push_back(1);
			idx++;
			lsf = !lsf;
		}
	}

	if (!lsf && idx) {
		if (len[idx - 1] > len[idx]) {
			len[idx]--;
		}
		else {
			len[idx - 1]--;
		}
	}

	REP(i, len.size()) {
		res += (len[i] + 1) * len[i] / 2;
	}

	cout << res;

	return 0;
}

Measured memory_bytes: 3352
#include <bits/stdc++.h>
using namespace std;
#define MAX 200001
#define BMAX 100002
#define INFI 2100000000
int S[MAX];
int n;
int L[BMAX], R[BMAX];

long Merge(int left, int mid, int right){
    int n1 = mid-left;
    int n2 = right-mid;
    long cnt = 0;
    for(int i=0;i<n1;i++){
        L[i] = S[left+i];
    }
    for(int i=0;i<n2;i++){
        R[i] = S[mid+i];
    }
    L[n1] = INFI;
    R[n2] = INFI;
    int i=0,j=0;
    for(int k=0;k<n1+n2;++k){
        if(L[i]<=R[j]){
            S[left+k] = L[i];
            i++;
        }
        else{
            S[left+k] = R[j];
            cnt += (n1-i);
            j++;
        }
    }
    return cnt;
}


long countInversion(int left, int right){
    if(left+1<right){
        long v1,v2,v3;
        int mid = (left+right)/2;
        v1 = countInversion(left,mid);
        v2 = countInversion(mid,right);
        v3 = Merge(left,mid,right);
        return v1+v2+v3;
    }
    return 0;
}

int main(){
    scanf("%d",&n);
    for(int i=0;i<n;++i){
        scanf("%d",&S[i]);
    }
    long cnt = countInversion(0,n);
    printf("%ld\n",cnt);
    return 0;
}



Measured memory_bytes: 4756
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
#define PI 3.14159265358979323846264338327950L
typedef unsigned long long uint64;
using namespace std;
int main(){
   int a;
   cin >>a;
   int b=0;
   int c = 0;
   int d = 0;
   int e = 0;
   for(int i= 0;i<a;i++){
      string s;
      cin >> s;
      if(s=="AC"){
         b++;
      }else if(s=="WA"){
         c++;
      }else if(s=="TLE"){
         d++;
      }else{
         e++;
      }
   }
   cout << "AC" << " " << "x" << " " << b << endl;
   cout << "WA" << " " << "x" << " " << c << endl;
   cout << "TLE" << " " << "x" << " " << d << endl;
   cout << "RE" << " " << "x" << " " << e << endl;
return 0;
}

Measured memory_bytes: 3644
// Copyright (C) 2017 __debug.

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; If not, see <http://www.gnu.org/licenses/>.


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>

#define x first
#define y second
#define MP std::make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif

using std::pair;
using std::vector;
using std::string;

typedef long long LL;
typedef pair<int, int> Pii;

const int oo = 0x3f3f3f3f;

template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; }
template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, true : false; }
string procStatus()
{
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}
template<typename T> T read(T &x)
{
    int f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar())
        f = (ch == '-' ? -1 : 1);
    for (x = 0; isdigit(ch); ch = getchar())
        x = 10 * x + ch - '0';
    return x *= f;
}
template<typename T> void write(T x)
{
    if (x == 0) {
        putchar('0');
        return;
    }
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    static char s[20];
    int top = 0;
    for (; x; x /= 10)
        s[++top] = x % 10 + '0';
    while (top)
        putchar(s[top--]);
}
// EOT

const int MAXN = 2e5 + 5;

int n;
char S[MAXN];

void solve()
{
    static int cnt[31];
    for (int i = 1; i <= n; ++i) ++cnt[S[i] - 'a'];
    LL ans = 1 + (LL)n * (n - 1) / 2;
    for (int i = 0; i < 26; ++i) {
        ans -= (LL)cnt[i] * (cnt[i] - 1) / 2;
    }
    printf("%lld\n", ans);
}

int main()
{
#ifdef __DEBUG
    freopen("B.in", "r", stdin);
    freopen("B.out", "w", stdout);
#endif

    scanf("%s", S + 1);
    n = strlen(S + 1);
    solve();

    return 0;
}

// 作家不是传声筒，不是应声虫；
// 文学有宣传教学作用，但不是一切宣传都是文艺，
// 文艺应该潜移默化，塑造人的灵魂。
//   --巴金


Measured memory_bytes: 384
N = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
if sum(a) > sum(b):
    print('No')
elif a == b:
    print('Yes')
elif sum(a) == sum(b):
    print('No')
else:
    count = 0
    diff = 0
    for ai,bi in zip(a,b):
        if ai == bi:
            continue
        elif ai < bi:
            diff += (bi-ai)//2
            continue
        else:
            count += (ai-bi)
    if diff >= count:
        print('Yes')
    else:
        print('No')

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

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << (b - a == c - b ? "YES" : "NO") << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(void) {
    int K, N, l = 0,ll = 0,lm = 0, l1;

    cin >> K >> N;
    
    vector<int> A(N);

    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    
    sort(A.begin(), A.end());

    for (int i = 0; i < N - 1; i++) {
        ll = abs(A.at(i) - A.at(i + 1));
        if (lm < ll) {
            lm = ll;
        }
        l += ll;
    }

    l1 = A.at(0) + (K - A.at(N - 1));
    if (lm > l1) {
        l -= lm;
        l += l1;
    }

    cout << l << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h>
using namespace std;

void print_n(){
    
}
void print_r(){
    
}


int main(){
    while(1){
        int h, w;
        cin >> h >> w;
        if(h == 0 && w == 0) break;
        for(int i=0; i<h; i++){
            int j, len;
            if(i%2==0){
                j = 0;
                len = w;
            }else{
                j = 1;
                len = w + 1;
            }
            for(; j<len; j++){
                if(j%2==0){
                    cout << "#";
                }else{
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3076
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,k; cin>>n>>k;
long double p=0;
for(int i=1;i<=n;i++)
{   int ans=i,m=0;

    while(ans<k)
    {   m++;
        ans*=2;
        //cout<<ans<<" "<<m<<endl;

    }
  p+= pow(0.5,m)/n;

}
if(k<=n){p= p+ (n-k)/n; }
cout<<setprecision(12)<<p;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

const long long MOD = 1e9 + 7;

template<typename value_type>
class fast_combination
{
public:
	value_type mod_value;

	vector<value_type> mod_inv;
	vector<value_type> fact;
	vector<value_type> fact_inv;

public:
	fast_combination(const value_type& limit, const value_type& m)
		: mod_value(m), mod_inv(), fact(), fact_inv()
	{
		mod_inv.assign(limit + 1, 0);
		fact.assign(limit + 1, 0);
		fact_inv.assign(limit + 1, 0);

		mod_inv[1] = 1;
		fact[0] = 1;
		fact[1] = 1;
		fact_inv[0] = 1;
		fact_inv[1] = 1;

		for (value_type i = 2; i <= limit; i++)
		{
			mod_inv[i] = MOD - (MOD / i) * mod_inv[MOD % i] % MOD;
			fact[i] = fact[i - 1] * i % MOD;
			fact_inv[i] = fact_inv[i - 1] * mod_inv[i] % MOD;
		}
	}

public:
	value_type process(const value_type& n, const value_type& r)
	{
		if (n < 0 || r < 0) return 0;
		if (n < r) return 0;

		return fact[n] * (fact_inv[r] * fact_inv[n - r] % MOD) % MOD;
	}
};

//fast_combination<long long> fc(N, MOD);
//int result = fc.process(n, r);

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

	fast_combination<long long> fc(2000100, MOD);

	int r1, c1, r2, c2;
	cin >> r1 >> c1 >> r2 >> c2;

	cout << (fc.process(r2 + 1 + c2 + 1, r2 + 1) - fc.process(r2 + 1 + c1, c1) - fc.process(r1 + c2 + 1, r1) + fc.process(r1 + c1, r1) + 2 * MOD) % MOD << endl;

	return 0;
}

Measured memory_bytes: 47104
#include <bits//stdc++.h>
using namespace std;
typedef bitset<32> b8;
int main(){
	unsigned int n,m;
	cin>>n>>m;
	b8 b(n),c(m);
	cout<<(b&c)<<endl;
	cout<<(b|c)<<endl;
	cout<<(b^c)<<endl;
}


Measured memory_bytes: 3136
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>

using namespace std;
using ll=long long;
using Vec = vector<ll>;
using P = pair<ll, ll>;
using VecP = vector<P>;
#define rep(i, n, s) for (int i = s; i < (int)(n); i++)
//static const ll MOD = 1000000007;
//static const ll INF = 1000000000000000000;
//#define PI 3.14159265358979323846

int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }

int findSumDigits(int s) {
    int num = 0;
    int temp = 0;
    while (s) {
        temp = s % 10;
        num += temp;
        s = s / 10;
    }
    return num;
}

int countDivisorNum(int n) {
    int count = 0;
    for (int i = 1; i <= n; i++) {
        if (n % i == 0) {
            count++;
        }
    }
    return count;
}

int main() {
    int x, y;
    cin >> x >> y;

    int j = 0;
    int temp = 0;
    for (int i = 0; i <= x; i++) {
        j = x - i;
        temp = i * 2 + j * 4;
        if (temp == y) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> mochi(N);
  for ( int i = 0; i < N; i++) {
    cin >> mochi.at(i);
  }
  
  for (int i = 0 ; i < N -1; i++){
    bool mark = false;
    for ( int j = 0; j < N - 1 - i ; j++){
      if ( mochi.at(j) <= mochi.at(j + 1)){
        int temp;
        temp = mochi.at(j + 1);
        mochi.at(j + 1) = mochi.at(j);
        mochi.at(j) = temp;
        mark = true;
        }      
    }
    if ( mark == false) break;
  }
  
  int ans = 1;
  for ( int i = 0; i < N - 1; i++){
     if( mochi.at(i) == mochi.at(i + 1))continue;
     else ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int A,B,C;
cin>>A>>B>>C;

if(A>=B&&A>=C){
    A=A*10;
}
else if(B>=A&&B>=C){
    B=B*10;
}
else C=C*10;
cout<<A+B+C;
   return 0;}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, math.MaxInt64)
}

func readInt() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func main() {
	n := readInt()
	var arr []int
	for i := 0; i < n; i++ {
		arr = append(arr, readInt())
	}
	ans := "APPROVED"
	for i := 0; i < n; i++ {
		if arr[i]%2 == 0 {
			if arr[i]%3 != 0 && arr[i]%5 != 0 {
				ans = "DENIED"
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
#define mp make_pair
using namespace std;
using ll=long long;
using P=pair<int,int>;
const ll INF=1LL<<30;
const ll LINF=1LL<<61;
const double eps=1e-5;
const ll MOD=1e9+7;
double dp[3010][3010];
int main(){
    int n;cin>>n;
    vector<double> p(n+10);
    for(int i=1;i<=n;i++)cin>>p[i];
    dp[0][0]=1.0;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=i;j++){
            if(j){
                dp[i][j]+=dp[i-1][j-1]*p[i];
            }
            if(j<i){
                dp[i][j]+=dp[i-1][j]*(1.0-p[i]);
            }
        }
    }
    double ans=0;
    for(int j=0;j<=n;j++){
        if(j*2<n)continue;
        ans+=dp[n][j];
    }
    printf("%.10lf\n",ans);
}   


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

int main()
{
	int n;
	int x[110],y[110],h[110];
	int Cx,Cy,H;
	int field[101][101];
	
	cin >> n;
	for(int i=0;i<n;i++)
	{
		cin >> x[i] >> y[i] >> h[i];
	}
	
	int tmph;
	bool ans;
	for(int cy=0;cy<=100;cy++)
	{
		for(int cx=0;cx<=100;cx++)
		{
			ans=true;
			for(int i=0;i<n;i++)
			{
				if(h[i]==0)continue;
				tmph=h[i]+abs(cx-x[i])+abs(cy-y[i]);
				break;
			}
			for(int i=0;i<n;i++)
			{
				if(h[i]!=max(tmph-abs(cx-x[i])-abs(cy-y[i]),0))
				{
					ans=false;
					break;
				}
			}
			if(ans)
			{
				cout << cx << " " << cy << " " << tmph << endl;
			}
		}
	}
	
	return 0;
}


Measured memory_bytes: 256