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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#define RNG() rng()
#else
#define db(...) true
#define RNG() true
#endif

template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c;
	return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;

int N, L, R;
string s;
set<pair<int, pii>> S;



int main() {
	#ifdef LOCAL
	auto stTime = clock();
//	freopen("in.txt", "r", stdin);
	mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);

	cin >> N;


	for (int i = 1; i <= N; ++i) {
		cin >> s;
		stack<int> stk;
		int l = 0;


		for (auto& c : s) {
			if (c == '(')
				stk.push(0);
			else {
				if (stk.empty())
					++l;
				else
					stk.pop();
			}
		}

		int r = stk.size();

		if (!l)
			L += r;
		else if (!r)
			R += l;
		else
			S.insert(mp(i, mp(l, r)));
	}


	db(S);

	while (!S.empty()) {



		if (!L || !R) {
			cout << "No\n";
			return 0;
		}

		--L, --R;

		for (auto it = S.begin(); it != S.end();) {
			int l = it->sc.fs, r = it->sc.sc, i = it->fs;
			--l, --r;
			auto it2 = it;
			++it;
			S.erase(it2);
			if (!l || !r) {
				L += r, R += l;
			} else
				S.insert(mp(i, mp(l, r)));
		}

	}

	cout << (L == R ? "Yes\n" : "No\n");

	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif
	return 0;
}


Measured memory_bytes: 16328
h, w = map(int, input().split())
a = []
for i in range(h):
    a.append(list(input()))

now_x = 0
now_y = 0
while(True):
    if now_x+1 <w and a[now_y][now_x+1] == "#":
        a[now_y][now_x] = "."
        now_x+=1

    elif now_y+1 <h and a[now_y+1][now_x] == "#":
        a[now_y][now_x] = "."
        now_y+=1

    else:
        a[now_y][now_x] = "."
        break

check = True
for i in a:
    for j in i:
        if j == "#":
            check = False

print("Possible" if check else "Impossible")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<int, ll> pli;
typedef pair<double,double> pdd;
#define SQ(i) ((i)*(i))
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) int(i.size())
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef tmd
#define TIME(i) Timer i(#i)
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define TIME(i)
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif
class Timer {
private:
    string scope_name;
    chrono::high_resolution_clock::time_point start_time;
public:
    Timer (string name) : scope_name(name) {
        start_time = chrono::high_resolution_clock::now();
    }
    ~Timer () {
        auto stop_time = chrono::high_resolution_clock::now();
        auto length = chrono::duration_cast<chrono::microseconds>(stop_time - start_time).count();
        double mlength = double(length) * 0.001;
        debug(scope_name, mlength);
    }
};

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int iNF = 0x3f3f3f3f;
// const ll MAXN = 

string s, t;
/********** Good Luck :) **********/
int main () {
    TIME(main);
    IOS();
    cin >> s >> t;
    int cnt = 0;
    REP (i, 3) {
        cnt += s[i] == t[i];
    }

    cout << cnt << endl;
    return 0;
}


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

int main(){
	int n,i,ans = 0;
	cin >> n;
	for(i = 1; i <= 9; i++){
		if(n%i == 0){
			if(n/i <= 9){
				ans = 1;
				break;
			}
		}
	}
	if(ans){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000
#define MOD 1000000007

int main(){
  int n,w;
  cin>>n>>w;
  vector<int> vec(n);
  rep(i,n) cin>>vec[i];
  sort(all(vec));

  if(vec[0] > w){
    cout << 1 << endl;
    return 0;
  }

  vector<vector<long>> dp(w+1,vector<long>(n+1,0));
  // sum=w, min(unused)=n
  dp[0][0] = 1;
  rep(i,n){
    rep(j,i) for(int k=w; k-vec[i]>=0; k--) (dp[k][j] += dp[k-vec[i]][j])%=MOD;
    for(int k=w; k-vec[i]>=0; k--) (dp[k][i+1] += dp[k-vec[i]][i])%=MOD;
  }

  long ans = 0;
  rep(i,n){
    for(int j=max(1,w-vec[i]+1); j<=w; j++) ans += dp[j][i];
  }
  rep(i,w+1) ans += dp[i][n];

  cout << ans %MOD << endl;

  return 0;
}

Measured memory_bytes: 18864
// Do you knOW what it feels like?

		// To be TorTured by your own MinD?
	
	// I don't wanna feel the PAIN.

// I BeG you to KILL me, pleASE...

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

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("Os")

#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()

typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;

const ll maxn=1e5+10, mod=1e9+7, inf=1e18;

ll n,a[maxn],b[maxn];
map<ll,ll> wer;

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

	cin>>n;
	ll tom=0;
	for(int i=0;i<n;i++){ cin>>a[i]; b[i]=a[i]; }
	sort(a,a+n);
	for(int i=0;i<n;i++) wer[a[i]]=i;
	for(int i=0;i<n;i++) tom+=(wer[b[i]]+i)%2;
	cout<<tom/2;

	return 0;
}













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

using namespace std;
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	vector<int> a(n);
	rep(i,n) cin >>a[i];
	
	sort(all(a));
	int  ps= lower_bound(all(a), a[n-1]/2) - a.begin();
	int  ans = 0;
	int mn =   2*mod;
	for( int i= max(0, ps-5); i< min(n-1, ps+5) ; i++){
		int w = abs(a[n-1] - 2*a[i]);
		if(mn > w ){ ans = i; mn = w; }
	}
	
	cout << a[n-1] <<" " << a[ans] <<"\n";
	
	return 0;
	
}


Measured memory_bytes: 640
import java.util.*;
public class Main {
    static long gcd(long a, long b) {
        if(a<b) {
            long t = b;
            b = a;
            a = t;
        }
        if(b==0) {
            return a;
        }
        return gcd(a%b, b);
    }
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        char arr[] = str.toCharArray();
        int n = sc.nextInt();
        String ans = "";
        for(int i=0;;i+=n){
            if(i>=arr.length){
                break;
            } else ans+=arr[i];
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 26580
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <assert.h>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(){
  ll a,b,c,k;
  cin>>a>>b>>c>>k;
  ll ans = 0;
  if(a>=k){
    cout << k << endl;
    return 0;
  }
  else{
    k -= a;
    ans += a;
  }
  if(b>=k){
    cout << ans << endl;
    return 0;
  }
  else{
    k -= b;
  }
  ans -= k;
  cout << ans << endl;
  return 0;
}

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

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  swap(a,b);
  swap(a,c);
  cout<<a<<" "<<b<<" "<<c<<endl;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
///**
// *    author:  dattrinh
// *    created:    Codeforces Round #635
//**/
//#define pb push_back
//#define fi first
//#define ss second
//#define tp(x) fixed<<setprecision(x)
//using namespace std;
//using ll = int64_t;
//const int N = 1000003;
//ll t;
//
//int main()
//{
//    ios_base::sync_with_stdio(false);
//    cin.tie(0);
//    int n;cin>>n;
//    for(int i=1;i<=n;++i){
//       string s;cin>>s;
//       if(s=="Tetrahedron")t+=4;
//       else if(s=="Cube")t+=6;
//       else if(s=="Octahedron")t+=8;
//       else if(s=="Dodecahedron")t+=12;
//       else t+=20;
//    }
//    cout<<t;
//    return 0;
//}
//
//
//
//
#include <bits/stdc++.h>
/**
 *    author:  dattrinh
 *    created:    Codeforces Round #635
**/
#define pb push_back
#define fi first
#define ss second
#define tp(x) fixed<<setprecision(x)
using namespace std;
using ll = int64_t;
const int N = 1000003;
ll t;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int a,b,c;
    cin>>a>>b>>c;
    swap(a,b);
    swap(a,c);
    cout<<a<<" "<<b<<" "<<c;
    return 0;
}






Measured memory_bytes: 256
import java.io.IOException;
import java.math.BigInteger;
import java.util.Deque;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			String a = scanner.next();
			int b = scanner.nextInt();
			if (a.equals("0") && b == 0)
				break;
			BigInteger big = new BigInteger(a).pow(b);
			Deque<String> ans = new LinkedList<String>();
			String an = big.mod(man).toString();
			if (!an.equals("0"))
				ans.push(an);
			big = big.divide(man);
			for (int i = 0; i < 17; i++) {
				an = big.mod(man).toString();
				if (!an.equals("0"))
					ans.push(an + list[i]);
				big = big.divide(man);
			}
			while (!ans.isEmpty()) {
				System.out.print(ans.poll());
			}
			System.out.println();

		}
	}

	BigInteger man = new BigInteger("10000");
	String[] list = { "Man", "Oku", "Cho", "Kei", "Gai", "Jo", "Jou", "Ko",
			"Kan", "Sei", "Sai", "Gok", "Ggs", "Asg", "Nyt", "Fks", "Mts" };
}

Measured memory_bytes: 19552
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
const int mod=1e9+7;

int main(){
    int n,m;cin>>n>>m;
    priority_queue<int> Q;
    rep(i,n){
      int tmp;cin>>tmp;Q.push(tmp);
    }
    rep(i,m){
        int t=Q.top();Q.pop();
        t/=2;Q.push(t);
    }
    long long ans=0;
    rep(i,n){
        ans+=Q.top();Q.pop();
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=a;i<b;i++)
using namespace std;
bool compare(int a, int b) {
    return a > b;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    REP(i, 0, n) cin >> a[i];
    REP(i, 0, n) cin >> b[i];
    REP(i, 0, n) cin >> c[i];

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

    long long ans = 0;
    REP(j, 0, n) {
        long long ca = 0, cc = 0;
        ca = lower_bound(a.begin(), a.end(), b[j]) - a.begin();
        cc = upper_bound(c.begin(), c.end(), b[j]) - c.begin();
        ans += ca * (n - cc);
    }
    cout << ans << endl;
}


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

typedef long long ll;

ll va[100005];
ll A, B;
int n;

bool ok(ll use)
{
	ll ext = 0;
	for (int i = 0;i < n;i++) if (va[i] > use*B)
		ext += (va[i]-use*B+A-B-1)/(A-B);
	return ext <= use;
}

int main()
{
	scanf("%d%lld%lld", &n, &A, &B);
	for (int i = 0;i < n;i++) scanf("%lld", va+i);
	ll lo = 0, hi = 1ll<<30;
	while (lo+1 < hi)
	{
		ll mid = (lo+hi) / 2;
		if (ok(mid)) hi = mid;
		else lo = mid;
	}
	printf("%lld\n", hi);
	return 0;
}


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

int main(void){
  int a,b,i;
  scanf("%d",&a);
  scanf("%d",&b);
  if(a<b){
   for(i=0;i<b;i++){
    printf("%d",a);
   }
  }else{
   for(i=0;i<a;i++){
    printf("%d",b);
   }
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main()
{
    int val, vmax;
    cin >> val >> vmax;

    int aux;
    for(int i=0; i<val; i++) cin >> aux;

    int ans = (val - 1) / (vmax - 1);

    if((val - 1) % (vmax - 1))
        ans++;
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <complex>
#include <cstdio>

using namespace std;

const double pi = 4 * atan(1.0);

int main()
{
	int A, B, H, M;
	cin >> A >> B >> H >> M;

	auto p = polar((double)A, 2 * pi * (H / 12.0 + M / 720.0));
	auto q = polar((double)B, 2 * pi * (M / 60.0));

	double ans = abs(q - p);

	printf("%.16f", ans);
}


Measured memory_bytes: 4008
#include <bits/stdc++.h>
#define rep(i,s,n) for (int i=s;i<n;++i)
#define drep(i,s,n) for (int i=n;i>=s;--i)
#define all(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define print(x) cout<<(x)<<endl
using namespace std;
typedef long long ll;

int gcd(int a,int b)
{if (a%b == 0) return(b);
 else          return(gcd(b,a%b));}
int lcm(int a,int b)
{return a*b/gcd(a,b);}
void printv(vector<auto> v) {cout<<'[';rep(i,0,v.size()){cout<<v[i]<<',';}cout<<']'<<endl;}
void printvv(vector<vector<auto>> vv)
{
  cout<<'['<<endl;
  rep(q,0,vv.size()){cout<<'[';rep(p,0,vv.at(q).size())cout<<vv.at(q).at(p)<<',';cout <<']'<<endl;}
  cout<<']'<<endl;
}
void solve(); int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}
int step_x[] = {-1,0,0,1};
int step_y[] = {0,-1,1,0};
//------------------------------------------------------------
// ll n,t,m;
string n;
bool bl=false;

void solve() {
  cin>>n;

  rep(i,0,3) 
  {
    if(n[i]=='7') bl = true;
  }

  if(bl) print("Yes");
  else print("No");
  return;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

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

    vector<lint> l(n);
    for(auto& e : l)  cin >> e;

    sort(begin(l), end(l));

    lint ans = 0;
    for(lint i=0; i<n; i++)
    for(lint j=0; j<n; j++) {
        if(i == j)  continue;
        lint a = l[i];
        lint b = l[j];
        lint mi = upper_bound(begin(l), end(l), abs(a-b)) - begin(l);
        lint ma = lower_bound(begin(l), end(l), a+b) - begin(l);
        lint cnt = ma - mi;
        if(mi <= i && i < ma)  cnt--;
        if(mi <= j && j < ma)  cnt--;
        ans += cnt;
    }

    cout << ans/6 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//const ll INF = 1LL << 60;
//const int INF = 1001001001;

int main(void){
    string t[3]={"Sunny", "Cloudy", "Rainy"};
    string s;
    cin >> s;
    REP(i,3){
        if(s==t[i]) cout << t[(i+1)%3];
    }

    return 0;
}

Measured memory_bytes: 3500
# -*- coding:utf-8 -*-
N = input()

ans = N[0]
for i in range(2):
    if N[i] != N[i+1]:
        if int(N[i]) < int(N[i+1]):
            ans = str(int(N[i]) + 1)
        break

for i in range(3):
    print(ans, end="")
print()


Measured memory_bytes: 2940
program ABC171D
    implicit none
    integer(8)::N,Numbers(100000),i,Q,ans,B,C
    integer(8),allocatable::A(:)
    read*,N
    allocate(A(N))
    read*,A
    read*,Q
    Numbers=0
    ans=sum(A)

    do i=1,N
        Numbers(A(i))=Numbers(A(i))+1
    end do

    do i=1,Q
        read*,B,C
        ans=ans+Numbers(B)*(C-B)
        print'(i0)',ans
        Numbers(C)=Numbers(C)+Numbers(B)
        Numbers(B)=0
    end do
end program ABC171D

Measured memory_bytes: 4656
local H = io.read("*n")
local W = io.read("*n")
io.read("*l")

local map = {}
local whiteCount = 0
for h = 1, H do
	local str = io.read('*l')
	map[h] = {}
	for w = 1, W do
		if string.sub(str, w, w) == '.' then
			whiteCount = whiteCount + 1
			map[h][w] = 0
		else
			map[h][w] = -1
		end
	end
end

map[1][1] = 1
local stack = {}
table.insert(stack, {1, 1})
local function unvisit(h, w)
	if not map[h] then
		return false
	end
	return map[h][w] == 0
end
while(true) do
	if not stack[1] then
		print(-1)
		break
	end
	local t = stack[1]
	local h, w, steps = t[1], t[2], map[t[1]][t[2]]
	local neightbors = {
		{h - 1, w},
		{h, w - 1},
		{h + 1, w},
		{h, w + 1}
	}
	for k, v in ipairs(neightbors) do
		if v[1] == H and v[2] == W then
			print(whiteCount - (steps + 1))
			finded = true
			break
		end
		if unvisit(v[1], v[2]) then
			map[v[1]][v[2]] = steps + 1
			table.insert(stack, {v[1], v[2]})
		end
	end
	if finded then
		break
	end
	table.remove(stack, 1)
end

Measured memory_bytes: 760
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	string s;
	int n, i, j, k, minn, maxx;
	vector<int> c(3, 0);
	bool valid = false;

	cin >> s;
	for (auto ch : s) c[ch - 'a']++;
	minn = min(c[0], min(c[1], c[2]));
	c[0] -= minn; c[1] -= minn; c[2] -= minn;
	maxx = max(c[0], max(c[1], c[2]));

	if (maxx <= 1) cout << "YES\n";
	else cout << "NO\n";


	return 0;
}



Measured memory_bytes: 512
using System;
using System.Collections.Generic;
public class ABC135C {
    public static void Main() {
        int N;
        long ans = 0;
        List<int> A = new List<int>();
        List<int> B = new List<int>();
        N = int.Parse(Console.ReadLine());
        string[] str = Console.ReadLine().Split(' ');
        for (int i = 0; i < N + 1; i++) {
            A.Add(int.Parse(str[i]));
        }
        str = Console.ReadLine().Split(' ');
        for (int i = 0; i < N; i++) {
            B.Add(int.Parse(str[i]));
        }

        for (int i = 0; i < N; i++) {
            if (A[i] >= B[i]) {
                ans += B[i];
                A[i] -= B[i];
            } else if (A[i] + A[i + 1] >= B[i]) {
                ans += B[i];
                A[i + 1] -= (B[i] - A[i]);
            } else {
                ans += A[i] + A[i + 1];
                A[i] = 0;
                A[i + 1] = 0;
            }
        }
        Console.WriteLine(ans);
    }
}


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

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

    vector<vector<int>> A(N + 1, vector<int>(N + 1, 0));
    long long ans = 0;
    for (int i = 1; i <= N; i++)
    {
        for (int j = 1; j <= N; j++)
        {
            cin >> A[i][j];
            ans += A[i][j];
        }
    }
    ans /= 2;

    for (int from = 1; from <= N; from++)
    {
        for (int to = from + 1; to <= N; to++)
        {
            for (int junction = 1; junction <= N; junction++)
            {
                if (junction == from || junction == to)
                {
                    continue;
                }

                if (A[from][junction] + A[junction][to] < A[from][to])
                {
                    cout << -1 << endl;
                    return 0;
                }

                if (A[from][junction] + A[junction][to] == A[from][to])
                {
                    ans -= A[from][to];
                    break;
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
import java.util.*;
class Main{
    void solve(){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        for ( int i = 0; i < N; i++ ){
            int K = sc.nextInt();
            int P = sc.nextInt();
            System.out.println((K-1)%P + 1);
        }
    }
    public static void main(String[] args){ new Main().solve(); }
}



Measured memory_bytes: 26244
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


int main() {
    string S; cin >> S;
    int ans = 1e9;
    for(int i=0; i<S.size()-2; i++){
        int t = 0;
        for(int j=2; j>=0; j--){
            
            t += (S[i+2-j] - '0') * (int)pow(10,j);
        }
        ans = min(ans, abs(753-t));
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
n = int(input())
points = []
for i in range(n):
  points.append(tuple(map(int, input().split())))
res = 0
for i in range(n):
  for j in range(i+1, n):
    res += ((points[i][0] - points[j][0])**2 + (points[i][1] - points[j][1])**2)**.5
print(res * 2 / n)

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

#define MAX 10003

int main(){
	int n, r;
	while(scanf("%d%d", &n, &r), n){
		vector<vector<pair<int,int> > > ev(MAX);
		int x1, x2, y1, y2;

		for(int i = 0; i < n; ++i){
			scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
			ev[x1+1].push_back(make_pair(y1+1, 1));
			ev[x1+1].push_back(make_pair(y2+1, -1));
			ev[x2+1].push_back(make_pair(y1+1, -1));
			ev[x2+1].push_back(make_pair(y2+1, 1));
		}

		int area = 0, len = 0;

		vector<int> prev(MAX), now = prev, next = prev;
		for(int i = 0; i + 1 < MAX; ++i){
			fill(next.begin(), next.end(), 0);
			for(int j = 0; j < ev[i+1].size(); ++j){
				next[ev[i+1][j].first] += ev[i+1][j].second;
			}
			for(int j = 1; j < MAX; ++j){
				next[j] += next[j-1];
			}
			for(int j = 0; j < MAX; ++j){
				next[j] += now[j];
			}

			for(int j = 1; j + 1 < MAX; ++j){
				if(now[j] == 0) continue;
				++area;
				
				if(prev[j] == 0) ++len;
				if(next[j] == 0) ++len;
				if(now[j-1] == 0) ++len;
				if(now[j+1] == 0) ++len;
			}
			
			prev.swap(now);
			now.swap(next);
		}

		printf("%d\n", area);
		if(r == 2) printf("%d\n", len);
	}
}

Measured memory_bytes: 1696
use std::vec::Vec;
use std::cmp::min;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}

fn main() {
    let n: usize = read();
    let mut pair = Vec::new();

    for i in 1..1_000_001 {
      if n % i == 0 {
         pair.push((i, n / i));
      }
    }

    let ans: usize = pair.iter().fold(1_000_000_0000_0000, |acc, &(a, b)| min(acc, a+b-2));
    println!("{}", ans);
}


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

int main() {
  	long long int N;
  	cin >> N;
  	long long int A[N];
  	for (int i = 0; i < N; i++) cin >> A[i];
  	
  	long long int res = 1;
  
  	bool flag = false;
  
  	for (int i = 0; i < N; i++){
      	if (A[i] == 0) flag = true;
    }
  	
  	if (flag == true) cout << 0 << endl;
  	else {for (int i = 0; i < N; i++){
      	if (1000000000000000000 / res < A[i] || 1000000000000000000 / A[i] < res){
          	res = -1;
           	break;
        }
        res *= A[i];
      	if (res > 1000000000000000000 || res <= 0){
          	res = -1;
          	break;
        }
    }
  
  	cout << res << endl;}
}

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

/* snippet: useful macros and functions */
#define ARC(i, a, b) for(Int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for(Int i = (a) - 1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)
template<class T> T ant(const T &a, const T &b){ return a > b ? a : b; }
template<class T> T ont(const T &a, const T &b){ return a < b ? a : b; }
template<class T> T rng(const T &a, const T &b){ return a < b ? b - a : a - b; }
template<class T> void th(T &a, const T &b, T (*f)(const T &, const T &)){ a = f(a, b); }
#define anth(a, b) th(a, b, ant)
#define onth(a, b) th(a, b, ont)

/* snippet: modint library */
template<class T, int MOD>
class Modint{
	T val;
public:
	Modint(T val = 0) : val(val) {}
	operator T(){ return val; }
	Modint &operator+=(const Modint &a){ val += a.val; if(val >= MOD) val -= MOD; return *this; }
	Modint &operator-=(const Modint &a){ val -= a.val; if(val < 0) val += MOD; return *this; }
	Modint &operator*=(const Modint &a){ val = val * a.val % MOD; return *this; }
	void inverse(){T x[2]={MOD,val},a[2]={0,1};int i;for(i=0;x[!i];i^=1){a[i]-=x[i]/x[!i]*a[!i];x[i]=x[i]%x[!i];}if(!i)a[i]+= MOD;val=a[i];}
	Modint &operator/=(Modint a){ a.inverse(); return *this *= a; }
	friend Modint modpow(Modint a, int n){ Modint ret(1); while(n){ if(n & 1) ret *= a; a *= a; n >>= 1; } return ret; }
	friend Modint operator+(Modint a, const Modint &b){ return a += b; }
	friend Modint operator-(Modint a, const Modint &b){ return a -= b; }
	friend Modint operator*(Modint a, const Modint &b){ return a *= b; }
	friend Modint operator/(Modint a, const Modint &b){ return a /= b; }
	friend std::ostream &operator<<(std::ostream &os, const Modint &a){ return os << a.val; }
};

/* snippet: using declarations */
using Int = long long;
using std::cout;
using std::cin;
using std::endl;
using Mint = Modint<long long, 1000000007>;

Int n, k;
Mint a[112345];

int main(){
	cin >> n >> k;
	for(Int i = k; i >= 1; --i){
		a[i] = modpow(Mint(k / i), n);
		for(int j = 2; i * j <= k; ++j){
			a[i] -= a[i * j];
		}
	}
	Mint ans;
	for(Int i = 1; i <= k; ++i){
		ans += a[i] * Mint(i);
	}
	cout << ans << endl;
}


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

int main()
{
    int n,m;
    cin>>n;
    vector<int>a(n);
    REP(i,n)cin>>a[i];
    cin>>m;
    vector<int>b(m);
    REP(i,m)cin>>b[i];
    vector<int>c;
    set_difference(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
    for(auto i:c)cout<<i<<endl;
}



Measured memory_bytes: 5488
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
	private static BufferedReader br;

	// 入力されるデータセットを格納するためのリスト
	private static ArrayList<String> dataSet = new ArrayList<String>();

	// mainメソッド
	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		String[] splitedLine = line.split(" ");
		int N = Integer.parseInt(splitedLine[0]);
		int M = Integer.parseInt(splitedLine[1]);

		inputDataSet(M); // データセットを読み込み、dataSetに格納する

		int costSum = 0;
		int max = 0;
		for(String data : dataSet) {
			int missNum = Integer.parseInt((data.split(" "))[1]);
			if(missNum > N) {
				if(missNum > max) {
					max = missNum;
				}

				costSum += missNum - N;
			}
		}
		if(max > N) {
			costSum -= max - N;
		}

		System.out.println(costSum);
	}

	// 指定された行数だけ読み込み、行ごとにdataSetに格納していくメソッド
	public static void inputDataSet(int rawNum) {
		for(int i = 0;i < rawNum;i++) {
			String line = null;
			try {
				line = br.readLine(); // 標準入力から読み込む
			} catch (IOException e) {
				e.printStackTrace();
			}

			// 行の終わりに達した場合、終了
			if(line == null)break;

			dataSet.add(line); // 読み込んだ行をdataSetに追加
		}
	}

	// 終端(terminal)まで読み込み、行ごとにdataSetに格納していくメソッド
	public static void inputDataSet(String terminal) {
		while(true) {
			String line = null;
			try {
				line = br.readLine(); // 標準入力から読み込む
			} catch (IOException e) {
				e.printStackTrace();
			}

			// 行の終わり、もしくはterminalと一致した場合、終了
			if(line == null || line.equals(terminal))break;

			dataSet.add(line); // 読み込んだ行をdataSetに追加
		}
	}
}



Measured memory_bytes: 25864
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#N = int(input())
a, b = map(str, input().split())

d = int(a+b)

if d == (math.floor(d**0.5) ** 2) :
  print ("Yes")
else :
  print ("No")


Measured memory_bytes: 38256
// Problem A

#include <stdio.h>
#include <iostream>
#include <vector>
#include <string.h>
#include <cassert>
#include <algorithm>
#include <set>
#include <map>
#include <math.h>
#include <queue>
#include <stack>

#define MAXN 1000
#define pb push_back
#define mp make_pair

using namespace std;

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



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


Measured memory_bytes: 3616
#include <iostream>
#include <math.h>
using namespace std;

int main(){
	unsigned long long int s;
	unsigned long long int y3,x3;
	cin>>s;
	if (s / 1000000000 == 1000000000){
		cout<<0<<" "<<0<<" "<<1000000000<<" "<<1<<" "<<0<<" "<<1000000000<<endl;
	}else{
		y3 = s / 1000000000 + 1;
		x3 = 1000000000 - s % 1000000000;
		cout<<0<<" "<<0<<" "<<1000000000<<" "<<1<<" "<<x3<<" "<<y3<<endl;
	
	}
	return 0;
}

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

using namespace std;

template<class T, class U>
void ckmin(T &a, U b)
{
	if (a > b) a = b;
}
template<class T, class U>
void ckmax(T &a, U b)
{
	if (a < b) a = b;
}

#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)
#define SZ(x) ((int) ((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define INF 998244353
#define MAXN 1000013

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

int N;
ll arr[MAXN];
int sp[MAXN];
vi primes;
vi factors[MAXN];
ll sum[MAXN];
ll co[MAXN];
ll ans;

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	cout << fixed << setprecision(12);
	cerr << fixed << setprecision(4);
	FOR(i, 1, MAXN)
	{
		co[i] = 1;
	}
	FOR(i, 1, MAXN)
	{
		factors[i].PB(i);
		for (int k = i + i; k < MAXN; k += i)
		{
			factors[k].PB(i);
			co[k] -= co[i] * (k / i);
		}
	}
	// cerr << co[1] << co[2] << co[3] << co[6] << endl;
	cin >> N;
	FOR(i, 0, N)
	{
		cin >> arr[i];
		for (int x : factors[arr[i]])
		{
			sum[x] += arr[i];
		}
	}
	FOR(i, 0, N)
	{
		for (int x : factors[arr[i]])
		{
			ans += (sum[x] / x) * co[x] % INF * arr[i];
			ans %= INF;
		}
	}
	FOR(i, 0, N)
	{
		ans -= arr[i];
	}
	ans %= INF; if (ans < 0) ans += INF; if (ans & 1) ans += INF;
	ans >>= 1;
	cout << ans << '\n';
	// sp[1] = 1;
	// FOR(i, 2, MAXN)
	// {
	// 	if (sp[i] == i)
	// 	{
	// 		primes.PB(i);
	// 	}
	// 	for (int p : primes)
	// 	{
	// 		if (sp[i] < p || i * p >= MAXN)
	// 		{
	// 			break;
	// 		}
	// 		sp[i * p] = p;
	// 	}
	// }
	//sum lcm(ai, aj)
	//sum of all numbers divisible by x.
	// cout << "time elapsed = " << clock() / (CLOCKS_PER_SEC / 1000) << " ms " << endl;
	return 0;
}


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

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

int n, a[5], b[5];
int dp1[5][5005], dp2[5][25000005];
signed main() {
	cin >> n;
	rep(i, 3)cin >> a[i];
	rep(i, 3)cin >> b[i];
	rep(i, 5) {
		fill(dp1[i], dp1[i] + 5005, -1);
		fill(dp2[i], dp2[i] + 25000005, -1);
	}
	dp1[0][0] = 0;
	rep(i, 4) {
		rep(j, n + 1) {
			if (dp1[i][j] == -1)continue;
			dp1[i + 1][j] = max(dp1[i + 1][j], dp1[i][j]);
			if (i&&j+a[i-1]<=n) {
				dp1[i][j + a[i - 1]] = max(dp1[i][j + a[i - 1]], dp1[i][j] + b[i - 1] - a[i - 1]);
			}
		}
	}
	int m = 0;
	rep(i, n + 1) {
		m = max(m, dp1[3][i]);
	}
	m += n;
	dp2[0][0] = 0;
	rep(i, 4) {
		rep(j, m + 1) {
			if (dp2[i][j] == -1)continue;
			dp2[i + 1][j] = max(dp2[i + 1][j], dp2[i][j]);
			if (i&&j+b[i-1]<=m) {
				dp2[i][j + b[i-1]] = max(dp2[i][j + b[i-1]], dp2[i][j] + a[i - 1] - b[i - 1]);
			}
		}
	}
	int ans = 0;
	rep(i, m + 1)ans = max(ans, dp2[3][i]);
	cout << ans + m << endl;
}


Measured memory_bytes: 977152
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <utility>
#include <math.h>
#include <stdexcept>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <cassert>
#include <string.h>

using namespace std;
#define  rep(i,n) for(int i=0;i<n;i++)
#define  rrep(i,n) for(int i=n-1;i>=0;i--)///n-1番目からn回
#define  REP(i,a,b) for(int i=a;i<b;i++) ///a番目からb回
#define  RREP(i,a,b) for(int i=a;i<b;i--)
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<string> vs;

#define MOD 1000003

//int arr[N]
////sort(arr,arr +N)

//vector <int> hoge
////sort(hoge.begin(),hoge.end());
///*min_element(hoge.begin(),hoge.end();　最小値　　　最大値はmax_element();
///(10-(n%10))%10  1桁目取得

#define Ru(n)  ( ((n)+9)/10*10  ) //切りあげ
#define Rd(n)  ( ((n)-10)/10*10 +10 )	切り捨て

int gcd(int a,int b);
size_t length(const std::string& str) {
	return str.length();
}



int main() {
	int h,w,first[1000],second[1000],dif[10000];
	cin>>h>>w;
	if(w-1!=0)
		cout<<h-(w-1)-1;
	else
		cout<<0;
	return 0;

}





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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vb=vector<bool>;
using vvb=vector<vb>;
using vc=vector<char>;
using vvc=vector<vc>;
using pii = pair<int,int>;
using pil = pair<int,ll>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using tiii = tuple<int,int,int>;
using vpii = vector<pii>;
using vpil = vector<pil>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  int L,R,d;
  cin >> L >> R >> d;
  
  cout << R/d-(L-1)/d << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string a,b;
  int n,i;
  cin >> n;
  cin >> a >> b;
  for(i=0;i<n;i++)
  {
    cout << a[i] << b[i];
  }
  cout << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define mem(a,val) memset(a,(val),sizeof((a)))
#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define decimal(n)  cout << fixed ; cout << setprecision((n));
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define f first 
#define s second
#define all(v) v.begin(), v.end()
#define endl "\n"
#define lcm(m,n) (m)*((n)/__gcd((m),(n)))
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(ll (i)=1;(i)<(n);(i)++)
#define repa(i,n,a) for(ll (i)=(a);(i)<(n);(i)++)
#define repr(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define tr(c,it) for(auto (it)=c.begin();(it)!=c.end();++(it))
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define M 1000000007
#define MM 998244353
#define sz(x) (ll)x.size()
#define ub upper_bound
#define lb lower_bound
#define pcnt(x) __builtin_popcountll(x)
#define N 1000000
#define N2 1000000000

int main()
{
 FAST
//code begins from here//
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
ll n,k;
cin>>n>>k;
ll h[n+1];
rep1(i,n+1)cin>>h[i];
ll dp[n+1];
dp[0]=0;
dp[1]=0;
dp[2]=abs(h[2]-h[1]);
if(k<=n)
{
   repa(i,k+1,3)
   {
       ll tmp=LLONG_MAX;
       rep1(j,i)
       {
          tmp=min(tmp,dp[j]+abs(h[j]-h[i]));
       }
       dp[i]=tmp;
   }
   repa(i,n+1,k+1)
   {
       ll tmp=LLONG_MAX;
       repa(j,i,i-k)
       {
          tmp=min(tmp,dp[j]+abs(h[j]-h[i]));
       }
       dp[i]=tmp;
   }
}
else
{
     repa(i,n+1,3)
   {
       ll tmp=LLONG_MAX;
       rep1(j,i)
       {
          tmp=min(tmp,dp[j]+abs(h[j]-h[i]));
       }
       dp[i]=tmp;
   } 
}
cout<<dp[n];
return 0;
}


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

int main(){
  string s;
  cin >> s;
 for(int i = 0;i < 4;i++)
    cout << s[i];
  cout << " ";
  for(int i = 4;i < s.size();i++)
    cout << s[i];
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#![allow(dead_code)]
fn solve(src: &str) -> String {
    let mut sc = Scanner::from_str(src);
    use std::fmt::Write;
    let mut buf = String::new();

    let n: usize = sc.read();
    let q: usize = sc.read();
    let neighbor = {
        let mut neighbor = vec![vec![]; n];
        for _ in 0..n - 1 {
            let v: usize = sc.read();
            let w: usize = sc.read();
            neighbor[v - 1].push(w - 1);
            neighbor[w - 1].push(v - 1);
        }
        neighbor
    };
    let mut counter = vec![0; n];
    for _ in 0..q {
        let p: usize = sc.read();
        let x: usize = sc.read();
        counter[p-1] += x;
    }
    let dfs = dfs(0, n, &neighbor);
    let mut ancestor = vec![None; n];
    for &v in &dfs {
        if let Some(a) = ancestor[v] {
            counter[v] += counter[a];
        }
        for &w in &neighbor[v] {
            if Some(w) != ancestor[v] && ancestor[w] == None {
                ancestor[w] = Some(v);
            }
        }
    }
    for v in 0..n {
        write!(&mut buf, "{} ", counter[v]).unwrap();
    }

    buf
}
fn dfs(start: usize, n: usize, neighbor: &[Vec<usize>]) -> Vec<usize> {
    let mut a = Vec::new();
    let mut stack = vec![start];
    let mut visited = vec![false; n];
    visited[start] = true;
    while let Some(v) = stack.pop() {
        a.push(v);
        for &w in &neighbor[v] {
            if !visited[w] {
                visited[w] = true;
                stack.push(w);
            }
        }
    }
    a
}
#[test]
fn test_solve() {
   assert_eq!(solve("4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n"), "100 110 111 110 ");
   assert_eq!(solve("6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n"), "20 20 20 20 20 20 ");
}
fn main() {
    let mut buf = String::new();
    use std::io::Read;
    std::io::stdin().read_to_string(&mut buf).unwrap();
    use std::io::Write;
    std::io::stdout().write_all(solve(&buf).as_bytes()).unwrap();
}
struct Scanner<I> {
    src: I,
}
impl<'a> Scanner<std::str::SplitWhitespace<'a>> {
    fn from_str(src: &'a str) -> Self {
        Scanner {
            src: src.split_whitespace(),
        }
    }
}
impl<'a, I> Scanner<I>
where
    I: std::iter::Iterator<Item = &'a str>,
{
    fn read<T: std::str::FromStr>(&mut self) -> T {
        self.src.next().unwrap().parse().ok().expect("Parse error")
    }
    fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    fn chars(&mut self) -> Vec<char> {
        self.src.next().unwrap().chars().collect()
    }
}


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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

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

    int kyori = INF;
    rep(i,100)
    {
        int tmp_kyori = 0;
        rep(j,N)
        {
            tmp_kyori += pow((x[j] - i),2);
        }
        if( tmp_kyori < kyori )
        {
            kyori = tmp_kyori;
        }
    }
    cout << kyori << endl;



}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pf push_front
#define mod 1000000007
#define endl '\n'
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


int main()
{
    ll n,i;
    cin>>n;
    set<ll>st;
    ll arr[n];
    for(i=0;i<n;i++)
    {
        cin>>arr[i];
        st.insert(arr[i]);
    }
    if(st.size()==n)
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
}


Measured memory_bytes: 11136
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int INF = 1 << 20;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main()
{
    while(true){
        int n,m,a; cin >> n >> m >> a;
        if(n==0&&m==0&&a==0) break;
        vector<pair <int,pair<int,int> > > v(m);
        int hight = 0;
        for(int i = 0; i < m; i++){
            int h,p,q; cin >> h >> p >> q;
            v[i] = make_pair(h,make_pair(p,q));
            hight = max(hight,h);
        }
        sort(v.begin(),v.end());
        reverse(v.begin(),v.end());
        for(int i = 0; i < m; i++){
            if(v[i].second.first == a){
                a = v[i].second.second; 
            }else if(v[i].second.second == a){
                a = v[i].second.first;
            }
        }
        cout << a << endl;
    }
}


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

#define N 10005

int n, m, cnt[N];

vector<int> to[N];

signed main(void)
{
	cin >> n >> m;
	
	memset(cnt, 0, sizeof(cnt));
	
	for (int u, v; m--; )
	{
		cin >> u >> v;
		to[u].push_back(v); ++cnt[v];
	}
	
	queue<int> que;
	
	for (int i = 0; i < n; ++i)
		if (!cnt[i])que.push(i);
		
	while (!que.empty())
	{
		int u = que.front(); que.pop();
		
		cout << u << endl;
		
		for (auto v : to[u])
			if (--cnt[v] == 0)
				que.push(v);
	}
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	string s; cin >> s;
	REP(i, s.size() - 8) cout << s[i];
	cout << endl;
	return 0;
}

Measured memory_bytes: 256