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

typedef long long ll;
#define rep(i,n) for( ll (i)=0; (i)<(n); ++(i) )
#define rpi(i,n) for( int (i)=0; (i)<(n); ++(i) )
#define rpv(d) for(auto& v:d)
#if __cplusplus < 201703L
  std::ostream& co_(){ return std::cout << std::endl; }
  std::istream& cn_(){ return std::cin; }
  template<class Head, class... Args>
  std::ostream& co_( Head&& head, Args&&... args ){ std::cout << head; return co_(std::forward<Args>(args)...); }
  template<class Head, class... Args>
  std::istream& cn_( Head&& head, Args&&... args ){ std::cin >> head; return cn_(std::forward<Args>(args)...); }
#else
  template<class... Args>
  std::ostream& co_( Args... args ){ return std::cout << ... << args << std::endl; }
  template<class... Args>
  std::istream& cn_( Args... args ){ return std::cin >> ... >> args; }
#endif
#define co(...) co_(__VA_ARGS__);
#define cn(...) cn_(__VA_ARGS__);
#define all(x) (x).begin(), (x).end()
#define rgt(x,i) (x).begin(), (x).begin()+(i)

int main(){
  int n;cn(n)
  string s;cn(s)
  int ans = 0;
  rep(i,n-2){
    if (s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
      ++ans;
    }
  }
  co(ans)
}

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

int main(void) {
  int N, M, C;
  cin >> N >> M >> C;
  vector<int> B(M);
  for (int i = 0; i < M; i++) {
    cin >> B[i];
  }
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    int sum = C;
    for (int j = 0; j < M; j++) {
      int A;
      cin >> A;
      sum += A * B[j];
    }
    if (sum > 0) cnt++;
  }
  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solve();
	}
	int a,b,c;
	void solve(){
		Scanner sc=new Scanner(System.in);
		a=sc.nextInt();
		b=sc.nextInt();
		c=sc.nextInt();
		if(c>=a && c<=b)System.out.println("Yes");
		else System.out.println("No");
	}
}


Measured memory_bytes: 23764
#import<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long LL;
LL i,j,k,m,n,p,a[200040];
string s;
main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>s;
	for(j=n-1;;)
	{
		for(;i<n&&s[i]^87;)i++;
		for(;~j&&s[j]^82;)j--;
		if(i>=j)break;
		k++;
		i++;
		j--;
	}
	cout<<k;
}

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

// #undef LOCAL
#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("temp.1", "r", stdin);
  
  string s;
  cin >> s;
  char c1 = '.';
  char c2 = '.';
  int cnt[2];
  cnt[0] = 0;
  cnt[1] = 0;
  for (int i = 0; i < s.size(); i++) {
    if (c1 == s[i]) {
      cnt[0]++;
    } else if (c2 == s[i]) {
      cnt[1]++;
    } else if (c1 == '.') {
      c1 = s[i];
      cnt[0]++;
    } else if (c2 == '.') {
      c2 = s[i];
      cnt[1]++;
    }
  }
  if (cnt[0] == 2 && cnt[1] == 2) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }
#define INF           1e9
#define INFL          static_cast<lint>(INF)
#define REP(i,n)      for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)     for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPI(i,ini,n) for(lint i=(ini),i##_len=(n);i<i##_len;++i)
#define REPC(i,obj)   for(auto i:obj)
#define R_UP(a,b)     (((a)+(b)-1)/(b))
#define ALL(obj)      (obj).begin(),(obj).end()
int main()
{
	int n = in(), q = in();
	vector<queue<int>>Q(n);
	REP(i, q)
	{
		int t, x;
		switch (in())
		{
		case 0:
			t = in(), x = in();
			Q[t].push(x);
			break;
		case 1:
			t = in();
			if (Q[t].size() != 0)cout << Q[t].front() << endl;
			break;
		case 2:
			t = in();
			if (Q[t].size() != 0)Q[t].pop();
			break;
		}
	}
}


Measured memory_bytes: 4272
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>

typedef long long ll;

void print() { std::cout << std::endl; }
template<class H> void print(H head) { std::cout << head << std::endl; }
template<class H, class... T> void print(H head, T... tail){std::cout << head << " ", print(tail...); }

int main()
{
  ll A, B, K;
  std::cin >> A >> B >> K;

  ll a = std::max(A - K , 0LL);
  K -= A - a;
  ll b = std::max(B - K , 0LL);

  print(a, b);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>

std::vector<int> a[100000], b[100000];
int n, m, k, x, y, tmp, cnt, ans[100001], groupnum[100001];
bool done[100001];

void solve() {
	std::cin >> n >> m >> k;

    for (int i=0; i<m; ++i) {
		std::cin >> x >> y;
		a[x].push_back(y);
		a[y].push_back(x);
	}

	cnt = 0;
	for (int i=0; i<10001; ++i) {
		done[i] = 0;
		ans[i] = 0;
	}
	std::queue<int> que;
    for (int i=1; i<n+1; ++i) {
		std::vector<int> group;
		if (done[i] == true)
            continue;
		done[i] = true;
		group.push_back(i);
		for (auto nx : a[i]) {
			que.push(nx);
			done[nx] = true;
			group.push_back(nx);
		}
		while (!que.empty()) {
			tmp = que.front();
			que.pop();
			for (auto nx : a[tmp]) {
				if (done[nx] == true)
                    continue;
				que.push(nx);
				done[nx] = true;
				group.push_back(nx);
			}
		}
		for (auto s : group) {
			ans[s] = group.size();
			groupnum[s] = cnt;
		}
		cnt++;
	}

    for (int i=0; i<k; ++i) {
		std::cin >> x >> y;
		if (groupnum[x] == groupnum[y]) {
			b[x].push_back(y);
			b[y].push_back(x);
		}
	}

    for (int i=1; i<n+1; ++i)
		std::cout << ans[i] - a[i].size() - b[i].size() - 1 << " ";
    std::cout << std::endl;
}

int main() {
    std::ios_base::sync_with_stdio(0);
    solve();
    return 0;
}


Measured memory_bytes: 14952
#include<iostream>
#include<queue>

using namespace std;



int n;
int u[102], k[102],  v[102][102];
int timecount = 0;
int time_keep[102][2];
bool visited[102];
vector<int> vertices[100+5];
bool check(int& remain, int N);


void dfs(int cur){
	visited[cur] = true;
	// cur の訪問時刻を記録
	timecount += 1;
	int e = timecount;
	// 動作確認用表示
	//cerr << "visiting " << cur <<" " << timecount << endl;
	
	//cout << cur + 1 << " " << timecount << " ";
	
	for(auto itr = vertices[cur].begin(); itr!=vertices[cur].end(); itr++){
        if(!visited[*itr]){
            dfs(*itr);
            visited[*itr] = true;
        }
    }
     
	/*
	for(int dst = 0; dst < n; ++dst){
		//timecount1 += 1;
		if(visited[dst] == false){
			dfs(dst);
			visited[dst] = true;
		}
	}
	*/
	
	// cur の訪問終了時刻を記録
	timecount += 1;
	int f = timecount;
	time_keep[cur][0] = e;
	time_keep[cur][1] = f;
	//cout << cur + 1 << " " << e << " " << timecount << endl;
	//cout << timecount << endl;
	// 関数の終わりで親に戻る(青矢印)
}

bool check(int& remain, int N){
    for(int i = 1; i <= N; ++i){
        if(!visited[i]) {
            remain = i;
            //cout << "remain:" << remain  << endl;
            return false;
        }
    }
    return true;
}

int main(){
	cin >> n;
	/*
	for(int i = 0; i < n; ++i){
		cin >> u[i] >> k[i];
		for(int j = 0; j < k[i]; ++j){
			cin >> v[i][j];
			//cout << D[i][j] << endl;
		}
	}
	*/
	for(int i = 0; i < n; ++i){
        int index, itr;
        cin >> index >> itr;
        for(int i = 0; i < itr; ++i) {
            int buff;
            cin >> buff;
            vertices[index].push_back(buff);
        }
    }

	dfs(1);
	int remain;
	//for(int i = 0; i < n; ++i){
	//	dfs(i);
	//}
	while(!check(remain, n)){//未発見のものがないか?
        //cout << "DETECTED" << endl;
        dfs(remain);
    }

    for(int i = 1; i <= n; ++i){
        cout << i << " " << time_keep[i][0] << " " << time_keep[i][1] << endl;
    }
}


Measured memory_bytes: 3160
import itertools
import math

n = int(input())


p = list(map(int, input().split()))
d = list(map(int, input().split()))


a = list(itertools.permutations(range(1,n+1)))

b = []
for i in range(1,len(a)+1):
    b.append(i)

it = itertools.zip_longest(b, a)

for i in it:
    if p != d:
        if p == list(i[1]):
            pcount = int(i[0])

        elif d == list(i[1]):
            dcount = int(i[0])

    else:
        pcount = 0
        dcount = 0
        
print(abs(pcount-dcount))


Measured memory_bytes: 9508
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<string.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
long long int mod=1e9+7;
bool debug=false;
typedef long long ll;
int main(){
	int a;
	string s;
	cin>>a>>s;
	if(a>=3200)cout<<s<<endl;
	else cout<<"red"<<endl;
	return 0;
}

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

typedef long long ll;

int main () {
    ll k,a,b;
    cin >> k >> a >> b;
    if (a >= b || b == a+1) {
        cout << k+1 << endl;
    }
    else {
        if (1 + k <= a) {
            cout << k+1 << endl;
        }
        else {
            ll times = a-(k+1);
            times = -times;
            ll del=0;
            if (times % 2 == 1) ++del;
            cout << del + (times/2 - 1) * (b-a) + b << endl;
        }
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);

int main() {
  int N; 
  ll T;
  cin >> N >> T;
  vector<ll> t(N);
  rep(i, N) cin >> t[i];

  ll ans = 0LL;
  for (int i = 1; i < N; i++) {
    ans += min(t[i]-t[i-1], T);
  }

  ans += T;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
typedef pair<string,int>P;
typedef pair<P,int>PP;
int main(){
  int n;
  PP array[1005];
  cin>>n;
  for(int i=0;i<n;i++){
    string str;
    int point;
    cin>>str>>point;
    array[i]=PP(P(str,-point),i+1);
  }
  
  sort(array,array+n);
  for(int i=0;i<n;i++){
    cout<<array[i].second<<endl;
  }
  return(0);
}


Measured memory_bytes: 256
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
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; }
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define DEBUG(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	ll N, K; cin >> N >> K;
	ll sum = 0;
	ll mi = 0, ma = 0;
	rep2(i, 0, N+1){
		mi += i;
		ma += N-i;
		if(i >= K - 1){
			sum += ma- mi + 1;
		}
	}

	cout << sum % MOD << endl;
	return 0;
}


Measured memory_bytes: 3628
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#include <bits/stdc++.h>
using std::cerr;using std::cin;using std::cout;using std::abs;using std::min;using std::max;using std::swap;using std::map;using std::pair;using std::set;using std::string;using std::vector;
using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;
#define ff first
#define ss second
#define pb emplace_back
template<typename T>void _dbg(const char*_s,T _h){cerr<<_s<<" = "<<_h<<"\n";}
template<typename T,typename...Ts>void _dbg(const char*_s,T _h,Ts..._t){int _b=0;while(((_b+=*_s=='(')-=*_s==')')!=0||*_s!=',')cerr<<*_s++;cerr<<" = "<<_h<<",";_dbg(_s+1,_t...);}
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...) 
#endif
struct init{init(){cin.tie(0);std::iostream::sync_with_stdio(0);cout<<std::fixed<<std::setprecision(10);cerr<<std::fixed<<std::setprecision(5);}~init(){
#ifdef LOCAL
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#endif
}}init;

const int MAXN = 3e5 + 1;
int su[MAXN];

int32_t main() {
    
    int n;
    string s;
    cin >> n >> s;

    s = "#" + s;
    for (int i = n; i >= 1; --i)
        su[i] = su[i + 1] + (s[i] == 'E');

    int ans = n;
    int c = 0;
    for (int i = 1; i <= n; ++i) {
        int pot = c + su[i + 1];
        if (ans > pot)
            ans = pot;
        c += s[i] == 'W';
    }

    cout << ans << '\n';
    

    return 0;
}


Measured memory_bytes: 1900
#include<bits/stdc++.h>
#define prArr(Arr,n) for(int _=0;_<n;_++)   cout<<(Arr)[_]<<" ";
#define f first
#define s second
using namespace std;
const int INF=(int)0x3f3f3f3f;
const int MOD=(int)998244353;
const double eps=1e-9;
long long dp[200005],pref[200005];
long long getSum(int l,int r);
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,k;
    cin>>n>>k;
    vector<pair<int,int>> tr(k);
    for(int i=0;i<k;i++)
        cin>>tr[i].f>>tr[i].s;
    dp[1]=pref[1]=1;
    for(int i=2;i<=n;i++){
        for(int j=0;j<k;j++)
            dp[i]+=getSum(i-tr[j].s-1,i-tr[j].f)+MOD,dp[i]%=MOD;
        pref[i]=(pref[i-1]+dp[i])%MOD;
    }
    cout<<dp[n];
    return 0;
}

long long getSum(int l,int r)
{
    if(r<=0)
        return 0;
    if(l<=0)
        return pref[r];
    return pref[r]-pref[l];
}


Measured memory_bytes: 6776
N=int(input())
d={}
for i in range(N):
  S=input()
  if S in d:
    d[S]+=1
  else:
    d[S]=1
l = sorted(d.items(), key=lambda x:x[1], reverse=True)
n=l[0][1]
s_list=[]
for c in l:
  if c[1] != n:
    break
  s_list.append(c[0])
s_list.sort()
for s in s_list:
  print(s)
  

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

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

	if (N % 2 == 0) {
		cout << 1.0/2.0 << endl;
	}
	else {
		cout << (N + 1)/ (2.0 * N)<< endl;
	}
}

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

int main(){
  
	int A,B,K,ans,count;
  	cin >> A >> B >> K;
  	count=0;
  	ans = 0;
  	for(int i = 100; i > 0 ; i--){

      	if(A%i==0&&B%i==0){
          
        	count++;

          	if(count==K){
            
            	ans = i;
            
            }
        
        }
    
    }
  	
	cout << ans << endl;

}

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


int main() {
	int n;
	cin >> n;
	set<int> st;
	int a;
	int cnt = 1;
	for (int i = 0; i < n; i++) {
		cin >> a;
		if (a == cnt) {
			st.insert(a);
			cnt++;
		}
	}
	if (st.size() == 0) {
		cout << -1 << endl;
	}
	else {
		cout << n - (cnt - 1) << endl;
	}
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<int> l(100005,0),r(100005,0);
    for(int i=0; i<N; i++){
        int a,b;
        cin >> a >> b;
        l[a]++;
        r[b]++;
    }
    int ans = 0;
    int now = l[0]+1;
    for(int i=1; i<100005; i++){
        now -= r[i-1];
        now += l[i];
        if(i <= now){
            ans = i-1;
        }
    }
    cout << ans << enld;
    return 0;
}



Measured memory_bytes: 3620
# -*- coding: utf-8 -*-

import math

h,w = map(int,input().split())

answer = 100000

for i in range(h):
    sa = i * w
    bh = math.floor((h-i)/2)
    ch = h - i - bh
    sb1 = bh * w
    sc1 = ch * w
    bw = math.floor(w/2)
    cw = w - bw
    bch = h - i
    sb2 = bw * bch
    sc2 = cw * bch
    pat1 = [sa,sb1,sc1]
    pat2 = [sa,sb2,sc2]
    pat1.sort()
    pat2.sort()
    anss = min(pat1[-1]-pat1[0],pat2[-1]-pat2[0])
    answer = min(anss,answer)

for i in range(w):
    sa = i * h
    bh = math.floor((w-i)/2)
    ch = w - i - bh
    sb1 = bh * h
    sc1 = ch * h
    bw = math.floor(h/2)
    cw = h - bw
    bch = w - i
    sb2 = bw * bch
    sc2 = cw * bch
    pat1 = [sa,sb1,sc1]
    pat2 = [sa,sb2,sc2]
    pat1.sort()
    pat2.sort()
    anss = min(pat1[-1]-pat1[0],pat2[-1]-pat2[0])
    answer = min(anss,answer)

print(answer)

Measured memory_bytes: 3188
#include <iostream>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;

int main() {
  int n;
  cin >> n;
  int t;
  int i, j;
  for (i = 0; i < n; i++) {
    queue<int> q;
    for (j = 0; j < 10; j++) {
      cin >> t;
      q.push(t);
    }
    stack<int> a, b;
    a.push(q.front());
    q.pop();
    b.push(0);
    while (q.size()) {
      if (a.top() < q.front()) {
        a.push(q.front());
      } else if (b.top() < q.front()) {
        b.push(q.front());
      } else {
        cout << "NO" << endl;
        break;
      }
      q.pop();
      if (q.size() == 0) {
        cout << "YES" << endl;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 3116
#![allow(dead_code)]
#![allow(unused_imports)]
use ascii::{AsciiChar, AsciiStr, AsciiString};
use indexmap::IndexMap;
use itertools::*;
use libm::*;
use num::*;
use ordered_float::OrderedFloat;
use permutohedron::LexicalPermutation;
use proconio::marker::{Bytes, Chars};
use proconio::{fastout, input};
use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::mem::swap;

fn main() {
    input!(n: isize);
    let mut cnt = n / 1000;
    if n % 1000 != 0 {cnt += 1;}
    cnt *= 1000;
    println!("{}", cnt - n);
}


Measured memory_bytes: 2148
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define drp(i,x,y) for (int i=(x);i>=(y);i--)
void judge(){
	freopen("data.in","r",stdin);
	freopen("data.out","w",stdout);
}
inline char read(){
	static const int IN_LEN=1000000;
	static char buf[IN_LEN],*s,*t;
	return (s==t?t=(s=buf)+fread(buf,1,IN_LEN,stdin),(s==t?-1:*s++):*s++);
}
template<class T>
inline void read(T &x){
	static bool iosig;
	static char c;
	for (iosig=false,c=read();!isdigit(c);c=read()){
		if (c=='-') iosig=true;if (c==-1) return;
	}
	for (x=0;isdigit(c);c=read()) x=((x+(x<<2))<<1)+(c^'0');
	if (iosig) x=-x;
}
const int OUT_LEN=10000000;
char obuf[OUT_LEN],*ooh=obuf;
inline void print(char c){
	if (ooh==obuf+OUT_LEN) fwrite(obuf,1,OUT_LEN,stdout),ooh=obuf;
	*ooh++=c;
}
template<class T>
inline void print(T x){
	static int buf[30],cnt;
	if (x==0) print('0');
	else{
		if (x<0) print('-'),x=-x;
		for (cnt=0;x;x/=10) buf[++cnt]=x%10+48;
		while (cnt) print((char)buf[cnt--]);
	}
}
inline void flush(){fwrite(obuf,1,ooh-obuf,stdout);}
int n,a,b,c;
int main(){
	//judge();
	read(a),read(b),read(c);
	if (a+b>=c) puts("Yes");
	else puts("No");
	return flush(),0;
}

Measured memory_bytes: 2304
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <cmath>
#include <numeric>
#include <functional>
#include <stack>
#include <iomanip>
#include <map>
#include <cstdio>

int main() {
	long long n, m;
	
	std::cin >> n >> m;

	std::vector<long long> v(n);
	long long sum = 0;

	for (long long  i = 0; i < n; i++)
	{
		std::cin >> v[i];
		sum += v[i];
	}

	long long bottom = std::ceil(sum / (4.0 * m));

	long long count = 0;
	for (long long i = 0; i < n; i++)
	{
		if (v[i] >= bottom) {
			count++;
		}
	}

	if (count >= m) {
		std::cout << "Yes" << std::endl;
	}
	else {
		std::cout << "No" << std::endl;
	}

	return 0;
}

Measured memory_bytes: 256
N=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
cntM=0

for i in range(N):
    if a[i]<=b[i]:
        cntM+=a[i]
        b[i]-=a[i]
        a[i]=0
        
        if a[i+1]<=b[i]:
            cntM+=a[i+1]
            b[i]-=a[i+1]
            a[i+1]=0
            
        else:
            a[i+1]-=b[i]
            cntM+=b[i]
            b[i]=0 
    else:
        a[i]-=b[i]
        cntM+=b[i]
        b[i]=0
        
print(cntM)

Measured memory_bytes: 19004
N,M = map(int,input().split())
L = [list(map(int,input().split())) for _ in range(N)]


class UnionFind:
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0] * (n+1)
        self.root = [-1]*(n+1)
        self.cnt = 0

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    
    def groupsize(self):
        self.cnt = 0
        for i,x in enumerate(self.par):
            if x == i:
                self.cnt += 1
        return self.cnt

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x==y:
            return
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.root[x] += self.root[y]
            self.root[y] = self.root[x]
        else:
            self.par[y] = x
            self.root[x] += self.root[y]
            self.root[y] = self.root[x]
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)
    
    def count(self, x):
        return -self.root[self.find(x)]
    
    
uf = UnionFind(M)
for lk in L:
    l = lk[1:]
    if len(l) > 0:
        base = l[0]-1
        for i in range(1,len(l)):
            uf.union(base,l[i]-1)
            
isUsed = [False] * M
for lk in L:
    for l in lk[1:]:
        isUsed[l-1] = True


looplist = [i for i in range(M) if isUsed[i]]
tmp1 = looplist[0]
for i in looplist[1:]:
    if not(uf.same_check(tmp1,i)):
        print('NO')
        break
else:
    print('YES')
        



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

int main(){
    int N;
    cin >> N;
    int a[50];
    int m=0;
    int operate[100][2];
    int index=0;
    int max=-1000000,maxindex;
    int min=1000000,minindex;

    for(int i=0;i<N;i++){
        cin >> a[i];
        if(a[i]>max){
            max=a[i];
            maxindex=i;
        }
        if(a[i]<min){
            min=a[i];
            minindex=i;
        }
    }
    

    if(abs(max)>=abs(min)){
        //if(max*min<0){
            for(int i=0;i<N;i++){
                a[i]+=max;
                operate[index][0]=maxindex+1;
                operate[index][1]=i+1;
                index++;
                m++;
            }
        //}
        for(int i=0;i<N-1;i++){
            a[i+1]+=a[i];
            operate[index][0]=i+1;
            operate[index][1]=i+2;
            index++;
            m++;
        }
    }
    else{
        //if(max*min<0){
            for(int i=0;i<N;i++){
                a[i]+=min;
                operate[index][0]=minindex+1;
                operate[index][1]=i+1;
                index++;
                m++;
            }
        //}
        for(int i=N-1;i>0;i--){
            a[i-1]+=a[i];
            operate[index][0]=i+1;
            operate[index][1]=i;
            index++;
            m++;
        }

    }

    cout << m << "\n";
    for(int i=0;i<m;i++){
        cout << operate[i][0] << ' ' << operate[i][1] << "\n";
    }
    
    return 0;
}



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

typedef struct{
    long long x,y;
}Point;

Point f(Point p){
    Point a;
    a.x=p.x-p.y;
    a.y=p.x+p.y;
    return a;
}

long long N,ans=0LL,ma,mi;
int main(){
    cin>>N;
    vector<Point>P(N);
    for(int i=0;i<N;i++){
        cin>>P[i].x>>P[i].y;
    }

    ma=-100000000000000000LL,mi=100000000000000000LL;
    for(int i=0;i<N;i++){
        Point a=f(P[i]);
        ma=max(ma,a.x);
        mi=min(mi,a.x);
    }
    ans=ma-mi;

    ma=-100000000000000000LL,mi=100000000000000000LL;
    for(int i=0;i<N;i++){
        Point a=f(P[i]);
        ma=max(ma,a.y);
        mi=min(mi,a.y);
    }
    ans=max(ans,ma-mi);

    cout<<ans<<endl;

    return 0;
}

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

int main(void){
    string s; cin >> s;

    bool flag=true;
    for(int i=1; i<s.size(); i++){
        bool breakflag=false;
        for(int j=0; j<i; j++){
            
            if(s[j]==s[i]){
                flag=false;
                breakflag=true;
                break;
            }
            
        }
        if(breakflag) break;
    }

    if(flag) cout << "yes" << endl;
    else cout << "no" << endl;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int x = in.nextInt();
        int y = in.nextInt();
        int z = in.nextInt();
         
        if(x<y && y<z){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 17172
a = list(input())
b = list(input())
c = list(input())
d = "a"
win = "no"
while (win == "no"):
    if d == "a":
        d = a[0]
        a = a[1:]
    elif d == "b":
        d = b[0]
        b = b[1:]
    elif d == "c":
        d = c[0]
        c = c[1:]
    if ((d == "a") & (len(a) == 0)):
        win = "A"
    elif ((d == "b") & (len(b) == 0)):
        win = "B"
    elif ((d == "c") & (len(c) == 0)):
        win = "C"
print(win)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
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; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

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

  ll ans = 0;
  rep(i, n) {
    ll x, y;
    cin >> x >> y;
    if (x * x + y * y <= d * d) ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3524
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A = iss()
    print(sum(A[i] != A[-i - 1] for i in range(len(A) // 2)))


if __name__ == '__main__':
    main()


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

int main() 
{
    int n,m;
    cin >> n >> m;
    vector<vector<int> > a(n, vector<int>(m));
    vector<int> b(m);

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

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

    for (int i = 0; i < n; i++)
    {
        int c = 0;
        for (int j = 0; j < m; j++)
        {
            c += a[i][j] * b[j];
        }
        cout << c <<endl;
    }
    return 0;

}



Measured memory_bytes: 3144
A,B,C,D = map(int, input().split())
n = 0

if C%B ==0:
    if A-(C//B-1)*D > 0:
        print('Yes')
    else:
        print('No')
elif C%B != 0:
    if A-(C//B)*D > 0:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 9032
import itertools

h, w, k = map(int, input().split())
c = [input() for _ in range(h)]
ans = 0
for x, y in itertools.product(range(2 ** h), range(2 ** w)):
    cnt = 0
    for i in range(h):
        for j in range(w):
            if x >> i & 1 or  y >> j & 1: continue
            if c[i][j] == '#': cnt += 1
    if cnt == k:
        ans += 1
print(ans)

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

int main()
{
    int n;
    string s;
    cin >> n >> s;
    int x = 0;
    int max = 0;

    for(int i=0;i<n;i++){
        if(s[i] == 'I'){
            x++;
        }
        else{
            x--;
        }

        if(x > max){
            max = x;
        }
    }
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 764
import java.util.Scanner;

public class Main {
	public static Scanner sc;
	
	public static void main(String[] args) {
		//宣言
		String[] str= new String[1000];
		sc = new Scanner(System.in);
		int i=0;
		int j=0;
		int count=0;
		//入力
		String search=sc.next();
		for(;;) {
			str[i]=sc.next();
			if(str[i].equals("END_OF_TEXT")) {
				break;
			}
			//System.out.println(i+str[i]);
			i++;
			j++;
		}
		//出力
		for(i=0;i<j;i++) {
			if(str[i].equalsIgnoreCase(search)) {
				count++;
			}
		}
		System.out.println(count);
	}
}



Measured memory_bytes: 26268
N = int(input())
mx=0
maxcnt=0
for i in range(1,N+1):
    cnt=0
    while True:
        if i%2==0:
            i/=2
            cnt+=1
        else:
            if cnt>=maxcnt:
                mx=i*2**cnt
                maxcnt=cnt
            break
print(int(mx))


Measured memory_bytes: 9160
#include <iostream>

using namespace std;

int main(){
    int W,H,x,y,r;
    cin >>W;
    cin >>H;
    cin >>x;
    cin >>y;
    cin >>r;
if(y>=r && y<=H-r && r<=x && x<=W-r){
        cout<<"Yes"<<endl;
   
    
}
    else{
        cout<<"No"<<endl;
    }
}


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

int main(int argc, char *argv[])
{
    long long n, m, d;

	
	cin >> n >> m >> d;


	double result = (n - d) * 2.0 * (m - 1) / (1.0 * n * n);

	if (d == 0)
		result /= 2.0;

	printf("%.10f\n", result);
	
	return 0;
}


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;
typedef pair<int,int> P;
struct UnionFind{
  vector<int> r;
  UnionFind(int n){
    r=vector<int>(n,-1);
  }
  int root(int a){
    if(r[a]<0) return a;
    return r[a]=root(r[a]);
  }
  void unite(int a,int b){
    a=root(a);
    b=root(b);
    if(a==b) return;
    if(r[a]>r[b]) swap(a,b);
    r[a]+=r[b];
    r[b]=a; 
  }
  int size(int a){
    return -r[a];
  }
};

int main(){
  int n,m;
  cin>>n>>m;
  UnionFind uf(n);
  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--;b--;
    uf.unite(a,b);
  }
  int ans=0;
  rep(i,n) ans=max(ans,uf.size(i));
  cout<<ans<<endl;
}

Measured memory_bytes: 4008
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  string S;
  cin >> S;
  set<char> s;
  for (const auto &c : S) {
    if (s.count(c) != 0) {
      cout << "no" << endl;
      return 0;
    }
    s.insert(c);
  }
  cout << "yes" << endl;
  return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <vector>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,P> PP;
vector<PP> v;
int H,W,A[510][510];

int main(){
	cin >> H >> W;
	bool judge = false;
	int a,b,count = 0;
	for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){
			cin >> A[i][j];
			if(A[i][j]%2==1) count++;
		}
	}
	int i = 1,j = 1;
	while(i<=H){
		while(1<=j && j<=W){
			if(count<=0) break;
			if(!judge && A[i][j]%2==1){
				judge = true;
				count--;
				a = i; b = j;
			}
			else if(judge && A[i][j]%2==0){
				if(i%2==1) v.push_back({{i,j-1},{i,j}});
				else v.push_back({{i,j+1},{i,j}});
			}else if(judge && A[i][j]%2==1){
				if(i%2==1) v.push_back({{i,j-1},{i,j}});
				else v.push_back({{i,j+1},{i,j}});
				judge = false;
				count--;
			}
			i%2==1? j++:j--;
		}
		if(count<=0) break;
		i++;
		if(i%2==1) j = 1;
		else j = W;
		if(judge){
			v.push_back({{i-1,j},{i,j}});
			if(A[i][j]%2==1){
//				cout << "A" << endl;
				judge = false;
				count--;
			}
			i%2==1? j++:j--;
		}
	}
	cout << v.size() << endl;
	for(int i=0;i<v.size();i++){
		cout << v[i].first.first << " " << v[i].first.second << " " << v[i].second.first << " " << v[i].second.second << endl;
	}
}

Measured memory_bytes: 5232
s=input()
cnt1=0
cnt2=1
ans=0
for i in range(len(s)-1):
    if s[i]==">" and s[i+1]=="<":
        a=max(cnt1,cnt2)
        b=max(min(cnt1,cnt2)-1,0)
        #print(cnt1,cnt2)
        ans+=(a*(a+1)+b*(b+1))//2
        cnt1=0
        cnt2=1
    elif s[i]=="<":
        cnt1+=1
    else:
        cnt2+=1
if s[len(s)-1]=="<" and s[len(s)-2]=="<":
    cnt1+=1
#print(cnt1,cnt2)
a=max(cnt1,cnt2)
b=max(min(cnt1,cnt2)-1,0)
ans+=(a*(a+1)+b*(b+1))//2
print(ans)



Measured memory_bytes: 4116
def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = [2]
    limit = int(n**0.5)
    data = [i + 1 for i in range(2, n, 2)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]


def main():
    X = int(input())
    primes = get_sieve_of_eratosthenes(X*2)
    for p in primes:
        if X <= p:
            print(p)
            break


if __name__ == "__main__":
    main()


Measured memory_bytes: 7576
#include<stdio.h>
int p;
char s[1010],c[10];
int g[][3]={
  {0,0,1},
  {0,1,1},
  {0,1,0},
  {1,1,1}
};
int f(int v){
  int i,a,o;
  if('a'<=s[p]&&s[p]<='k'){
    for(i=0;s[p]-c[i];i++);//printf("%d %d %d\n",v,i,(v>>i)%2);
    return (v>>i)%2;
  }
  if(s[p]=='T')return 1;
  if(s[p]=='F')return 0;
  if(s[p]=='-'){
    p++;
    return 1-f(v);
  }
  if(s[p]=='('){
    p++;//printf("%s\n",s+p);
    a=f(v);
    if(s[p+1]=='*')o=0;
    if(s[p+1]=='+')o=1;
    if(s[p+1]=='-'){
      o=2;
      p++;
    }
    p+=2;//printf("%d %d %s\n",a,o,s+p);printf("\n");
    a=g[a*2+f(v)][o];
    p++;
    return a;
  }
}      
int main(){
  int i,j,r;
  /*while(scanf("%s",s),s[0]-'#'){
    p=0;
    printf("%d\n",f(0));
  }
  return 0;//*/
  while(scanf("%s",s),s[0]-'#'){
    for(i=r=0;s[i];i++){
      if('a'<=s[i]&&s[i]<='k'){
	c[r]=s[i];
	for(j=0;c[j]-s[i];j++);
	if(j==r)r++;
      }
    }
    //for(i=0;i<r;i++)printf("%c ",c[i]);printf("\n");
    //for(l=0;s[l]-'=';l++);
    //s[l++]=0;
    for(i=0;i<(1<<r);i++){
      p=0;
      j=f(i);
      p+=2;//printf("%d %d %s\n",i,j,s+p);
      if(j-f(i))break;
    }//printf("%d\n",i);
    printf("%s\n",i-(1<<r)?"NO":"YES");
  }
  return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define ll long long
vector<pii> lim[305];
ll dp[305][305][305],n,m;
const ll md=1000000007;
inline ll dfs(int x,int r,int g,int b){
	if(~dp[r][g][b])return dp[r][g][b];
	dp[r][g][b]=0;
	if(x>0)for(int i=0;i<lim[x-1].size();++i){
		int l=lim[x-1][i].first,k=lim[x-1][i].second;
		int c=(bool)(r>=l)+(bool)(g>=l)+(bool)(b>=l);
		if(c!=k)return 0;
	}
	if(x==n+1){
		dp[r][g][b]=1;
		return 1;
	}
	dp[r][g][b]=(dfs(x+1,x,g,b)+dfs(x+1,r,x,b)+dfs(x+1,r,g,x))%md;
	return dp[r][g][b];
}
int main(){
	ios_base::sync_with_stdio(false);
	cin>>n>>m;
	for(int i=1,l,r,x;i<=m;++i){
		cin>>l>>r>>x;
		lim[r].push_back({l,x});
	}
	memset(dp,-1,sizeof(dp));
	cout<<dfs(1,0,0,0)<<'\n';
}

Measured memory_bytes: 225364
/* 
 * Project: AtCoder Beginners Contest 139 B - Resistors in Parallel
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/08/28
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
#include <cstdint>
#include <vector>
#include <numeric>
#include <functional>
using namespace std;

uint16_t n;
vector<uint32_t> a;

void solve() {

    double sum = 0;

    for (auto i : a) {
        sum += 1 / (double)i;
    }

    double inv_sum = 1 / sum;

    printf("%lf\n", inv_sum);

}

int main() {

    scanf("%hd", &n);
    a.resize(n);
    for (int i=0;i<n;i++) {
        scanf("%d", &a[i]);
    }

    solve();

}

Measured memory_bytes: 3200
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <cstdlib>

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<string, int> si;
const int INF = 1 << 29;
const int MAX = 100000;
#define mp make_pair
#define fi first
#define se second

int main() {
    ios::sync_with_stdio(false);
    string s;
    vector<int> ans;
    cin >> s;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == '1') ans.push_back(1);
        else if (s[i] == '0') ans.push_back(0);
        else if (s[i] == 'B' && ans.size() > 0) ans.pop_back();
    }
    for (int i = 0; i < ans.size(); i++) {
        cout << ans[i];
    }
    cout << endl;
    return 0;
}

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

int main(){
  // input
  ll n, m;
  cin >> n >> m;

  // distribute each prefecture
  vector<vector<ll>> r(100010);
  vector<ll> p(m), y(m);
  rep(i, 0, m){
    cin >> p[i] >> y[i];
    r[p[i]].push_back(y[i]);
  }
  
  // in prefecture, x set
  map<ll, bool> seen;
  vector<map<ll, ll>> o(100010); // o[prefecture][year] 
  for(auto t : p){
    if(seen[t]) continue;
    seen[t] = true;
    sort(r[t].begin(), r[t].end());
    rep(i, 0, r[t].size()){
        o[t][r[t][i]] = i + 1;  
    }
  }

  rep(i, 0, m){
    string s = to_string(p[i]);
    // front id
    ll lm = s.size();
    rep(j, 0, 6-lm){
        s = "0" + s;
    }
    // back id
    ll ty = o[p[i]][y[i]];
    string ss = to_string(ty);
    lm = ss.size();
    rep(j, 0, 6-lm){
        ss = "0" + ss;
    }
    cout << s + ss << endl;
  }

  return 0;
}


Measured memory_bytes: 27328
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
#include <set>
using namespace std;

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

#define INF INT_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)

int main(){
	long N,A,B;

	cin>>N>>A>>B;

	long k = B - A + 1;
	
	if(k < 1 ){
		cout<<0<<endl;
		return 0;
	}
	if(N == 1 && k > 1){
		cout<<0<<endl;
		return 0;
	}
	if(k == 1){
		cout<<1<<endl;
		return 0;
	}
	
	long answer = (B - A) * (N - 2) + 1;
	cout<<answer<<endl;
	return 0;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.buffer.readline
import numpy as np
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N = int(readline())
    A = np.array(readline().split(), np.int64)
    total = A.sum()
    X = A[:-1].cumsum()
    Y = total - X
    ans = np.abs(X-Y).min()
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 23504
## C - Same Integers
X = list(map(int, input().split()))
cnt = 0
if sum([x%2 for x in X]) == 2:
    for i in range(3):
        X[i] = X[i] + 1 if X[i]%2 == 1 else X[i]
        cnt = 1
elif sum([x%2 for x in X]) == 1:
    for i in range(3):
        X[i] = X[i] + 1 if X[i]%2 == 0 else X[i]
        cnt = 1
Max = max(X)
X.remove(Max)
print( (2 * Max - sum(X) )//2 + cnt )

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << 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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



vector<pair<long long, long long> > divisor(long long n) {
    vector<pair<long long, long long> > res;
    for (long long i = 1LL; i*i <= n; ++i) {
        if (n%i == 0LL) {
            long long temp = n/i;
            res.push_back(make_pair(i, temp));
            //if (i != temp) res.push_back(make_pair(temp, i));
        }
    }
    return res;
}

long long sq(long long a) { return a*a; }

int a, b;

int main() {
    while (cin >> a >> b) {
        if (a == 0 && b == 0) break;
        
        long long res = 1LL<<60;
        vector<pll> va = divisor(a), vb = divisor(b);
        for (int i = 0; i < va.size(); ++i) {
            for (int j = 0; j < vb.size(); ++j) {
                vll vec(4);
                vec[0] = va[i].first, vec[1] = va[i].second, vec[2] = vb[j].first, vec[3] = vb[j].second;
                sort(ALL(vec));
                
                ll tmp = sq(vec[1] - vec[0]) + sq(vec[2] - vec[1]) + sq(vec[3] - vec[2]);
                chmin(res, tmp);
            }
        }
        
        cout << res << endl;
    }
    
    return 0;
}


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

int main() {
	int x,n; cin >> x >> n;
	bool arr[102] = {false};
	for(int i=0;i<n;i++)
	{
	    int z; cin >> z;
	    arr[z] = true;
	}
	int mn = 101,ans = 101;
	if(n==0) ans = x;
	else
	{
	    for(int i=0;i<102;i++)
    	{
    	    if(!arr[i])
    	    {
    	        int val = abs(x-i);
        	    if(val < mn)
        	    {
        	        mn = val;
        	        ans = i;
        	    }
    	    }
    	}
	}
	
	cout << ans;
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

void Main();

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	Main();
	return 0;
}

void Main(){
	using ld = long double;
	int n; cin >> n;
	priority_queue<ld> q;
	Rep(n){
		int v; cin >> v;
		q.push(-v);
	}
	while(q.size() > 1){
		ld a = q.top();
		q.pop();
		ld b = q.top();
		q.pop();
		q.push((a+b)/2);
	}
	cout << -q.top() << endl;
}

Measured memory_bytes: 3716
N = int(input())

ketalis = list(str(N))
ketalis.reverse()

dp = []

for i in range(10):

    a = []

    for i2 in range(2):
        b = []

        for i3 in range(2):
            c = []

            for i4 in range(2):
                d = []

                for i5 in range(2):
                    e = []

                    for i6 in range(2):

                        e.append(-1)

                    d.append(e)

                c.append(d)

            b.append(c)
            
        a.append(b)

    dp.append(a)

dp[0][0][0][0][0][0] = 1

#print (dp[4][0][0][0][0][0])


for i in range(10):

    if i == 0:
        continue;

    keta = 10 - i

    nowketa = 0

    if len(ketalis) >= keta:

        nowketa = int(ketalis[keta-1])


    for sf in range(2):

        for ff in range(2):

            for tf in range(2):

                for mnf in range(2):

                    for mxf in range(2):

                        for x in [0,3,5,7]:

                            if dp[i-1][sf][ff][tf][mnf][mxf] == -1:
                                continue;


                            nsf = sf
                            nff = ff
                            ntf = tf
                            nmnf = mnf
                            nmxf = mxf


                            if x == 0 and mxf == 1: #最上位ビットが出た後だと0はたせない
                                continue;

                            if x != 0 and mxf == 0: #最上位ビットが出た時の処理
                                nmxf = 1

                            if mnf == 0:

                                if x > nowketa:
                                    continue;

                                if x < nowketa:
                                    nmnf = 1

                            if x == 7:
                                nsf = 1
                            if x == 5:
                                nff = 1
                            if x == 3:
                                ntf = 1

                            if dp[i][nsf][nff][ntf][nmnf][nmxf] == -1:
                                dp[i][nsf][nff][ntf][nmnf][nmxf] = 0

                            dp[i][nsf][nff][ntf][nmnf][nmxf] += dp[i-1][sf][ff][tf][mnf][mxf]

print (max(0,max(0,dp[-1][1][1][1][0][1]) + max(0,dp[-1][1][1][1][1][1])))
    



Measured memory_bytes: 38916