akhauriyash/Code-Regression huggingface dataset:
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("O3")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include<unordered_set>
#include <stack>
#include <unordered_map>
#include <map>
#include<numeric>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007 // prime modulo value 
#define M 998244353
#define all(x) x.begin(),x.end()
#define mkp(a,b) make_pair(a,b)
using namespace std;

inline int mex(unordered_set<int> st)
{
	int m = 0;
	while (st.find(m) != st.end())
	{
		m += 1;
	}
	return m;
}
inline int calculateGrundy(int n)
{
	if (n == 1)
		return 0;
	unordered_set<int> mexi;
	for (int i = 1; i <= sqrt(n); i += 1)
	{
		if (n % i == 0)
		{
			if (n / i != n)
				mexi.insert(calculateGrundy(n / i));
			mexi.insert(calculateGrundy(i));
		}
	}
	return mex(mexi);
}
inline ll gcd(ll a, ll b)
{
	// This is code taken from geeksforgeek
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
ll power(ll x, ll y)
{
	// This is code taken from geeksforgeek
	ll res = 1;

	x = x % N;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x) % N;
		y = y >> 1;
		x = (x * x) % N;
	}
	return res;
}
bool check(ll a)
{
	ll count = 0;
	while (a % 2 == 0)
	{
		a /= 2;
		count += 1;
	}
	if (count > 1)
		return false;
	bool flag = true;
	for (ll i = 3; i <= sqrt(a); i += 2)
	{
		if (a % i == 0)
		{
			flag = false;
			break;
		}
	}
	return flag;
}
ll sum(ll n)
{
	return (n * (n + 1)) / 2;
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	vector<ll> arr(5,0);
	ll x,y;
	cin>>x>>y;
	if(y%2!=0)
		cout<<"No";
	else
	{
		if(y/2>=x && y/2-x<=x)
		{
			cout<<"Yes";
		}
		else
		{
			cout<<"No";
		}
		
	}
	
	return 0;
}

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

#define FOR(i, j, k) for (int i = j; i < k; i++)
#define REP(i, j) FOR(i, 0, j)
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

int m[500][500];

int main() {

  int H, W;
  cin >> H >> W;
  REP(y, H) REP(x, W) { cin >> m[y][x]; }

  //  cout << " -- input " << endl;
  //  REP(y, H) {
  //    REP(x, W) { cout << m[y][x] << " "; }
  //    cout << endl;
  //  }

  vvi ans;

  REP(y, H) {
    REP(_x, W) {
      if (y % 2 == 0) {
        int x = _x;
        if (m[y][x] % 2 > 0) {
          if (x + 1 < W) {
            ans.push_back(vi{y, x, y, x + 1});
            m[y][x]--;
            m[y][x + 1]++;
          } else {
            if (y + 1 < H) {
              ans.push_back(vi{y, x, y + 1, x});
              m[y][x]--;
              m[y + 1][x]++;
            }
          }
        }
      } else {
        int x = W - _x - 1;
        if (m[y][x] % 2 > 0) {
          if (x > 0) {
            ans.push_back(vi{y, x, y, x - 1});
            m[y][x]--;
            m[y][x - 1]++;
          } else {
            if (y + 1 < H) {
              ans.push_back(vi{y, x, y + 1, x});
              m[y][x]--;
              m[y + 1][x]++;
            }
          }
        }
      }
    }
  }

  //  cout << " -- output " << endl;
  //  REP(y, H) {
  //    REP(x, W) { cout << m[y][x] << " "; }
  //    cout << endl;
  //  }

  cout << ans.size() << endl;
  REP(i, ans.size()) {
    REP(j, ans[i].size()) {
      cout << ans[i][j] + 1;
      if (j < ans[i].size() - 1)
        cout << " ";
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 10032
import collections
N,K = map(int,input().split())
A = list(map(int,input().split()))

c = collections.Counter(A)
ans = 0
d=c.most_common()
len_A=len(set(A))
if(len_A<=K):
    print(ans)
else:
    for i in range(len_A-K):
        ans +=d[-1*(i+1)][1]
    print(ans)

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

int main()
{
  int a,b;
  cin>>a>>b;
  if(a<=b)
  {
    for(int i=0; i<b; i++)
      cout<<a;
  }
  else
  {
    for(int i=0; i<a; i++)
      cout<<b;
  }
  cout<<endl;
  return 0;
}

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

int main()
{
  int n;
  scanf("%d", &n);
  int *arr = malloc(sizeof(int)*n);
 
  for(int i = 0; i<n; i++)
    {
      scanf("%d", &arr[i]);
    }
  for(int i = n-1; i>0; i--)
    {
      printf("%d ", arr[i]);
    }
  printf("%d\n", arr[0]);
  return 0;
}



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

using namespace std;

const int N = 200000 + 7;

#define mp make_pair
#define pb push_back
#define st first
#define nd second

typedef long long ll;
typedef vector<ll> vl;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef pair<ll,ll> pll;

int main() {
  int n;
  scanf("%d", &n);
  map<int, vii> list;
  for(int i = 0; i < n - 1; ++i) {
    int u, v, w;
    scanf("%d %d %d", &u, &v, &w);
    w %= 2;
    list[u].push_back(ii(v, w));
    list[v].push_back(ii(u, w));
  }
  vector<int> dist(n + 1, 0);
  vector<bool> vis(n, false);
  queue<int> q;
  while(!q.empty()) q.pop();
  vis[1] = true;
  q.push(1);
  while(!q.empty()) {
    int qf = q.front(); q.pop();
    for(int i = 0; i < list[qf].size(); ++i) {
      int v = list[qf][i].first;
      int w = list[qf][i].second;
      //cout << qf << v << w << endl;
      if(!vis[v]) {
        q.push(v);
        vis[v] = true;
        dist[v] = (dist[qf] + w) % 2;
      }
    }
  }

  for(int i = 1; i < dist.size(); ++i) {
    //cout << i << " " << dist[i] << endl;
    printf("%d\n", dist[i]);
  }

  return 0;
}
/*
8
1 2 1
2 4 3
2 5 7
1 3 2
3 6 9
6 7 4
6 8 8
*/


Measured memory_bytes: 12288
#include <bits/stdc++.h>
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; }

int main(void){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  int N = 1000;
  for(int i = 0; i < N; i++){
    C = C - B;
    if(C <= 0){
      cout << "Yes" << endl;
      break;
    }
    A = A - D;
    if(A <= 0){
      cout << "No" << endl;
      break;
    }
  }
}

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

    cin >> S;

    int h,m,s;

    h = S/3600;

    S = S - h*3600;

    m = S/60;

    s = S - m*60;

    cout << h << ":" << m << ":" << s << endl;

    return 0;

}


Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k,a[1100],m,b,z;
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	    k=k-a[i];
	}
	sort(a,a+n+1);
	for(int i=1;i<=n;i++)
	b=k/a[1];
	z=n+b;
	cout<<z<<endl;
	return 0;
}

Measured memory_bytes: 256
#! ruby
# Try AtCoder
# author: Leonardone @ NEETSDKASU
############################################################
def gs() gets.chomp end
def gi() gets.to_i end
def gf() gets.to_f end
def gss() gs.split end
def gis() gss.map(&:to_i) end
def nmapf(n,f) n.times.map{ __send__ f } end
def ngs(n) nmapf n,:gs end
def ngi(n) nmapf n,:gi end
def ngss(n) nmapf n,:gss end
def ngis(n) nmapf n,:gis end
def arr2d(h,w,v=0) h.times.map{[v] * w} end
def for2p(hr,wr,&pr) hr.each{|i|wr.each{|j| yield(i,j)}} end
def nsum(n) n * (n + 1) / 2 end
def vcount(d,r=Hash.new(0)) d.inject(r){|m,e| m[e]+=1;m} end
############################################################

s = gss.sort * ''

puts s == '557' ? :YES : :NO

Measured memory_bytes: 1788
# -*- coding: utf-8 -*-
x1, y1, x2, y2 = map(int,input().split()) 

l = pow(x1 - x2, 2) + pow(y1 - y2, 2)

a1 = complex(x1, y1)
a2 = complex(x2, y2)
a3 = complex(0, -1) * (a1 - a2) + a2
a4 = complex(0, -1) * (a2 - a3) + a3
x3 = int(a3.real)
y3 = int(a3.imag)
x4 = int(a4.real)
y4 = int(a4.imag)
print(x3, y3, x4, y4)


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<list>
using namespace std;
#define df 0
typedef long int li;
int solve(vector<vector<int>>& adj,int i,int n);
int check(vector<vector<int>>& adj,int n,int i,int c);

int main(){
  if(df) printf("*debug mode*\n");
  int n; cin >>n;
  vector<string> mat(n);
  for(int i=0;i<n;i++){
    cin >> mat.at(i);
  }
  if(df)printf("done\n");
  vector<vector<int>> adj(n);
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(mat[i][j]=='1') {
	adj.at(i).push_back(j);
      }
    }
  }
  if(df){
    for(int i=0;i<n;i++){
      printf("%d:",i);
      for(int j:adj.at(i)){
	printf(" %d",j);
      }
      printf("\n");
    }
  }

  if(check(adj,n,0,1)==0){
    printf("-1");
    return 0;
  }
  int ans=2;
  for(int i=0;i<n;i++){
    int x=solve(adj,i,n);
    if(x>ans)ans=x;
  }
  printf("%d",ans);
}

int check(vector<vector<int>>& adj,int n,int i,int c){
  static vector<int>buf(n,0);
  buf.at(0)=1;
  if(df)printf("[%d colord by %d]\n",i,c);
  for(const int& j:adj.at(i)){
    if(df)printf("%d ",j);
    if(buf.at(j)==c){
      if(df)printf("no\n");
      return 0;
    }
    if(buf.at(j)==-c){
      continue;
    }
    buf.at(j)=-c;
    if(df)printf("rec\n");
    int flag=check(adj,n,j,-c);
    if(flag==0)return 0;
  }
  if(df)printf("ret\n");
  return 1;
}

int solve(vector<vector<int>>& adj,int i,int n){
  vector<int>buf(n,0);
  list<int> que;
  if(df)printf("find %d\n",i);
  buf.at(i)=1;
  que.push_back(i);
  while(que.size()!=0){
    i=que.front();
    que.pop_front();
    for(int& k:adj.at(i)){
      if(buf.at(k)!=0)continue;
      
      buf.at(k)=buf.at(i)+1;
      if(df)printf("%d color by %d\n",k,buf.at(k));
      que.push_back(k);
    }
  }
  if(df)printf("ret %d\n",buf.at(i));
  return buf.at(i);
}


/// confirm df==0 ///


Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>

const int INF = 1000000009;
const long LINF = 1123456789012345678;

long n, a, b;
int main(){
	scanf("%ld%ld%ld", &n, &a, &b);
	long ans = (b*(n-1)+a) - (a*(n-1)+b) + 1;
	printf("%ld\n", ans>0 ? ans : 0);
	return 0;
}


Measured memory_bytes: 764
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    int input;
    
    int h = 0;
    int m = 0;
    int s = 0;
    
    scanf("%d",&input);
    
    s = input % 60;
    m = input / 60;
    m = m % 60;
    h = input / 3600;
    
    printf("%d:%d:%d\n",h,m,s);
}


Measured memory_bytes: 2044
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define ALL(u) (u).begin(),(u).end()

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

typedef pair<int, int> PII;

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;

const int MR = 5e5 + 10;

char s[MR];

int dp[MR][2];

int main()
{
	int n;
	scanf("%d%s", &n, s);

	int ile = 0, first = -1, last = -2, prev0 = -2;
	REP(i, n)
	{
		if (s[i] == '1')
		{
			if (first == -1)
				first = i;
			last = i;
		}
		else
		{
			if (prev0 == i - 1)
			{
				// policz dla wyznaczonej czesci tekstu
				last++;
				int ile1 = 0, ile0 = 0;
				FOR(j, first, last)
					if (s[j] == '0')
					{
						ile0++;
						dp[ile0][0] = (ile0 == 1 ? ile1 : max(ile1 + max(dp[ile0 - 2][0], dp[ile0 - 2][1]), max(dp[ile0 - 1][0] + ile1 - 1, dp[ile0 - 1][1])));
						int k = j + 1;
						while (k < last && s[k] == '1')
							k++;
						int ilen = k - j - 1;
						dp[ile0][1] = (ile0 == 1 ? ilen : max(ilen + max(dp[ile0 - 2][0], dp[ile0 - 2][1]), max(dp[ile0 - 1][0] + (ile1 > 1 ? ilen : 0), max(dp[ile0 - 1][1], dp[ile0 - 1][1] - 1 + ilen))));
						ile1 = 0;
					}
					else
						ile1++;
				ile += max(dp[ile0][0], dp[ile0][1]);
				first = -1;
				last = -2;
			}

			prev0 = i;
		}
	}

	// na koncu rowniez policz dla wyznaczonej czesci tekstu
	last++;
	int ile1 = 0, ile0 = 0;
	FOR(j, first, last)
		if (s[j] == '0')
		{
			ile0++;
			dp[ile0][0] = (ile0 == 1 ? ile1 : max(ile1 + max(dp[ile0 - 2][0], dp[ile0 - 2][1]), max(dp[ile0 - 1][0] + ile1 - 1, dp[ile0 - 1][1])));
			int k = j + 1;
			while (k < last && s[k] == '1')
				k++;
			int ilen = k - j - 1;
			dp[ile0][1] = (ile0 == 1 ? ilen : max(ilen + max(dp[ile0 - 2][0], dp[ile0 - 2][1]), max(dp[ile0 - 1][0] + (ile1 > 1 ? ilen : 0), max(dp[ile0 - 1][1], dp[ile0 - 1][1] - 1 + ilen))));
			ile1 = 0;
		}
		else
			ile1++;
	ile += max(dp[ile0][0], dp[ile0][1]);

	printf("%d\n", ile);
	
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define pb push_back
#define S second
#define F first

using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
const int maxn = 1e5 + 10;
int seq[maxn];
int se[maxn];
int32_t main() {
    int n;
    cin >> n;
    int a,b;
    cin >> a >> b;
    a = a-b;
    for (int i = 1;i <= n;i++) cin >> seq[i];
    int lo = 1,hi= 1e9/b * 1e5 + 1e5,m,found = -1;
    int need;
    while(lo <= hi){
        m = (lo + hi) / 2;
        need = 0;
        for (int i = 1;i <= n;i++ ) se[i] = seq[i] - b * m;
        for (int i = 1;i <= n;i++){
            if (se[i] <= 0) continue;
            need += (se[i] + a - 1) / a;
        }
        if (need <= m){
            found = m;
            hi = m - 1;
        }else lo = m + 1;
    }
    cout << found << endl;;
    return 0;
}


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

const int maxn = 1e5+5;
int N, A, B;
ll h[maxn];

ll ceil(ll a, ll b) {
    return a%b==0?a/b:a/b+1;
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> N >> A >> B;
    for (int i = 0; i < N; i++) {
        cin >> h[i];
    }
    sort(h,h+N);
    int lo = 0, hi = 1e9+9;
    ll diff = A - B;
    while (lo + 1 < hi) {
        ll mid = (lo + hi) >> 1;
        vector<ll> v;
        for (int i = 0; i < N; i++) {
            if (h[i] - B * mid > 0) {
                v.push_back(h[i]-B*mid);
            }
        }
        ll cnt = mid;
        for (ll i: v) {
            cnt -= ceil(i,diff);            
        }
        if (cnt < 0) {
            lo = mid;
        }
        else hi = mid;
    }
    cout << hi << '\n';
}



Measured memory_bytes: 2916
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define get0(x)     (get<0>(x))
#define get1(x)     (get<1>(x))
#define get2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       9223372036854775807LL
#define LLMIN       -9223372036854775808LL
#define IMAX        2147483647
#define IMIN        -2147483648
typedef long long LL;
using namespace std;

LL H,W,h,w;
LL a[500][500];
LL m=1e9/250000;

int main(void){
    cin>>H>>W>>h>>w;
    int s=0;
    REP(i,H)
        REP(j,W){
            if((i+1)%h==0&&(j+1)%w==0)
                a[i][j]=-((h*w-1)*m+1);
            else
                a[i][j]=m;
            s+=a[i][j];
        }
    if(0<s){
        cout<<"Yes"<<endl;
        REP(i,H){
            REP(j,W)
                cout<<a[i][j]<<" ";
            cout<<endl;
        }
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <algorithm>

using namespace std;
typedef long long ll;

const int MAXN = 1e5 + 10; 
int l[MAXN] , u[MAXN];
int n , x;
int b[MAXN] , num[MAXN];
bool ch[MAXN];
ll get(int n1){
	return 1ll * b[n1] * l[n1] + 1ll * (x - b[n1]) * u[n1];
}

bool cmp(int n1 , int n2){
	return get(n1) > get(n2);
}

int main(){
	ios::sync_with_stdio(0);
	cin >> n >> x;
	for(int i = 1 ; i <= n ; ++ i)
		cin >> b[i] >> l[i] >> u[i];
	ll tmp = 0;
	for(int i = 1 ; i <= n ; ++ i)
		tmp += 1ll * -b[i] * l[i];
	for(int i = 1 ; i <= n ; ++ i)
		num[i] = i;
	sort(num + 1 , num + n + 1 , cmp);
	ll head = 0 , tail = 1ll * x * n;
	while(head < tail){
		ll mid = (head + tail) >> 1;
		int cnt1 = mid / x , cnt2 = mid % x;
		ll mx = 0; 
		for(int i = cnt1 + 1 ; i <= n ; ++ i){
			if(cnt2 > b[num[i]])
				mx = max(mx , 1ll * b[num[i]] * l[num[i]] + 1ll * (cnt2 - b[num[i]]) * u[num[i]]);
			else
				mx = max(mx , 1ll * cnt2 * l[num[i]]);
		}
		ll s1 = 0;
		for(int i = 1 ; i <= cnt1 ; ++ i)
			s1 += get(num[i]);
		bool flag = 0;
		for(int i = 1 ; i <= n ; ++ i)
			if(i <= cnt1){
				ll cur = 0;
				if(cnt2 > b[num[i]])
					cur = max(cur , 1ll * b[num[i]] * l[num[i]] + 1ll * (cnt2 - b[num[i]]) * u[num[i]]);
				else
					cur = max(cur , 1ll * cnt2 * l[num[i]]);
				if(cur + s1 + get(num[cnt1 + 1]) - get(num[i]) + tmp >= 0){
					flag = 1;
					break;
				}
			}
		if(s1 + mx + tmp >= 0)
			flag = 1;
		if(flag)
			tail = mid;
		else
			head = mid + 1;
	}
	cout << head << endl;
	return 0;
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)turn idx;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
};

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

int main() {
    int N;
    cin >> N;
    ll K;
    cin >> K;
    vector<ll> A(N);
    vector<ll> F(N);
    rep(i, 0, N) {
        cin >> A[i];
    }
    rep(i, 0, N) {
        cin >> F[i];
    }
    sort(All(A));
    sort(All(F));
    reverse(All(F));

    ll ok = 1e12;
    ll ng = -1;

    while (abs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;
        ll cnt = 0;
        rep(i, 0, N) {
            if (A[i] * F[i] <= mid) continue;
            else {
                cnt += A[i] - mid / F[i];
            }
        }
        if (cnt <= K) {
            ok = mid;
        } else {
            ng = mid;
        }
    }

    cout << ok << endl;
};


Measured memory_bytes: 3328
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let a: i64 = sc.read();
    let b: i64 = sc.read();
    let c: i64 = sc.read();
    if a + b >= c {
        println!("No");
        return;
    }
    let result = if c * c - 2 * (a + b) * c + (a + b) * (a + b) > 4 * a * b {
        "Yes"
    } else {
        "No"
    };
    println!("{}", result);
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}
pub mod utils {
    const DYX: [(isize, isize); 8] = [
        (0, 1),   //right
        (1, 0),   //down
        (0, -1),  //left
        (-1, 0),  //top
        (1, 1),   //down right
        (-1, 1),  //top right
        (1, -1),  //down left
        (-1, -1), //top left
    ];

    pub fn try_adj(y: usize, x: usize, dir: usize, h: usize, w: usize) -> Option<(usize, usize)> {
        let ny = y as isize + DYX[dir].0;
        let nx = x as isize + DYX[dir].1;
        if ny >= 0 && nx >= 0 {
            let ny = ny as usize;
            let nx = nx as usize;
            if ny < h && nx < w {
                Some((ny, nx))
            } else {
                None
            }
        } else {
            None
        }
    }
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

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

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    string s;
    cin >> s;
    
    int i = 0;
    bool flag = true;
    while(true){
        if(s.substr(i,6)=="eraser") i+=6;
        else if(s.substr(i,7)=="dreamer"){
            if(s.substr(i+5,6)=="eraser" or s.substr(i+5,5)=="erase") i+=5;
            else i+= 7;
        }
        else if(s.substr(i,5)=="dream") i+=5;
        else if(s.substr(i,5)=="erase") i+=5;
        else {
            flag = false;
            break;
        }
        
        if(i >= s.size()) break;
    }
    
    if(flag) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 512
# define _CRT_SECURE_NO_WARNINGS 1
# define _USE_MATH_DEFINES
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <unordered_set>
# include <unordered_map>
# include <climits>
# include <complex>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;
# define INF ((int)(1<<25))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,n) REP(i,n)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define STR(x) string x;cin>>x;
# define ALL(x) begin(x),end(x)
# define RALL(x) (x).rbegin(),(x).rend()
# define DEBUG(x) cout<<#x<<":"<<x<<endl;
# define EPS 1e-12
#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif
typedef long long lint;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<int> vi;
typedef vector<lint> vl;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { -1, 0, 1, 0 };
template<class T> void debug(T a) { for (auto i : a)cout << i << endl; }



int main()
{
	while (true)
	{
		int a[5] = {}, x[4] = {};
		FOR(i, 5)
		{
			cin >> a[i];
			x[a[i]]++;
		}
		if (a[0] == 0)break;
		int g, c, p;
		g = x[1]; c = x[2]; p = x[3];
		if ((g&&c&&p) || (g&&!c&&!p) || (!g&&c&&!p) || (!g&&!c&&p))
		{
			FOR(i, 4)x[i] = 3;
		}
		else
		{
			FOR(i, 4)x[i] = 2;
			if (!g)
			{
				x[2] = 1;
			}
			if (!c)
			{
				x[3] = 1;
			}
			if (!p)
			{
				x[1] = 1;
			}
		}
		FOR(i, 5)cout << x[a[i]] << endl;

	}
}

Measured memory_bytes: 3000
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)

int a[10];
bool flag = false;

void dfs(int B, int C, int cnt){
	if(cnt == 9){
		if(B < a[cnt]) flag = true;
		if(C < a[cnt]) flag = true;
		return;
	}
	if(B < a[cnt]){
		dfs(a[cnt], C, cnt + 1);
	}
	if(C < a[cnt]){
		dfs(B, a[cnt], cnt + 1);
	}
	if(B > a[cnt] && C > a[cnt]){
		return;
	}
}
int main(void){
	int n; cin >> n;
	for (int i = 0; i < n; ++i){
		rep(j, 10) cin >> a[j];
		flag = false;
		dfs(0, 0, 0);
		if(flag) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 1116
#include <iostream>
#include <algorithm>
#include <stdio.h>

using namespace std;

#define LL long long
#define FOR(i,l,r) for(int i = l; i <= r; ++i)
#define REP(i,l,r) for(int i = l; i < r; ++i)

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();
    //
    int A,B;
    cin >> A >> B;
    cout << max(A - 2 * B,0);   

    return 0;

}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

template <typename T>
bool chmax(T &a, const T& b) {
    if (a < b) {
      a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmin(T &a, const T& b) {
    if (a > b) {
      a = b;
      return true;
    }
    return false;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,K;
    cin >> N >> K;
    if(N-2*K+1<0){
        cout << -1 << endl;
        return 0;
    }
    vl A(3*N);
    rep(i,3*N){
        A[i]=K+i;
    }
    rep(i,N){
        //cout << i << endl;
        if(i%2==0){
            cout << A[i/2] << ' ' << A[3*N/2+i/2] << ' ' << A[2*N+i] << endl;
        }
        else{
            cout << A[(N+1)/2+(i)/2] << ' ' << A[N+i/2] << ' ' << A[2*N+i] << endl;
        }
    }
}

Measured memory_bytes: 5464
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

struct UnionFind {
  vector<int> d;
  UnionFind(int n): d(n,-1) {}
  int root(int x) {
    if (d[x] < 0) return x;
    return d[x] = root(d[x]);
  }
  bool unite(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return root(x) == root(y);}
  int size(int x) { return -d[root(x)];}
};

int main(){
    int n,m,k;
    cin >> n >> m >> k;
    UnionFind fre(n);
    Graph f(n),blo(n);
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--;b--;
        fre.unite(a,b);
        f[a].push_back(b);
        f[b].push_back(a);
    }
    rep(i,k){
        int a,b;
        cin >> a >> b;
        a--;b--;
        blo[a].push_back(b);
        blo[b].push_back(a);
    }
    vi ans(n);
    rep(i,n){
        ans[i] = fre.size(i) - f[i].size() - 1;
        for(auto t : blo[i]){
            if(fre.same(i,t)) ans[i]--;
        }
    }
    rep(i,n){
        cout << ans[i] << " ";
    }
    cout << endl;
}

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

int main(){
    int n; cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;++i){
        cin>>a[i];
    }
    double ans = 0;
    for(int i=0;i<n;++i) ans+=(double)1/a[i];
    cout<<1/ans<<endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
  int n, x_i, y_i, t_i, flag=0;
  cin >> n;
  int t[n+1], x[n+1], y[n+1];
  t[0] = x[0] = y[0] = 0;
  for (int i = 1; i <= n; ++i)
    cin >> t[i] >> x[i] >> y[i];
  for (int i = 1; i <= n; ++i) {
    x_i = x[i] - x[i-1];
    y_i = y[i] - y[i-1];
    t_i = t[i] - t[i-1];
    if (t_i < (x_i + y_i) || (t_i - (x_i + y_i)) % 2 != 0) {
      flag = 1;
      break;
    }
  }
  if (flag == 1) cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>

using namespace std;

int main()
{
    std::string input;
    cin >> input;

    int sum = 0;
    for (auto c : input)
        sum += c - '0';

    if (sum % 9 == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 3700
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
template<typename T>
void chmax(T& a, T b) {
	a = max(a, b);
}

template<typename T>
void chmin(T& a, T b) {
	a = min(a, b);
}

template<typename T>
void IN(vector<T> &A,int N=-1) {
	if (N == -1) {
		N = A.size();
	}
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
}

template<typename T>
void SO(vector<T> &A,bool F=false) {
	sort(A.begin(), A.end());
	if (F) {
		reverse(A.begin(), A.end());
	}
}
//////////////

void solve() {
	LL N, X;
	cin >> N >> X;
	vector<LL> A(N);
	IN(A);
	LL ans = 0;
	for (int i = 1; i < N; ++i) {
		LL ter = A[i - 1] + A[i];
		if (ter <= X) continue;
		ans += ter - X;

		if (ter-X <= A[i]) {
			A[i] -= (ter - X);
		}
		else {
			ter -= A[i];
			A[i] = 0;
			A[i - 1] -= ter - X;
		}
	}
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


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

int main(){
  ios::sync_with_stdio(0);
  int X, Y;

  cin >> X >> Y;
  if (Y % 2 == 0 && Y >= 2 * X && Y <= 4 * X){
    cout << "Yes" << endl;
  }
  else{
      cout << "No" << endl;
  }
}


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

int main()
{
  int N;
  cin >> N;
  int tmp = 0;

  vector<int> d(N);

  for (int i = 0; i < N; i++)
  cin >> d.at(i);

  for (int i = 0; i < N; i++){
    for (int j = i + 1; j < N; j++){
      if(d.at(i) == d.at(j)){
        d.at(j) = tmp;
        tmp--;
      }
    }
  }

  cout << N + tmp << endl;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define FOR(NAME, START, NUM) for (ll NAME = START; NAME < (NUM); NAME++)
#define REP(NAME, NUM) for (ll NAME = 0; NAME < (NUM); NAME++)
#define BREP(NAME, NUM) for (ll NAME = (NUM)-1; NAME >= 0; NAME--)
#define ALL(NAME) (NAME).begin(), (NAME).end()
const ll INF =1000000000000000;

int main(){
  ll n,m;cin >> n >> m;
  
  if(m <= n){cout << 0 << endl;return 0;}
  vector<ll> x(m),d(m-1);
  
  REP(i,m)cin >> x[i];
  
  sort(ALL(x));
  
  REP(i,m-1){
    d[i]=abs(x[i]-x[i+1]);
  }
  
  sort(ALL(d));
  reverse(ALL(d));
  
  ll ans=x[m-1]-x[0];
  
  BREP(i,n-1){
    ans-=d[i];
  }
  
  cout << ans << endl;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M);
  vector<int> b(M);
  vector<int> sum(N);
  for(int i = 0; i < M; i++)
    cin >> a.at(i) >> b.at(i) ;
  for(int j = 0; j < N; j++){
    for(int k = 0; k < M; k++){
      if(a.at(k) == (j + 1) || b.at(k) == (j + 1))
        sum.at(j)++;
    }
    cout << sum.at(j) << endl; 
  } 
}

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

flag = 0

for i in range(N - 1):
    if(A[i] == 0):
        flag = 1
        break
    
    if(A[i] < 0):
        A[i] *= -1
        A[i + 1] *= -1

if(A[N - 1] > 0):
    flag = 1

for i in range(N):
    A[i] = abs(A[i])

if(flag == 1):
    print(sum(A))
else:
    print(sum(A) - 2 * min(A))

Measured memory_bytes: 14468
[X,N] = [int(s) for s in input().rstrip().split(' ')]
if N == 0:
    print(X)
else:
    L = [int(s) for s in input().rstrip().split(' ')]
    k = 0
    a = 0
    while a == 0:
        if X - k not in L:
            print(X-k)
            a = 1
            continue
        elif X + k not in L:
            print(X+k)
            a = 1
            continue
        k += 1

Measured memory_bytes: 9196
#include <iostream>
#define TOU 4
#define KAI 3
#define GOUSHITSU 10
using namespace std;

struct kousya
{
	int ninzu;
};


int main()
{
	struct kousya nyukyo[TOU][KAI][GOUSHITSU];
	for (int t = 0; t < TOU; t++)
	{
		for (int k = 0; k < KAI; k++)
		{
			for (int g = 0; g < GOUSHITSU; g++)
			{
				nyukyo[t][k][g].ninzu = 0;
			}
		}
	}

	int count;
	cin >> count;

	int b, f, r, v;
	for (int i = 0; i < count; i++)
	{
		cin >> b >> f >> r >> v;
		for (int t = 0; t < TOU; t++)
		{
			for (int k = 0; k < KAI; k++)
			{
				for (int g = 0; g < GOUSHITSU; g++)
				{
					if (b==t+1 && f==k+1 && r==g+1)
					{
						nyukyo[t][k][g].ninzu = nyukyo[t][k][g].ninzu + v;
					}
				}
			}
		}
	}

	for (int t = 0; t < TOU; t++)
	{
		for (int k = 0; k < KAI; k++)
		{
			for (int g = 0; g < GOUSHITSU; g++)
			{
				cout << ' ' << nyukyo[t][k][g].ninzu;
			}
			cout << endl;
		}
		if (t != 3)
		{
			cout << "####################" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3096
S = input()
R = ''.join(list(reversed(list(S))))
#print(R)

cursol=0
while cursol <= len(S)-1:
    if R[cursol:cursol+5]=='maerd':
        cursol += 5
    elif R[cursol:cursol+7]=='remaerd':
        cursol += 7
    elif R[cursol:cursol+5]=='esare':
        cursol += 5
    elif R[cursol:cursol+6]=='resare':
        cursol += 6
    else:
        print('NO')
        break
else:
    print('YES')

Measured memory_bytes: 50032
class Array
  def swap!(a, b)
    self[a], self[b] = self[b], self[a]
  end
end

w=gets.to_i
n=gets.to_i
ans=Array.new(w)
w.times{|i|
	ans[i]=i+1
}
n.times{
	input=gets.split(",")
	a=input[0].to_i
	b=input[1].to_i
	ans.swap!(a-1,b-1)
}
for j in 0..w-1 do
	puts ans[j]
end 


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

ll max_ans = 0;
ll n,m,q;
ll arr[55][4];


void check(vector<ll>& A){
	ll ans = 0;
	for(ll i=0; i<q; ++i){
		if( A[arr[i][1]-1] - A[arr[i][0]-1] == arr[i][2] ){
			ans += arr[i][3];
		}
	}
	max_ans = max(max_ans, ans);
}

void produce(int id, int prev, vector<ll>& curr){
	if( curr.size() == n ){
		check(curr);
		return;
	}
	for(int i=prev; i<=m; ++i){
		vector<ll> cp = curr;
		cp.push_back(i);
		produce(id+1, i, cp);
	}
}

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


	cin>>n>>m>>q;
	for(ll i=0; i<q; ++i){
		for(ll j=0; j<4; ++j){
			cin>>arr[i][j];
		}
	}
	vector<ll> v;
	produce(0,1,v);
	cout<<max_ans<<'\n';
	return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define rep(i,a,n)  for (int i=(int)(a); i<=(int)(n); ++i)
#define rrep(i,a,n) for (int i=(int)(a); i>=(int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(f, 0, (x.size()-1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N,M,K;
string S,T;
int A,B;
//=============================
void input()
{
    cin>>N>>A>>B;
}
//=============================
void func(){}
/*
 - 樹形図をかく
*/
//=============================

bool check(int a){
    int ketasum=0;
    while(a){
        ketasum += a%10;
        a /= 10;
    }
    return (A<=ketasum && ketasum<=B);
}


void solve()
{
    int ans = 0;
    rep(i,1,N){
        if (check(i)) {
            ans += i;
        }
    }
    cout<<ans<<endl;


}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        cin = new Scanner();
        new Myon().calc();
        return 0;
    }

    static Scanner cin;

    void calc()
    {
        var A = cin.nextInt();
        var B = cin.nextInt();
        var C = cin.nextInt();
        var ret = 0;
        if (A == B)
        {
            ret = C;
        }
        else if(B == C)
        {
            ret = A;
        }
        else
        {
            ret = B;
        }
        Console.WriteLine(ret);
    }


    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}

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

int main() {
  int N, ans=0;
  cin >> N;
  
  rep(i, N){
    int l, r;
    cin >> l >> r;
    
    ans = ans - l + r + 1;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
const int MOD=(int)1e9+7;
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<string> s(n);
    REP(i,n){
        string tmp;
        cin>>tmp;
        if(i!=0){
            string t=s.at(i-1);
            auto itr = find(s.begin(),s.end(),tmp);
            if(t[t.size()-1]!=tmp[0]){
                cout<<"No"<<endl;
                return 0;
            }
            if(itr!=s.end()){
                cout<<"No"<<endl;
                return 0;
            }
        }
      s.at(i)=tmp;
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<utility>
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
using ll = long long;
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int> p(n);
	int c = 0;
	REP(i, n)cin >> p[i];
	REP(i, n) {
		if (p[i] != i + 1)c++;
	}
	if (c > 2)cout << "NO" << endl;
	else cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.io.*;
public class Main

{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        String st="";
        int n=sc.nextInt();
        String s=sc.next();
        String t=sc.next();
        for(int i=0;i<n;i++)
        {
            st=st+s.charAt(i)+t.charAt(i);
        }
        System.out.println(st);
        
        
    }
}

Measured memory_bytes: 39332
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	  
	public static void main(String args[]) {
		    Scanner scanner = new Scanner(System.in);
		    
		    int N = scanner.nextInt();
		    int M = scanner.nextInt();
		    int[] moto = new int[N];
		    int sum = 0;
		    
		    for(int i = 0; i < N; i++) 
		    {
		    	moto[i] = scanner.nextInt();
		    	sum = sum + moto[i];
		    }
		    
		    Arrays.sort(moto);
		    System.out.println(N + (M - sum) / moto[0]);
		    scanner.close(); }
		  }

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair

int main(){
    int a,b; cin >> a >> b;
    string sa = to_string(a);
    string sb = to_string(b);
    
    string ans_a = "";
    string ans_b = "";
    rep(i,b){
        ans_a += sa;
    }

    rep(i,a){
        ans_b += sb;
    }

    if(ans_a > ans_b) cout << ans_b << endl;
    else cout << ans_a << 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 repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int H,W;
    cin >> H >> W;
    vector<string> vec(H);
    rep(i,H){
        cin >> vec[i];
    }
    rep(i,H){
        cout << vec[i] << endl;
        cout << vec[i] << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      int a,b,ans=0;
      cin >> a >> b;
      while (a<=b){
        if((a%10000)/1000 == (a%100)/10 && a/10000 == a%10)ans++;
        a++;
      }
      cout << ans;
    }

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


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

	for (int i = 1; i <= 9 ; i++)
	{		for (int j = 1; j <= 9; j++) {
			if (N== i*j)
			{
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main(void) {
  int n, x;
  int d, cnt, tmp;
  
  cin >> n >> x;
  d = 0; cnt = 1;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    d += tmp;
    if (d <= x) cnt++;
  }
  cout << cnt << endl;
  
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayInt();
            var P = input[0];
            var Q = input[1];
            var R = input[2];
            var ans = Math.Min(P + Q, Math.Min(Q + R, R + P));

            Console.WriteLine(ans);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

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

int main() {
  int N, M;
  vector<pair<string, int>> st;

  cin >> N;
  rep(i, N) {
    string s;
    cin >> s;
    st.emplace_back(s, 1);
  }

  cin >> M;
  rep(i, M) {
    string t;
    cin >> t;
    st.emplace_back(t, -1);
  }

  sort(st.begin(), st.end());
  st.emplace_back("___", 0);

  string s = "";
  int count = 0;
  int ans = 0;
  rep(i, N + M + 1) {
    if (st[i].first != s) {
      s = st[i].first;
      ans = max(ans, count);
      count = st[i].second;
    } else {
      count += st[i].second;
    }
  }

  cout << ans << endl;
}

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

int main() {
    long long n;
    std::vector<long long> bou;
    scanf("%lld", &n);
    for (long long i = 0; i < n; i++) {
        long long a;
        scanf(" %lld", &a);
        bou.push_back(a);
    }
    std::sort(bou.begin(), bou.end(), std::greater<long long>());
    long long max1 = 0;
    long long max2 = 0;
    for (auto itr = bou.begin(); itr !=bou.end(); itr++) {
        if (*itr == *(itr + 1)) {
            if (max1 == 0)
                max1 = *itr;
            else if (max2 == 0)
                max2 = *itr;
            else
                break;
            if (itr + 1 != bou.end())
                itr++;
        }
    }
    printf("%lld\n", max1 * max2);
    return 0;
}


Measured memory_bytes: 1400