akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef pair< ll, ll > P;

//マクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 1000000007    //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

// debug
#define DEBUG(x) cout << #x << ": " << x << endl
#define DEBUG2(x, y) cout << #x << ": " << x << " " << #y << ": " << y << endl
#define DEBUG_VEC(v)   \
  cout << #v << ":";   \
  REP(i, v.size())     \
  cout << " " << v[i]; \
  cout << endl
#define DEBUG_ARR(v, n) \
  cout << #v << ":";    \
  REP(i, n)             \
  cout << " " << v[i];  \
  cout << endl

signed main()
{
  int N;
  string S;
  cin >> N;
  cin >> S;

  ll cnt = 0;
  FOR(i, 0, N - 3)
  {
    string str = S.substr(i, 3);
    // cout << str << endl;
    if (str == "ABC")
    {
      cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i =(b)-1;i>=(a);--i)
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
typedef vector<int> vi;
const int mod = 1e9 + 7;
const int maxn = 2e6 + 10; 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	n = n % 10;
	if(n == 3)
		cout << "bon";
	else
		if(n == 1 || n == 0 || n == 6 || n == 8)
			cout << "pon";
		else
			cout << "hon";
	return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>

int main(void){
    long int A,B;
    scanf("%ld %ld",&A,&B);
    long int r;
    if (A<B) {
        int tmp;
        tmp=A;
        A=B;
        B=tmp;
    }
    r=A%B;
    long int a=A,b=B;
    while (r!=0) {
        a=b;
        b=r;
        r=a%b;
    }
    printf("%ld\n",(A*B)/b);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()



int main() {
    int n;
    cin >> n;
    vector<int> m(n, 0), sum(n, 0);
    rep (i, n) {
        string s;
        cin >> s;
        int ctr = 0;
        rep (j, s.size()) {
            switch (s[j]) {
                case '(':
                    ctr++;
                    break;
                case ')':
                    ctr--;
                    break;
            }
            chmin(m[i], ctr);
        }
        sum[i] = ctr;
    }
    int check_sum = 0;
    rep (i, n) {
        check_sum += sum[i];
    }
    if (check_sum != 0) {
        cout << "No" << endl;
        exit(0);
    }
    vector<P> plus, minus;
    rep (i, n) {
        if (sum[i] < 0) {
            minus.emplace_back(make_pair(m[i], sum[i]));
        } else {
            plus.emplace_back(make_pair(m[i], sum[i]));
        }
    }
    sort(all(plus), greater<P>());
    int now = 0;
    rep(i, plus.size()) {
        if (plus[i].first + now < 0) {
            cout << "No" << endl;
            exit(0);
        } else {
            now += plus[i].second;
        }
    }
    rep(i, minus.size()) {
        int newm = minus[i].first - minus[i].second;
        int news = -minus[i].second;
        minus[i] = make_pair(newm, news);
    }
    sort(all(minus), greater<P>());
    now = 0;
    rep (i, minus.size()) {
        if (minus[i].first + now < 0) {
            cout << "No" << endl;
            exit(0);
        } else {
            now += minus[i].second;
        }
    }
    cout << "Yes" << endl;
}

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

int main(){
	long long Q,H,S,D,N;
	cin >> Q >> H >> S >> D >> N;
	
	H=min(H,Q*2);
	S=min(S,H*2);
	D=min(D,S*2);
	
	long long ans=N/2*D;
	if(N%2==1)ans+=S;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
n, k = map(int, readline().split())
A = [i - 1 for i in map(int, readline().split())]

m = 60
d = [A]
pre = A
for i in range(m):
    current = [pre[pre[j]] for j in range(n)]
    d.append(current)
    pre = current

route = 0
for i in range(m-1, -1, -1):
    if k >= (x := 1 << i):
        route = d[i][route]
        k -= x
print(route+1)


Measured memory_bytes: 113008
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
const int N = 110;
int n, m;
char a[N][N];
bool row[N], col[N];

int main()
{
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++){
            a[i][j] = getchar();
            while (a[i][j] != '.' && a[i][j] != '#') a[i][j] = getchar();
        }
    for (int i = 1; i <= n; i++){
        bool fl = 1;
        for (int j = 1; j <= m; j++)
            if (a[i][j] == '#'){
                fl = 0;
                break;
            }
        row[i] = fl;
    }
    for (int i = 1; i <= m; i++){
        bool fl = 1;
        for (int j = 1; j <= n; j++)
            if (a[j][i] == '#'){
                fl = 0;
                break;
            }
        col[i] = fl;
    }
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= m; j++)
            if (!row[i] && !col[j])
                putchar(a[i][j]);
        if (!row[i]) putchar('\n');
    }
    return 0;
}


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

int main() {
  string a, b, c;
  cin >> a >> b >> c;

  if (a.at(a.size() - 1) == b.at(0) && b.at(b.size() - 1) == c.at(0)) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


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

int E, Y;

int main() {
	cin >> E >> Y;
	if (E == 0) {
		if (Y <= 1911) cout << "M" << Y - 1867 << endl;
		else if (Y <= 1925) cout << "T" << Y - 1911 << endl;
		else if (Y <= 1988) cout << "S" << Y - 1925 << endl;
		else cout << "H" << Y - 1988 << endl;
	}
	else if (E == 1) cout << 1867 + Y << endl;
	else if (E == 2) cout << 1911 + Y << endl;
	else if (E == 3) cout << 1925 + Y << endl;
	else if (E == 4) cout << 1988 + Y << endl;
	return 0;
}


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

using namespace std;

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

	vector<long long> X(N), Y(N);
	int count = 0;

	for (int i = 0; i < N; i++) {
		cin >> X[i] >> Y[i];
	}

	for(int i = 0; i < N; i++) {
		if(X[i] * X[i] + Y[i] * Y[i] <= D * D) {
			count++;
		}
	}

	cout << count << endl;
	return 0;
}

Measured memory_bytes: 6368
#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define BIT(b, i) (((b) >> (i)) & 1)
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

ll pow(int x, int n){
  return n == 0 ? 1 : x * pow(x, n - 1);
}


/*
n
xi ui

 1.0 BTC あたり 380000.0 円
 
 n 10
 JPY または BTC
 JPY xi 10^8
 BTC xi double
 
 epsilon 10^-5
 */
int n;
long double ans=0;

int main(){
  cin>>n;
  REP(i,n){
    long double x;
    string u;
    cin>>x>>u;
    if(u=="JPY"){
      ans += x;
    } else {
      ans += 380000.0 * x;
    }
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String args[]) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        int n = Integer.parseInt(br.readLine().trim());
        out.println(n+(n*n)+(n*n*n));
        out.flush();
    }
}

Measured memory_bytes: 32528
import heapq
n,m = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n):
    a[i] = -a[i]
heapq.heapify(a)
ans = 0
for i in range(m):
    temp = (heapq.heappop(a)+1)//2
    heapq.heappush(a,temp)
print(-sum(a))

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

int main() {
  string s, t;
  cin >> s >> t;
  
  
  // 全探索
  int max_cnt = 0; // 最大一致数
  for (int i = 0; i <= (s.size() - t.size()); i++) {
    int cnt = 0;
    for (int j = 0; j < t.size(); j++) {
      if (s[i + j] == t[j]) cnt += 1;
     }
    max_cnt = max(max_cnt, cnt);
  }

  cout << (t.size() - max_cnt);
}

Measured memory_bytes: 3228
#include<stdio.h>
#include<iostream>
#include<string.h>
using namespace std;
int a[100];
int i;
bool check(int n)
{
    while(n)
    {
    if(a[n%10])
     return 0;
    n=n/10;
    }
    return true;
}
int main()
{
    int n;
    int k;
    int x;
    while(~scanf("%d%d",&k,&n))
    {
        for(i=0;i<n;i++)
        {
            scanf("%d",&x);
            a[x]=1;
        }
        for(i=k;;i++)
        if(check(i))
           {

           printf("%d\n",i);
           break;
           }
           memset(a,0,sizeof(a));
    }
    return 0;
}

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

int main() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (count(s.begin(), s.end(), s[i]) != 1) {
			cout << "no" << endl;
			return 0;
		}
	}
	cout << "yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define db double

using namespace std;
const int N=1e5+10,mod=998244353;
int rd()
{
    int x=0,w=1;char ch=0;
    while(ch<'0'||ch>'9'){if(ch=='-') w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+(ch^48);ch=getchar();}
    return x*w;
}
void ad(int &x,int y){x+=y,x-=x>=mod?mod:0;}
int fpow(int a,int b){int an=1;while(b){if(b&1) an=1ll*an*a%mod;a=1ll*a*a%mod,b>>=1;}return an;}
int ginv(int a){return fpow(a,mod-2);}
int n,pw[N],vs[N],ti,sb[3][N],ans;
queue<int> q;
struct graph
{
	int to[N],nt[N],hd[N],sg[N],tot;
	void adde(int x,int y){++tot,to[tot]=y,nt[tot]=hd[x],hd[x]=tot;}
	void inii()
	{
		for(int x=n;x;--x)
		{
			++ti;
			for(int i=hd[x];i;i=nt[i])
			{
				int y=to[i];
				vs[sg[y]]=ti;
			}
			while(vs[sg[x]]==ti) ++sg[x];
		}
	}
}gg[3];

int main()
{
	n=rd();
	pw[0]=1,pw[1]=fpow(10,18);
	for(int i=2;i<=n;++i) pw[i]=1ll*pw[i-1]*pw[1]%mod;
	for(int h=0;h<=2;++h)
	{
		int m=rd();
		for(int i=1;i<=m;++i)
		{
			int x=rd(),y=rd();
			if(x>y) swap(x,y);
			gg[h].adde(x,y);
		}
		gg[h].inii();
		for(int i=1;i<=n;++i) ad(sb[h][gg[h].sg[i]],pw[i]);
	}
	for(int i=0;i<=1000;++i)
		for(int j=0;j<=1000;++j)
			ad(ans,1ll*sb[0][i]*sb[1][j]%mod*sb[2][i^j]%mod);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 6784
#include <stdio.h>
int main(){
    int W,H,x,y,r;
    scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
    if(r<=x && x<=(W-r) && r<=y && y<=(H-r)){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 584
import java.util.Scanner;


public class Main{

	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);

		int a =sc.nextInt();
		int c=sc.nextInt();
		int b=sc.nextInt();

		if((a<=b&&b<=c)||(c<=b&&b<=a))System.out.println("Yes");
		else System.out.println("No");


	}
}

Measured memory_bytes: 22100
#include<stdio.h>

#define MAX 100000
#define NIL -1

struct Node{
  int p;
  int l;
  int r;
  };

struct Node T[MAX];
int n,D[MAX];

void print(int u){
  int i,c;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].p);
  printf("depth = %d, ",D[u]);

  if(T[u].p == NIL) {
    printf("root,");
  }else if(T[u].l == NIL){
    printf("leaf,");
  } else {
    printf("internal node,");
  }
  printf(" [");

  for(i = 0,c = T[u].l;c !=NIL;i++,c = T[c].r){
    if(i>0) printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}
void rec(int node, int depth){
  D[node]=depth;
  if(T[node].r!=NIL) rec(T[node].r,depth);
  if(T[node].l!=NIL) rec(T[node].l,(depth+1));
}

int main(){
  int i,u,j,k,a,m,root;

  scanf("%d",&n);

  for(i=0;i<n;i++) T[i].p = T[i].l = T[i].r = NIL;

  for(i=0;i<n;i++){
    scanf("%d%d",&u,&j);
    for(k=0;k<j;k++){
      scanf("%d",&a);
      if(k==0) T[u].l=a;
      else T[m].r=a;
      m=a;
      T[a].p=u;
    }
  }

  for(i=0;i<n;i++){
    if(T[i].p==NIL) root=i;
  }
  rec(root,0);
  for(i=0;i<n;i++) print(i);

  return 0;
}



Measured memory_bytes: 6420
#include<iostream>
#include<cmath>
#include<vector>
#define ll long long 



using namespace std;

ll dp[102][100005];
ll mod = 1e9 + 7;

ll solve(ll n, ll k, vector<ll>& v)
{
	

	for (ll j = 0; j <= k ; j++){
		dp[1][j] = (j > v[1]) ? 0 : 1;
	}

	for (ll i = 2; i <= n ; i++){
		for(ll j = 0; j<= k; j++){

			if(j == 0)
			{
				dp[i][j] = dp[i -1][j];
				dp[i][j] = (mod + dp[i][j])%mod;
			}
			else
			{
				dp[i][j] = dp[i][j - 1]+ dp[i - 1][j]  - ((j - v[i] - 1 >= 0) ? dp[i - 1][j - v[i] - 1] : 0);
				dp[i][j] = (mod + dp[i][j]) % mod;
			}
		}
	}
	return dp[n][k];

}


int main(){

	ll n, k;

	cin >> n >> k;
	vector<ll> v(n + 1);

	for(ll i = 1; i<=n; i++){
		cin >> v[i];

	}

	cout << solve(n, k, v) << endl;
	return 0;
}

Measured memory_bytes: 78336
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx")

#include <bits/stdc++.h>
#define pb push_back
#define pp pop_back()
#define mp make_pair
#define f first
#define s second
#define y1 yasfasf
#define kz ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FILE "substring"
#define fr freopen(FILE".in", "r", stdin); freopen(FILE".out", "w", stdout);
using namespace std;
typedef pair <int, int> pii;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef struct node* treap;

const int N = 3e5 + 11, inf = 1e9;
const ll linf = 1e18, mod = 1e9 + 7;

int n, a[N], ans;

int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
		scanf("%d", &a[i]);
	for(int i = 1; i < n; ++i){
		if(a[i] == i){
			swap(a[i], a[i + 1]);
			ans++;
		}	
	}
	if(a[n] == n)
		ans++;
	cout << ans;
	return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <iostream>
#include <map>
#include <random>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
/*---------------------------------------*/

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n; cin >> n;
  vector<int> d(n); REP(i, n) cin >> d[i];
  sort(ALL(d));
  d.erase(unique(ALL(d)), d.end());
  cout << d.size() << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#include <iomanip>
#define rep(i,x) for(ll i=0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 10010010010;
typedef pair<ll, ll> P;
using graph = vector<vector<ll>>;
const ll mod = 1000000007;
ll gcd(ll a, ll b) {//a>b
    if (a < b)swap(a, b);
    if (a % b == 0) return b;
    else return gcd(b, a % b);
}/*フィボナッチテンプレ
ll memo[50];
ll fibo(ll n) {
    if (memo[n] != 0)return memo[n];
    if (n <= 1)return memo[n] = n;
    else return memo[n] = fibo(n - 1) + fibo(n - 2);
}
*/
bool isp(ll n) {
    bool res = true;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            res = false;
            break;
        }
    }
    return res;
}
ll ctoi(char c) {
    if (c == '0')return 0;
    else if (c == '1')return 1;
    else if (c == '2')return 2;
    else if (c == '3')return 3;
    else if (c == '4')return 4;
    else if (c == '5')return 5;
    else if (c == '6')return 6;
    else if (c == '7')return 7;
    else if (c == '8')return 8;
    else if (c == '9')return 9;
    else return -1;
}int main() {
    ll A, B, C, K;
    cin >> A >> B >> C >> K;
    bool even = false;
    if (K % 2 == 0)even = true;
    ll sa = A - B;
    if (even)cout << sa << endl;
    else cout << sa * -1 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<math.h>
#include<algorithm>
#include<tuple>
#include<utility>
typedef long long LL;
typedef unsigned long long ULL;
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define pb push_back
#define mp make_pair

int main() {
	int r, g, b, n, count = 0;
	cin >> r >> g >> b >> n;
	rep(x, 0, 3001) {
		rep(y, 0, 3001) {
			int m = x * r + y * g;
			if (n >= m && (n - m) % b == 0) {
				count++;
			}
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
const int maxn=100000,maxm=100000;

int n,m,col[maxn+5],A,B;
int E,lnk[maxn+5],son[maxm*2+5],nxt[maxm*2+5];

inline void Add(int x,int y) {son[++E]=y;nxt[E]=lnk[x];lnk[x]=E;}
void Dfs(int x,int now=0,int fa=0)
{
	col[x]=now;now^=1;
	for (int j=lnk[x];j;j=nxt[j])
	{
		if (col[son[j]]==-1) Dfs(son[j],now,x);
		if (col[son[j]]!=now) printf("%lld\n",(LL)n*(n-1)/2-m),exit(0);
	}
}
int main()
{
	scanf("%d%d",&n,&m);memset(col,255,sizeof(col));
	for (int i=1,x,y;i<=m;i++) scanf("%d%d",&x,&y),Add(x,y),Add(y,x);
	Dfs(1);for (int i=1;i<=n;i++) if (col[i]) A++; else B++;
	return printf("%lld\n",(LL)A*B-m),0;
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        int n;
        cin >> n;
        int ans;
        for(int i = 1; i <= n; i++){
            if((i * (i + 1)) / 2 >= n){
                ans = i;
                break;
            }
        }
        int sum = 0;
        while(ans > 0){
            if(sum + ans <= n){
                sum += ans;
                cout << ans << '\n';
            }
            ans--;
        }
    }
}

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

#define int long long
#define ll long long
#define vi vector <int>
#define vii vector <pair<int,int> >
#define rep(i,a,b) for (int i=a;i<b;i++)
#define repD(i,a,b) for (int i=a;i>b;i--)
#define pb push_back
#define pii pair <int,int>
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define MOD 1000000007
#define PI 3.14159265359
/*

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

using namespace __gnu_pbds;
typedef tree<pii,null_type,less <pii>,rb_tree_tag,tree_order_statistics_node_update>ind_set;
*/
///*X.find_by_order("index")
///X.order_of_key("key")



#define deb(x) cerr<<#x<< " : " <<x<<"\n";
#ifndef local
	#define deb(x) ;
#endif
///----------------------------------------------------------------------------------

int n;
pii arr[400005];

void solve()
{
	cin>>n;rep(i,0,n)cin>>arr[i].ss>>arr[i].ff;
	sort(arr,arr+n);

	int ct=0;

	rep(i,0,n)
	{
		ct+=arr[i].ss;
		if (ct>arr[i].ff)
		{
			cout<<"No";return;
		}
	}
	cout<<"Yes";


}
signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);

    #ifdef local
    ///freopen("input.txt","r",stdin);
    ///freopen("output.txt","w",stdout);
    #endif

    clock_t qwertyuiop = clock();
    int t=1;
    ///cin>>t;
    rep(a,0,t)
    {
        ///cout<<"Case #"<<a+1<<": ";
        solve();
    }
    #ifdef local
	{qwertyuiop = clock() - qwertyuiop;double time_taken = ((double)qwertyuiop)/CLOCKS_PER_SEC;cerr<<fixed<<setprecision(5)<<"\n\nTime Taken : "<<time_taken<<" seconds\n";}
	#endif
}


Measured memory_bytes: 4352
#include<cstdio>
#include<vector>
#define N 100000
using namespace std;

vector<int> G[N];
/*
??£??\??????????????????????????°???????????¨??????????????£????????????????????????DFS??§????????????

 */
int labels[N], c=0;

void dfs_init(){
    int i;
    for(i=0;i<N; i++)labels[i]=0;
}

/*
  ?????°?????¨??????????£?
  ??§???????????????????????????
  stack???????????°??§???????????????
 */
bool dfs(int u, int v){
    if (u == v) return true;
    labels[u] = 1;
    int i,x;
    for(i=0; i<G[u].size(); i++){
	x = G[u][i];
	dfs(x,v);
    }
    return false;
}

void dfs2(int u){
    labels[u]=c;
    int i;
    for(i=0; i<G[u].size(); i++){
	if (labels[G[u][i]]==0) dfs2(G[u][i]);
    }
}


int main(void) {
    int n,m,i,q, u,v;
    scanf("%d %d",&n,&m);
    for(i=0;i<m;i++){
	scanf("%d %d",&u,&v);
	G[u].push_back(v);
	G[v].push_back(u);
    }
    dfs_init();
    /*
      ????????§?????¨???????????????
     */
    for(i=0; i<n; i++){
	if(labels[i]==0){
	    c++;
	    dfs2(i);
	}
    }

    scanf("%d",&q);
    for(i=0;i<q;i++){
	scanf("%d %d", &u, &v);
	if(labels[u]>0 && labels[u]==labels[v])printf("yes\n");
	else printf("no\n");
    }
    
    return 0;
}

Measured memory_bytes: 10008
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<int(n);i++)
using namespace std;
int main() {
	int n;
	string ans="No";
	cin >>n;
	map<string,int>memo;
	rep(i,n){
		string s;
		cin >> s;
		memo[s]++;
	}
	int maxv=0;
	for(const auto& x :memo){
		maxv=max(maxv,x.second);
	}
	for(auto it=memo.begin();it!=memo.end();it++){
		if (it->second==maxv){
			cout << it->first<<endl;
		}
	}
	return 0;
}


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

int main()
{
  short n;
  cin >> n;
  if(n==1){
    cout << "1" << endl;
    return 0;
  }
  
  long lucas[87];
  lucas[0]=2;
  lucas[1]=1;
  for(int i=2;i<=n;++i){
    lucas[i]=lucas[i-2]+lucas[i-1];
  }
  
  cout << lucas[n] << endl;
  return 0;
}

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

#define ll long long
#define ull unsigned long long

using namespace std;

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

	vector <ll> A(N);
	for (int ii = 0; ii < N; ++ii){
		cin >> A[ii];
	}

	ll ans = 0;
	map <ll, ll> m;
	m[-A[0]]++;
	for (int ii = 1; ii < N; ++ii){
		ll tmp1 = A[ii] - ii;
		ans += m[tmp1];
		ll tmp2 = -A[ii] - ii;
		m[tmp2]++;
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 27400
n, m = map(int, input().split(" "))
ab = [tuple(map(int, input().split(" "))) for i in range(m)]

from_one, to_n = set(), set()
for ab_i in ab:
	if ab_i[0] == 1:
		from_one.add(ab_i[1])
	elif ab_i[1] == n:
		to_n.add(ab_i[0])
	
print("POSSIBLE" if from_one & to_n else "IMPOSSIBLE")

Measured memory_bytes: 37160
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
char a[]="apple";
char p[]="peach";
main(){
  char str[1111];
  fgets(str,sizeof(str),stdin);
  int n=strlen(str);
  for(int i=0;i<n-5;i++){
    int ac=0;
    int pc=0;  
    for(int j=0;j<5;j++){
      if(str[i+j]==a[j]) ac++;
      if(str[i+j]==p[j]) pc++;
    }
    if(ac==5){
      for(int j=0;j<5;j++){
	str[i+j]=p[j];
      }
    }else if(pc==5){
      for(int j=0;j<5;j++){
	str[i+j]=a[j];
      }
    }

  }
  printf("%s",str);
}

Measured memory_bytes: 1112
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt(),m=sc.nextInt();
		boolean[] ac=new boolean[n+1];
		int[] wa=new int[n+1];
		Arrays.fill(ac, false);
		int acn = 0,wan = 0;
		while(m-->0) {
			int a=sc.nextInt();
			String s=sc.nextLine();
			if(s.equals(" AC")) {
				ac[a] = true;
			}else {
				if(!ac[a]) {
					wa[a]++;
				}
			}
		}
		for(int i=1;i<n+1;i++) {
			if(ac[i])
				acn++;
			if(wa[i]>0&&ac[i]) {
				wan+=wa[i];
			}
		}
		System.out.print(acn+" "+wan);
	}
}

Measured memory_bytes: 152696
#!/usr/bin/env python
import string
import sys
from itertools import chain, dropwhile, takewhile

INF = float("inf")


def read(
    *shape, f=int, it=chain.from_iterable(sys.stdin), whitespaces=set(string.whitespace)
):
    def read_word():
        w = lambda c: c in whitespaces
        nw = lambda c: c not in whitespaces
        return f("".join(takewhile(nw, dropwhile(w, it))))

    if not shape:
        return read_word()
    elif len(shape) == 1:
        return [read_word() for _ in range(shape[0])]
    elif len(shape) == 2:
        return [[read_word() for _ in range(shape[1])] for _ in range(shape[0])]


def readi(*shape):
    return read(*shape)


def readi1(*shape):
    return [i - 1 for i in readi(*shape)]


def readf(*shape):
    return read(*shape, f=float)


def reads(*shape):
    return read(*shape, f=str)


def arr(*shape, fill_value=0):
    if len(shape) == 1:
        return [fill_value] * shape[0]
    elif len(shape) == 2:
        return [[fill_value] * shape[1] for _ in range(shape[0])]


def dbg(**kwargs):
    print(
        ", ".join("{} = {}".format(k, repr(v)) for k, v in kwargs.items()),
        file=sys.stderr,
    )


def main():
    V, E = readi(2)
    G = arr(V, V, fill_value=INF)
    for i in range(V):
        G[i][i] = 0
    for _ in range(E):
        s, t, d = readi(3)
        G[s][t] = d

    for k in range(V):
        for i in range(V):
            for j in range(V):
                G[i][j] = min(G[i][j], G[i][k] + G[k][j])

    for k in range(V):
        for i in range(V):
            for j in range(V):
                if G[i][j] > G[i][k] + G[k][j]:
                    print("NEGATIVE CYCLE")
                    return

    for i in range(V):
        print(" ".join(map(lambda n: "INF" if n == INF else str(n), G[i])))


if __name__ == "__main__":
    main()



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

typedef long long ll;

/* メモリ食い過ぎ注意 */
#define int ll
#define ALL(v) v.begin(), v.end()
#define _REP(i, n) for (int i = 0; i < n; i++)
#define REP(n) _REP(i, n)

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    int n;
    vector<int> b;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int tmp;
        cin >> tmp;
        b.push_back(tmp);
    }

    vector<int> v;
    while (b.size())
    {
        int mx = 0;
        for (int i = 1; i <= b.size(); i++)
        {
            if (i == b[i - 1])
            {
                mx = max(mx, i);
            }
        }
        if (!mx)
        {
            cout << -1 << endl;
            return 0;
        }
        v.push_back(mx);
        // cout << "a" << mx << endl;
        if (b.size())
            b.erase(b.begin() + mx - 1);
    }
    reverse(v.begin(), v.end());
    for (int i = 0; i < v.size(); i++)
        cout << v[i] << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

class question {
public:
	int N;
	void ans() {
		cin >> N;
		string res = "second\n";
		REP(i, N) {
			int a;
			cin >> a;
			if (a % 2) res = "first\n";
		}
		cout << res;
	}
};

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

	question q;
	q.ans();

	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
using ll = long long;
int main() {
    int k;
    cin >> k;
    int ans = 0;
    if(k % 2 == 0 || k % 5 == 0){
        ans = -1;
    }else{
        int num = 7;
        int keta = 1;
        int n = num % k;
        while(n != 0){
            n = (n * 10 + 7) % k;
            keta++;
        }
        ans = keta;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3584
class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i


n, m = map(int, input().split())
bit = Bit(n + 1)
cities = map(int, input().split())
prev = next(cities)
for cur in cities:
    if prev < cur:
        bit.add(prev, 1)
        bit.add(cur, -1)
    else:
        bit.add(cur, 1)
        bit.add(prev, -1)
    prev = cur

ans = 0
for i in range(1, n):
    a, b, c = map(int, input().split())
    bep = c // (a - b)
    cnt = bit.sum(i)
    if cnt > bep:
        ans += b * cnt + c
    else:
        ans += a * cnt
print(ans)

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

#define ff first
#define ss second
#define PI acos(-1)
#define pb push_back
#define int long long
#define ld long double
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define all(x) x.begin(),x.end()
#define pii pair<long long,long long>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int M = (1e9)+7;
const int N = 1e6+5;

signed main()
{
    FAST
    int tc=1;
    //cin>>tc;
    for(int ti=1;ti<=tc;ti++)
    {
        int ma = 0;
        int n;
        cin>>n;
        int a[n];
        int ans = 0;
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            ma = max(ma, a[i]);
            if(i)ans += ma - a[i];
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 5176
#include <iostream>
#include <string>
#include <algorithm>
#include<math.h>
using namespace std;
int main(){
	int A, B, C, K;
			cin >> A >>B>>C>>K; 
	int Z;
	if(A>B){
		Z=A;
		if(A>C){
			Z=A;
			cout << B + C + A*(pow(2,K))<<endl;
		}else{
			Z=C;
			cout << B + A + C*(pow(2,K))<<endl;
		}
	}else{
		Z=B;
		if(B>C){
			Z=B;
			cout << C + A + B*(pow(2,K))<<endl;
		}else{
			Z=C;
			cout << B + A + C*(pow(2,K))<<endl;
		}
	}
	return 0;
}

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

using namespace std;

int main()
{
    char in;
    char out;


    cin >> in;

    switch (in)
    {
        case 'A':
            out = 'T';
            break;
        case 'T':
            out = 'A';
            break;
        case 'G':
            out = 'C';
            break;
        case 'C':
            out = 'G';
            break;
        default:
            break;
    }
    cout << out << endl;
}

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

using namespace std;
typedef long long LL;

template<typename T>
void vecprint(vector<T> v) {
    for(auto x : v) {
        cout << x << " ";
    }
    cout << endl;
}

template<typename T>
void pqprint(priority_queue<T> q) {
    while(!q.empty()) {
        cout << q.top() << " ";
        q.pop();
    }
    cout << endl;
}

template<typename T>
void qprint(queue<T> q) {
    while(!q.empty()) {
        cout << q.front() << " ";
        q.pop();
    }
    cout << endl;
}

template<typename T>
void vecqprint(vector<queue<T>> v) {
    for(int i = 0; i < v.size(); i++) {
        qprint(v[i]);
    }
}

int main(void) {
    int n;
    cin >> n;
    
    vector<queue<int>> v(n);
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n-1; j++) {
            int tmp;
            cin >> tmp;
            v[i].push(tmp-1);
        }
    }
    
    //vecqprint(v);
    
    int day=0;
    vector<int> check;
    for(int i = 0; i < n; i++) {
        check.push_back(i);
    }
    
    while(!check.empty()) {
        day++;
        //cout << "day " << day << endl;
        
        vector<bool> isdone(n, false);
        vector<int> checknext;
        
        for(auto i : check) {
            if(v[i].empty()) continue;
            if(isdone[i] || isdone[v[i].front()]) continue;
            
            if(i == v[v[i].front()].front()) {
                isdone[i] = true;
                isdone[v[i].front()] = true;
                checknext.push_back(i);
                checknext.push_back(v[i].front());
                v[v[i].front()].pop();
                v[i].pop();
            }
        }
        
        check = checknext;
        //vecqprint(v);
    }
    
    
    for(int i = 0; i < n; i++) {
        if(!v[i].empty()) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << day-1 << endl;
}

Measured memory_bytes: 4736
#!/usr/bin/env ruby

n = gets.to_i

avs = []
n.times do
  avs << gets.chomp.split.map(&:to_i)
end

avs.sort! { |a, b| a[0] <=> b[0] }

max = -1
winner = []
avs.each do |av|
  if max < av[1]
    max = av[1]
    winner = av
  end
end


puts winner.join(' ')

Measured memory_bytes: 6884
import math
import itertools
n = int(input())
xy = []
for i in range(n):
  xy.append(list(map(int,input().split())))


total_distance = 0
list_keiro = []
for team in itertools.permutations(range(n)):
    list_keiro.append(team)

def distance(x1,x2,y1,y2):
  return (math.sqrt((x1-x2)**2 + (y1-y2)**2))

for i in list_keiro:
  dis_tmp = 0
  for j in range(n-1):
    dis_tmp += distance(xy[i[j]][0],xy[i[j+1]][0],xy[i[j]][1],xy[i[j+1]][1])
  total_distance += dis_tmp

print(total_distance / len(list_keiro))

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

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

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

const ll maxs = 1e6+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert

ll n,s;
ll dp[3005][3005];
ll a[maxs];

ll go(ll pos,ll s){
    if(s==0){
        return n-pos+1 + 1;
    }
    if(pos > n || s < 0)
        return 0;
    ll& ans = dp[pos][s];
    if(ans != -1)
        return ans;
    ans =0;
    ans = go(pos+1 , s-a[pos]) + go(pos+1,s);
    ans %= mod;
    return ans;
}

void solve(){
    mod = 998244353;
    memset(dp,-1,sizeof dp);
    cin>>n>>s;
    for(ll i=1;i<n+1;i++)
        cin>>a[i];
    ll ans=0;
    for(ll i=1;i<=n;i++){
        ans += go(i,s);
        if(ans > mod )
            ans -= mod;
    }
    cout << ans ;
}

int main() {
    
    IOS;
    int T=1;
    //cin >> T;
    while(T --){
        solve();
    }
}

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

int main(){
	long H,W;
	cin>>H>>W;
	long ans=H*W;
	long S1,S2,S3;
	long Ssa;
	for(int h=1;h<=H/2;++h){
		S1=h*W;
		if((H-h)%2==0 || W%2==0){
			S2=(H*W-S1)/2;
			S3=(H*W-S1)/2;
		}
		else if(H-h>=W){
			S2=(H-h)/2*W;
			S3=((H-h)/2+1)*W;
		}
		else{
			S2=W/2*(H-h);
			S3=(W/2+1)*(H-h);
		}
		Ssa=max(max(S1,S2),S3)-min(min(S1,S2),S3);
		if(ans>Ssa){
			//cout<<S1<<" "<<S2<<" "<<S3<<endl;
			//cout<<h<<endl;
			ans=Ssa;
		}
	}
	for(int w=1;w<=W/2;++w){
		S1=H*w;
		if(H%2==0 || (W-w)%2==0){
			S2=(H*W-S1)/2;
			S3=(H*W-S1)/2;
		}
		else if(H>=W-w){
			S2=H/2*(W-w);
			S3=(H/2+1)*(W-w);
		}
		else{
			S2=H*((W-w)/2);
			S3=H*((W-w)/2+1);
		}
		Ssa=max(max(S1,S2),S3)-min(min(S1,S2),S3);
		if(ans>Ssa){
			//cout<<S1<<" "<<S2<<" "<<S3<<endl;
			//cout<<w<<endl;
			ans=Ssa;
		}
	}
	cout<<ans<<endl;
}


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

const int mod = 1e9 + 7;

int lim, n, m;
int a[18];
int fac[1 << 17], inv[1 << 17], bc[1 << 17], f[18][1 << 17];

inline int ADD(int x, int y) { return x + y >= mod ? x + y - mod : x + y; }

inline int SUB(int x, int y) { return x - y < 0 ? x - y + mod : x - y; }

inline int mpow(int a, int x)
{
	int ans = 1;
	while(x)
	{
		if(x & 1) ans = 1ll * ans * a % mod;
		a = 1ll * a * a % mod;
		x >>= 1;
	}
	return ans;
}

inline int C(int n, int m)
{
	if(n < m) return 0;
	return 1ll * fac[n] * inv[n - m] % mod * inv[m] % mod;
}

int main()
{
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= m; i++) scanf("%d", &a[i]);

	lim = (1 << n);
	fac[0] = 1;
	for(int i = 1; i <= lim; i++) fac[i] = 1ll * fac[i - 1] * i % mod;
	inv[lim] = mpow(fac[lim], mod - 2);
	for(int i = lim - 1; i >= 0; i--) inv[i] = 1ll * inv[i + 1] * (i + 1) % mod;

	for(int i = 1; i <= lim; i++) bc[i] = bc[i ^ (i & -i)] + 1;

	f[m + 1][0] = 1;
	for(int i = m; i >= 1; i--)
		for(int s = 0; s < lim; s++)
		{
			f[i][s] = ADD(f[i][s], f[i + 1][s]);
			for(int j = 0; j < n; j++)
				if(s & (1 << j)) 
					f[i][s] = ADD(f[i][s], 1ll * f[i + 1][s ^ (1 << j)] * C(lim - a[i] - s + (1 << j), (1 << j) - 1) % mod * fac[1 << j] % mod);
		}
	
	int ans = 0;
	for(int s = 0; s < lim; s++)
	{
		f[1][s] = 1ll * f[1][s] * fac[lim - 1 - s] % mod;
		if(bc[s] & 1) ans = SUB(ans, f[1][s]);
		else ans = ADD(ans, f[1][s]);
	}
	ans = 1ll * ans * lim % mod;

	printf("%d", ans);
	return 0;
}


Measured memory_bytes: 9472
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(void) {
    int n;
    cin >> n;
    string w[n];
    rep (i, n) cin >> w[i];

    map<string, int> mp;

    mp[w[0]]++;
    rrep (i, n - 1) {
        mp[w[i]]++;
        if (mp[w[i]] >= 2 || w[i][0] != w[i - 1][w[i - 1].size() - 1]) {
            cout << "No" << endl;
            return 0;
        }
        
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int num = sc.nextInt();
		int []a = new int[num];

		long min,max,sum;

		for(int i=0; i<num; i++){
			a[i] = sc.nextInt();
		}

		min = a[0];
		for(int i=0; i<num; i++){
			if(a[i] < min){
				min = a[i];
			}
		}
		max = a[0];
		for(int i=0; i<num; i++){
			if(a[i] > max){
				max = a[i];
			}
		}
		sum =0;
		for(int i=0; i<num; i++){
			sum += a[i];
		}
		System.out.println(min + " " + max + " " + sum);
		sc.close();
	}
}


Measured memory_bytes: 41724
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	N := nextInt()
	x := N * 800
	y := N / 15 * 200

	fmt.Println(x - y)
}

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}

	return i
}

// ---------- Input.

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

int main() {
  ll a, b;
  string s;
  cin >> a >> b >> s;
  
  rep(i, a) {
    if(s[i] < '0' || s[i] > '9') {
      cout << "No" << endl;
      return 0;
    }
  }
  
  if (s[a] != '-' ) {
    cout << "No" << endl;
    return 0;
  }
  
  repI(i, a+1, a+b+1) {
    if(s[i] < '0' || s[i] > '9') {
      cout << "No" << endl;
      return 0;
    }
  }
  
  cout << "Yes" << endl;
  
  return 0;
}


Measured memory_bytes: 3600
final = Array.new
3.times do
        race = Array.new
        8.times do
                run,time = gets.split
                run = run.to_i
                time = time.to_f
                race << [run,time]
        end
        race.sort!{|t1,t2| t1[1]-t2[1]}
        puts "%d %.2f" % race[0]
        puts "%d %.2f" % race[1]
        final << race[2]
end
final.sort!{|t1,t2| t1[1]-t2[1]}
puts "%d %.2f" % final[0]
puts "%d %.2f" % final[1]

Measured memory_bytes: 6144
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;

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

    string s;
    cin >> s;

    ll cnt = 0;
    rep(i, n){
        if(s[i] == 'L'){
            if(i != 0 && s[i-1] == 'L')cnt++;
        }
        else {
            if(i != n-1; s[i+1] == 'R')cnt++;
        }
    }

    cout << min(n-1, cnt+2*k) << endl;
}

Measured memory_bytes: 3756
n=int(input())
a=[]
sum=0
j='Yes'
for _ in range(n):
    a.append(list(map(int,input().split())))
a.sort(key=lambda i: i[1])
for i in range(len(a)):
    sum += a[i][0]
    if sum > a[i][1]:
        j='No'
print(j)

Measured memory_bytes: 53720
#include <bits/stdc++.h>
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define perm(c) sort(ALL(c));for(bool c##p=1;c##p;c##p=next_permutation(ALL(c)))
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define drop(x) cout << (x) << '\n', exit(0)
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vector<ll>> vec2;
typedef vector<vector<vector<ll>>> vec3;
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 (b<a) { a=b; return 1; } return 0; }
ll devc(ll x, ll y) { return (x + y - 1) / y; }

struct IoSetup {
    IoSetup() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

template< typename T1, typename T2 >
ostream &operator << (ostream &os, const pair< T1, T2 > &p) {
    os << p.first << " " << p.second;
    return os;
}

template< typename T1, typename T2 >
istream &operator >> (istream &is, pair< T1, T2 > &p) {
    is >> p.first >> p.second;
    return is;
}

template< typename T >
ostream &operator << (ostream &os, const vector< T > &v){
    for (int i = 0; i < (int)v.size(); ++i) {
        os << v[i] << (i + 1 != v.size() ? " " : "");
    }
    return os;
}

template< typename T >
istream &operator >>  (istream &is, vector< T > &v){
    for(T &in : v) is >> in;
    return is;
}

int main()
{
    ll D, N;
    cin >> D >> N;
    if(N == 100) ++N;
    ll ans = pow(100, D) * N;
    print(ans);

    return 0;
}

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

int main()
{
    int a,b,c;
    int f = 0;
    cin >> a >> b >> c;
    for(int x=a; x<=b; x++){
        if(c%x == 0)
            f++;
    }
    cout << f << endl;
    return 0;
}

Measured memory_bytes: 3104
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;

 main()

{
    fast
    int n,a,b;
    cin>>n>>a>>b;
    if(n<a+b-1 || n>a*b)
    {
        cout<<"-1"<<endl;return 0;
    }
    int cur=1;
    vector<vector<int> >vec;
    while(1)
    {
        int lft=cur;
        int rgt=cur+a-1;
        vector<int>nw;
        rgt=min(rgt,n);
        f(i,lft,rgt)nw.pb(i);
        vec.pb(nw);
        cur=rgt+1;
        if(cur>n)break;
    }
    int sz=vec.size();
    vector<vector<int> >ses;
    rf(i,sz-1,0)
    {
        int dan=i;
        int nd=b-dan;
        if(nd==1)
        {
            ses.pb(vec[i]);
            b--;
            continue;
        }
        int len=vec[i].size();
        vector<int>nw;
         if(nd>=len)
        {
             nw=vec[i];
             reverse(nw.begin(),nw.end());
             ses.pb(nw);
             b=b-len;
        }
        else
        {

           f(j,0,nd-1)
           {
               nw.pb(vec[i][j]);
           }
           reverse(nw.begin(),nw.end());
           f(j,nd,len-1)
           {
               nw.pb(vec[i][j]);
           }
           ses.pb(nw);
           b-=nd;
        }
    }
    for(auto x:ses)
    {
        for(auto z:x)
        {
            cout<<z<<" ";
        }
    }
    cout<<endl;
    return 0;

}





































Measured memory_bytes: 14560
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;


int main(){
  int n,k; cin>>n>>k;
  int ans=1;
  rep(i,n){
    if(ans+k>ans*2)
    ans*=2;
    else
    ans+=k;
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
A = input()
B = input()
if A == B:
  print("EQUAL")
else:
  if len(A) > len(B):
    print("GREATER")
  elif len(B) > len(A):
    print("LESS")
  else:
    if A > B:
      print("GREATER")
    else:
      print("LESS")

Measured memory_bytes: 3060
n = int(input())
count = 0
for i in range(n):
  a,b = map(int,input().split())
  if a == b:
    count +=1
  else:
    count = 0
  if count == 3:
    print('Yes')
    break
  else:
    pass
if count !=3:
  print('No')

Measured memory_bytes: 9172