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

# define rep(i, n) for(int(i)=0;(i)<(n);(i)++)
# define reps(i, n) for(int(i)=1;(i)<=(n);(i)++)
# define rrep(i, n) for(int i=((int)(n)); i>0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>=0; --i)
# define ALL(v) v.begin(), v.end()
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<typename T> void dump(T e){std::cout << e << std::endl;}
template<typename T> void dump(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void dump(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ dump(v); } }
typedef long long ll;

int main() {
  string a,b; cin >> a >> b;
  sort(a.begin(), a.end());
  sort(b.rbegin(), b.rend());
  
  if (a < b) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import sys
n = int(input())
h = list(map(int,input().split()))
mi = h[0]-1
if n == 1:
  print("Yes")
  sys.exit()
  
for i in range(1,n):
  if h[i-1]-1 == h[i]:
    if mi > h[i]:
      print("No")
      sys.exit()
    mi = h[i]
  elif h[i-1] > h[i]:
    print("No")
    sys.exit()
    
print("Yes")    
    
      
    
    
  
     

Measured memory_bytes: 14704
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
	int N = nextInt();
	ArrayList<Integer> list = nextIntArray();
	int min = 1000000;
	for(int i = 0; i < N; i++){
		int L = 0;
		int R = 0;
		for(int j = 0; j < N; j++){
			if(j <= i){
				L += list.get(j);
			}else{
				R += list.get(j);
			}
		}
		min = Math.min(min, Math.abs(L - R));
	}
	myout(min);
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 32884
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define all(a) a.begin(),a.end()
#define println printf("\n");
#define readln(x) getline(cin,x);
#define pb push_back
#define endl "\n"
#define INT_INF 0x3f3f3f3f
#define LL_INF 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
#define MOD2 1494318097
#define SEED 131
#define mp make_pair
#define fastio cin.tie(0); cin.sync_with_stdio(0);

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef unordered_map<int,int> umii;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef pair<int,pii> triple;
typedef int8_t byte;

mt19937 g1(time(0));

int randint(int a, int b){return uniform_int_distribution<int>(a, b)(g1);}
ll randlong(ll a,ll b){return uniform_int_distribution<long long>(a, b)(g1);}

ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}

ll fmul(ll a, ll b, ll mod){ll res=0;while(a){if(a&1)res=(res+b)%mod;a>>=1;b=(b<<1)%mod;}return res;}
ll fpowfast(ll b, ll exp, ll mod){ll res=1;while(exp){if(exp&1)res=fmul(res,b,mod);b=fmul(b,b,mod);exp>>=1;}return res;}
inline bool rabbin_miller(ll x){if(x%2==0) return false;for(int i=0;i<5;i++){ll rd=randlong(2,x-2);if(fpowfast(rd,x-1,x)!=1)return false;}return true;}

ll A,B,res=1;

int main(){
	scanf("%lld %lld",&A,&B);
	ll gg = __gcd(A,B);
	for(ll i=2; i<=sqrt(gg); i++){
		if(gg%i == 0){
			res++;
			while(gg%i == 0){
				gg/=i;
			}
		}
	}
	if(gg > 1) res++;
	printf("%lld\n",res);
}

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

int main(){
  string s;
  int count = 0;
  cin>>s;
  for(int i=0;i<s.length();i++){
  	count+=s[i]-'0';
  }
  if(count%9==0)cout << "Yes" <<endl;
  else cout << "No" <<endl;
  return 0;
}

Measured memory_bytes: 3480
# ANSHUL GAUTAM
# IIIT-D

'''

'''

def solve(grid):
	H,W = len(grid),len(grid[0])
	q = []
	dist = [0]*H
	for i in range(H):
		dist[i] = []
	for i in range(H):
		for j in range(W):
			if(grid[i][j] == '#'):
				q.append([i,j])
				grid[i][j] = 0
	maxx = 0
	while(q):
		qq = []
		for i,j in q:
			for r,c in [[i+1,j],[i-1,j],[i,j+1],[i,j-1]]:
				if(0 <= r < H and 0 <= c < W and grid[r][c] == '.'):
					grid[r][c] = grid[i][j] + 1
					maxx = max(maxx,grid[r][c])
					qq.append([r,c])
		q = qq
	return maxx

H,W = map(int, raw_input().split())
grid = []
for h in range(H):
	s = list(raw_input())
	grid.append(s)
ans = solve(grid)
print(ans)



Measured memory_bytes: 185288
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

int main(){
    ll n; cin>>n;
    ll ans=0;
    for(ll i=1; ; i++){
        ll num = n;
        num -= i;
        if(i >= num / i) break;
        if(num % i == 0) ans += num / i;
    }

    cout << ans << endl;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		for(int i=0;i<n;i++){
			int x = sc.nextInt();
			int y = sc.nextInt();
			int b = sc.nextInt();
			int p = sc.nextInt();
			int s = x*b + y*p;
			b = Math.max(b, 5);
			p = Math.max(p, 2);
			int t = x*b + y*p;
			System.out.println((int)Math.min(s, t*0.8));
		}
	}
}

Measured memory_bytes: 23276
#include <bits/stdc++.h>
#define endl '\n'
#define pb push_back
#define mp make_pair
#define ll long long
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
ll MOD=1000000007;
ll fact[200010];
ll inv[200010];
ll pow(ll x,ll n){
	ll ret=1;
	while(n>0){
		if((n&1)==1)ret=(ret*x)%MOD;
		x=(x*x)%MOD;
		n>>=1;
	}
	return ret;
}
void init(){
	fact[0]=fact[1]=1;
	for(ll i=2;i<=200010;i++)fact[i]=(fact[i-1]*i)%MOD;
	inv[200010-1]=pow(fact[200010-1],MOD-2)%MOD;
	for(ll i=200010-2;i>=1;i--)inv[i]=(inv[i+1]*(i+1))%MOD;
	inv[0]=1;
}
ll comb(ll x,ll y){
	return fact[x]*inv[x-y]%MOD*inv[y]%MOD;
}
int main(){
	init();
	ll n,k;
	cin>>n>>k;
	k=min(n,k);
	ll ans=0;
	for(ll i=0;i<=k;i++)ans+=(comb(n,i)*comb(n-1,i))%MOD;
	cout<<ans%MOD<<endl;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

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

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

#ifdef LOCAL
	#define eprintf(...) printf(__VA_ARGS__)
#else 
	#define eprintf(...) 1
#endif

#define ROUNDUP(a, b) 		( ((a) + ((b) - 1) ) / b)
#define SET_ZERO(a)	 		( memset((a), 0, sizeof(a)))
#define SET_NUM_ARRAY(a,b)	( memset((a), b, sizeof(a)))
//#define int long long int //dont forget to change int to signed

int main() {
	int N;
	scanf("%d", &N);
	int n = N;
	int sn = 0;
	
	while (n > 0) {
		sn += n%10;
		n /= 10;
	}

	if (N % sn == 0) printf("Yes\n");
	else printf("No\n");
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,v,l[200005],b,e;//数组直接开200000
int main(){
    cin>>n;
    b=ceil((double)(n+1)/2);//第一个数的位置
    e=(n%2==0)?(-1):(1);//判断是偶数还是奇数
    for(int i=1;i<=n;i++){//一定要从一开始
        cin>>v;
        l[b]=v;
        b+=i*e;//利用i变量，乘上符号
        e*=-1;//变符号
    }
    for(int i=1;i<=n;i++)//这个也是要从一开始
    cout<<l[i]<<" ";
    return 0;
}

Measured memory_bytes: 2944
/* ex 5_3
   Rikuta */

#include <stdio.h>
//strlenを使うためのヘッダファイルのインクルード
#include <string.h>

int main(void)
{ 
    //最高文字列数は10なのでヌル文字も含め11,ポインタの宣言
    char sequence[11];
    int i,max = 0,array[10]={0};
    //入力
    scanf("%s", sequence);
    for ( i = 0; i < strlen(sequence); i++)
    {
        if (sequence[i]=='A'||sequence[i]=='C'||sequence[i]=='G'||sequence[i]=='T')
        {   
            if (i==0)
            {
                array[i] = 1;
            }
            else
            {
                array[i] = array[i - 1] + 1;
            }
            if (array[i] >= max)
            {
                max = array[i];
            }
        }
    }
    printf("%d\n", max);
    return 0;
}

Measured memory_bytes: 1704
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// #include <ext/rope>
// using namespace __gnu_cxx;
typedef long long int ll;
typedef long double ld;
#define FAST                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(), v.end())
#define mne(v) *min_element(v.begin(), v.end())
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define bb break
#define cc continue
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
ll power(ll x, ll y, ll p)
{
    ll res = 1; // Initialize result
    x = x % p;  // Update x if it is more than or
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return power(n, p - 2, p);
}
struct point
{
    ll x, y;
};
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll n;
    cin>>n;
    ll val1=power(10,n,rem);
    ll val2=2*power(9,n,rem);
    ll val3=power(8,n,rem);
    val2%=rem;
    val2-=val3;
    if (val2<0)
    {
        val2+=rem;
    }
    val1-=val2;
    if (val1<0)
    {
        val1+=rem;
    }
    cout<<val1<<"\n";
}


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {

  private static long power(long m, long n) {
    long res;
    long MODE = 1000000007;

    if (n == 0) {
      return 1;
    }
    res = power(m * m % MODE, n / 2);
    if (n % 2 == 1) {
      res = res * m % MODE;
    }
    return res;
  }

  public static void main(String[] args) {

    Scanner stdIn = new Scanner(System.in);
    long m = stdIn.nextInt();
    long n = stdIn.nextInt();

    System.out.println(power(m, n));
  }

}

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

typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define DECIM8  fixed<<setprecision(8) 
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

using namespace std;
int main(void)
{
  for(;;){
    int n;
    cin >> n;
    if(!n) return 0;
    vector<pair<int,int> > tile;
    tile.PB(MP(0,0));
    REP(i,n-1){
      int t,d;
      cin >> t >> d;
      if(d==0) tile.PB(MP(tile[t].first-1,tile[t].second));
      if(d==1) tile.PB(MP(tile[t].first,tile[t].second+1));
      if(d==2) tile.PB(MP(tile[t].first+1,tile[t].second));
      if(d==3) tile.PB(MP(tile[t].first,tile[t].second-1));
    }
    int left=0,right=0,top=0,bottom=0;
    REP(i,SZ(tile)){
      left=min(left,tile[i].first);
      right=max(right,tile[i].first);
      top=min(top,tile[i].second);
      bottom=max(bottom,tile[i].second);
    }
    cout << right-left+1 << ' ' << bottom-top+1 << endl;
  }
}

Measured memory_bytes: 1204
#include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;
int main (void) {
    int N;

    cin >> N;
    ll A = 1, B = 1;
    for (int i = 0; i < N; i++) {
        ll x, y;
        cin >> x >> y;
        ll n = max((A + x - 1) / x, (B + y - 1) / y);
        A = n * x;
        B = n * y;
    }

    cout << A + B << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;
vector<int> g[N];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    int a[n+1],p[m][2];
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=0;i<m;i++)
    {
        int u,v;
        cin>>u>>v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        int this_height=a[i];
        bool pos=1;
        for(int v:g[i])
        {
            if(this_height<=a[v])
            {
                pos=0;
                break;
            }
        }
        if(pos)
            ans++;
    }
    cout<<ans;
    
    return 0;
}

Measured memory_bytes: 9188
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	string V;
	stack<ll> S;
	ll lhs,rhs;
	auto get = [&](){
		rhs = S.top();
		S.pop();
		lhs = S.top();
		S.pop();
	};
	while(cin>>V){
		if(V=="+"){
			get();
			S.push(lhs+rhs);
		}
		else if(V=="-"){
			get();
			S.push(lhs-rhs);
		}
		else if(V=="*"){
			get();
			S.push(lhs*rhs);
		}
		else{
			S.push(stoi(V));
		}
	}
	out(S.top());

	return 0;
}



Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ll long long
#define inf 0x3f3f3f3f
#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 3e5+10;
const ll mod =   1e9+7;

int main()
{  fast
string s;
cin>>s;
cout<<s[0]<<s[1]<<s[2];

}

Measured memory_bytes: 3600
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	string res = "";
	rep(i, 3){
		string s;
		cin >> s;
		res += s[i];
	}	
	cout << res << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

int main() {
	int N, Y, x = -1, y = -1, z = -1;
	cin >> N >> Y;
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= N; j++) {
			int k = (Y - 10000 * i - 5000 * j) / 1000;
			if (k == N - i - j && k >= 0) x = i, y = j, z = k;
		}
	}
	cout << x << " " << y << " " << z;
}

Measured memory_bytes: 256
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cassert>
#include <bitset>

using namespace std;

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////


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

    int X;
    cin >> X;

    int64 S = (X / 500) * 1000;
    X %= 500;

    S += (X / 5) * 5;

    cout << S << "\n";

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solve();
	}
	
	int n;
	int[]a;
	int mod=1000000000+7;
	long[]fact;
	long[]inverse;
	
	void solve(){
		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		a=new int[n+1];
		int left=0, right=0;
		int[] count=new int[n+1];
		
		for(int i=0;i<=n;i++){
			a[i]=sc.nextInt();
			
			if(count[a[i]]==1)right=i;
			count[a[i]]++;
		}
		for(int i=0;i<=n;i++){
			if(count[a[i]]==2){
				left=i;
				break;
			}
		}
		
		fact=new long[n+2];
		fact[0]=1;
		inverse=new long[n+2];
		inverse[0]=1;
		
		for(int i=1;i<=n+1;i++){
			fact[i]=(fact[i-1]*(long)i)%mod;
			inverse[i]=mod_pow(fact[i],mod-2,mod);
		}
		
		for(int i=1;i<=n+1;i++){
			long ex=mod_comb(left+n-right,i-1,mod)%mod;
			System.out.println((mod_comb(n+1,i,mod)-ex+mod)%mod);
		}
	}
	
	long mod_pow(long x,int n,int mod){
		long res=1;
		while(n>0){
			if((n&1)==1){
				res=res*x%mod;
				res%=mod;
			}
			x=x*x%mod;
			x%=mod;
			n>>=1;
		}
		return res%mod;
	}
	
	long mod_comb(int n,int k,int mod){
		if(n<0 || k<0 || n<k)return 0;
		return fact[n]*(inverse[k]*inverse[n-k]%mod) %mod;
	}
}

Measured memory_bytes: 62360
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

void find_divisor(ll N, vector<ll>& divisor) {
  for(int i=1; i<=sqrt(N); i++) {
    if(N % i == 0)
      divisor.push_back(i);
  }
  int n = divisor.size();
  for(int i=n-1; i>=0; i--) {
    if(N != (ll)pow(divisor[i], 2))
      divisor.push_back(N / divisor[i]);
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n; cin >> n;
  vector<ll> div;
  find_divisor(n, div);
  int ans = inf;
  for(ll d: div) {
    ans = min(max((int)log10(d)+1, (int)log10(n/d)+1), ans);
  }
  cout << ans << "\n";
  return 0;
}


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

int main() {
    int N, P;
    string S;
    cin >> N;
    vector<tuple<string, int, int>> p;
    rep(i,N) {
        cin >> S >> P;
        p.push_back(make_tuple(S, -P, i + 1));
    }
    sort(p.begin(), p.end());
    for (auto t : p) {
        cout << get<2>(t) << endl;
    }
}


Measured memory_bytes: 3624
# -*- coding: utf-8 -*-

a, b, x = map(int, input().split())

# これじゃ全然間に合わない…
# ans = 0
# for i in range(a, b+1):
#     if i % x == 0:
#         ans += 1
# print(ans)

all_num = b // x
lower_num = (a - 1) // x
print(all_num - lower_num)

Measured memory_bytes: 2940
def fact(n):
    if n <= 1:
        return 1
    else:
        return n * fact(n - 1)

def comb(n, r):
    return fact(n) // fact(r) // fact(n - r)

N, A, B = map(int, input().split())
Vs = list(map(int, input().split()))

Vs = list(reversed(sorted(Vs)))
cnt = {}
for v in Vs:
    if v not in cnt:
        cnt[v] = 1
    else:
        cnt[v] += 1

dict = {}
for i in range(A, B + 1):
    dict[i] = sum(Vs[:i]) / i

avg = 0
for k in dict:
    if avg < dict[k]:
        avg = dict[k]

cand = []
for k in dict:
    if avg - dict[k] < 1E-6:
        cand.append(k - 1)

ans = 0
for c in cand:
    x = 0
    for i in range(c + 1):
        if Vs[i] == Vs[c]:
            x += 1
    ans += comb(cnt[Vs[c]], x)

print(avg)
print(ans)


Measured memory_bytes: 3064
module ArrayL = ArrayLabels
module ListL = ListLabels

let dbg = Printf.printf "[debug]%s"

let max_num = 100_000_000_000

let id = fun x -> x
let tuple2 x y = (x,y)
let tuple3 x y z = (x,y,z)
let succ x = x + 1
let pred x = x - 1

let (++) n m =
  let rec aux i =
    if i = m then [m]
    else i :: aux (i+1) in
  if n > m then [] else aux n

let (++^) n m = n ++ (m-1)

let scan fmt f = Scanf.sscanf (read_line ()) fmt f

let scan_list ~sep cnv =
  let line = read_line () in
  Str.split (Str.regexp_string sep) line
  |> List.map cnv

let scan_lines n fmt f =
  List.map (fun _ -> scan fmt f) (0++^n)

let scan_matrix n m e conv =
  let arr = Array.make_matrix n m e in
  Array.iteri (fun i line ->
      let s = Scanf.Scanning.from_string @@ read_line () in
      Array.iteri (fun j _ ->
          arr.(i).(j) <- Scanf.bscanf s " %s" conv;
        ) line) arr; arr

let rec powerset = function
  | [] -> [[]]
  | hd::tl ->
    let pws =  powerset tl in
    pws @ ListL.map pws ~f:(fun pw -> hd::pw)

let permutations l =
  let rec interleave x = function
    | [] -> [[x]]
    | (hd::tl) as l ->
      (x::l) :: (interleave x tl |> ListL.map ~f:(fun l -> hd::l)) in
  let rec aux = function
    | [] -> [[]]
    | a::rest ->
      aux rest |> ListL.map ~f:(interleave a) |> List.concat in
  aux l

let between n x m = n <= x && x < m

let string_to_list s =
  List.map (String.get s) (0 ++^ String.length s)

let n = scan "%d" id
let ls = scan_lines n "%d %d" tuple2

exception Found of int array array
let print_mat mat =
  ArrayL.iter mat ~f:(fun a ->
      ArrayL.iter a ~f:(fun v ->
          if v = 0 then Printf.printf "."
          else Printf.printf "Q"
        );
      Printf.printf "\n"
    )

let () =
  let sets = permutations (0++^8) in
  (try ListL.iter sets ~f:(fun set ->
       let mat = Array.make_matrix 8 8 0 in
       ListL.iteri set ~f:(fun i n -> mat.(i).(n) <- 1;);
       if not @@ ListL.for_all ls ~f:(fun (i, j) -> mat.(i).(j) = 1) then ()
       else
       if ListL.map (0++^8) ~f:(fun i ->
           ListL.map (0++^8) ~f:(fun j ->
               if mat.(i).(j) = 1 then
                 ListL.for_all (0++^8) ~f:(fun k -> k = i || mat.(k).(j) = 0)
                 && ListL.for_all (1++^8) ~f:(fun k -> i-k < 0 || j-k < 0 || mat.(i-k).(j-k) = 0)
                 && ListL.for_all (1++^8) ~f:(fun k -> i+k >= 8 || j+k >= 8 || mat.(i+k).(j+k) = 0)
                 && ListL.for_all (1++^8) ~f:(fun k -> i-k < 0 || j+k >= 8 || mat.(i-k).(j+k) = 0)
                 && ListL.for_all (1++^8) ~f:(fun k -> i+k >= 8 || j-k < 0 || mat.(i+k).(j-k) = 0)
               else true))
          |> List.concat |> List.for_all ((=) true) then raise @@ Found mat else ());
      Array.make_matrix 8 8 0
   with
   | Found x -> x)
  |> print_mat



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

using tree_t = std::vector<std::vector<int>>;

void dfs(int s, tree_t & tree, long long * counter, int * is_calculated) {
    is_calculated[s] = true;
    const auto sub_tree { tree[s] };
    for (std::size_t i = 0, elements = sub_tree.size(); i < elements; ++i) {
        const int v { sub_tree[i] };
        if (is_calculated[v]) {
            continue;
        }
        counter[v] += counter[s];
        dfs(v, tree, counter, is_calculated);
    }
}

std::string solve(int n, int q, tree_t & tree, long long * counter) {
    int * is_calculated = new int[n];
    for (int i = 0; i < n; ++i) {
        is_calculated[i] = 0;
    }
    dfs(0, tree, counter, is_calculated);
    std::string s { "" };
    for (int i = 0; i < n; ++i) {
        s += std::to_string(counter[i]) + " ";
    }
    delete[] is_calculated;
    return s;
}
 
int main() {
    int N, Q;
    std::cin >> N >> Q;

    tree_t tree = [&]() {
        tree_t v(N);
        for (int i = 0; i < N - 1; ++i) {
            int a, b;
            std::cin >> a >> b;
            v[a - 1].push_back(b - 1);
            v[b - 1].push_back(a - 1);
        }
        return v;
    }();
 
    long long * counter = new long long[N];
    for (int i = 0; i < N; ++i) {
        counter[i] = 0;
    }
    for (int i = 0; i < Q; ++i) {
        int x, p;
        std::cin >> p >> x;
        counter[p - 1] += x;
    }
 
    std::cout << solve(N, Q, tree, counter) << std::endl;
    
    delete[] counter;

    return 0;
}


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

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

  int count, max_count = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) == 'R') {
      count++;
      max_count = count > max_count ? count : max_count;
    } else {
      count = 0;
    }
  }

  cout << max_count << endl;
}


Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i >= 1; i--)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
typedef long long int ll;
typedef pair<ll, ll> p;


int main() {
	int a, b;
	cin >> a >> b;
	if (a % 500 <= b) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}

//Ctrl+Aを使わない

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

int main() {
  //initialize
  int N;
  cin >> N;
  int a[N];
  for(int i = 0;i < N; ++i) cin >> a[i];
  sort(a, a+N); 
  
  int alice = 0;
  int bob = 0;
  for(int i = 0;i < N; i++) {
    if((N-i-1)%2==0) alice += a[i];
    else bob += a[i];
  }
  cout << alice-bob;
}

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

int main() {
  string num, ans;
  cin >> num;
  ans = "No";
  for (int i = 0; i < num.size(); i++) {
    if (num[i] == '7') {
      ans = "Yes";
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<pair<int, int>> A(N);
  for(int i = 0; i < N; i++){
    cin >> A[i].first;
    A[i].second = i;
  }
  sort(A.begin(), A.end());
  
  long long yi = 0;
  for(int i = 0; i < N; i++){
    if((A[i].second ^ i) & 1) ++yi;
  }
  
  cout << (yi >> 1) << endl;
  
  return 0;
}

Measured memory_bytes: 1024
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
Ps = list(mapint())

S = Ps[:]
S.sort()

cnt = 0
for p, s in zip(Ps, S):
    if not p==s:
        cnt += 1

if cnt>2:
    print('NO')
else:
    print('YES')

Measured memory_bytes: 61996
#include <iostream>
using namespace std;
int main(void){
    bool flag = true;
    int n, A[100],count = 0,tmp;
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> A[i];
    }
    while(flag){
        flag = false;
        for (int j = n - 1; j >= 1; j--){
            if (A[j] < A[j-1]){
                tmp = A[j];
                A[j] = A[j-1];
                A[j-1] = tmp;
                flag = true;
                count += 1;
            }
        }
    }
    for (int i = 0; i < n; i++){
        cout << A[i];
        if (i != n - 1){
            cout << " ";
        }
    }
    cout << endl;
    cout << count << endl;
}


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

int n, k, q, score[202020];

int main(){
  cin >> n >> k >> q;
  rep(i, q){
    int num; cin >> num;
    score[num]++;
  }
  for(int i = 1; i <= n; i++){
    if(k - q + score[i] > 0){
      cout << "Yes" << "\n";
    }else{
      cout << "No" << "\n";
    }
  }
  return 0;
}

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

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

const int MAXN = 2e5;

int N;
vector<int> adj[MAXN+10];
int sz[MAXN+10];
int main()
{
	int i, j;

	scanf("%d", &N);
	for(i=2; i<=N; i++)
	{
		int p;
		scanf("%d", &p);
		adj[p].push_back(i);
	}
	for(i=1; i<=N; i++) sz[i]=1;

	for(i=N; i>=1; i--) for(auto it : adj[i]) sz[i]+=sz[it];

	for(i=1; i<=N; i++) printf("%d\n", adj[i].size());
}

Measured memory_bytes: 15536
#include <bits/stdc++.h>
using namespace std;
 
using tpl = tuple<char, int>;
typedef pair<int,int> pii;
typedef long long ll;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}

int N, K;

int main(){


    cin >> N >> K;
    ll ans = 0;
    if(K == 0){
        ans = (ll)N * N;
    }
    else{
        for(int b = K + 1; b <= N; b++){
            ans += (ll)(N / b) * (b - K);
            ans += max(N % b - K + 1, 0);
        }
    }

    cout << ans << endl;
    


    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int m = stdIn.nextInt();
		
		int[][] A = new int[n][m];
		int[] B = new int[m];
		int[] C = new int[n];
		for(int i = 0; i < n; i++) {
			for(int j = 0; j <  m; j++) {
				A[i][j] = stdIn.nextInt();
			}
		}
		for(int i = 0; i < m; i++) {
			B[i] = stdIn.nextInt();
		}
		
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < m; j++) {
				C[i] += A[i][j] * B[j];
			}
		}
		
		for(int i = 0; i < n; i++) {
			System.out.println(C[i]);
		}
	}

}

Measured memory_bytes: 31840
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define veci vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))


using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
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;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x:vec) is >> x;
    return is;
}
const ll INF=1e9+100;


int main()
{
    ll n;
    cin >> n;
    vector<ll> x(n);
    rep(i,n){
        cin >> x[i];
    }
    sort(x.begin(),x.end());
    ll l=0;
    ll r=0;
    ll ans=INF;
    for(ll i=x[0];i<=x[n-1];i++){
        ll sum=0;
        rep(j,n){
            sum+=(x[j]-i)*(x[j]-i);
        }
        chmin(ans,sum);
    }
    cout << ans << endl;
    return 0;
} 

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

int main(void)
{
  int n,l;
  scanf("%d %d",&n,&l);
  char s[200][128];
  char tmp[128];

  for(int i=0;i<n;i++){
    scanf("%s",s[i]);
  }

  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      if(strcmp(s[i],s[j])>0){
        strcpy(tmp,s[i]);
        strcpy(s[i],s[j]);
        strcpy(s[j],tmp);
      }
    }
  }


  for(int i=0;i<n;i++){
    printf("%s",s[i]);
  }
  puts(" ");
  return 0;
}


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

int main(){

    int n;
    set<int> a;
    int x;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> x;
        if(!a.insert(x).second)
            a.erase(x);
    }
    cout << a.size() << endl;
    return 0;
}


Measured memory_bytes: 4864
H,W = map(int, input().split())
B = [list(input()) for i in range(H)]

l = []

for i in range(H):
    for j in range(W):
        if B[i][j] == '#':
            l.append((i,j))

def a(l):
    n = []
    d = [(1, 0), (-1, 0), (0, 1), (0, -1)]
    for y, x in l:
        for dy, dx in d:
            ny = y + dy
            nx = x + dx
            if 0 <= ny < H and 0 <= nx < W and B[ny][nx] == '.':
                B[ny][nx] = '#'
                n.append((ny, nx))
    return n

ans = 0
while len(l) != 0:
    l = a(l)
    ans += 1
print(ans-1)

Measured memory_bytes: 127916
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

using Weight = int;
struct Edge {
	int s, d; Weight w;
	Edge(int s, int d, Weight w = 1) : s(s), d(d), w(w) {};
	bool operator<(const Edge &e)const { return w < e.w; }
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

//lowest common ancestor (??????????????° + dfs????????°)
//?§????O(NlogN) ?????¨???O(logN)
struct LowestCommonAncestor {
	const Graph &g;
	int root;
	const int n, log2_n;
	vector<vector<int>> parent;
	vector<int> depth;
	LowestCommonAncestor(const Graph &g, int root)
		:g(g), root(root), n(g.size()), log2_n(log2(n) + 1), parent(log2_n, vector<int>(n)), depth(n) {
		dfs();
		for (int k = 0; k + 1 < log2_n; k++) {
			for (int v = 0; v < n; v++) {
				if (parent[k][v] < 0)
					parent[k + 1][v] = -1;
				else
					parent[k + 1][v] = parent[k][parent[k][v]];
			}
		}
	}
	void dfs() {
		using State = tuple<int, int, int>;
		stack<State> st; st.emplace(root, -1, 0);
		while (st.size()) {
			int s, p, d;
			tie(s, p, d) = st.top(); st.pop();
			parent[0][s] = p;
			depth[s] = d;
			for (auto &e : g[s]) {
				if (e.d == p)continue;
				st.emplace(e.d, s, d + 1);
			}
		}
	}
	int get(int u, int v) {
		if (depth[u] > depth[v]) swap(u, v);
		for (int k = 0; k < log2_n; k++) {
			if ((depth[v] - depth[u]) >> k & 1) {
				v = parent[k][v];
			}
		}
		if (u == v) return u;
		for (int k = log2_n - 1; k >= 0; k--) {
			if (parent[k][u] != parent[k][v]) {
				u = parent[k][u];
				v = parent[k][v];
			}
		}
		return parent[0][u];
	}
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	Graph g(n);
	rep(i, 0, n) {
		int k; cin >> k;
		rep(j, 0, k) {
			int c; cin >> c;
			g[i].emplace_back(i, c);
		}
	}
	int q; cin >> q;
	LowestCommonAncestor lca(g, 0);
	rep(i, 0, q) {
		int u, v; cin >> u >> v;
		cout << lca.get(u, v) << endl;
	}
	return 0;
}

Measured memory_bytes: 15736
# -*- coding:utf-8 -*-
"""
問題
https://atcoder.jp/contests/dp/tasks/dp_d

解説
https://qiita.com/drken/items/dc53c683d6de8aeacf5a#d-%E5%95%8F%E9%A1%8C---knapsack-1
"""

def solve():
    """
    Python: TLE (´･_･`)
    """
    N, LIMIT = list(map(int, input().split()))
    W, V = [None], [None]
    for i in range(N):
        w, v = list(map(int, input().split()))
        W.append(w)
        V.append(v)
    
    # dp[i][w] := i個目までの品物を選んだ時の、重さがwのときの価値の最大値
    dp = [[w for w in range(LIMIT+1)] for i in range(N+1)]
    for w in range(LIMIT+1):
        dp[0][w] = 0
    
    #O(N*LIMIT) = O(10**7)
    for i in range(1, N+1):
        for w in range(LIMIT+1):
            if w-W[i] >= 0:
                dp[i][w] = max(dp[i-1][w], dp[i-1][w-W[i]] + V[i])
            else:
                dp[i][w] = dp[i-1][w]

    ans = 0
    for w in range(LIMIT+1):
        ans = max(ans, dp[N][w])

    print(ans)


if __name__ == "__main__":
    solve()


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

#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
#define ldb long double 
#define db double
#define int long long

#define fr first
#define se second
#define lb lower_bound 
#define ub upper_bound 
#define pb push_back
#define mpr make_pair

#define pi pair<int,int>
#define pdb pair<db,db>
#define pldb pair<ldb,ldb>

#define vi vector<int>
#define vdb vector<db>
#define vldb vector<ldb>
#define vpi vector< pi >

#define mi map<int,int>
#define mdb map<db,db>
#define mldb map<ldb,ldb>


#define forr(a,b) for (int i = (a); i < (b); ++i)
#define rrof(a,b) for (int i = (b)-1; i >= (a); --i)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)

const int md = 1e9+7;
const int MX = 2e5+5;
const int INF = 1e18; 
const ldb PI = 4*atan((ldb)1);

int power_md(int a,int n)
{
 int res=1;
 while(n)
{
 if(n%2)
  res=(res%md*a%md)%md;
  a=(a%md*a%md)%md;
  n/=2;
}
res%=md;
return res;
}

int power(int a,int n)
{
 int res=1;
 while(n)
{
 if(n%2)
  res*=a;
  a=a*a;
  n/=2;
}
return res;
}

int abst(int a)
{
 return ((a<0)?(-1*a):(a));
}

class cmp_set{
public:
	bool operator() (int a, int b){
		return a > b;
	}
};

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

/*int ter_search(int l,int r)
{
    while((r-l)>0)
    {
        int m1=l+(r-l)/3;
        int m2=r-(r-l)/3;
        int f1=f(m1);
        int f2=f(m2);
        if(f1>f2)
         l=m1+1;
         else
          r=m2-1;
    }
    return f(l);
}*/

int spf[10000005];

int32_t main()
{
    for(int i=0;i<10000005;i++)
     spf[i]=i;
    for(int i=2;i<10000005;i++)
    {
        if(spf[i]==i)
        {
            for(int j=i;j<10000005;j+=i)
            {
                if(spf[j]==j)
                 spf[j]=i;
            }
        }
    }
    int n;
    cin>>n;
    int res=0;
    int tmp=0;
    for(int i=1;i<=n;i++)
    {
      int c=i;
      tmp=1;
      int cnt=0;
      while(c!=1)
      {
        cnt=0;
        int z=spf[c];
        while(c%z==0)
        {
            cnt++;
            c/=z;
        }  
        tmp*=(1+cnt);
      } 
      res+=(i*tmp); 
    }
    cout<<res<<"\n";
    return 0;
}

Measured memory_bytes: 81752
import sys
 
 
N,M = sys.stdin.readline().strip().split()
N = int(N)
M = int(M)

A = []
B = []
for i in range(N):
    a,b = sys.stdin.readline().strip().split()
    A.append(int(a))
    B.append(int(b))

#print(A)
#print(B)
comb = zip(A,B)
comb = sorted(comb)
#print(comb)
#print(comb[0][1])


num=0
money=0
num_tmp=0
while(num<M):
    if(len(comb)>1):
        if(M-num<comb[0][1]):
            num_tmp = M - num
            num += num_tmp
        else:
#            print("else num_tmp",B[cheap_index])
            num_tmp = comb[0][1]
            num += num_tmp
        money += comb[0][0] * num_tmp
        comb.pop(0)
#        print("num_tmp",num_tmp)
#        print("m,num", money,num)
    else:
        num_tmp = M - num
        num += num_tmp
        money += comb[0][0] * num_tmp
#        print(money,num)
        
print(money)


Measured memory_bytes: 18640
package main

import (
	"bufio"
	"os"
	"strings"
	"fmt"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	words := strings.Split(scanner.Text(), " ")
	wordMap := make(map[string]int)
	for _, v := range words {
		wordMap[v]++
	}
	key := ""
	value := -1
	l := -1
	word := ""
	for k, v := range wordMap {
		// fmt.Println(k, v)
		if value < v {
			key = k
			value = v
		}
		if l < len(k) {
			l = len(k)
			word = k
		}
	}

	fmt.Println(key, word)
	// fmt.Println(wordMap)
}


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

using namespace std;

int main() {
    int W,H, x,y;
    cin >> W >> H >> x >> y;

    fprintf(stdout, "%lf %d\n", double(W)*double(H)/2.0, 2*x==W && 2*y==H);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long int num;

int main(int argc, char** argv) {
	num n, k;
	cin >> n >> k;
	num sum = 0;
	for (num b = k + 1; b <= n; b++) {
		sum += n / b * (b - k);
		if (n % b != 0) {
			num d = 0;
			if (k == 0) {
				d = n - (n / b * b + 1) + 1;
			} else {
				d = n - (n / b * b + k) + 1;
			}
			if (d > 0) {
				sum += d;
			}
		}
	}
	cout << sum;
	return 0;
}

Measured memory_bytes: 256
import math
import copy
import sys
import numpy as np

# ===FUNCTION===

def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList



# ===CODE===

n = getInputNum()

a = getSomeInputInt(n)

sorted_a= sorted(a, reverse=True)

maxNum = sorted_a[0]
second = sorted_a[1]

for i in range(n):
    if a[i] == maxNum:
        print(second)
    else:
        print(maxNum)









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

int main(){
  int n,h;cin>>n>>h;
  vector<int>a(n);
  vector<int>b(n);
  int max_a=0;
  for(int i=0;i<n;++i){
    cin>>a[i]>>b[i];
    max_a=max(max_a,a[i]);
  }
  sort(b.begin(),b.end(),greater<int>());
  int ans=0;
  for(int i=0;;++i){
    if(b[i]<=max_a||i==n){
      ans+=h/max_a+bool(h%max_a);
      break;
    }else{
      h-=b[i];
      ++ans;
      if(h<=0)break;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
function Main(input) {
  var N = parseInt(input.split(" ")[0]);
  var L = parseInt(input.split(" ")[1]);
  var aji = [];
  for(var i = 1; i < N + 1; i++){
    aji.push(L + i - 1);
  }
  aji.sort(function(a, b){
  	return Math.abs(a) - Math.abs(b);
  });
  var output = 0;
  for(var i = 0; i < aji.length; i++){
    output += parseInt(aji[i]);
  }
  output = output - parseInt(aji[0]);
  console.log(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7500
#include<bits/stdc++.h>
#define N 17
using namespace std;
int a,b,n,x,y,dp[N][N];
 
int main(){
  while(1){
    cin>>a>>b;
    if(!a&&!b)break;
    memset(dp,0,sizeof(dp));
    cin>>n;
    for(int i=0;i<n;i++)
      cin>>x>>y,dp[x-1][y-1]=-1;
    dp[0][0]=1;
    for(int i=0;i<a;i++)
      for(int j=0;j<b;j++){
    if(dp[i][j]<0)continue;
    if(dp[i+1][j]>=0)dp[i+1][j]+=dp[i][j];
    if(dp[i][j+1]>=0)dp[i][j+1]+=dp[i][j];
      }
    cout<<dp[a][b-1]<<endl;
  }
  return 0;
}

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

using namespace std;

const int N = 110;

int grid[N][N];
int dp[N][N], n, m;

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

bool ok(int x, int y) {
  return x >= 0 && y >= 0 && x < n && y < m;
}

int dfs(int x, int y) {
  if (x == n - 1 && y == m - 1) return 0;
  if (dp[x][y] != -1) return dp[x][y];
  int ans = 123456789;
  for (int k = 0; k < 2; k++) {
    int nx = dx[k] + x;
    int ny = dy[k] + y;
    if (ok(nx, ny)) {
      ans = min(ans, dfs(nx, ny) + (grid[nx][ny] == 1 && grid[x][y] == 0));  
    }
  }
  return dp[x][y] = ans;  
}

int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    string temp;
    cin >> temp;
    for (int j = 0; j < m; j++) {
      grid[i][j] = temp[j] == '#';
    }
  }
  memset(dp, -1, sizeof dp);
  cout << (grid[0][0] == 1) + dfs(0, 0)<< '\n';
  return 0;
}

Measured memory_bytes: 384
N, K, Q = map(int, input().split())
A = [int(input()) for x in range(Q)]
P = [K-Q]*N
for i in range(Q):
    P[A[i]-1] +=1
for i in range(N):
    if P[i] > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 10472