akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long int;
#define INF             1e14
#define dd              double
#define MOD             1000000007
#define my_sizeof(type) ((char *)(&type+1)-(char*)(&type)) 
#define nl              cout<<endl
#define fill(a,val)     memset(a,val,sizeof(a))
#define mp              make_pair
#define endl            "\n"
#define pb              push_back
#define ff              first    
#define ss              second
#define SIZE            200005
#define all(v)          v.begin(),v.end()
#define s(ar,n)         sort(ar,ar+n)
#define rs(ar,n)        sort(ar, ar+n, greater<ll>()) 
#define oa(a,n)         for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n)         for(ll i=0;i<n;i++)cin>>a[i];
#define maxa(ar,N)      *max_element(ar,ar+N)
#define mina(ar,N)      *min_element(ar,ar+N)
#define fastio()        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define printclock      cerr<<"Time : "<<1000*(long double)clock()/(long double)CLOCKS_PER_SEC<<"ms\n";
typedef tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ll power(ll x, ll y){
    ll res=1;x=x;
    while(y>0){
        if(y&1)
            res = (res*x);
        y = y>>1;
        x = (x*x);
    }
    return res;
}  
ll logtwo(ll n){
    if(n==1)
        return 0;
    return logtwo(n/2)+1;
}
signed main()
{
	fastio();   
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
	int t=1;
	//cin>>t;
	while(t--)
	{
		ll N,M;
		cin>>N>>M;
		cout<<N*M<<endl;
	}
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define loope(i,a,b) for(ll i=a;i<=b;i++)
#define test() ull t;cin>>t;while(t--)
#define puu pair<ull,ull>
#define f first
#define s second
#define pb push_back
#define mkp make_pair
#define ins insert
#define Vint vector<int>
#define Vll vector<ll>
#define Vull vector<ull>
#define nl cout<<endl
#define sp cout<<" "
#define MOD 1000000007
#define all(x) x.begin(),x.end()
int optifunc(vector<ll> &v,vector<ll> &dp,ll n)
{
	if(n<=1)
		return 0;
	if(dp[n]!=-1)
		return dp[n];
	int k = n-3>=0?n-3:0;
	int m = n-2>=0?n-2:0;
	dp[n] = min(optifunc(v,dp,n-1) + abs(v[n-1] - v[m]),optifunc(v,dp,n-2) + abs(v[n-1] - v[k]));

	return dp[n];
}
int main() 
{
	 // #ifndef ONLINE_JUDGE
  //       freopen("input.txt", "r", stdin);
  //       freopen("output.txt", "w", stdout);
  //   #endif
  //   fastio();
    ll n;
    cin>>n;
    vector<ll> v(n);
    loop(i,0,n)
    	cin>>v[i];
    vector<ll> dp(n+1,-1);
    dp[1] = 0;
    ll ans = optifunc(v,dp,n);
    // for(ll a:dp)
    // 	cout<<a<<" ";
    // nl;
    cout<<ans;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,n) for(int i=1;i<(int)(n);i++)

typedef long long ll;
using namespace std;
int main()
{

  ll a,b,c;
  cin>>a>>b>>c;
  if(a==b&&b==c){
    cout<<1<<endl;
  }else if(a==b||b==c||a==c){
    cout<<2<<endl;
  }else{
    cout<<3<<endl;
  }
  return 0;
}


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

int main()
{
  int N, K;
  std::cin >> N >> K;
  int l[N];

  for ( int i = 0; i < N; i++ ) std::cin >> l[i];

  std::sort(l, l + N, std::greater<int>());
  int sum = 0;
  for ( int i = 0; i < K; i++ ) { 
    sum += l[i];
  }

  std::cout << sum << std::endl;
}

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

int main() {
  int N,T,ans=0;
  cin >> N >> T;
  vector<int> t(N);
  cin >> t[0];
  
  for(int i=1;i<N;i++){
    cin >> t[i];
    if(t[i]-t[i-1]<T) ans += t[i]-t[i-1];
    else ans += T;
  }
  ans += T;
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
N,M=map(int,input().split())
K=[0]*N
T=[]
for k in range(N):
  C=list(map(int,input().split()))
  T.append(C)
D=[int(input()) for i in range(M)]
for i in range(N):
  for j in range(M):
    K[(i*M+j)//M]+=T[i][j]*D[j]
for o in range(N):
  print(K[o])


Measured memory_bytes: 6024
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <string>
#include <cmath>
#include <map>
#include <iomanip>
#include <utility>
#define INF 1000000009
#define LINF 1000000000000000009
#define double long double
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;
typedef pair<ll, double> PD;
//ll mod = 1000000007;
//ll mod = 998244353;

int main() {
	ll n, x;
	cin >> n >> x;
	if (x == 1 || x == 2 * n - 1) {
		cout << "No" << endl;
		return 0;
	}
	vector<int> ans(2 * n - 1);
	ans[n - 2] = x - 1;
	ans[n - 1] = x;
	ans[n] = x + 1;
	ll base = 1;
	for (int i = n + 1; i < 2 * n - 1; i++) {
		if (base == x - 1) base += 3;
		ans[i] = base;
		base++;
	}
	for (int i = 0; i < n - 2; i++) {
		if (base == x - 1) base += 3;
		ans[i] = base;
		base++;
	}
	cout << "Yes" << endl;
	for (ll i : ans) cout << i << endl;
}

Measured memory_bytes: 2304
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<list>
#include<vector>
#include<cmath>

using namespace std;

int main(){

    string s;
    cin >> s;
    string t = "";

    while(s.size()>t.size()){
        if(s[t.size()]=='d'){
            t += "dream";
            if(s[t.size()]=='d')continue;
            if(s[t.size()]=='e' && s[t.size()+1]=='r' && s[t.size()+2]=='a')continue;
            if(s.size()>t.size())t += "er";
        }else{
            t += "erase";
            if(s[t.size()]=='r')t += "r";
        }
    }
//cout << t << endl;
    if(s==t)cout << "YES" << endl;
    else cout << "NO" << endl;


}


Measured memory_bytes: 640
N = int(input())
a = [0 for _ in range(N)]
for i in range(N):
  a[i] = int(input())
 
c = 0
x = 1
while(x != 2):
  nex = a[x-1]
  if not nex:
    c = -1
    break
  else:
    c += 1
    a[x-1] = False
  x = nex
 
print(c)

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

typedef pair <int, int> ii;

const int Maxn = 15;

int n;
vector <ii> neigh[Maxn];
int res;

bool Check(int mask)
{
    for (int i = 0; i < n; i++) if (mask & 1 << i) {
        bool ok = true;
        for (int j = 0; j < neigh[i].size() && ok; j++) {
            int ind = neigh[i][j].first;
            ok = bool(mask & 1 << ind) == neigh[i][j].second;
        }
        if (!ok) return false;
    }
    return true;
}

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        int cnt; scanf("%d", &cnt);
        neigh[i].resize(cnt);
        for (int j = 0; j < cnt; j++) {
            scanf("%d %d", &neigh[i][j].first, &neigh[i][j].second);
            neigh[i][j].first--;
        }
    }
    for (int i = 0; i < 1 << n; i++) if (Check(i))
        res = max(res, __builtin_popcount(i));
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class BExponential {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int x;
	    in >> x;
	    int mx = 0;
	    for(int i=1; i*i <= 1000; i++){
            for(int j=2; j < 10; j++){
                int num = pow(i, j);
                if(num > x) break;
                chmax(mx, num);
            }
	    }
	    out << mx << endl;
	}
};


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


Measured memory_bytes: 384
#include<bits/stdc++.h>
#include <queue>
#include <stack>
using namespace std;
 
typedef pair<long long int,long long int>pa;
#define resize(A) A.resize(unique(A.begin(), A.end()) - A.begin())
#define pb push_back
 
# define  MAX 200005
long long int MOD=998244353;
long long int INF=1e18;
 
int main()
{
    
       ios_base::sync_with_stdio(false); 
       cin.tie(NULL);
     cout.tie(NULL);
      long long int i,j,k=0,l=0,r=0,m=0,n,p=0,cnt=0,cnt1=0,x,y,z=0,a,b,low,mid,high,ans=0,maxi=0,mini=INF,t;
   cin>>r;
    ans=3*r*r;
    cout<<ans<<endl;
   
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
/* #define int long long */
/* #define double long double */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
#define MOD 1000000007
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i,a,b) for(int i=a;i>=b;i--)

signed main(){
    int n;
    cin >> n;
    map<string, ll> m;
    string s;
    rep(i, n){
        cin >> s;
        sort(s.begin(), s.end());
        m[s]++;
    }

    ll v = 0;
    for(auto itr = m.begin(); itr != m.end(); itr++){
        ll t = itr -> second;
        v += t * (t - 1) / 2;
    }

    cout << v << endl;
}

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

int main() {
  int N,a=1,b=0;
  cin >> N;
  vector<string>S(N);
  vector<string>T(N);
  vector<string>U(N);
  vector<int>P(N);
  vector<int>Q(N);
  for(int i=0;i<N;i++){
    cin >> S.at(i);
  }
  sort(S.begin(),S.end());
  T.at(0)=S.at(0);
  P.at(0)=1;
  Q.at(0)=1;
  for(int i=1;i<N;i++){
    if(S.at(i-1)!=S.at(i)){
      T.at(a)=S.at(i);
      P.at(a)++;
      Q.at(a)++;
      a++;
    }else{
      P.at(a-1)++;
      Q.at(a-1)++;
    }
  }
  sort(Q.begin(),Q.end());
  for(int i=0;i<N;i++){
    if(P.at(i)==Q.at(N-1)){
      U.at(b)=T.at(i);
      b++;
    }
  }
  sort(U.begin(),U.end());
  for(int i=0;i<b;i++){
    cout << U.at(i+N-b) << endl;
  }
}

Measured memory_bytes: 19072
#include <iostream>
#include "bits/stdc++.h"

using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i, a, b) for(ll i=a;i<b;i++)
#define REP(i, a) for(ll i=0;i<a;i++)
#define jkl ll debug = 0;
#define RREP(i, a) for(ll i=a;i>0;i--)
#define rrep(i, a, b) for(ll i=a-1;i>=b;i--)
#define printall(n, array) {for(ll i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
#define mp make_pair
typedef long long ll;
typedef pair<ll, ll> Pi;
typedef pair<ll, Pi> V;
typedef vector<ll> VE;
typedef vector<vector<ll>> VVE;
const ll mod = 1e9 + 7; //10^9+7

int main() {
    ll x, y, z, k;
    cin >> x >> y >> z >> k;
    VE a(x), b(y), c(z);
    REP(i, x) cin >> a[i];
    REP(i, y) cin >> b[i];
    REP(i, z) cin >> c[i];
    sort(a.rbegin(), a.rend());
    sort(b.rbegin(), b.rend());
    sort(c.rbegin(), c.rend());
    VE vec;
    REP(i, x)REP(j, y)REP(l, z) {
        if((i + 1) * (j + 1) * (l + 1) > k)continue;
        vec.push_back(a[i] + b[j] + c[l]);
    }
    sort(vec.rbegin(), vec.rend());
    REP(i, k)print(vec[i]);
}

Measured memory_bytes: 1404
N = int(input())
S = input()

res = 0
dp = [[0] * (N + 1) for _ in range(N + 1)]
for i in reversed(range(N)):
    for j in reversed(range(i + 1, N)):
        if S[i] == S[j]:
            dp[i][j] = max(dp[i][j], dp[i + 1][j + 1] + 1)
        res = max(res, min(dp[i][j], j - i))
        
print(res)


Measured memory_bytes: 229896
#include <algorithm>
#include <map>
#include <vector>
#include <iostream>
#include <stdio.h>
#include <set>
#include <string.h>
#include <stack>
#include <stdlib.h>

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<ll, ll> point;

int n, k, tmp;
vector<int> d;

bool contains(int a) {
    if (a<n) return true;
    while (a>0) {
        for (int i=0; i< d.size(); i++) if (d[i]==a%10) return true;
        a/=10;
    }
    return false;
}

int main() {
    cin>>n>>k;
    for (int i=0; i<k; i++) cin>>tmp, d.push_back(tmp);

    int ans=1;
    while (contains(ans)==true) ans++;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
//jinhaonan
#include<set>
#include<map>
#include<list>
#include<ctime>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<cassert>
#include<sstream>
#include<numeric>
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
#define For(i,x,y) for(int i=x,_y=y;i<=_y;++i)
#define Rep(i,x,y) for(int i=x,_y=y;i>=_y;--i)
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
inline int read()
{
	int x=0;char c=getchar();bool f=0;
	for(;c>'9'||c<'0';f=c=='-',c=getchar());
	for(;c>='0'&&c<='9';x=(x<<1)+(x<<3)+c-'0',c=getchar());
	return f?-x:x;
}
inline void write(int x)
{
	if(x<0)putchar('-'),x=-x;
	if(x>=10)write(x/10);
	putchar(x%10+48);
}
int n,ans;
int check(int x)
{
	int res=0;
	For(i,1,x)if(x%i==0)++res;
	return res==8;
}
int main()
{
	n=read();
	For(i,1,n)if(i&1)ans+=check(i);
	write(ans);puts("");
}

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

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

long long MOD = 1000000000 + 7;

int main(){
  string s;
  cin >> s;
  if(s[0] == '9' || s[1] == '9'){
    cout << "Yes" << endl;
  } else { 
    cout << "No" << endl;
  }
}





Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int a,b,c,d,e,sum;

  scanf("%d\n%d\n%d\n%d\n%d", &a,&b,&c,&d,&e);
  if(a < 40)
    a=40;
  if(b < 40)
    b=40;
  if(c < 40)
    c=40;
  if(d < 40)
    d=40;
  if(e < 40)
    e=40;
  sum=a+b+c+d+e;
  sum=sum/5;
  printf("%d\n", sum);
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <queue>
#include <algorithm>
#include <map>
#include <string>
using namespace std;

string exchange(string s,int a,int b){
	char tmp = s[a];
	s[a] = s[b];
	s[b] = tmp;
	return s;
}

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

int p_x(int k){
	return k / 4;
}

int p_y(int k) {
	return k % 4;
}

int main(){
	map<string,int> dp;
	string target = "01234567";
	queue<string> Q;
	Q.push(target);
	while(!Q.empty()){
	 	string s = Q.front();
	 	Q.pop();
	 	int p0 = 0;//'0'的位置 
	 	for(int i = 0;i < 8;++i){
	 		if(s[i] == '0') p0 = i;
		}
		int x = p_x(p0),y = p_y(p0);
		for(int i = 0;i < 4;++i){
			int cx = x+dx[i],cy = y+dy[i];
			if(cx >= 0 && cy >=0 && cx < 4 && cy < 4){
				int pcrt = cx*4+cy;
				string crt = exchange(s,p0,pcrt);
				if(dp.find(crt) == dp.end()){
					dp[crt] = dp[s] + 1;
					Q.push(crt);
				}
			}
		}
	}
	
	string line;
	while(getline(cin,line)){
		line.erase(remove(line.begin(),line.end(),' '), line.end());
		cout << dp[line] << endl;
	}
	return 0;
}


Measured memory_bytes: 8848
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll h;
  cin >> h;
  ll num = 1, ans = 0;
  while (h) {
    h /= 2;
    ans += num;
    num *= 2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000000LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int n, m, Q; cin >> n >> m >> Q;
    vector<vector<int>> cnt(n, vector<int>(n, 0));
    rep(i, m){
        int l, r; cin >> l >> r; l--; r--;
        cnt[l][r]++;
    }
    rep(i, n){
        rep(j, n-1){
            cnt[i][j+1] += cnt[i][j];
        }
    }
    rep(i, n){
        for(int j=n-1; j > 0; j--){
            cnt[j-1][i] += cnt[j][i];
        }
    }/*
    rep(i, n){
        rep(j, n){
            cout << cnt[i][j]  << " ";
        }
        cout << ln;
    }*/
    rep(i, Q){
        int pl, pr; cin >> pl >> pr; pl--; pr--;
        cout <<  cnt[pl][pr] << ln;
    }
}


Measured memory_bytes: 1920
/*
    ____        __
   / __ \____  / /_  ____ _____ ___
  / /_/ / __ \/ __ \/ __ `/ __ `__ \
 / _, _/ /_/ / / / / /_/ / / / / / /
/_/ |_|\____/_/ /_/\__,_/_/ /_/ /_/
*/
#include<bits/stdc++.h>

typedef long long ll ;

#define pll pair<ll , ll >
#define X   first
#define Y   second
#define mp  make_pair
#define pii pair<int , int>
#define vec vector
#define vpii vector<pair<int , int>>
#define i_n   int i = 0 ; i< n ; i++
#define cn  int n ; cin>>n
#define file_io freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define cina int a[n] ; for(int i = 0 ; i < n ; i++) cin>>a[i]
#define pb push_back

using namespace std;
const int maxn = 1000*100+5 ;
const ll inf = 9223372036854775807 ;


int main()
{
	migmig ;
	int n  ,x[maxn] ,sum = 0  , ans = 0   , ans2= 0 ; 
	cin>>n ; 
	for(int i = 0 ; i < n ; i ++ )
	{
		cin>>x[i] ; 
		sum += x[i] ; 
	}
	sum /= n ; 
	 for(int i = 0 ;  i < n ; i ++ )
	 {
	 	ans += (x[i] - sum) * (x[i] - sum) ; 
	 }
	 sum++ ; 
	  for(int i = 0 ;  i < n ; i ++ )
	 {
	 	ans2 += (x[i] - sum) * (x[i] - sum) ; 
	 }
	 cout<<min(ans , ans2) ; 
}
//////
////////
///////////




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

void main()
{
  int M=0;
  scanf("%d",&M);
  if(M>=400 && M<600)
    printf("8");
  else if(M>=600 && M<800)
    printf("7");
  else if(M>=800 && M<1000)
    printf("6");
  else if(M>=1000 && M<1200)
    printf("5");
  else if(M>=1200 && M<1400)
    printf("4");
  else if(M>=1400 && M<1600)
    printf("3");
  else if(M>=1600 && M<1800)
    printf("2");
  else if(M>=1800 && M<2000)
    printf("1");
  else
    printf("error");
}

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

sumA = [0] * (N + 1)
sumcnt = {}
for i in range(N):
    sumA[i + 1] = sumA[i] + A[i]
    if sumA[i + 1] in sumcnt:
        sumcnt[sumA[i + 1]] += 1
    else: 
        sumcnt[sumA[i + 1]] = 1

ans = 0
for i in range(N):
    if sumA[i] in sumcnt:
        ans += sumcnt[sumA[i]]
    sumcnt[sumA[i + 1]] -= 1

print(ans)

Measured memory_bytes: 40140
#include <bits/stdc++.h>
using namespace std;
#define ll                  long long
#define ld                  long double
#define pb                  push_back
#define mkp                 make_pair
#define f(i,l,h)            for(ll i=l;i<h;i++)
#define fr(i,h,l)           for(ll i=h;i>=l;i--)
#define mem(a,val)          memset(a,val,sizeof(a))
#define all(v)              (v).begin(),(v).end()
#define ff                  first
#define ss                  second
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
const ld pi=3.14159265359;
const ll mod=998244353;
const ll INF=(ll)(1e9+7);
typedef pair<ll,ll> pll;
typedef vector<ll> vll;

ll power(ll a,ll b){
	ll res=1;
	while(b){
		if(b&1) res=(res*a);
		a=(a*a);
		b>>=1;
	}
	return res;
}

int main()
{
    //cout << "Hello world!" << endl;
    ll t;
    t=1ll;
    while(t--){
        ll a,b,v,w;
        ld tt;
        cin>>a>>v;
        cin>>b>>w;
        cin>>tt;

        if(w>=v){
            cout<<"NO"<<endl;
            continue;
        }
        ll diff=llabs(a-b);
        
        if((ld)(diff)/(ld)(v-w)<=tt){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }


    }
    return 0;
}


Measured memory_bytes: 3732
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;
//|\_
//g++ -std=c++1z temp.cpp
//./a.out

int ans=0;
vvc v(30,vector<char> (30,'a'));
int dfs(int x,int y,int h,int w){
    // cout<<x<<" "<<y<<" "<<ans<<endl;
    if(v[y][x]=='%')return 0;
    if(v[y][x]=='@'||v[y][x]=='.'){
        ans++;
        v[y][x]='%';
        if(x+1<w&&v[y][x+1]=='.')dfs(x+1,y,h,w);
        if(x-1>=0&&v[y][x-1]=='.')dfs(x-1,y,h,w);
        if(y+1<h&&v[y+1][x]=='.')dfs(x,y+1,h,w);
        if(y-1>=0&&v[y-1][x]=='.')dfs(x,y-1,h,w);

    }
    else return 0;
    return 0;
}

int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
    
    int h,w,i,j,x,y;
    while(1){
        cin>>w>>h;
        ans=0;
        if(h==0&&w==0)break;
        rep(i,30)rep(j,30)v[i][j]='%';
        rep(i,h){
            rep(j,w){
                cin>>v[i][j];
                if(v[i][j]=='@'){
                    // cout<<i<<" "<<j<<endl;
                    y=i;
                    x=j;
                }
            }
        }
        dfs(x,y,h,w);
        cout<<ans<<endl;
    }
    
    

//////////////////////////////////////////////////////
return 0;}











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

signed main(){
    ll n;
    cin>>n;
    ll a[n];
    int odd=0,ev=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]%2) odd++;
        else ev++;
    }
    ll ans = 0;
    if(odd==0 || ev==0){
        cout << 0 << endl;
        return 0;
    }
    ans += ev-1;
    ans+=odd;
    if(odd%2==0) ans--;
    cout<<ans<<endl;
    return 0;

}


Measured memory_bytes: 4548
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main()
{
	int h, w;

	scanf("%d %d\n", &h, &w);

	int image[100][100];
	
	int c, i = 0, j = 0;

	while (i < h)
	{
		c = getchar();

		if (c != '\n')
		{
			image[i][j] = c;
			j++;
		}
		else
		{
			i++;
			j = 0;
		}
	}

	for (i = 0; i < h; i ++)
	{
		for (j = 0; j < w; j++)
		{
			printf("%c", image[i][j]);
		}

		printf("\n");

		for (j = 0; j < w; j++)
		{
			printf("%c", image[i][j]);
		}
		printf("\n");
	}

	return 0;
}

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

int main() {
	int n, d;
	cin >> n >> d;
	int w= d * 2 + 1;
	int ans = (n + w - 1) / w;
	cout << ans << endl;
	return 0;
}

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

int main() {
	int A, B, C; cin >>A>>B>>C;
	int large = max(max(A,B),C);
	int X = 3*large-A-B-C;
	if(X%2 == 0) cout << X / 2 << endl;
	else cout << (X + 3) / 2 << endl;
}

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

using namespace std;

const int maxn=1e6;
int n;

int main()
{
    int c;
    int t=100;
    int sum=0;
    for(int i=2;i>=0;i--)
    {
                 scanf("%d",&c);
                sum+=t*c;
            t/=10;
    }
    if(sum%4==0)
        printf("YES");
    else
        printf("NO");
    return 0;
}


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

using namespace std;

void funcA() {

  double d, t, s;
  cin >> d >> t >> s;

  double time = d / s;

  if (time <= t) cout << "Yes";
  else cout << "No";
}

void funcB() {

  string s, t;
  cin >> s >> t;

  int ans = 10000;
  for (int i = 0; i < s.size() - t.size() + 1; ++i) {
    int count = 0;

    for (int j = 0; j < t.size(); ++j) {
      if (s[i + j] != t[j]) ++count;
    }
    if (count < ans) ans = count;
  }

  cout << ans;
}

void funcC() {


}

void funcD() {

  int n, m;
  cin >> n >> m;
  int group = 1;

  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
  }




}

int main() {

  //funcA();
  funcB();

  //funcD();

  return 0;
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

vector<ll> C[30];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S, T;
    cin >> S >> T;
    ll N = S.length();
    ll M = T.length();
    REP(i, N) {
        C[S[i] - 'a'].push_back(i);
    }

    REP(i, 30) {
        C[i].push_back(INF);
    }

    ll x = 0;
    ll index = -1;
    REP(i, M) {
        auto &v = C[T[i] - 'a'];
        if (v.size() == 1) {
            cout << -1 << endl;
            return 0;
        }
        ll nxt = upper_bound(v.begin(), v.end(), index) - v.begin();
        if (v[nxt] == INF || v[nxt] < index) {
            x++;
            nxt = 0;
        }
        index = v[nxt];
    }

    cout << x * N + index + 1 << endl;

    return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

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

struct Edge{int to,weight; Edge(int t, int w) : to(t), weight(w) {}};
using DirectedGraph = vector<vector<Edge>>;
using UndirectedGraph = vector<vector<int>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,l;
    cin>>n>>l;
    vector<int> num(n);
    int sum=l;
    num[0] = l;
    int mi = l;
    for(int i=1;i<n;i++){
        num[i] = l + i;
        sum+=num[i];
        //cout<<num[i]<<endl;
        if(abs(mi) > abs(num[i])){
            mi=num[i];
        }
    }
    cout<<sum-mi<<endl;
}

Measured memory_bytes: 256
#include <fstream>
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

int main() {
  int a[5];
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  sort(a, a+5);
  for (int i = 4; i > 0; i--)
    cout << a[i] << " ";
  cout << a[0] << endl;
}

Measured memory_bytes: 1176
n, m, l = map(int, input().split())
a = [0 for i in range(n)]
b = [0 for i in range(m)]

for i in range(n):
  a[i] = list(map(int, input().split()))
for i in range(m):
  b[i] = list(map(int, input().split()))

s = 0
for i in range(n):
  for j in range(l):
    for k in range(m):
      s = s + a[i][k] * b[k][j]
    if k == (m-1):
      print(s, end="")
      s = 0
      if j == (l-1):
        print("")
      else:
        print("", "", end="")


Measured memory_bytes: 6772
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
const int INFTY = (1 << 21); // 2097152
// const ll INFTY = (1LL << 60);
const ll MD = 1000000007LL;
// fprintf(stderr, "%d %lld \n", x, xll);

class Point{
public:
	int x, y;
	Point(int x=0, int y=0):x(x), y(y){}
	bool operator < (const Point &p) const {
		return x != p.x ? x < p.x : y < p.y;
	}
	bool operator == (const Point &p) const{
		return x - p.x == 0 && y - p.y == 0;
	}
};

ll H, W, N;
set<Point> P;
vector<set<Point>> C;

int main() {
	cin >> H >> W >> N;
	rep(i, N){
		int x, y; cin >> y >> x; x--; y--;
		P.insert(Point(x, y));
	}
	rep(d, 10) {
		set<Point> p;
		C.push_back(p);
	}

	for(auto &p: P){
		for(int x = p.x - 2; x <= p.x + 2; x++)
		for(int y = p.y - 2; y <= p.y + 2; y++)
		if(0 <= x && x + 2 < W && 0 <= y && y + 2 < H)
        {
			int c = 0;

            for(int xx = x; xx <= x + 2; xx++)
			for(int yy = y; yy <= y + 2; yy++)
			if(P.find(Point(xx, yy)) != P.end())
            {c++;}

			if(c > 0) { C[c].insert(Point(x, y));
                //fprintf(stderr, "%d - x:%d y:%d\n", c, x, y);
                }
		}
	}

	ll zero = (H - 2) * (W - 2);
	for(int c = 1; c <= 9; c++){
		zero -= C[c].size();
	}

    cout << zero << endl;
	for(int c = 1; c <= 9; c++){ cout << C[c].size() << endl;}
}

Measured memory_bytes: 47104
from collections import Counter

N = int(input())
l = []
for _ in range(N):
    l.append(input())
c = Counter(l)
max_count = c.most_common()[0][1]


output = []
for v in c.most_common():
    if v[1] == max_count:
        output.append(v[0])
    else:
        break

output.sort()
for elem in output:
    print(elem)

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

int main() {
long long n,k,w[100000],d[100000],l=0,r=2e18+4;
cin>>n>>k;
for(int i=0;i<n;i++){
    cin>>w[i]>>d[i];
}
while(l+1<r){
    long long m=(l+r)/2,f=0;
    for(int i=0;i<n;i++){
        if(w[i]<=m){
            f+=(m-w[i])/d[i] +1;
        }
    }
    if(f<k){
        l=m;
    }else{
        r=m;
    }
}
cout<<r<<endl;

	return 0;
}

Measured memory_bytes: 1792
MOD = 998244353

list_size = 10**5*5   # 問題に合わせて適宜書き換え

f_list = [1] * list_size
f_r_list = [1] * list_size

for i in range(list_size - 1):
	f_list[i + 1] = ((f_list[i] * (i+2)) % MOD)

f_r_list[-1] = pow(f_list[-1], MOD - 2, MOD)

for i in range(-2, -list_size-1, -1):
	f_r_list[i] = ((f_r_list[i+1] * (list_size + 2 + i)) % MOD)

def comb(n,r):
    if n < r:
        return 0
    if n == 0 or r == 0 or n == r:
        return 1
    return (((f_list[n - 1] * f_r_list[n - r - 1]) % MOD) * f_r_list[r - 1]) % MOD


N, M, K = map(int,input().split())

X = [M]
for i in range(N-1):
    X.append((X[-1]*(M-1)) % MOD)

ans = 0
for i in range(K+1):
    ans += (X[N-i-1] * comb(N-1,i)) % MOD
    ans %= MOD

print(ans)

Measured memory_bytes: 56280
#include<bits/stdc++.h>
using namespace std;
 
//#define int long long
#define ll long long 
#define f(i,l,n) for(int i=l;i<n;i++)
#define E "\n"
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAX 1e18
#define float long double
 
const int N=2e5+3;

#define pi 3.141592653590





int32_t main()
{
 
  

	int n,m;
	cin >> n >> m;
	int sum=0,a[m];
	f(i,0,m) cin >> a[i],sum+=a[i];
	sum=n-sum;
	if(sum<0) cout<<-1;
	else cout<<sum;
}


Measured memory_bytes: 3672
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

bool ans[100005] = {0};

long long gozyo(long long x){
    long long ans = x;
    for (int i = 1;i < 5;i++){
        ans = ans*x;
    }
    return ans;
}

int main()
{
    long long x;
    cin >> x;
    
    long long ansx = 0;
    long long ansy = 0;
    for (long long i = 1;i <= 5000;i++){
        for (long long j = -1000;j <= 1000;j++){
            if (gozyo(i) - gozyo(j) == x){
                ansx = i;
                ansy = j;
                break;
            }
        }
    }
    cout << ansx << " " << ansy << endl;
    
}


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

int main() {
	int n,l;
	cin >> n >> l;
	vector<string> s(n);
	rep(i,n) cin >> s[i];
	sort(s.begin(), s.end());
	rep(i,n) cout << s[i];
	return 0;
}


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

using namespace std;

int n;

int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; i++)
        cin >> p[i];
    int res = 0;
    for (int i = 1; i < n - 1; i++)
    {
        int a[] = {p[i - 1], p[i], p[i + 1]};
        vector<int> g(a, a + 3);
        sort(g.begin(), g.end());
        if (p[i] == g[1])
            ++res;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int,input().split()))
L = {}
R = {}
ans = 0
for i,j in enumerate(A):
    if i+j in L:
        L[i+j] += 1
    else:
        L[i+j] = 1
    if i-j in R:
        R[i-j] += 1
    else:
        R[i-j] = 1
for i,j in L.items():
    if i in R:
        ans += j*R[i]
print(ans)

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

int main() {
  
  int D;
  cin >> D;
  if(D == 25) cout << "Christmas";
  else if(D == 24) cout << "Christmas Eve";
  else if(D == 23) cout << "Christmas Eve Eve";
  else cout << "Christmas Eve Eve Eve";
  
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, A, B;
    cin >> N >> A >> B;
    cout << min(A*N,B) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
string s; cin >> s;
int n = s.size();
set<char> se;
for(int i = 0; i < n; ++i)se.insert(s[i]);
string ans = "no";
if(n== se.size())ans = "yes";
cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
 
using namespace std;
using namespace __gnu_pbds;
 
#define debug(s) cout << #s << " = " << s << endl
#define all(v) (v).begin(), (v).end()
#define mem(a,val) memset(a, val, sizeof a)
 
#define maxn 100010
#define INF 1e15
#define ff first
#define ss second
#define endl '\n'
typedef long long ll;
 
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  string s;
  cin >> s;
  n = s.size();
  string a = "0", b = "1";
  for (int i = 1; i < n; ++i) {
    if (a[i - 1] == '0') a += "1";
    else a += "0";
    if (b[i - 1] == '0') b += "1";
    else b += "0";
  }
  int ca = 0, cb = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] != a[i]) ca++;
    if (s[i] != b[i]) cb++;
  }
  if (ca < cb) cout << ca << endl;
  else cout << cb << endl;
}





Measured memory_bytes: 720
#include <stdio.h>
int main()
{int n,i,j,h,s,l[10000];
while(~scanf("%d",&n))
  {s=0;
  for(i=0;i<n;i++)
     scanf("%d",&l[i]);
     for(i=0;i<n;i++)
     for(j=i+1;j<n;j++)
     for(h=j+1;h<n;h++)
     if(l[i]+l[j]>l[h]&&l[i]+l[h]>l[j]&&l[j]+l[h]>l[i])s++;
     printf("%d\n",s);
  }
}


Measured memory_bytes: 384
from collections import deque
r,c=map(int,input().split())
ko =[list(input()) for i in range(r)]
d=[(-1,0),(1,0),(0,-1),(0,1)]


ans = 0
for sy in range(r):
    for sx in range(c):
        if ko[sy][sx] == "." :
            #print(sy,sx, "やります")
            dist = [[r*(2*c) for i in range(c)] for i in range(r)]
            H = deque()
            H.append((sy,sx))
            dist[sy][sx]=0


            while H:
                y,x=H.popleft()
                #print(y,x)
                for i in d:
                    if 0<=y+i[0]< r and 0<=x+i[1]< c and ko[y+i[0]][x+i[1]]=="." and dist[y+i[0]][x+i[1]]>dist[y][x]+1:
                        dist[y+i[0]][x+i[1]] = dist[y][x]+1
                        H.append((y+i[0],x+i[1]))

            #print(dist)
            maxnow = 0
            for i in range(r):
                for j in range(c):
                    if dist[i][j] > maxnow and dist[i][j] != r*2*c:
                        maxnow = dist[i][j]
            if maxnow > ans :
                ans = maxnow

print(ans)

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

#define cnd(c, a, b) (c ? a : b);
#define fl(x,y,z) for(int x=y;x<z;x++)
#define fe(x,y,z) for(int x=y;x<=z;x++)
#define fge(x,y,z) for(int x=y;x>=z;x--)

#define debug(x) std::cerr << #x << " --> " << x << "\n";
#define fastIO std::ios_base::sync_with_stdio(false);std::cin.tie(0);std::cout.tie(0);
#define pb push_back
#define pob pop_back
 
#define ln '\n'
typedef long long int ll;

ll mod=1e9+7;

void decrypt() {
  string s;
  cin>>s;
  if(s[s.length()-1]=='s') {
     s += "es";
  } else {
    s+='s';
  }
  cout<<s<<ln;
  return;
} 

int main() {
    fastIO
    int t = 1;
    // cin >> t;
    fl(i,0,t) {
    	// cout << "Case #"<< i+1 <<": ";
    	decrypt();
    }
    return 0;
}

Measured memory_bytes: 3636
n = int(input())
a=[]
for i in range(n):
    x=list(map(int,input().split()))
    a.append(x)

a.sort(key=lambda x:x[1])
time=0
over=0
for i in range(n):
    if time+a[i][0]>a[i][1]:
      over=1
      break
    else:
        time+=a[i][0]

print("Yes") if over==0 else print("No")

Measured memory_bytes: 53716
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    long long int a,b,c;
    cin >> a >> b >> c;
    if(4 * a * b < (c-a-b) * (c-a-b) && a + b < c){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

const int maxn = 20 + 3, maxv = maxn * maxn;

const int dxy[][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};

int h, w;
char s[maxn][maxn];
int d[maxn][maxn], ans;
bool vis[maxn][maxn];

void bfs(int u, int v) {
    std::queue<std::pair<int, int>> q;
    memset(vis, 0, sizeof(vis));
    d[u][v] = 0;
    vis[u][v] = true;
    q.emplace(u, v);
    while(!q.empty()) {
        int x, y;
        x = q.front().first;
        y = q.front().second;
        q.pop();
        for(int i = 0; i < 4; ++i) {
            int dx = dxy[i][0];
            int dy = dxy[i][1];
            if(x + dx < 0 || x + dx >= h || y + dy < 0 || y + dy >= w || vis[x + dx][y + dy] || s[x + dx][y + dy] == '#') {
                continue;
            }
            d[x + dx][y + dy] = d[x][y] + 1;
            vis[x + dx][y + dy] = true;
            q.emplace(x + dx, y + dy);
        }
    }
}

void update() {
    for(int i = 0; i < h; ++i) {
        for(int j = 0; j < w; ++j) {
            if(vis[i][j]) {
                ans = std::max(ans, d[i][j]);
            }
        }
    }
}

int main() {
    scanf("%d%d", &h, &w);
    for(int i = 0; i < h; ++i) {
        scanf("%s", s[i]);
    }
    for(int i = 0; i < h; ++i) {
        for(int j = 0; j < w; ++j) {
            if(s[i][j] == '.') {
                bfs(i, j);
                update();
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

//-------------------------------------------------
//--ModInt
//-------------------------------------------------
const ::std::uint_fast64_t MOD = 1e9+7;

class mint
{
private:
    using value_type = ::std::uint_fast64_t;
    value_type n;
public:
    mint():n(0){}
    mint(::std::int_fast64_t _n):n(_n<0 ? MOD-(-_n)%MOD : _n%MOD){}
    mint(const mint &m):n(m.n){}

    friend ::std::ostream& operator<<(::std::ostream &os, const mint &a){
		return os << a.n;
	}
    friend ::std::istream& operator>>(::std::istream &is, mint &a){
        value_type temp; is>>temp;
        a = mint(temp);
        return is;
    }

    mint& operator+=(const mint &m){n+=m.n; n=(n<MOD)?n:n-MOD; return *this;}
    mint& operator-=(const mint &m){n+=MOD-m.n; n=(n<MOD)?n:n-MOD; return *this;}
    mint& operator*=(const mint &m){n=n*m.n%MOD; return *this;}
    mint& operator/=(const mint &m){return *this*=m.inv();}
    mint& operator++(){return *this+=1;}
    mint& operator--(){return *this-=1;}

    mint operator+(const mint &m) const {return mint(*this)+=m;}
    mint operator-(const mint &m) const {return mint(*this)-=m;}
    mint operator*(const mint &m) const {return mint(*this)*=m;}
    mint operator/(const mint &m) const {return mint(*this)/=m;}
    mint operator++(int){mint t(*this); *this+=1; return t;}
    mint operator--(int){mint t(*this); *this-=1; return t;}

    mint operator==(const mint &m) const {return n==m.n;}
    mint operator!=(const mint &m) const {return n!=m.n;}
    mint operator-() const {return mint(MOD-n);}

    mint pow(value_type b) const {
        mint ret(1), m(*this);
        while(b){
            if (b & 1) ret*=m;
            m*=m;
            b>>=1;
        }
        return ret;
    }

    mint inv() const {return pow(MOD-2);}
};

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    string s[2];
    rep(i,2) cin>>s[i];
    int last=0;
    mint ans=1;
    rep(i,n){
        if (s[0][i]==s[1][i]){
            ans*=3-last;
            last = 1;
        }else{
            if (last==2) ans*=3;
            if (last==1) ans*=2;
            if (last==0) ans*=6;
            last = 2;
            i++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

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

  int n, a[100100];
  cin >> n;
  for (int i = 0; i < n; i++)
  {
    cin >> a[i];
    if (!i || a[i] > a[i - 1])
      a[i]--;
    if (i && a[i] < a[i - 1])
    {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }

int main() {
	string s;
	cin >> s;
	int n = s.size();
	REP(i, n - 1) {
		if (s[i] == 'A' && s[i + 1] == 'C') {
			put("Yes");
			return 0;
		}
	}
	put("No");
	return 0;
}


Measured memory_bytes: 256
x = int(input())
a = []

for i in range(1,32):
  for j in range(2,10):
    if i**j > 1000:
      break
    else:
      a.append(i**j)
a = list(set(a))
a.sort()
for i in reversed(a):
  if i <= x:
    print(i)
    break

Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>

int main(void){
	char s[200],t[101];
	int n;
	int i,j;
	int flag;

	scanf("%s",s);
	scanf("%s",t);

	n = strlen(s);


	for(i = n;i<n*2-1;i++){
		s[i] = s[i-n];
	}

	for(i=0;i<n;i++){
		flag = 0;
		for(j=0;j<n;j++){
			if(s[j+i] != t[j]){
				flag = 1;
				break;
			}
		}
		if(flag == 0){
			printf("Yes\n");
			return 0;
		}
	}

	printf("No\n");
	return 0;

}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A,B,C,D,F,G=0,H=0,I=0;
    vector<int>ans(1);
    cin>>ans[0];
    for(int i=1;;i++){
        if(ans[i-1]%2==0)ans.push_back(ans[i-1]/2);
        else ans.push_back(ans[i-1]*3+1);
        A=ans.size();
        for(int j=0;j<A-1;j++){
            if(ans[A-1]==ans[j]){
                cout << A << endl;
                G=1;
                break;
            }
        }
        if(G)break;
    }
}


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

n = a[0]
k = a[1]

c = []
bfr = 0
aft = 0
for i in range(k-1, n):
    if i != k-1:
        if b[i - k] < b[i]:
            c.append("Yes")
        else:
            c.append("No")
    
            
s_n = '\n'.join(c)
print(s_n)   

Measured memory_bytes: 31660