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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-9;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int n;
  cin>>n;
  cout<<((n-1)/1000+1)*1000-n<<'\n';
  return 0;
}


Measured memory_bytes: 3648
#ifdef _WIN32
#include "stdc++.h"
#else
#include <bits/stdc++.h>
#endif

// 継承可能な型
template <class Type>
struct IN : Type
{
	IN()
	{
		std::cin >> *this;
	}
};

// 継承不可能な型
template <class Type>
struct IN_
{
	Type val;

	IN_()
	{
		std::cin >> val;
	}

	operator Type&()
	{
		return val;
	}

	IN_<Type>& operator=(const Type& _value)
	{
		val = _value;
		return *this;
	}
};

template <class Char, class Type>
std::basic_ostream<Char>& operator <<(std::basic_ostream<Char>& os, const IN_<Type>& value)
{
	return os << value.val;
}

template <class Char, class Type>
std::basic_istream<Char>& operator >>(std::basic_istream<Char>& is, IN_<Type>& value)
{
	return is >> value.val;
}

template <class Type>
void OUT(const Type& value)
{
	std::cout << value << std::endl;
}

template <class Type, class ... Args>
void OUT(const Type& value, const Args& ... args)
{
	std::cout << value << ' ';
	OUT(args...);
}

void Yes()
{
	OUT("Yes");
}
void No()
{
	OUT("No");
}

using ll = long long;
using inll = IN_<ll>;
using vll = std::vector<ll>;
using setll = std::set<ll>;
using msetll = std::multiset<ll>;
using instr = IN<std::string>;

// 階乗を計算 O(N) (N=10^7 で O(10^7))
int Factorial(ll n)
{
	for (ll i = n - 1; i > 1; i--)
		n *= i;
	return n;
}

// nCrを計算 O(N) (N=10^7 で O(10^7))
ll Combination(const ll n, const ll r)
{
	return Factorial(n) / (Factorial(r) * Factorial(n - r));
}

// 素数判定 O(sqrt(N)) (N=10^7 で O(10^3))
bool IsPrime(const ll num)
{
    if (num < 2) return false;
    if (num == 2) return true;
    if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }

    return true;
}

// 各桁の和を計算 O(logN) (N=10^7 で O(7))
ll DigitSum(ll n)
{
	ll sum = 0;
	while(n != 0){
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

#define FOR(i, m, n) for (ll (i) = (m); (i) < (n); ++(i))
#define REP(i, n) for (ll (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for (ll (i) = (n); (i) >= 0; --(i))
#define ITRREP(it, v) for (auto (it) = (v).begin(); (it) != (v).end(); ++(it))
#define ITRREPR(it, v) for (auto (it) = (v).rbegin(); (it) != (v).rend(); ++(it))
#define DIVUP(a, b) (((a) + (b) - 1) / (b))

void Main();

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

	Main();

#ifdef _DEBUG
	system("pause");
#endif

	return 0;
}

using namespace std;

//////////////////////////////

void Main()
{
	inll n, k;
	vll a;
	REP(i, n)
	{
		inll a_;
		a.push_back(a_);
	}

	return OUT(
		((n - 1) / (k - 1)) +
		(((n - 1) % (k - 1) == 0) ? 0 : 1)
	);
}


Measured memory_bytes: 1400
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	String [] table = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101","1110", "1111"};
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		int dataset = sc.nextInt();
		while(dataset-- > 0){
			String s = sc.next();
			StringBuilder sb = new StringBuilder();
			for(int i = 0; i < s.length(); i++){
				int ind = s.charAt(i) - '0';
				if(ind > 9){
					ind = s.charAt(i) - 'a' + 10;
				}
				sb.append(table[ind]);
			}
			double min = 0.0, value = 0.5;
			for(int i = 0; i < 7; i++){
				char c = sb.charAt(32 - 7 + i);
				if(c == '1'){
					min += value;
				}
				value = value * 0.5;
			}
			String op = sb.charAt(0) == '0' ? "" : "-";
			String temp = sb.substring(1, 32-8 + 1);
			int num = Integer.parseInt(temp, 2);
			String res = (min - (int)min) + "";
			System.out.println(op + num + "." + res.substring(2));
		}
	}


	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}
}

Measured memory_bytes: 42348
import math

# 1行目の入力を空白で分割された数値として扱う
X = int(input())

# 素数
def isPrime(n):
    for i in range(2, int(math.sqrt(n) + 1)):
        if n % i == 0:
            return False
    return True

while True:
    if isPrime(X):
        print(X)
        break
    else:
        X += 1

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

vector<int> pre_kmp(string pat) {
	int k;
	vector<int> table((int)pat.size() + 1);
	table[0] = -1;

	for (int i = 1; i <= pat.size(); ++i) {
		k = table[i-1];

		while (k >= 0) {
			if (pat[k] == pat[i-1]) break;
			else k = table[k];
		}

		table[i] = k + 1;
	}

	return table;
}

const int maxn = 500010;

int to[maxn];

void match(string t, string p, vector<int> fail, int slen) {
	int n = t.size(), m = p.size();

	for (int i = 0, k = 0; i < n; ++i) {
		while (k >= 0 && p[k] != t[i]) {
			k = fail[k];
		}
		if (++k == m) {
			// match at t[i-m+1 .. i]
			if (i - m + 1 < slen) to[i - m + 1] = (i + 1) % slen;
			k = fail[k];
		}
	}
}

int main() {
	memset(to, -1, sizeof(to));

	string s, t;
	cin >> s >> t;
	int slen = s.size(), tlen = t.size();

	string u;
	while (u.size() < slen + tlen) u += s;

	vi vec = pre_kmp(t);

	match(u, t, vec, slen);

	vi out(slen);
	vector<vi> rev(slen);

	queue<int> que;
	vi dp(slen, -1);

	rep(i, slen) {
		if (to[i] != -1) {
			rev[to[i]].pb(i);
		} else {
			dp[i] = 0;
			que.push(i);
		}
	}

	while (!que.empty()) {
		int v = que.front(); que.pop();
		for (int a : rev[v]) {
			dp[a] = dp[v] + 1;
			que.push(a);
		}
	}

	bool ng = 0;
	int m = *max_element(ALL(dp));
	rep(i, slen) if (dp[i] == -1) {
		ng = 1;
	}

	if (ng) {
		puts("-1");
	} else {
		cout << m << endl;
	}

	return 0;
}

Measured memory_bytes: 37864
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll Pow(ll n,ll p){
	ll r=1;
	for(;p>0;p>>=1){
		if(p&1) r=(r*n)%mod;
		n=(n*n)%mod;
	}
	return r;
}

const int M=2000005;
ll F[M];

void Init(){
	F[0]=1;
	for(int i=1;i<M;i++) F[i]=F[i-1]*i%mod;
}

ll Div(ll n,ll m){
	return n*Pow(m,mod-2)%mod;
}

ll nCk(ll n,ll k){
	return Div(F[n],F[n-k]*F[k]%mod);
}

string s,t;

int main(){
	cin>>s>>t;
	int n=s.size(),res=0;
	for(int i=0;i<n;i++) if(s[i]!=t[i]) res++;
	cout<<res<<endl;
}

Measured memory_bytes: 3848
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S max_L(S a,T b){
  return a>=b?a:b;
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(unsigned x){
  int s=0;
  char f[10];
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(long long x){
  int s=0;
  int m=0;
  char f[20];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(unsigned long long x){
  int s=0;
  char f[21];
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(double x){
  printf("%.15f",x);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
inline void wt_L(string &x){
  int i=0;
  for(i=0;x[i]!='\0';i++){
    putchar_unlocked(x[i]);
  }
}
int main(){
  int N;
  int R;
  rd(N);
  rd(R);
  wt_L(R + 100 *max_L(0, 10-N));
  wt_L('\n');
  return 0;
}
// cLay varsion 20200217-1

// --- original code ---
// {
//   int N, R;
//   rd(N,R);
//   wt(R + 100 * max(0,10-N));
// }


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
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;}
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

ll N,Q,c,x,y;
vector<int> bit;

void add(int i, int x){
    while(i <= N){
        bit[i] += x;
        i += i & -i;
    }
}

int sum(int x, int y){
    int res = 0;
    while(x > 0){
        res -= bit[x];
        x -= x & -x;
    }
    while(y > 0){
        res += bit[y];
        y -= y & -y;
    }
    return res;
}


int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> N >> Q;
    // init (1-indexed) //
    bit.resize(N+1,0);
    // init //

    REP(i,Q){
        cin >> c >> x >> y;
        if(c==0){
            add(x,y);
        } else {
            cout << sum(x-1,y) << endl;
        }
    }
    return 0;
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

string split(const string &str, const string &delim){
    string res;
    size_t current = 0, found, delimlen = delim.size();
    while((found = str.find(delim, current)) != string::npos){
        res+=string(str, current, found - current) + " " + delim + " ";
        current = found + delimlen;
    }
    res+=string(str, current, str.size() - current);
    return res;
}

int n,c;
typedef tuple<int,int,int> edge;
vector<edge> es;
vector<int> dist;

void bellmanford(){
    fill_n(dist.begin(),n,inf);
    dist[0]=0;

    for(int i=0; i<2*n; ++i){
        for(edge& e:es){
            int a=get<0>(e),b=get<1>(e),w=get<2>(e);
            if(dist[a]+w<dist[b]) dist[b]=dist[a]+w;
        }
    }
}

void add_edge(string& constraint){
    constraint=split(constraint,">=");
    constraint=split(constraint,"<=");
    constraint=split(constraint,"+");
    constraint=split(constraint,"-");

    int a,b,d;
    string tmp1,tmp2;
    stringstream ss(constraint);
    ss >> a >> tmp1 >> b >> tmp2 >> d;
    --a; --b;

    if(tmp1=="<=") es.push_back(make_tuple(b,a,0));
    else if(tmp1==">=") es.push_back(make_tuple(a,b,0));

    int w=-d;
    if(tmp2=="-"){
        w*=-1;
        swap(a,b);
    }
    if(tmp1=="<=") es.push_back(make_tuple(b,a,w));
    else if(tmp1==">=") es.push_back(make_tuple(a,b,w));
}

void solve(){
    cin >> n >> c;

    dist.resize(n);
    vector<string> unfixed;

    rep(i,0,c){
        string constraint;
        cin >> constraint;
        if(constraint.find("*")==string::npos) add_edge(constraint);
        else unfixed.push_back(constraint);
    }
    rep(v,1,n) es.push_back(make_tuple(v,0,0));

    vector<edge> es_=es;
    int ans=-1;
    rep(b,0,1<<unfixed.size()){
        es=es_;
        rep(i,0,unfixed.size()){
            string constraint=unfixed[i];
            if(1&(b>>i)) constraint.replace(constraint.find("*"),1,"<=");
            else constraint.replace(constraint.find("*"),1,">=");
            add_edge(constraint);
        }

        bellmanford();
        if(dist[0]<0) continue;
        rep(i,0,n) ans=max(ans,dist[i]);
    }
    if(ans==inf) cout << "inf" << endl;
    else cout << ans << endl;
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	solve();
	return 0;
}

Measured memory_bytes: 3280
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF 1e9
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;


int n,k;
int a[112345];
int main(){

    cin>>n>>k;
    rep(i,n)cin>>a[i];

    int memo=-1;
    rep(i,n){
        if(a[i]==1)memo=i;
    }

    int ans=0;

    int t=n-1;

    ans=(t+(k-2))/(k-1);
    cout<<ans<<endl;


}





Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define WRAP(y,x,h,w) (0<=y && y<h && 0<=x && x<w)

typedef long long ll;
typedef unsigned long long ull;
typedef string str;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

struct st
{
	int c;
	int s;
	int f;
};

int main() {
	int n;
	cin >> n;
	vector<st> sts(n - 1);
	REP(i, n - 1) {
		cin >> sts[i].c >> sts[i].s >> sts[i].f;
	}
	REP(i, n) {
		int ans=0;
		if (i != n - 1) {
			ans = sts[i].s;
		}
		FOR(j, i + 1, n) {
			ans += sts[j - 1].c;
			if (j == n - 1)
				break;
			if (ans < sts[j].s) {
				ans = sts[j].s;
			}
			else 
			{
				ans += (sts[j].f-(ans%sts[j].f)) % sts[j].f;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
    result=(result*base)%modulus;
    exponent=exponent>>1;
    base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
  if(N<K)return 0;
  if(K==0)return 1;
  if(N==0)return 0;

  ll den=1;
  for(ll i=1;i<=K;i++)den*=i;
  ll num=1;
  while(K--){
    num*=N;
    if(num%den==0){
      num/=den;
      den=1;
    }
    N--;
  }

  return num;
}
*/

ll n,k,a[2*MAX];

ll pro(ll x){
  ll cuts = 0;
  for(ll i=1;i<=n;++i){
    cuts+=(a[i]+x-1)/x-1;
  }
  return cuts;
}

int main(){FAST;
cin>>n>>k;
for(ll i=1;i<=n;++i){
  cin>>a[i];
}
ll lo = 1,hi = 1000000000;
while(lo<hi){
  ll mid = (lo+hi)>>1;
  ll cuts = pro(mid);
  if(cuts>k){
    lo = mid+1;
  }
  else{
    hi = mid;
  }
}
cout<<lo;
return 0;
}

/*
 WA? check edge cases, N=1,M=1 etc. Read code fully once and check all variables.
 Read the question again and see what you might have missed.
 Consider changing your solution or find more cases.
 */


Measured memory_bytes: 5212
#include<iostream>
#include<vector>
#define F(i,n) for(int i=0;i<n;i++)
#define lli long long int
#define vi vector<int> v
#define vpb(x) v.push_back(x)
#define spb(x) s.push_back(x)
using namespace std;
// int ans()
// {

// }
int main()
{
    string s;
     cin>>s;
     int count=0,maxco=0;
     for(int i=0;s[i]!='\0';i++)
     {
         if(s[i]=='R')
         {count++;
         maxco = max(maxco,count);
         }
         else
         {
             count=0;
         }
         
     }
     cout<<maxco;
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define rep(i,l,r)for(int i=(l);i<(r);i++)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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; }
//ミョ(-ω- ?)
int main() {
    int n;
    cin >> n;
    if(n == 1){
        cout << "Hello World\n";
    }else{
        int a,b;
        cin >> a >> b;
        cout << a + b << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) ((y)<0||(x)<0||(y)>=(h)||(x)>=(w))
#define dump(...)
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct{template<class T> operator T(){T x;cin>>x;return x;}} IN;
struct before_main_function {
    before_main_function() {
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N;
    cin >> N;
    vector<int> P(N);
    cin >> P;
    vector<int> c(N + 1, 0);
    REP(i, N) {
        chmax(c[P[i]], c[P[i] - 1] + 1);
    }
    int mx = (*max_element(ALL(c)));
    cout << N - mx << endl;
    return 0;
}



Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> v(m);
    rep(i, m)
    {
        cin >> v[i].second >> v[i].first;
        v[i].first--;
        v[i].second--;
    }
    sort(ALL(v));
    int cur = 0;
    int ans = 0;
    while (cur < m)
    {
        int end = v[cur].first;
        // cerr << end << endl;
        while (cur < m && v[cur].second < end)
        {
            cur++;
        }
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
N = int(input())
w = []
ans = "Yes"
for i in range(N):
  s = str(input())
  if(i>0):
    if(s[0]==w[-1][-1]):
      None
    else:
      ans = "No"
      break
  w.append(s)
j = set(w)
l = len(list(j))
if(N==l):
  None
else:
  ans="No"
print(ans)


Measured memory_bytes: 3060
#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 REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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; }

const long long INF = 1LL << 60;

int main(){
  string s,t; cin >> s >> t;
  vector<pair<int, vector<int> > > a(26), b(26);
  rep(i, s.size()){
    a[s[i] - 'a'].first++;
    a[s[i] - 'a'].second.push_back(i);
  }
  rep(i, t.size()){
    b[t[i] - 'a'].first++;
    b[t[i] - 'a'].second.push_back(i);
  }

  sort(all(a));
  sort(all(b));

  cout << (a == b ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 2824
//#include <boost/multiprecision/cpp_int.hpp> 
#include<bits/stdc++.h>
#define ll long long 
#define ull unsigned ll
#define pb push_back
#define mp make_pair
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define test    ll t=0;cin>>t;while(t--)
#define fast    ios_base::sync_with_stdio(false);cin.tie(NULL)
//using namespace boost::multiprecision; 
using namespace std;

int main(void) {
	ll n,c=0,i;
	string s1,s2;
	cin>>s1>>s2;
	for(i=0;i<s1.length();i++){
	if(s1[i]!=s2[i]){
	c++;
	break;}}
	if(c>0||s1.length()==s2.length())
	cout<<"No\n";
	else
	cout<<"Yes\n";
	
	return 0;
}



Measured memory_bytes: 3628
S = input()
is_YYMM = True
is_MMYY = True
if int(S[0] + S[1]) > 12 or int(S[0] + S[1]) == 0:
    is_MMYY = False
if int(S[2] + S[3]) > 12 or int(S[2] + S[3]) == 0:
    is_YYMM = False

if is_MMYY and is_YYMM:
    print('AMBIGUOUS')
elif is_YYMM:
    print('YYMM')
elif is_MMYY:
    print('MMYY')
else:
    print('NA')


Measured memory_bytes: 3060
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
	let mut stdin = String::new();
    std::io::Read::read_to_string(
    	&mut std::io::stdin(),
        &mut stdin).unwrap();
	let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
    	($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!();
    let a = get!();
    let b = get!();
    let c = get!();
    let mut xs = vec![];
    for _ in 0..n {
    	xs.push(get!());
    }
    xs.sort();
    
    fn foo(a:i64,b:i64,c:i64,i:usize,xs:&[i64],ys:&mut[i64])->i64{
    	if i == xs.len() {
        	if ys.iter().any(|y| *y==0) {
            	return std::i64::MAX;
            }
            let mp: i64 = ys
            	.iter()
                .filter(|y|**y>1)
                .map(|y|*y-1)
                .sum();
			return mp*10+a.abs()+b.abs()+c.abs();
        }
        let mut mp = foo(a,b,c,i+1,xs,ys);
        for j in 0..3 {
        	ys[j] += 1;
            let (a,b,c) = match j {
            0 => (a-xs[i],b,c),
            1 => (a,b-xs[i],c),
            _ => (a,b,c-xs[i]),
            };
            let tmp=foo(a,b,c,i+1,xs,ys);
            if tmp<mp { mp = tmp; }
            ys[j] -= 1;
        }
        mp
    }
    
    let mut ys = vec![0; 3];
    let ans = foo(a,b,c,0,&xs,&mut ys);
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
const int N=4e3+10;

int n,st[N],tp=0;

int query(int x,int y) {
	cout<<'?'<<' '<<x-1<<' '<<y-1<<endl;
	string s;cin>>s;
	return s=="Y";
}

int main() {
	int a,b;cin>>a>>b;n=a+b;
	if(a<=b) cout<<"Impossible",exit(0);
	for(int i=1;i<=n;i++) {
		if(!tp||query(st[tp],i)) st[++tp]=i;
		else --tp;
	}
	string s;
	for(int i=1;i<=n;i++) s+=char(query(st[tp],i)+'0');
	cout<<"! "<<s;
	return 0;
}


Measured memory_bytes: 724
#include<bits/stdc++.h>
using namespace std;
int a,b,c,x,y,sum=0,mini=10000;
int main()
{
	cin>>a>>b>>c>>x>>y;
	if(2*c<=(a+b))
	{
		if(x==y)
		{
			cout<<2*x*c; return 0;
		}
		if(x>y)
		{
			if(a>=2*c)
			{
				cout<<2*x*c; return 0;
			}
			
			else
			{
				cout<<2*y*c+(x-y)*a; return 0;
			}
		}
		if(x<y)
		{
			if(b>=2*c)
			{
				cout<<2*y*c; return 0;
			}
			
			else
			{
				cout<<2*x*c+(y-x)*b; return 0;
			}
		}
	}
	else
	{
		cout<<x*a+y*b;
	}
	return 0; 
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define in insert
#define ff first
#define ss second
#define mp make_pair
#define int long long
#define uint unsigned long long
#define rep(i,x,m) for(int i=x;i<m;i++)
#define repr(i,x,m) for(int i=x;i>=m;i--)
#define MOD 1000000007
#define endl "\n"
using namespace std;
#define noob ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

void ram5564()
{
    int a,b;
    cin>>a>>b;
    int num=b*10;
   // cout<<num<<endl;
   for(int i=num;i<num+10;++i)
   {
   	if(i*8/100==a)
   	{
   		cout<<i;
   		return;
   	}
   }
   cout<<-1;

}

signed main()
{
		noob
		
        
        int t=1;
        //cin>>t;
        while(t--)
        ram5564();
        return 0;
}

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

using namespace std;

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

    sort(d.begin(), d.end());

    int ans = 0;
    ans = d[n / 2] - d[(n / 2) - 1];
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
// typedef long double ldouble;

using Graph = vector<vector<int>>;

// int ctoi(const char c){
//   if('0' <= c && c <= '9') return (c-'0');
//   return -1;
// }

// int gcd(int a, int b){
//   int ma = max(a,b);
//   int mi = min(a,b);
//   if(mi == 0) return ma;

//   return gcd(mi, ma%mi);
// }

// llong POW(llong a, llong b){
//   if(b == 0) return 1;
//   else{
//     if(b%2 == 0) return POW(a * a % MOD, b / 2) % MOD;
//     else return a * POW(a * a % MOD, b / 2) % MOD;
//   }
// }

int main(){
  llong A, B;
  char op;
  cin >> A >> op >> B;
  if(op == '+') cout << A+B << endl;
  else cout << A-B << endl;
}

Measured memory_bytes: 256
n, a, b = map(int, input().split())

mod = 10**9+7
gokei = pow(2, n, mod) - 1

def f(n,r):
    p, q = 1, 1
    for i in range(r):
        p = p*(n-i)%mod
        q = q*(i+1)%mod
    return p * pow(q, mod-2,mod) % mod

print((gokei-f(n, a)-f(n, b))%mod) 

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int K = in.nextInt();
            int S = in.nextInt();
            int count = 0;
            for (int X = 0; X <= K; X++) {
                for (int Y = 0; Y <= K; Y++) {
                    int Z = S - (X + Y);
                    if (!(Z >= 0 && Z <= K)) {
                        continue;
                    }
                    count++;
                }
            }
            System.out.println(count);
        }
    }
}


Measured memory_bytes: 21844
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define fst first
#define snd second
using ll = long long;
using I = pair<int, int>;

int main() {
  int a, b, c;
  while (cin >> a >> b >> c) {
    set<int> s = {a, b, c};
    cout << s.size() << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int m,d;
	while(cin>>m>>d){
		if(!m) break;
		int daym[12]={0,31,60,91,121,152,182,213,244,274,305,335};
		int wd = (daym[m-1] + d + 2)%7;
		switch(wd){
		case 0:
			cout <<"Monday"<<endl;
			break;
		case 1:
			cout<<"Tuesday"<<endl;
			break;
		case 2:
			cout<<"Wednesday"<<endl;
			break;
		case 3:
			cout<<"Thursday"<<endl;
			break;
		case 4:
			cout<<"Friday"<<endl;
			break;
		case 5:
			cout<<"Saturday"<<endl;
			break;
		case 6:
			cout<<"Sunday"<<endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,a) for(int i=0;i<(a);++i)
#define MP make_pair
#define INF 1e9
#define F first
#define S second
using namespace std;
typedef long long LL;
#define int LL
typedef pair<int, int> P;
int N, M, n, ans = -1;
vector<int> v, h, t, s, vrsk;
int dp[1010][3010][2];
signed main()
{
	cin >> N >> M;
	v.resize(N); h.resize(N); t.resize(M); s.resize(M);
	vrsk.resize(N);
	REP(i, N)
		cin >> v[i] >> h[i];
	REP(i, M)
		cin >> t[i] >> s[i];
	vrsk[0] = v[0];
	FOR(i, 1, N)
	{
		vrsk[i] = vrsk[i - 1] + v[i];
	}
	dp[0][0][1] = h[0];
	FOR(i, 1, N)
	{
		if(t[0] >= vrsk[i])
			dp[0][i][1] = dp[0][i - 1][1] + h[i] + abs(h[i] - h[i - 1]);
	}
	REP(i, N)
	{
		if(dp[0][i][0] < s[0])
			dp[0][i][0] = -1;
		if(dp[0][i][1] < s[0])
			dp[0][i][1] = -1;
	}
	FOR(i, 1, M)
	{
		REP(j, N)
			if(t[i] >= vrsk[j])
				dp[i][j][0] = max(dp[i - 1][j][0], dp[i - 1][j][1]);
		FOR(j, 1, N)
			if(t[i] >= vrsk[j])
				dp[i][j][1] = max(dp[i][j - 1][0] + h[j], dp[i][j - 1][1] + h[j] + abs(h[j] - h[j - 1]));
		REP(j, N)
		{
			if(dp[i][j][0] < s[i])
				dp[i][j][0] = -1;
			if(dp[i][j][1] < s[i])
				dp[i][j][1] = -1;
		}
	}
	/*REP(i, M)
	{
		REP(j, N)
			cout << dp[i][j][0] << " ";
		cout << endl;
	}
	cout << endl;
	REP(i, M)
	{
		REP(j, N)
			cout << dp[i][j][1] << " ";
		cout << endl;
	}*/
	REP(i, N)
	{
		if(dp[M - 1][i][0] > 0 || dp[M - 1][i][1] > 0)
		{
			ans = t[M - 1] - vrsk[i];
			break;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 50140
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

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

bool g(int x, vi a){
    if(x >= 8){
        if(a[8]%3 || a[9]%3)return false;
        return true;
    }
    rep(i,a[x]/3+1){
        vi t = a;
        t[x] -= i*3;
        if(t[x] <= t[x+1] && t[x] <= t[x+2]){
            t[x+1] -= t[x];
            t[x+2] -= t[x];
            t[x] = 0;
            if(g(x+1,t))return true;
        }
    }
    return false;
}

bool f(vi a){
    loop(i,1,10)if(a[i] >= 2){
        a[i] -= 2;
        if(g(1,a))return true;
        a[i] += 2;
    }
    return false;
}

signed main(void) {
    int n = 13;
    string s;
    while(cin >> s){
        vi a(10);
        rep(i,n)a[s[i]-'0']++;
        vi ans;
        loop(i,1,10)if(a[i] < 4){
            a[i]++;
            if(f(a))ans.push_back(i);
            a[i]--;
        }
        if(ans.size()){
            rep(i,ans.size()){
                cout << ans[i];
                if(i < ans.size()-1)cout << " ";
                else cout << endl;
            }
        }else{
            cout << 0 << endl;
        }
    }
}



Measured memory_bytes: 3020
n = int(input())
d,x = map(int, input().split())

def aaa(D, Ai):
    a = 0
    for i in range(0,D):
        if D >= Ai*i+1:
            a += 1
    return a

y= 0
for j in range(n):
    y += aaa(d, int(input()))

print(y + x)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
	using namespace std;
	#define ll long long
	#define rep(i,n) for(long long (i)=0;(i)<(n);++(i))
	#define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i))
	#define endl '\n'
	#define st first
	#define nd second
	#define pb push_back
	#define mp make_pair
	const int mx=2e6+5;

	int main(){
		ios_base::sync_with_stdio(false); cin.tie(0);
		int n,a,b,c,d;cin >> n >> a >> b >> c >> d;
		string s;cin >> s;
		bool ans=true;
		if(s[c-1]=='#' or s[d-1]=='#' or s[a-1]=='#' or s[b-1]=='#'){cout<<"No"<<endl;return 0;}
		for(int i=a;i<c;++i){
			if(i>0)if(s[i-1]=='#' and s[i]=='#')ans=false;
		}
		for(int i=b;i<d;++i){
			if(i>0)if(s[i-1]=='#' and s[i]=='#')ans=false;
		}
		bool ank=true;
		if(c>d){
			ank=false;
			for(int i=b-2;i<d-1;++i)if(s[i]=='.' and s[i+1]=='.' and s[i+2]=='.')ank=true;
		}
		if(!ans or !ank)cout<<"No" << endl;
		else cout << "Yes" << endl;

	}

Measured memory_bytes: 592
//
//  main.c
//  Save Your Privacy!
//
//  Created by x15071xx on 2016/06/15.
//  Copyright ?? 2016??´ AIT. All rights reserved.
//

#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    
    
    while (1) {
        int human[100][100] = {0},n,m,i,j,k = 0,cri[100]={0},x,count=0;
        int human_num[100]={0},criminal[2]={0,-1};
        scanf("%d",&n);
        
        if (n==0) {
            break;
        }
        for (i=0; i<n; i++) {
            scanf("%d",&m);
            human_num[i] = m;
            for (j=0; j<m; j++) {
                scanf("%d",&human[i][j]);
            }
        }
        scanf("%d",&k);
        for (j=0; j<k; j++) {
            scanf("%d",&cri[j]);
        }
        
        
        for (i=0; i<n; i++) {
            for (j=0; j< human_num[i]; j++) {
                for (x=0; x<k ; x++) {
                    if (cri[x] == human[i][j]) {
                        count++;
                    }
                }
            }
            if (count == k) {
                criminal[0]++;
                criminal[1] = i+1;
            }
            count=0;
        }
        
        if (criminal[0] == 1) {
            printf("%d\n",criminal[1]);
        } else if (criminal[0] > 1|| criminal[0] == 0) {
            printf("-1\n");
        }
        
    }
    return 0;
}

Measured memory_bytes: 660
import sys
N = int(input())
H = [int(x) for x in input().split()]

flag = 0
key = 0

for i in range(len(H)-1):
    if flag == 1:
        if H[i+1] < key:
            print('No')
            sys.exit()

    if i < len(H) - 1:
        if H[i] > H[i+1] + 1:
            print('No')
            sys.exit()

        elif H[i] == H[i+1] + 1:
            flag = 1
            key = H[i+1]
	
print('Yes')

Measured memory_bytes: 14396
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int MOD = (int)1e9 + 7;
template<class T> void add(T &a, T b) { (a += (b % MOD + MOD) % MOD) %= MOD; }

long long modpow(long long a, long long n, long long mod = MOD) {
	long long res = 1;
	while (n > 0) { if (n & 1) (res *= a) %= mod; (a *= a) %= mod; n >>= 1; }
	return res;
}

int main() {
    const int inv = 111111112;
    string s; cin >> s;
    int a = 0,
        l = 0,
        c = count(begin(s), end(s), 'C'),
        r = count(begin(s), end(s), '?');
    long long ans = 0;
    auto calc = [&](int a, int l, int c, int r) {
        long long res = modpow(3, l + r) * inv % MOD;
        res = res * (a * 3 + l) % MOD;
        res = res * (c * 3 + r) % MOD;
        return res;
    };
    for (char ch: s) {
        if (ch == 'A') a++;
        if (ch == 'B') add(ans, calc(a, l, c, r));
        if (ch == 'C') c--;
        if (ch == '?') add(ans, calc(a, l++, c, --r));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include<set>
#define ll long long 
#include <string>
#define pb push_back
#define mp make_pair
# define pi 3.14159265358979323846
#define mod 1000000007
using namespace std;
int main()
{ 
    ll int n;
    cin>>n;
    ll int a[n],i;
    for(i=0;i<n;i++)
    {cin>>a[i];
    
	}
	ll int m=a[0],ans=0;
	for(i=0;i<n;i++)
	{
		if (a[i]>m)
		m=a[i];
		else
		{
			ans+=m-a[i];
		}
		
	}
	cout<<ans<<endl;
    
   
   
}
   



	
		
	
	
	
	



Measured memory_bytes: 5132
#include "bits/stdc++.h"
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
typedef long long ll;
const int inf = 1000000001;
const ll INF = 1e18 * 4;
using namespace std;

struct UnionFind{
    vi parents;
    UnionFind(int N): parents(N){
        rep(i, 0, N) parents[i] = -1;
    }
    int find(int x){
        if(parents[x] < 0) return x;
        return parents[x] = find(parents[x]);
    }
    bool unite(int x, int y){
        int root_x = find(x);
        int root_y = find(y);
        if(root_x == root_y) return false;
        if(size(root_x) < size(root_y)) swap(root_x, root_y);
        parents[root_x] += parents[root_y];
        parents[root_y] = root_x;
        return true;
    }
    int size(int x){
        return -parents[find(x)];
    }
    bool same(int x, int y){
        return find(x) == find(y);
    }
};

int main(){
    int n, q;
    cin >> n >> q;
    vi ans;
    UnionFind uf(n);
    rep(i, 0, q){
        int c, x, y; 
        cin >> c >> x >> y;
        if(c==0){
            uf.unite(x, y);
        } else if(c==1){
            if(uf.same(x, y)) ans.push_back(1);
            else ans.push_back(0);
        }
    }
    rep(i, 0, ans.size()) cout << ans[i] << endl;
    return 0;
}





Measured memory_bytes: 3328
from operator import itemgetter
N = int(input())

A = []
for i in range(N):
  A.append(list(map(int, input().split())))
  
A.sort(key=itemgetter(1))

now = 0
for a in A:
  now += a[0]
  if now > a[1]:
    print('No')
    exit(0)
    
print('Yes')

Measured memory_bytes: 87384
#include <math.h>

#include <algorithm>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;

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

  long long maxval = 0;
  if (n < b) {
    long long max1 = floor(a * n / b);
    cout << max1;

  } else {  // n>=b
    cout << floor(a * (b - 1) / b) - a * floor((b - 1) / b);
  }
  return 0;
}


Measured memory_bytes: 3744
using System;
using System.Collections.Generic;

namespace _20200328_ABC160B
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadStringList(1);

            int X = int.Parse(input[0]);

            int num500 = X / 500;
            X -= num500 * 500;
            int num5 = X / 5;

            uint result = 1000u * (uint)num500 + 5u * (uint)num5;

            Console.WriteLine(result);
        }

        private static List<string> ReadStringList(int numberOfLines)
        {
            var stringList = new List<string>();

            for (int lineIndex = 0; lineIndex < numberOfLines; lineIndex++)
            {
                stringList.Add(Console.ReadLine().Trim());
            }

            return stringList;
        }

    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
 
#define INF 1234567890
#define ll long long
#define MOD 1000000007

int N;
ll res = 1;
map<pair<ll, ll>, int> m;

ll gcd(ll a, ll b)
{
	return a ? gcd(b%a, a) : b;
}

ll pw(ll a, ll n)
{
	ll ret = 1;
	while(n)
	{
		if (n&1) ret=ret*a%MOD;
		a=a*a%MOD;
		n>>=1;
	}
	return ret;
}

int main()
{
	scanf("%d", &N);
	ll zero = 0;
	for(int i=1; i<=N; i++)
	{
		ll a, b;
		scanf("%lld %lld", &a, &b);
		if (a == 0 && b == 0) //
		{
			zero++;
			continue;
		}
		ll g = gcd(a, b);
		a /= g; b /= g;
		if (b < 0) a=-a, b=-b;
		m[{a, b}]++;
	}
	while(!m.empty())
	{
		auto it = *m.begin();
		ll a = it.first.first, b = it.first.second;
		int cnt = it.second;
		m.erase(m.begin());

		ll na = b, nb = -a;
		if (nb < 0) na=-na, nb=-nb;
		
		if (m.find({na, nb}) == m.end())
		{
			//printf("%lld %lld (%d) deleted\n", a, b, cnt);
			res *= pw(2, cnt);
			res %= MOD;
		}
		else
		{
			int ncnt = m[{na, nb}];
			//printf("%lld %lld (%d) found %lld %lld (%d)\n", a, b, cnt, na, nb, ncnt);
			res *= (pw(2, cnt) + pw(2, ncnt) - 1) % MOD;
			res %= MOD;
			m.erase({na, nb});
		}
	}
	res--; // 공집합 제외
	res %= MOD; res += MOD; res %= MOD;

	res += zero; // 제로벡터도 하나만이라면 선택 가능하다.
	res %= MOD;

	printf("%lld", res);
	return 0;
}

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

int n;
int main()
{
	scanf("%d", &n);
	long long ans = 0;
	for (int i = 1; i <= n; i++)
	{
		if (i % 3 == 0 || i % 5 == 0)
			continue;
		ans += i;
	}
	printf("%lld\n", ans);
	return 0;
}


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

int main(){
    int H1, M1, H2, M2, K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;

    int ans_H, ans_M;
    ans_H = H2 - H1;
    ans_M = M2 - M1;

    cout << ans_H * 60 + ans_M - K << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> void Max(T &m, const T q) { if (m < q) m = q; }
template<typename T> void Min(T &m, const T q) { if (m > q) m = q; }
template<typename T1, typename T2> pair<T1, T2> operator+(pair<T1, T2> &l, pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(pair<T1, T2> &l, pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;

string S;
vector<int> s(4);

int main()
{
    cin >> S;
    for (auto c : S)
    {
        if (c == 'N') s[0] = 1;
        if (c == 'S') s[1] = 1;
        if (c == 'E') s[2] = 1;
        if (c == 'W') s[3] = 1;
    }

    if (s[0] + s[1] == 1 or s[2] + s[3] == 1) puts("No");
    else puts("Yes");
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl
#define CE cout<<endl

ll n,m,a,b,c,x,y,z,aa[200010],ab[200010],ac[1010][1010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc,cd[1010][1010];
vector<ll> va,vb,vc,vd,ve;

template<typename TARG> ll gcdt(TARG targ) {return targ;}
template<typename TARG,typename ... CALL>
ll gcdt(TARG targa,TARG targh,CALL ... targc){
    return targh ? gcdt(targh,targa%targh,targc...): gcdt(targa,targc...);
}
template<typename TARG> ll gcdt(vector<TARG> targ) { for(TARG it:targ)targ[0]=gcdt(targ[0],it);return targ[0]; }

int main(){
    cin>>n;
    for(size_t i = 0; i < n; i++){
        cin>>aa[i];
        va.push_back(aa[i]);
    }
    C gcdt(va) E;   
}


Measured memory_bytes: 2676