akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,M;
vector<int> E[1010];
int vis[1010];
vector<int> V,C;
int id[1010];

void dfs(int cur) {
	if(vis[cur]==2) {
		if(C.empty()) {
			int i,j;
			FOR(i,V.size()) if(V[i]==cur) {
				for(j=i;j<V.size();j++) {
					C.push_back(V[j]);
					id[V[j]]=j-i;
				}
				break;
			}
		}
		return;
	}
	if(vis[cur]==1) return;
	vis[cur]=2;
	V.push_back(cur);
	FORR(e,E[cur]) dfs(e);
	V.pop_back();
	vis[cur]=1;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>M;
	FOR(i,M) {
		cin>>x>>y;
		E[x].push_back(y);
	}
	
	MINUS(id);
	FOR(i,N) {
		ZERO(vis);
		V.clear();
		dfs(i+1);
	}
	
	if(C.empty()) return _P("-1\n");
	retry:
	FOR(i,C.size()) {
		FORR(e,E[C[i]]) if(id[e]!=-1 && id[e]!=(id[C[i]]+1)%C.size()) {
			vector<int> C2;
			y=id[e];
			MINUS(id);
			FOR(j,C.size()) {
				C2.push_back(C[(y+j)%C.size()]);
				id[C[(y+j)%C.size()]]=j;
				if((y+j)%C.size()==i) break;
			}
			swap(C,C2);
			goto retry;
		}
	}
	
	cout<<C.size()<<endl;
	FORR(c,C) cout<<c<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 384
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    a1 =0
    a2=0
    if a[0] > a[1]+ a[2]:
        a1 = min(a[1],a[2])
        a2 = 0
    else:
        a1 = min(a[1],a[2])
        a2= a[1]+a[2] -a[0]
    
    print(str(a1)+" "+str(a2)  )
    

Measured memory_bytes: 3956
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>

using namespace std;

int main(){

  double R1, R2; cin >> R1 >> R2;
  cout << setprecision(16) << (R1 * R2) / (R1 + R2) << endl;

  return 0;
}

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

using namespace std;

typedef multiset<int> si;
typedef vector<int> vi;

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    si s;
    for (int i = 0; i < 1 << n; i++) {
        int a;
        cin >> a;
        s.insert(a);
    }

    vi a[n+1];
    a[0] = {*s.rbegin()};
    s.erase(s.find(a[0][0]));
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < 1 << i - 1; j++) {
            a[i].push_back(a[i-1][j]);

            auto it = s.lower_bound(a[i-1][j]);
            if (it == s.begin()) {
                cout << "No" << endl;
                return 0;
            } else {
                --it;
                a[i].push_back(*it);
                s.erase(it);
            }
        }

        sort(a[i].begin(), a[i].end());
        reverse(a[i].begin(), a[i].end());
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 15032
//:58~
#include <iostream>
#include <string>
#include <map>
using namespace std;

int main(){
  map<string,int> words;
  int l_max=0, f_max=0;
  string longest, frequent;

  string word;
  while(cin >> word){
    words[word]++;
    if(word.size()>l_max){
      l_max=word.size();
      longest=word;
    }
    if(words[word]>f_max){
      f_max=words[word];
      frequent=word;
    }
  }
  cout << frequent << ' ' << longest << endl;

  return 0;
}

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

#include <utility>
using namespace std;

#define REP(i, n) for ( int i = 0; i < (n); i++ )
const int INF = 1e9;
using Pii = pair<int, int>;

const int con_type = 26;
int D = 365;
int C[con_type];
int S[365][con_type];
vector<int> ans;
int last[con_type];

struct State {
  int cost;
  vector<int> ans;
  vector<int> last;

  State() {
    cost = 0;
    last = vector<int>(26, -1);
  }

  State(int cost, vector<int> ans, vector<int> last):
    cost(cost), ans(ans), last(last) {};

  bool operator<( const State& s ) const {
    return cost < s.cost;
  }

  bool operator>( const State& s ) const {
    return cost > s.cost;
  }
};

void solve() {
  priority_queue<State> Q;
  Q.push(State());
  REP(d, D) {
    priority_queue<State> nQ;
    while ( !Q.empty() ) {
      State now = Q.top(); Q.pop();
      vector<Pii> add_cost;
      int sum = 0;
      int type_cost[26];
      REP(i, con_type) {
        sum += (d-now.last[i])*C[i];
        type_cost[i] = (d-now.last[i])*C[i];
      }
      REP(i, con_type) {
        add_cost.emplace_back(Pii(S[d][i]+(d-now.last[i])*C[i]-sum, i));
      }
      sort(add_cost.begin(), add_cost.end(), greater<Pii>());
      REP(i, 4) {
        int id = add_cost[i].second;
        State next = now;
        next.cost += S[d][id];
        next.cost -= sum;
        next.cost += type_cost[id];
        next.ans.emplace_back(id);
        next.last[id] = d;
        nQ.push(next);
      }
    }
    Q = priority_queue<State>();
    REP(i, min(1600, (int)nQ.size())) {
      Q.push(nQ.top()); nQ.pop();
    }
  }

  ans = Q.top().ans;
  REP(i, 1000) {
    vector<int> next = ans;

  }
}

void input() {
  cin >> D;
  REP(i, con_type) {
    cin >> C[i];
    last[i] = -1;
  }
  REP(i, D) REP(j, con_type) cin >> S[i][j];
}

void output() {
  REP(i, D) cout << ans[i]+1 << endl;
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  input();
  solve();
  output();

  return 0;
}


Measured memory_bytes: 15580
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string t,s;
    cin>>s>>t;
    int ans=INF;
    for(int i=0;i<s.size()-t.size()+1;i++){
        int sum=0;
        for(int j=0;j<t.size();j++){
            if(s[i+j]!=t[j])sum++;
        }
        chmin(ans,sum);
    }
    cout<<ans<<"\n";
}

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

ans = 0

if B[0] > A[0]:
    ans = A[0]
    B[0] -= A[0]
else:
    ans = B[0]
    B[0] = 0
if B[N-1] > A[N]:
    ans += A[N]
    B[N-1] -= A[N]
    A[N] = 0
else:
    ans += B[N-1]
    A[N] -= B[N-1]
    B[N-1] = 0

for i in range(N):
    if B[i] != 0:
        if B[i] > A[i+1]:
            ans += A[i+1]
            A[i+1] = 0
        else:
            ans += B[i]
            A[i+1] -= B[i]
    if A[i+1] != 0:
        if i == N-1:
            break
        if B[i+1] > A[i+1]:
            ans += A[i+1]
            B[i+1] -= A[i+1]
        else:
            ans += B[i+1]
            B[i+1] = 0

print(ans)


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

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(int i=x;i<y;i++)
#define frr(i,x,y) for(int i=x-1;i>=y;i--)
#define inf 1e18+1
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

void solve()
{
    ll d,t,s;
    cin>>d>>t>>s;
    if(t*s>=d)
    {
        cout<<"Yes\n";
    }
    else
        cout<<"No\n";
    return;
}
int main()
{
    IOS;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        //cout<<"Case #"<<pp-t<<":\n";
        solve();
    }
    return 0;
}
/* stuff you should look for
        * int overflow, array bounds
        * special cases (n=1?)
        * do smth instead of nothing and stay organized
        * WRITE STUFF DOWN
*/
/*
recursion - matrix exponential

*/
// BITMASK:
// 1)When some constrall is of the order of 15-20, think of bitmask DP.
// 2)When some constrall is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algorithm

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>

#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif


int main(int argc, char **argv){
	int n, q;
	std::vector<long> a;
	long k;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif


#if INPUT_FROM_FILE
	ifs >> n;
#else
	std::cin >> n;
#endif

	a.resize(n);
	for(int i = 0; i < n; i++){
#if INPUT_FROM_FILE
		ifs >> a[i];
#else
		std::cin >> a[i];
#endif
	}

	
#if INPUT_FROM_FILE
	ifs >> q;
#else
	std::cin >> q;
#endif

	for(int i = 0; i < q; i++){
#if INPUT_FROM_FILE
		ifs >> k;
#else
		std::cin >> k;
#endif
		if(std::binary_search(a.begin(), a.end(), k)){
			std::cout << "1" << std::endl;
		}
		else{
			std::cout << "0" << std::endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3616
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))

    g = [0] * n
    for ai in a:
        g[ai - 1] += 1
    print(*g, sep='\n')


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Measured memory_bytes: 93720
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define forn(i, a, b) for (int i=a; i<(signed)(b); ++i)
#define pb push_back
 
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";


const int mxN = 1e5 + 7;
vector<int> adj[mxN];

// dijstra's algo
void solve(){
	int n,m; cin >> n >> m;
	int dist[n], prev[n];
	memset(dist,inf,sizeof(dist));
	memset(prev,-1,sizeof(dist));
	forn(i,0,m){
		int a,b; cin >> a >> b;
		--a;--b; // 0-index
		adj[a].pb(b);
		adj[b].pb(a);
	}
	dist[0] = 0;
	queue<int> q;
	q.push(0);
	while(q.size()){
		int cur = q.front();
		q.pop();
		int cost = dist[cur] + 1;
		for(auto x : adj[cur]){
			if(dist[x] > cost){
				dist[x] = cost;
				prev[x] = cur;
				q.push(x);
			}
		}
	}
	bool imp = 0;
	forn(i,1,n) if(dist[i] == inf) imp = 1;
	if(imp) cout << "No";
	else{
		cout << "Yes\n";
		forn(i,1,n){
			cout << prev[i]+1 << '\n';
		}
	}
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
	return 0;
}
 


Measured memory_bytes: 10788
// tested by Hightail: https://github.com/dj3500/hightail
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define INF 1001001001
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define mp make_pair
#define pii pair<int,int>
#define ll long long
#define vi vector<int>
#define SZ(x) ((int)((x).size()))
#define fi first
#define se second
#define wez(n) int (n); scanf("%d",&(n));
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m));
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k));
inline void pisz(int n) { printf("%d\n",n); }
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){FOR(i,SZ(t))s<<t[i]<<" ";return s; }
#define DBG(vari) cout<<"["<<__LINE__<<"] "<<#vari<<" = "<<(vari)<<endl;
#define ALL(t) t.begin(),t.end()
#define FOREACH(i,t) for (__typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define TESTS wez(testow)while(testow--)
#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 REMAX(a,b) (a)=max((a),(b));
#define REMIN(a,b) (a)=min((a),(b));
#define IOS ios_base::sync_with_stdio(0);

#define MAXN 1000007
ll a[MAXN]; // a[j] = min x st there is an increasing subsequence of length j+1 ending with x
int lis (const vector<ll> &v) {
   int q = 0;
   FOREACH(y,v) {
      int k = lower_bound(a,a+q,*y) - a;
      a[k] = *y;
      if (k == q) q++;
   }
   return q;
}

int main () {
   vector<ll> v;
   wez(n);
   FOR(i,n) {
      wez(x);
      v.pb(-200000LL * x + i);
   }
   pisz(lis(v));
}

Measured memory_bytes: 1908
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  int K, A, B;
  cin >> K >> A >> B;
  bool can = false;
  for (int i=A; i<=B; i++) {
    if (i%K==0) {
      can = true;
      break;
    }
  }
  if (can) cout << "OK" << endl;
  else cout << "NG" << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << a * b << endl;
    return 0;
}


Measured memory_bytes: 3652
import numpy as np
from collections import Counter
import collections
round = lambda x:(x*2+1)//2
a = input()
b = input()
a = list(a)
b = list(b)
b = sorted(b,reverse = True)
a = sorted(a)
#a = a[1:]
a = "".join(a)
b = "".join(b)
if a <  b :
  print("Yes")
else:
  print("No")

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

int main()
{
    int n , a , b , c , d;

    cin >> n >> a >> b >> c >> d;

    string s;

    cin >> s;

    string ans = "Yes";

    a--;
    b--;
    c--;
    d--;

    for(int i = b+2 ; i<=d ; i++)
    {
        if(s[i]==s[i-1] && s[i]=='#')
            ans = "No";
    }

    s[d] = '#';

    for(int i = a+2 ; i<=c ; i++)
    {
        if(s[i]==s[i-1] && s[i]=='#')
            ans = "No";
    }

    s[d] = '.';

    if(ans=="No")
    {
        for(int i = b+1 ; i<=d ; i++)
        {
            if(s[i-2]=='.' && s[i-1]=='.' && s[i]=='.')
                ans = "Yes";
        }
    }

    cout << ans;

    return 0;

}


Measured memory_bytes: 640
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

const int N = 1e5;
std::vector<std::vector<int>> g;
int n;

int used[N];

void dfs(int i, int p) {
  if(used[i]) return;
  used[i] = 1;
  for(auto j : g[i]) if(j != p) {
    dfs(j, i);
  }
}

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int m;
  cin >> n >> m;
  g.resize(n);
  for(int i = 0; i < m; i++) {
    int a, b, c; std::cin >> a >> b >> c;
    a--; b--;
    g[a].emplace_back(b);
    g[b].emplace_back(a);
  }
  int ans = 0;
  for(int i = 0; i < n; i++) if(used[i] == 0) dfs(i, -1), ans++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 10752
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define inf 1e16
#define M 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define mx 1000010

int main(){
	IOS;
	ll n,k;
	string s;cin>>n>>s>>k;
	char c;
	rep(i,0,n)if(i+1==k)c=s[i];//cout<<c<<" ";
	rep(i,0,n){
		if(s[i]==c)cout<<s[i];
		else cout<<"*";
	}
	return 0;
}



Measured memory_bytes: 256
import sys
a,b=map(int,input().split())
if (a==1 and b==13):
  print('Alice')
  sys.exit()
else:
  pass
if a==13 and b==1:
  print('Bob')
  sys.exit()
else:
  pass
if a>b:
  print('Alice')
elif a==b:
  print('Draw')
else:
  print('Bob')


Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(){
    string c1, c2; cin >> c1 >> c2;
    int ans=1;
    if (c1[0] != c2[2]) ans=0;
    else if (c1[1] != c2[1]) ans=0;
    else if (c1[2] != c2[0]) ans=0;
    cout << (ans ? "YES" : "NO") << endl;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

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

    ll a , b, c;cin >> a >> b >> c;
    if(a == b && a != c)cout << "Yes" << endl;
    else if(b == c && a != c)cout << "Yes" << endl;
    else if(a == c && a != b)cout << "Yes" << endl;
    else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
H,W=map(int,input().split())

co=[]
c=[0]*10
for i in range(10):
   temp=list(map(int,input().split()))
   co.append(temp)

f=True

while f:
    f=False
    for i in range(10):
        for j in range(10):
            temp=[]
            for k in range(10):
                if co[i][k]<co[i][j] and co[k][j]<co[i][j]:
                    temp.append(co[i][k]+co[k][j])
            if len(temp) >= 1:
                if co[i][j] > min(temp):
                    co[i][j] = min(temp)
                    f = True




for i in range(10):
    c[i]=co[i][1]


ans=0
for i in range(H):
    A=list(map(int,input().split()))
    for j in range(W):
        if A[j]!=-1 and A[j]!=1:
            ans+=c[A[j]]
print(ans)

Measured memory_bytes: 3064
import sys
import math

input = sys.stdin.readline

N, K = list(map(int,input().split()))
A = list(map(int,input().split()))
F = list(map(int,input().split()))

A.sort()
F.sort(reverse=True)

cost = []
for ai, fi in zip(A,F):
	cost.append([ai*fi,fi])
cost.sort(reverse=True)

thmin = -1
thmax = cost[0][0]+1

while thmax-thmin!=1:
	# print(thmin,thmax)
	th = (thmin+thmax)//2
	ktmp = 0
	ind = 0
	judge = True
	while True:
		ci, fi = cost[ind]
		if ci<=th: break
		ktmp += math.ceil((ci-th)/fi)
		if ktmp>K:
			judge = False
			break
		ind += 1
		if ind==N: break
	if judge:
		thmax = th
	else:
		thmin = th

print(thmax)

Measured memory_bytes: 125132
import sys
from heapq import *
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def main():
    n,m=map(int, input().split())
    aa=list(map(int, input().split()))
    hp=[]
    for a in aa:
        heappush(hp,-a)
    for _ in range(m):
        a=heappop(hp)
        a/=2
        heappush(hp,a)
    print(sum(int(-a) for a in hp))

main()

Measured memory_bytes: 14172
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    
    int ans = 0;
    for(int i=1; i<=x; i++) {
    	for(int j=2; j<=x; j++) {
    		if((int)Math.pow(i, j) <= x) {
    			if((int)Math.pow(i, j) > ans){
    			ans = (int)Math.pow(i, j);
    		}
    	}
    }
    }
    if(x == 1){
    	System.out.println("1");
    }else{
    	System.out.println(ans);
      }
}
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define forin(x,n) for(auto& (x) : n)
#define all(v) (v).begin(),(v).end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define inf 1000000000
#define llinf 1000000000000000
#define MAX 1000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef vector<pint> vpint;
typedef pair<int,pint> P;

int main(){
    ll r,d,x;
    cin>>r>>d>>x;
    rep(i,10){
        x=r*x-d;
        cout<<x<<endl;
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
int main()
{
	int n;
	char s[100];
	scanf("%s",s);
	if(s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I')
		printf("Yes");
	else
		printf("No");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

int findsumofdigits(int n)
{
  int sum =0;
  while(n > 0)
  {
    sum += (n % 10);
    n /= 10;
  }
  return sum;
}
int main()
{
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  int N, A, B;
  std::cin >> N >> A >> B;
  int total = 0;
  for(int i = 1; i <= N; ++i)
  {
    int  sum = findsumofdigits(i);
    if(A <= sum && sum <= B) total += i;
  }
  std::cout << total <<'\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    int a[N];
    int x[110] = {0};
    int count = 0;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < N; i++) {
        x[a[i]]++;
    }

    for (int i = 0; i < 110; i++) {
        if (x[i])
            count++;
    }

    cout << count << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define found(m,x) ((m).find(x)!=(m).end())
#define uset unordered_set
#define umap unordered_map
#define db(x) cerr << #x << " == " << x << ";\n";
#define a(x) x.begin(),x.end()
#define input(v,n) for(int i=0;i<n;i++)cin>>v[i]
typedef vector<int> vi;
typedef pair<int,int> pi;

const int nax = 1e5+7;
const int mod = 1e9+7; //1e9+2667
const int inf = numeric_limits<int> :: max();
// ===================== MANASH =================== //

int n,m;

void test() {

    cin >> n;
    vector<int> B;
    B.push_back(inf);
    for ( int i = 0; i < n-1; i++ ) {
         int t;
         cin >> t;
         B.push_back(t);
    }
    B.push_back(inf);

    int s = 0;
    for( int i = 1; i <= n; i++) {
        s += min(B[i-1],B[i]);
    }

    cout << s;

}

signed main() {

    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    #ifdef LOCAL
    freopen("input.txt","r",stdin);
    cout<<"Time Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec.\n";
    #endif

    int T = 1;
    //cin >> T;
    while(T--) {
        test();
        cout << "\n";
    }
    return 0;

}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
int n,a[111111];
int dp[111111][2];
long long int res;
void upd(int&x,int y){
	if(x==-1 || x<y)x=y;
}
int main(){
	cin>>n;
	res = 0;
	for(int i=0; i<n; i++){
		cin>>a[i];
		if(a[i]){
			if(a[i]%2){
				res += (a[i] - 1)/2;
				a[i] = 1;
			}else{
				res += (a[i] - 2)/2;
				a[i] = 2;
			}
		}
	}
	memset(dp,-1,sizeof(dp));
	dp[0][0] = 0;
	int o = -1;
	for(int i=0; i<=n; i++)
		for(int j=0; j<2; j++)
			if(dp[i][j]!=-1){
				if(i == n)upd(o, dp[i][j]);else{
					upd(dp[i+1][a[i]%2],dp[i][j]+a[i]/2);
					if(a[i]>=1 && j>=1)
						upd(dp[i+1][a[i]-1],dp[i][j]+1);
				}
			}
	cout << res + o << endl;
	return 0;
}

Measured memory_bytes: 1536
import sys


def read_input():
    return sys.stdin.readline().strip().split(' ')


def task(s):
    rainy_til = []
    l = len(s)
    i = 0
    while i < l:
        if s[i] == 'R':
            last_rainy = rainy_til[i - 1] if i > 0 else 0
            rainy_til.append(last_rainy + 1)
        else:
            rainy_til.append(0)
        i += 1
    return max(rainy_til)


def main():
    [s] = read_input()
    result = task(s)
    print(result)


main()


Measured memory_bytes: 9076
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
#define max(x, y)	(((x) > (y))? (x) : (y))
#define abs(x)		(((x) < 0)? (-1*(x)) : (x))

//int dp[10000][10000];
int N;

using namespace std;

int main() {
	cin >> N ;

	cout << (48-N) << endl;

	return 0;
}

Measured memory_bytes: 256
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprint

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""
def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# a^n
def power(a,n,mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod

# n*(n-1)*...*(l+1)*l
def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n-1
    while(tmp >= l):
        a = a*tmp%mod
        tmp -= 1
    return a

inf = 10**18
mod = 10**9+7

n = ir()
a = lr()
b = lr()

yoyu = []
muri = []

for i in range(n):
    if a[i] > b[i]:
        yoyu.append(a[i]-b[i])
    if a[i] < b[i]:
        muri.append(b[i]-a[i])

if sum(yoyu) < sum(muri):
    print(-1)
else:
    if muri:
        yoyu.sort(reverse=True)
        muri.sort()
        yoyu_ind = 0
        muri_ind = 0
        flag = False
        while muri_ind < len(muri):
            ret = muri[muri_ind]
            while ret > 0:
                if yoyu[yoyu_ind] > ret:
                    yoyu[yoyu_ind] -= ret
                    ret = 0
                    flag = False
                elif yoyu[yoyu_ind] == ret:
                    yoyu[yoyu_ind] -= ret
                    ret = 0
                    yoyu_ind+=1
                    flag = True
                else:
                    ret -= yoyu[yoyu_ind]
                    yoyu[yoyu_ind] = 0
                    yoyu_ind+=1
            muri_ind+=1
        if flag:
            print(muri_ind + yoyu_ind)
        else:
            print(muri_ind + yoyu_ind+1)
    else:
        print(0)

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

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

    vector<int> a(n-1);
    rep(i,n-1) cin >> a[i];
    vector<int> ans(n +1);

    rep(i, n-1) 
    {
       ans[a[i]]++;
    }

    for(int i = 1; i < n + 1; i++) cout << ans[i] << endl;

    return 0;
}

Measured memory_bytes: 4844
N,M=map(int,input().split())

if abs(N-M)>1:
    print(0)
    exit()

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
n = 10 ** 5  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p) 階乗のmod
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, n + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

ans=(fact[N]*fact[M])%p
if N==M:
    ans*=2
    ans%=p
print(ans)

Measured memory_bytes: 15248
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;


public class Main {
	
	private static String[] encode = {
		"101",
		"000000",
		"000011",
		"10010001",
		"010001",
		"000001",
		"100101",
		"10011010",
		"0101",
		"0001",
		"110",
		"01001",
		"10011011",
		"010000",
		"0111",
		"10011000",
		"0110",
		"00100",
		"10011001",
		"10011110",
		"00101",
		"111",
		"10011111",
		"1000",
		"00110",
		"00111",
		"10011100",
		"10011101",
		"000010",
		"10010010",
		"10010011",
		"10010000"
	};
	
	private static Map<String,Character> decode = new HashMap<String,Character>();
	
	private static String encodeChar(char c){
		if(c >= 'A' && c <= 'Z'){
			return encode[c-'A'+6];
		}else if(c == ' '){
			return encode[0];
		}else if(c == '\''){
			return encode[1];
		}else if(c == ','){
			return encode[2];
		}else if(c == '-'){
			return encode[3];
		}else if(c == '.'){
			return encode[4];
		}else if(c == '?'){
			return encode[5];
		}else{
			return null;
		}
	}
	
	private static void init_decode(){
		decode.put("00000", 'A');
		decode.put("00001", 'B');
		decode.put("00010", 'C');
		decode.put("00011", 'D');
		decode.put("00100", 'E');
		decode.put("00101", 'F');
		decode.put("00110", 'G');
		decode.put("00111", 'H');
		decode.put("01000", 'I');
		decode.put("01001", 'J');
		decode.put("01010", 'K');
		decode.put("01011", 'L');
		decode.put("01100", 'M');
		decode.put("01101", 'N');
		decode.put("01110", 'O');
		decode.put("01111", 'P');
		decode.put("10000", 'Q');
		decode.put("10001", 'R');
		decode.put("10010", 'S');
		decode.put("10011", 'T');
		decode.put("10100", 'U');
		decode.put("10101", 'V');
		decode.put("10110", 'W');
		decode.put("10111", 'X');
		decode.put("11000", 'Y');
		decode.put("11001", 'Z');
		decode.put("11010", ' ');
		decode.put("11011", '.');	
		decode.put("11100", ',');
		decode.put("11101", '-');
		decode.put("11110", '\'');
		decode.put("11111", '?');
	}
	
	public static void main(String[] args){
		init_decode();
		Scanner sc = new Scanner(System.in);
		
		while(sc.hasNextLine()){
			char[] strs = sc.nextLine().toCharArray();
			StringBuilder br = new StringBuilder();
			
			for(char c:strs){
				br.append(encodeChar(c));
			}
			
			int tmp;
			if((tmp = br.length()%5) != 0){
				for(int i = 0; i < (5 - tmp); i++){
					br.append("0");
				}
			}
			
			for(int i = 0; i < br.length(); i+=5){
				System.out.print(decode.get(br.substring(i, i+5)));
			}
			System.out.println();
			
		}
	}
}

Measured memory_bytes: 12000
//コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#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,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define cin(x) cin >> x

signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //入力
    ll D = 0, T =0,S;
    cin >> D >> T >> S;

    //本文
    ll ans = D/S;
    //出力
    if(D%S==0){
    if(ans <= T) cout << "Yes";
    else cout << "No" << endl;
    }
    else
    { if(ans < T) cout << "Yes";
      else cout << "No" << endl;
    }
      /* code */
    
    //REP(i,N) cout << ans.at(i) <<endl;
  return 0;
}

Measured memory_bytes: 3652
H,W,N = map(int,input().split())
dic={}
for _ in range(N):
  a,b = [int(x)-1 for x in input().split()]
  for h in range(a,a+3):
    for w in range(b,b+3):
      if 0<=h-2 and h<H and 0<=w-2 and w<W:
        dic[10**10*h+w] = dic.get(10**10*h+w,0)+1
ans = [0]*10
for x in dic.values():
  ans[x] += 1
ans[0] = (H-2)*(W-2)-sum(ans[1:])
for x in ans:
  print(x)
        


Measured memory_bytes: 152308
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>
 
using namespace std;
using namespace __gnu_pbds;
 
#define endl '\n'
 
typedef long long ll;
typedef pair<ll, ll> pii;
typedef tree<int, null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template<typename T>
static T randint(T lo, T hi){
	return uniform_int_distribution<T>(lo, hi)(rng);
}



int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 
	// freopen("settling.in", "r", stdin);
	// freopen("settling.out", "w", stdout);

	ll x;
	cin >> x;

	cout << (x >= 30 ? "Yes" : "No") << endl;

	return 0;
}


Measured memory_bytes: 3608
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

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

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>istream&operator>>(istream&is,vector<T>&vec){rep(i,vec.size())is>>vec[i];return is;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

int dp[1000001], dp_odd[1000001];

signed main()
{
    vi tet, tet_odd;

    for (int i = 1; ; ++i) {
        tet.PB(i * (i + 1) * (i + 2) / 6);
        if (tet.back() >= 1000000) break;
    }

    for (int i = 0; i < tet.size(); ++i) {
        if (tet[i] & 1) tet_odd.PB(tet[i]);
    }

    for (int i = 1; i <= 1000000; ++i) dp[i] = dp_odd[i] = inf;

    for (int i = 1; i <= 1000000; ++i) {
        for (int j = 0; j < tet.size(); ++j) {
            if (i >= tet[j]) {
                dp[i] = min(dp[i], dp[i - tet[j]] + 1);
            }
            if (i < tet[j]) break;
        }

        for (int j = 0; j < tet_odd.size(); ++j) {
            if (i >= tet_odd[j]) {
                dp_odd[i] = min(dp_odd[i], dp_odd[i - tet_odd[j]] + 1);
            }
            if (i < tet_odd[j]) break;
        }
    }

    int N;
    while (cin >> N, N) cout << dp[N] << ' ' << dp_odd[N] << endl;
}

Measured memory_bytes: 9028
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int t = sc.nextInt();
			int p = sc.nextInt();
			int r = sc.nextInt();
			if (t == 0 && p == 0 && r == 0)
				break;
			int[] co = new int[t];
			int[] pe = new int[t];
			int[][] wr = new int[t][p];
			for (int i = 0; i < t; i++) {
				co[i] = 0;
				pe[i] = 0;
				for (int j = 0; j < p; j++)
					wr[i][j] = 0;
			}
			for (int i = 0; i < r; i++) {
				int tid = sc.nextInt();
				int pid = sc.nextInt();
				int time = sc.nextInt();
				String me = sc.next();
				if (me.equals("CORRECT")) {
					co[tid - 1]++;
					pe[tid - 1] += wr[tid - 1][pid - 1] * 1200 + time;
				}
				if (me.equals("WRONG"))
					wr[tid - 1][pid - 1]++;
			}
			int[] rank = new int[t];
			for (int i = 0; i < t; i++)
				rank[i] = 1;
			for (int i = 0; i < t; i++)
				for (int j = i + 1; j < t; j++) {
					if (co[i] < co[j])
						rank[i]++;
					if (co[i] > co[j])
						rank[j]++;
					if (co[i] == co[j]) {
						if (pe[i] > pe[j])
							rank[i]++;
						if (pe[i] <= pe[j])
							rank[j]++;
					}
				}
			for (int i = 0; i < t; i++)
				for (int j = 0; j < t; j++)
					if (rank[j] == i + 1)
						System.out.println((j + 1) + " " + co[j] + " "
								+ pe[j]);
		}
		sc.close();
	}
}

Measured memory_bytes: 67596
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

char s1[101],s2[101];

int main(){
    gets(s1);
    gets(s2);
    int n=strlen(s1);
    int m=strlen(s2); 
    sort(s1,s1+n);
    sort(s2,s2+m);
    for(int i=0;i<fmax(n,m);i++){
        if(s1[i]<s2[m-i-1]){
            printf("Yes\n");
            return 0;
        }
        if(s1[i]>s2[m-i-1])
            break;
    }
    printf("No\n");
    return 0;
} 


Measured memory_bytes: 128
var flag=[];
for(var i=0;i<300000;i++)flag[i]=true;
var ms=[];
var i=1;
while(true){
   var m=(7*i)-1;
   var s=(7*i)+1;
   if(flag[m])ms.push(m);
   if(flag[s])ms.push(s);
   var j=2;
   while(true){
      flag[m*j]=false;
      flag[s*j]=false;
      if(m*j>300000)break;
      j++;
   }
   if(m>300000)break;
   i++;
}
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
while(true){
   var n=arr.shift()-0;
   if(n==1)break;
   var sqrt=Math.sqrt(n);
   var ans=[];
   var i=0;
   ms.forEach(function(v){
      if(n%v==0)ans.push(v);
   });
   console.log(n+": "+ans.join(" "));
}

Measured memory_bytes: 35436
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int pop();
void push(int);
int top,num[1000];

int main(){
  int x,m,n;
  char s[100];
  top = 0;
  
  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      m = pop();
      n = pop();
      push(n + m);
      
    } else if ( s[0] == '-' ){
      m = pop();
      n = pop();
      push(n - m);
      
    } else if ( s[0] == '*' ){
      m = pop();
      n = pop();
      push(n * m);
      
    } else {
      x = atoi(s);
      push(x);
    }
  }
  printf("%d\n",pop());
  return 0;
}

int pop()
{
  top--;
  return num[top+1];
}

void push(int a)
{
  num[++top] = a;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
struct TwoSat {
    int n, nmark = 0; vector<vector<int> > adj;
    vector<int> preorderof, stack;
    vector<bool> instack; vector<int> result;
    TwoSat(int nvar): n(2*nvar), adj(n), preorderof(n, -1), instack(n, false), result(nvar, -1){}
    void add_or(int a, int b) { // 2 * a for "a" is true, 2*a+1 for "a" is false
        adj[a^1].push_back(b);
        adj[b^1].push_back(a);
    }
    bool solve(){ // result has size nvar = n / 2, result[i] == 1 means "i" is true
        for(int u = 0; u < n; ++u)
            if(preorderof[u] == -1) dfs(u);
        for(int u = 0; u < n;  ++u)
            for(int v : adj[u])
                if(result[u/2] == 1-(u&1) && result[v/2] != 1-(v&1))
                    return false;
        return true;
    }
    int dfs(int v){
        int reach = preorderof[v] = nmark++;
        stack.push_back(v); instack[v] = true;
        for(int u : adj[v])
            if(preorderof[u] == -1) reach = min(reach, dfs(u));
            else if(instack[u]) reach = min(reach, preorderof[u]);
        if(reach == preorderof[v]){
            int u;
            do{
                u = stack.back(); stack.pop_back();
                instack[u] = false;
                if(result[u/2] == -1) result[u/2] = 1 - (u & 1);
            } while(u != v);
        }
        return reach;
    }
};
const int maxn = 10100;
int x[maxn], y[maxn], n;
int all[maxn * 2], wh[2][maxn];
bool check(int d){
	int len = 2 * n;
	vector<int> ids(2 * len);
	int cnt = 0;
	for(int i = 0; i < len; i++) ids[i + len] = cnt++;
	for(int i = len - 1; i > 0; i--) ids[i] = cnt++;
	TwoSat s(cnt);
	auto connect = [&](int l, int r, int p){
		for(l += len, r += len + 1; l < r; l >>= 1, r >>= 1){
			if(l & 1){
				s.add_or(2 * ids[l] + 1, p);
				l++;
			}
			if(r & 1){
				r--;
				s.add_or(2 * ids[r] + 1, p);
			}
		}
	};
	int l = 0, r = 0;
	for(int i = 0; i < len; i++){
		while(l < i && all[i] - all[l] >= d) l++;
		while(r < len && all[r] - all[i] < d) r++;
		if(l < i){
			connect(l, i - 1, 2 * ids[i + len] + 1);
		}
		if(i < r - 1){
			connect(i + 1, r - 1, 2 * ids[i + len] + 1);
		}
	}
	for(int i = 0; i < n; i++){
		s.add_or(2 * ids[wh[0][i] + len] + 1, 2 * ids[wh[1][i] + len] + 1);
		s.add_or(2 * ids[wh[0][i] + len], 2 * ids[wh[1][i] + len]);
	}
	for(int i = len - 1; i > 0; i--){
		// -p ^ s
		s.add_or(2 * ids[i], 2 * ids[2 * i] + 1);
		s.add_or(2 * ids[i], 2 * ids[2 * i + 1] + 1);
	}
	return s.solve();
}
int main(){
	cin >> n;
	for(int i = 0; i < n; i++) cin >> x[i] >> y[i];
	vector<pair<int, int> > vals;
	for(int i = 0; i < n; i++){
		vals.push_back({x[i], i});
		vals.push_back({y[i], i});
	}
	vector<int> stk(n, 0);
	sort(vals.begin(), vals.end());
	for(int i = 0; i < 2 * n; i++){
		all[i] = vals[i].first;
		wh[stk[vals[i].second]++][vals[i].second] = i;
	}
	int lo = 0, hi = 1000000001 / max(n / 2, 1), ans = 0;
	while(lo <= hi){
		int mid = (lo + hi)>>1;
		if(check(mid)) ans = mid, lo = mid + 1;
		else hi = mid - 1;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 17252
#include <iostream>

using namespace std;

long long LCM(long long a, long long b){
    long long big = max(a, b);
    long long small = min(a, b);

    while(big % small != 0){
        long long num = big % small;
        big = small;
        small = num;
    }
    return small;
}

long long GCD(long long a, long long b){
    long long L = LCM(a, b);
    long long G = (a / L) * b;
    return G;
}


int main(){

    long long A, B, C, D;
    cin >> A >> B >> C >> D;

    long long G = GCD(C, D);

    long long cntB = (B / C) + (B / D) - (B / G);
    long long cntA = ((A-1) / C) + ((A-1) / D) - ((A-1) / G);

    long long cnt = cntB - cntA;

    cout << (B - A + 1) - cnt << endl;

    return 0;
}

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

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define uniqueV(x)          \
  sort(x.begin(), x.end()); \
  x.erase(unique(x.begin(), x.end()), x.end());
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) cerr << "(" << #x << ", " << #y << ") = " \
                          << "(" << x << ", " << y << ")" << '\n'

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

const long long INF = 3e18 + 12;
const int inf = 1e9;

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

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

  int n, x;
  cin >> n >> x;
  vector<int> v(n);
  ll sum = 0;
  rep(i, n) {
    cin >> v[i];
    sum += v[i];
  }

  sort(all(v));

  ll noko = x - sum;

  cout << (noko / v[0]) + n << endl;

  return 0;
}

Measured memory_bytes: 256
a,b,c=map(int,input().split())
K=int(input())
for i in range(K):
  if a<b<c:
    print('Yes')
    exit()
  if c<=a or c<=b:
    c*=2
  else:
    if b<=a:
      b*=2
  if a<b<c:
    print('Yes')
    exit()
print('No')

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
signed main(){
  	int n;
  	cin>>n;
      char s[110];
      for(int i=0;i<n;i++)
        cin>>s[i];
      bool flg=(n+1)%2,c;
      for(int i=0;i<n/2;i++){
        c=(s[i] == s[n/2+i]);
         flg = flg && c;
      }
      if(flg)
        cout<<"Yes"<<endl;
      else
        cout<<"No"<<endl;
 
     return(0);
}

Measured memory_bytes: 384
#include<iostream>
#include<queue>
using namespace std;
char f[50000][11]= {"753"};
long long s[50000][3],n,t=0;
long long Check(int x)
{
    long long y=0;
    int i=9;
    while (!(f[x][i]=='3'||f[x][i]=='5'||f[x][i]=='7'))i--;
    for (int j=i; j>=0; --j)
        y*=10,y+=f[x][j]-'0';
    return y;
}
int Do(int i,int j)
{
    switch(f[i][j])
    {
    case '3':
        f[i+1][j]='5',s[i+1][0]--,s[i+1][1]++;
        break;
    case '5':
        f[i+1][j]='7',s[i+1][1]--,s[i+1][2]++;
        break;
    case '7':
        f[i+1][j]='3',s[i+1][2]--,s[i+1][0]++;
        Do(i,j+1);
        break;
    default:
        f[i+1][j]='3',s[i+1][0]++;
    }
}
int Fun(int i,int j)
{
    if (Check(i)<=n)
    {
        for (int x=0; x<=2; ++x)
            s[i+1][x]=s[i][x];
        int x=0;
        while (f[i][x]=='3'||f[i][x]=='5'||f[i][x]=='7')
            f[i+1][x]=f[i][x],x++;

        if (s[i][0]==0||s[i][1]==0||s[i][2]==0);
        else t++;
        Do(i,j);
        Fun(i+1,0);
    }
}
int main(void)
{
    cin>>n;
    for (int j=0; j<=2; ++j)
        s[0][j]=1;
    Fun(0,0);
    cout<<t;
    return 0;
}



Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main()
{
    Int K, A, B; cin >> K >> A >> B;
    if (A >= K) {
        cout << 1 << endl;
    } else if (A - B > 0) {
        cout << (K - B - 1) / (A - B) * 2 + 1 << endl;
    } else {
        cout << -1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256