akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	ll n,y; cin>>n>>y;
	ll a=MOD,b=MOD,c=MOD;
	//++n;
	rep(i,0,n+1){
		rep(j,0,n-i+1){
			//if(i==2000) cout<<"st ";
			if(n-i-j<0) continue;
			ll k=n-i-j;
			//if(i==1999) cout<<"t ";
			if(10000*i+5000*j+1000*k==y){
				cout<<i<<" "<<j<<" "<<k;
				return 0;
			}
		}
	}
	cout<<"-1 -1 -1";
	//20000 270000 
	return 0;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
  int64 A, B;
  cin >> A >> B;
  if (A > 9 || B > 9) {
    cout << -1 << endl;
  } else {
    cout << A*B << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int h,w,d[2010][2010][2];
bool s[2010],t[2010];
int main(){
	cin>>h>>w;int ans=0;char z;
	for(int i=1;i<=h;i++){cin>>z;s[i]=(z=='O');}
	for(int i=0;i<=h;i++){
		for(int j=0;j<=w;j++){
			if(!i&&j){cin>>z;t[j]=(z=='O');}
			d[i][j][0]=0,d[i][j][1]=0;
			if(i){
				if(!s[i])d[i][j][1]=d[i-1][j][0]+1;
				else if(d[i-1][j][1])d[i][j][0]=d[i-1][j][1]+1;
			}
			if(j){
				if(!t[j])d[i][j][1]=max(d[i][j][1],d[i][j-1][0]+1);
				else if(d[i][j-1][1])d[i][j][0]=max(d[i][j][0],d[i][j-1][1]+1);
			}
			ans=max(ans,d[i][j][1]);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 34548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pp;
ll INF = 1e6;
ll n=INF,m;
vector<vector<pp>> graph(n,vector<pp>(0));


ll dijkstra(ll goal){
  priority_queue<pp,vector<pp>,greater<pp>> pq;
  pq.push(make_pair(0,0));
  vector<int> visited(n,0);
  while (!pq.empty()){
    auto now = pq.top();
    pq.pop();
    ll cost,node;
    tie(cost,node) = now;
    if(node == goal){
      return cost;
    }
    if(visited.at(node)==1){
      continue;
    }else{
      visited.at(node) = 1;
      for(auto next:graph.at(node)){
        ll next_cost,next_node;
        tie(next_cost,next_node) = next;
        pq.push(make_pair(cost+next_cost,next_node));
      }
    }
  }
  return -1;
}
      
  
int main() {
  cin >> n >> m;  
  for(int i=1;i<n;i++){
    graph.at(i).push_back(make_pair(0,i-1));
  }
  for(int i=0;i<m;i++){
    ll l,r,c;
    cin >> l >> r >> c;
    graph.at(l-1).push_back(make_pair(c,r-1));
  }
  cout << dijkstra(n-1) << endl;
}
  
  
                          

  

Measured memory_bytes: 31736
/*author : Yashvardhan
Wednesday, May 08, 2019
3:33 PM
*/

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pi>
#define ff first
#define ss second
#define endl '\n'

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("O2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS

#ifdef __APPLE__
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define debug(...)
#endif

template <typename T> ostream& operator << (ostream& os,const vector<T>& v){for(int i=0;i<v.size();++i) os<<v[i]<<" ";return os;} 
template <typename T> ostream& operator << (ostream& os,const set<T>& v){for(auto it:v) os<<it<<" ";return os;} 
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) {os<<v.ff<<" "<<v.ss;return os;}

const int mod = 1e9 + 7;
const int inf = 2e18;
const int ninf = -2e18;

int pow(int a, int b, int m)
{
	int ans = 1;
	while (b)
	{
		if (b & 1)
			ans = (ans * a) % m;
		b /= 2;
		a = (a * a) % m;
	}
	return ans;
}

signed main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef __APPLE__
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	time_t t1, t2;
	t1 = clock();
	
	int n,k;
	cin>>n>>k;

	string s;
	cin>>s;

	int gaps = 0;
	int maxi = -1;
	
	int i = 0;
	int j = 0;

	while(j < n){
		while(j < n && s[j] == '1') j++;
		maxi = max(maxi,j - i);
		while(j < n && s[j] == '0') j++;
		gaps++;
		if(gaps > k){
			while(i < n && s[i] == '1') i++;
			while(i < n && s[i] == '0') i++;
			gaps--;
		}
		maxi = max(maxi, j - i);
	}

	cout<<maxi<<endl;
	

	t2 = clock();
	cerr<<endl<<t2-t1<<endl;
	
	return 0;
}



Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
string itos(int a){
	string s="";
	while(a){
		s=(char)(a%10+'0')+s;
		a/=10;
	}
	return s;
}
int main(){
	int n,m;
	while(cin>>n>>m,n+m){
		vector<bool>ha(n,true);
		vector<string>in(m);
		rep(i,m)cin>>in[i];
		int co=0;
		int no=n;
		loop(i,1,m+1){
			if(no==1)break;
			//テヲツュツ」ティツァツ」テ」ツ?ョテァツ卍コティツィツ?
			string s=itos(i);
			if(i%15==0)s="FizzBuzz";
			else if(i%5==0)s="Buzz";
			else if(i%3==0)s="Fizz";
			//ティツェツーテ」ツ?古ィツィツ?」ツ??」ツ??
			while(ha[co]==false){co++;if(co==n)co=0;}
			//テァツ卍コティツィツ?」ツ?古、ツクツ催ヲツュツ」ティツァツ」テ」ツ?ェテ」ツつ嘉・ツ、ツアテヲツ?シ
			string a=in[i-1];
			if(a!=s){no--;ha[co]=false;}
			co++;
			if(co==n)co=0;
		}
		vi out;
		rep(i,n)if(ha[i])out.pb(i+1);
		rep(i,out.size()-1)cout<<out[i]<<" ";
		cout<<out[out.size()-1]<<endl;
	}
}

Measured memory_bytes: 1648
# A - Candy Distribution Again
count = 0
N, x = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
for i in range(N-1):
    x -= A[i]
    if(x < 0):
        break
    count += 1
if(x == A[N-1]):
    count += 1
        
print(count)

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

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; ++i){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    int ans = 0;
    for (int i = 0; i < k; ++i){
        ans += a[i];
    }
    cout << ans << endl;
    return 0;
}

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

int main(void){
  int L, R;
  cin >> L >> R;
  
  int ans = 0;
  for(int a = 1; a < 10; a++){
    for(int b = 0; b < 10; b++){
      for(int c = 0; c < 10; c++){
        int x = (10001 * a) + (1010 * b) + (100 * c);
        if((x >= L) && (x <= R)){
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons;

void main()
{
    auto abc = readln.split.to!(int[]);
    auto K = readln.chomp.to!int;

    auto max = abc.reduce!max;

    writeln(abc.sum - max + max*2^^K);
}

Measured memory_bytes: 256
//------------------------------>> tsukasa_diary's template <<------------------------------//
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define for_rev(i,a,b) for(int i=(a);i>=(b);--i)
#define allof(a) (a).begin(),(a).end()
#define minit(a,b) memset(a,b,sizeof(a))

using lint = long long;
using pii = pair< int, int >;

template< typename T > using Vec = vector< T >;

template< typename T > bool in_range(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool in_range(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }

template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }

int bitCount(int x) { return __builtin_popcount(x); }
int bitCount(lint x) { return __builtin_popcountll(x); }

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};
const double EPS = 1e-9;
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//
int main() {
	int N, M;
	cin >> N >> M;
	
	Vec< int > root(N);
	for_(i,0,N) root[i] = i;
	
	Vec< set< pii > > group(N);
	for_(i,0,N) {
		int a; 
		cin >> a;
		group[i].insert(pii(a, i));
	}
	
	auto merge = [&](int i, int j) {
		int ri = root[i], rj = root[j];
		if (ri == rj) return -1;
		if (group[ri].size() > group[rj].size()) swap(ri, rj);
		for (pii p : group[ri]) {
			root[p.second] = rj;
			group[rj].insert(p);
		}
		group[ri] = set< pii >();
		return rj;
	};
	
	for_(i,0,M) {
		int x, y;
		cin >> x >> y;
		merge(x, y);
	}
	
	lint ans = 0;
	
	Vec< int > deg1;
	for_(i,0,N) if (group[i].size() == 1) deg1.push_back(i);
	int K = deg1.size();
	for_(i,0,K/2) {
		ans += (lint)(*group[deg1[2 * i]].begin()).first;
		group[deg1[2 * i]].clear();
		ans += (lint)(*group[deg1[2 * i + 1]].begin()).first;
		group[deg1[2 * i + 1]].clear();
	}
	
	set< pii > deg_order;
	for_(i,0,N) if (!group[i].empty()) deg_order.insert(pii(group[i].size(), i));
	
	while (deg_order.size() > 1) {
		pii s = *deg_order.begin();
		pii t = *deg_order.rbegin();
		
		pii gs = *group[s.second].begin();
		pii gt = *group[t.second].begin();
		
		ans += (lint)gs.first + (lint)gt.first;
		
		group[s.second].erase(gs);
		group[t.second].erase(gt);
		
		deg_order.erase(s);
		deg_order.erase(t);
		
		int new_id = merge(s.second, t.second);
		deg_order.insert(pii(group[new_id].size(), new_id));
	}
	
	int cnt = (K / 2) * 2;
	pii p = *deg_order.begin();
	if (p.first < cnt) {
		puts("Impossible");
	} else {
		int id = p.second;
		while (cnt) {
			pii g = *group[id].begin();
			ans += (lint)g.first;
			group[id].erase(g);
			--cnt;
		}
		cout << ans << endl;
	}
}
//--------------8---------------->> coding space <<-----------------8-------------//


Measured memory_bytes: 10624
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned long long int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________

	int a, b, c;
	cin >> a >> b >> c;
	//cout << fixed << setprecision(29);
	if (c > (a + b) && 4 * a * b < (c - a - b) * (c - a - b))
	{
		cout << "Yes" << en;
	}
	else
	{
		cout << "No" << en;
	}


	return 0;
}



Measured memory_bytes: 256
N = int(input())

if N >= 28:
    print("Yes")
else:
    fou = []
    sev = []
    for num in range(5):
        fou.append(7*(num))
    for num in range(8):
        sev.append(4*(num))
    sum = []
    for i in range(7):
        for j in range(4):
            sum.append(sev[i] + fou[j])
    if N in sum:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 3064
N = int(input())

C = [[0 for _ in range(10)] for __ in range(10)]
for i in range(1,N+1):
    C[int(str(i)[0])][int(str(i)[-1])] += 1
ans = 0
for i in range(10):
    for j in range(10):
        ans += C[i][j]*C[j][i]
print(ans)

Measured memory_bytes: 9184
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    double n;
    cin >> n;
    double ave = 0;
    vec(double) a((lli) n);
    rep(i,n){
        double an;
        cin >> an;
        a[i] = an;
        ave += an;
    }
    ave /= n;
    double d = INF;
    lli rec=INF;
    rep(i,n){
        if(d>abs(a[i]-ave)){
            d = abs(a[i] - ave);
            rec = i;
        }
    }
    out(rec);
}

Measured memory_bytes: 3756
# -*- coding: utf-8 -*-
N = map(int, input().split())
L = list(map(int,input().split()))

L.sort()
med1 = len(L)//2 -1
med2 = len(L)//2
if L[med1] == L[med2]:
  print(0)
else:
  print(L[med2] - L[med1])
  

Measured memory_bytes: 13992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
constexpr ll INF = LLONG_MAX;
constexpr double DINF = DBL_MAX;
constexpr ll mod = 1e9+7;
constexpr double PI = M_PI;

template<typename T>
vector<T> make_v(size_t a){
  return vector<T>(a);
}
 
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

int main(){
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
 
  long long ans = 0;
  string s;
  cin >> s;
  long long n = (int)s.size();
  for(int i = 0; i < n/2; i++){
    if(s[i] != s[n-1-i]){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int,int>
const int mod = 998244353;
 
int dx[]={-1, 0, 1, 0,1,-1,1,-1};
int dy[]={0, -1, 0, 1,1,-1,-1,1};




int32_t main()
{

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


int n;
cin >>n;
int ans=0;

for(int i=1;i<=n;i++)
{
    if(i%3!=0&&i%5!=0)
    ans+=i;
}

cout<<ans<<"\n";


}


Measured memory_bytes: 3640
//...Bismillahir Rahmanir Rahim...
// Code by    Asad Bin Saber

#include <bits/stdc++.h>

using namespace std;

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

// constants...
const double PI = acos(-1);

// defines...
#define MP make_pair
#define PB push_back
#define fi first
#define se second
#define si(a) scanf("%d", &a)
#define sii(a, b) scanf("%d%d", &a, &b)
#define siii(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define sl(a) scanf("%lld", &a)
#define sll(a, b) scanf("%lld%lld", &a, &b)
#define slll(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)

int gcd(int a, int b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
ll lcm(ll a, ll b)
{
    return (a/gcd(a, b)*b);
}
ll comb(ll a, ll b)
{
    ll x = max(a-b, b), ans=1;

    for(ll K=a, L=1; K>=x+1; K--, L++){
        ans *= K;
        ans /= L;
    }

    return ans;
}


void task()
{
    //code here...
    
    int n, mid=0;
    
    cin >> n;
    int ara[n];
    for(int K=0; K<n; K++) cin >> ara[K];
    for(int K=0; K<n; K++) mid ^= ara[K];
    
    for(int K=0; K<n; K++) cout << (mid^ara[K]) << " ";
    cout << "\n";
}

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

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    task();

    return 0;
}




Measured memory_bytes: 4332
/*author - Aryan Mittal*/
#include<bits/stdc++.h>
using namespace std;

#pragma GCC push_options
#pragma GCC optimize ("unroll-loops")

#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"

#define pow2(x) ((x)*(x))
#define ll long long
#define ld long double
#define eb emplace_back
#define pb push_back
#define pf push_front

#define mod 1000000007
#define clock (clock() * 1000.0 / CLOCKS_PER_SEC)

#define mp make_pair
#define ff first
#define ss second
#define null NULL

#define all(c) (c).begin(),(c).end()
#define nl "\n"

typedef vector<ll> vl;
typedef vector< vl > vvl;
typedef pair< ll,ll> pll;
typedef map< ll,ll> mll;

int main(){

	// Use ctrl+shift+b ( second option )
	ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt" , "w" , stderr);
	#endif

	// int a,b;
	// cin>>a>>b;

	// cout<<a<<" "<<b<<"\n";
	// cout<<"Aryan"<<"\n"; 
	// cerr<<"Aryan "<<a;

	
	ll s,w;
	cin>>s>>w;

	ll ans;
	if(w>=s){
		ans = 1;
	}else{
		ans = 0;
	}

	if(ans==1){
		cout<<"unsafe"<<"\n";
	}else{
		cout<<"safe"<<"\n";
	}


	return 0;
}


Measured memory_bytes: 3636
#include <cstdio>
#include <cstdlib>
using namespace std;
int n,m;
int main()
{
	scanf("%d %d",&n,&m);
	if(n%3==0 || m%3==0 || (n+m)%3==0) puts("Possible");
	else puts("Impossible");
	return 0;
}

Measured memory_bytes: 128
MOD=10**9+7
N=int(input())
clist=list(map(int,input().split()))
clist.sort()

def powmod(a,p):
  if p==0:
    return 1
  elif p==1:
    return a
  else:
    pow2=powmod(a,p//2)
    if p%2==0:
      return (pow2**2)%MOD
    else:
      return (a*pow2**2)%MOD

base=powmod(2,2*N-2)
coef=0
for i in range(N):
  coef+=clist[i]*(N+1-i)
  coef%=MOD

print(base*coef%MOD)

Measured memory_bytes: 26024
#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG_OUTPUT
#define DEBUG_LOG(s) cout << s << endl;
#else
#define DEBUG_LOG(s) void();
#endif

class Combination {
private:
    int64_t mod; // 元, 素数でないとNG
    int64_t max_size; // 最大値, 10^7まで
    vector<int64_t> factorial; // 階乗
    vector<int64_t> inverse; // 逆元
    vector<int64_t> inverse_factorial; // 逆元の階乗

    void init() {
        factorial.resize(max_size);
        inverse.resize(max_size);
        inverse_factorial.resize(max_size);
        // 値は1で初期化する
        factorial[0] = factorial[1] = 1;
        inverse[1] = 1;
        inverse_factorial[0] = inverse_factorial[1] = 1;
        for (auto i = 2; i < max_size; i++) {
            factorial[i] = factorial[i - 1] * i % mod;
            inverse[i] = mod - inverse[mod % i] * (mod / i) % mod; // 拡張Euclidの互除法の変形版
            // inverse[i] = modinv(i); // Fermatの小定理
            inverse_factorial[i] = inverse_factorial[i - 1] * inverse[i] % mod;
            // cout << i << " " << factorial[i] << " " << inverse[i] << " " << inverse_factorial[i] << endl;
        }
    };
public:;
    Combination(int64_t mod, int64_t max_size) {
        this->mod = mod;
        assert(max_size < 1e7);
        this->max_size = max_size + 1;
        // テーブル生成
        init();
    };
    virtual ~Combination(){};

    int64_t modpow(int64_t a, int64_t n) {
        int64_t ret = 1;
        while(n > 0) {
            if(n & 1) ret = ret * a % mod;
            a = a * a % mod;
            n >>= 1;
        }
        return ret;
    };
    int64_t modinv(int64_t a) { return modpow(a, mod - 2); };
    int64_t combination(int64_t n, int64_t k) {
        if (n < k) return 0;
        if (n < 0 or k < 0) return 0;
        // cout << factorial[n] << " " << inverse_factorial[k] << " " << inverse_factorial[n - k] << endl;
        return factorial[n] * (inverse_factorial[k] * inverse_factorial[n - k] % mod) % mod;
    };
};

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

    int a = x / 2, b = (x - a * 2);
    while(y != a + b * 2) {
        a--; b+=2;
        // cout << a << " " << b << " " << a * 2 + b << " " << a + b * 2 << endl;
        if(a < 0 or b > y / 2) {
            cout << 0 << endl;
            return 0;
        }
    }

    int64_t mod = 1e9+7, n = a + b;
    Combination c(mod, n);

    cout << c.combination(n, a) % mod << endl;
    return 0;
}

Measured memory_bytes: 18836
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
const long long INF=200000000000000;
double pi=3.141592653589793;

const int MOD = 1000000007;

long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(a%b==0)return b;
	return gcd(a%b,b);
}

long long lcm(long long a,long long b){
	return a/gcd(a,b)*b;
}
long myPow(long long x, long long n, long long m=MOD){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

class Point{
public:
	long long x;
	long long y;
	long long dis;
	Point(long long _x,long long _y,long long _dis){
		x=_x;
		y=_y;
		dis=_dis;
	}
};

typedef long long ll;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	ll H,W;
	ll num=0;
	cin>>H>>W;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			char a;
			cin>>a;
			if(a=='#')num++;
		}
	}
	if(num==H+W-1)cout<<"Possible"<<endl;
	else cout<<"Impossible"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <limits>
#include <cctype>
#include <iomanip>
#include <math.h>
#include <cstdio>
#include <stack>
#include <bitset>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <queue>
#include <set>
#include <map>
#include <iterator>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;

int main() {
	int a, b;
	scanf("%d %d", &a, &b);

	int ans = 0, sum = 1;

	while (b > sum) {
		sum--;
		sum += a;
		ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

int N;
V<ll> a;

ll dfs(int l,int r,int x,int y){
	if(l+1 == r) return 0;
	ll res = 1e18;
	for(int m = l+1; m < r; m++){
		chmin(res,dfs(l,m,x,x+y) + a[m]*(x+y) + dfs(m,r,x+y,y));
	}
	return res;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);

	cin >> N;
	a.resize(N);
	rep(i,N) cin >> a[i];
	
	cout << dfs(0,N-1,1,1) + a[0] + a[N-1] << endl;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))

dp = [0] * n
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
    dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))

print(dp[-1])

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

int main()
{
	string s, p;
	cin >> s;
	cin >> p;

	s = s + s;

	int flag = 0;

	for (int i = 0; i < s.size() / 2; i++)
	{
		

		if (s.substr(i, p.size()) == p)
		{
			flag = 1;
		}
	}

	if (flag == 1) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

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

using namespace std;

const int maxn = 1e5 +  5;

int a[maxn];

int main()
{
   int n;
   cin >> n;
   int ans = 0;
   for(int i=1;i<=n;i++)
   {
       cin >> a[i];
       ans += abs(a[i] - a[i-1]);
   }
   ans += abs(a[n]);
   for(int i=1;i<=n;i++)
   {
       cout << ans - abs(a[i] - a[i-1]) - abs(a[i+1] - a[i]) + abs(a[i-1] - a[i+1]) << endl;
   }
   return 0;
}


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

using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<uint, uint> puu;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<uint> vu;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<puu> vpuu;
typedef vector<pll> vpll;
typedef vector<pull> vpull;
typedef vector<string> vstr;
typedef vector<double> vdbl;
typedef vector<ldbl> vldbl;
#define pb push_back
#define ppb pop_back
#define pfr push_front
#define ppfr pop_front
#define emp emplace
#define empb emplace_back
#define be begin
#define rbe rbegin
#define all(x) (x).be(), (x).end()
#define rall(x) (x).rbe(), (x).rend()
#define fir first
#define sec second
#define mkp make_pair
#define brif(cond) if (cond) break
#define ctif(cond) if (cond) continue
#define retif(cond) if (cond) return
void canhazfast() {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a%b) : a;}
template<typename T> T extgcd(T a, T b, T &x, T &y)
{
    T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b) {
        T q = a/b; a %= b; swap(a, b);
        x0 -= q*x1; swap(x0, x1);
        y0 -= q*y1; swap(y0, y1);
    }
    x = x0; y = y0; return a;
}
int ctz(uint x) {return __builtin_ctz(x);}
int ctzll(ull x) {return __builtin_ctzll(x);}
int clz(uint x) {return __builtin_clz(x);}
int clzll(ull x) {return __builtin_clzll(x);}
int popcnt(uint x) {return __builtin_popcount(x);}
int popcntll(ull x) {return __builtin_popcountll(x);}
int bsr(uint x) {return 31^clz(x);}
int bsrll(ull x) {return 63^clzll(x);}

int main()
{
    canhazfast();

    int n;

    cin >> n;
    cout << (n-1)/2 << '\n';

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <queue>
#include <list>
#include <limits>
#include <string>
#include <vector>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 998244353;


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

int main()
{
  ll N,M,l,r;
  cin >> N >> M;
  ll lmax = 0,rmin = N;
  for(ll i=0;i<M;i++){
    cin >> l >> r;
    if(lmax < l) lmax = l;
    if(rmin > r) rmin = r;
  }  
  if(rmin - lmax + 1 >= 0) cout << rmin - lmax + 1;
  else cout << "0";
}


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

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

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

const ll MOD = 1000000007LL;

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

    vector<ll> A(N);
    rep (i, N) { cin >> A[i]; }

    ll sum = 0;
    rep (i, N) { sum += A[i]; }

    ll ans = 0;

    rep (i, N)
    {
        sum -= A[i];
        const auto x = A[i];
        const auto y = sum % MOD;

        ans += (x * y) % MOD;
        ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4836
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]
x, y = list(map(int, input().split()))
if (x in a and y in a) or (x in b and y in b) or (x in c and y in c):
    print("Yes")
else:
    print("No")

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }

int main(){
  ll i, j;
  ll n;
  string str;
  cin >> n >> str;
  vector<ll> b(n + 1), w(n + 1);
  w[0] = 0; 
  b[n] = 0;
  for(i = 1; i < n + 1; i++){
    w[i] = w[i - 1];
    if(str[i - 1] == '.')
      w[i]++;
  }
  for(i = n - 1; i >= 0; i--){
    b[i] = b[i + 1];
    if(str[i] == '#')
      b[i]++;
  }
  ll result = MOD;
  for( i = 0; i < n + 1; i++)
    chmin(result, n - w[i] - b[i]);
  cout << result << endl;

  return 0;
}

Measured memory_bytes: 4224
def main():
    N, X = [int(n) for n in input().split()]
    L = [int(n) for n in input().split()]
    now = 0
    res = 0
    for i in range(N):
        if now <= X:
            res += 1
        now += L[i]
    if now <= X:
        res += 1
    print(res)
main()

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

const int64 mod = 1e9+7;
using ld = long double;
using P = complex<ld>;

ld dot(P a, P b){
	return (a.real()*b.real()+a.imag()*b.imag());
}

int main(void){
	P p[3];
	REP(i, 3){
		ld x, y;
		cin >> x >> y;
		p[i] = {x, y};
	}
	ld deg[3];
	REP(i, 3){
		P v1 = p[(i+1)%3]-p[i], v2 = p[(i+2)%3]-p[i];
		deg[i] = acos(dot(v1, v2)/abs(v1)/abs(v2));
		deg[i]/=2;
	}
	ld res = 0;
	REP(i, 3){
		ld l = abs(p[(i+1)%3]-p[i]);
		ld x = tan(deg[(i+1)%3]), y = tan(deg[i]);
		res = max(res, x*y*l/(2*x*y+x+y));
	}
	cout << fixed << setprecision(10) << res << endl;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        ArrayList<Integer> x = new ArrayList<>();
        ArrayList<Integer> y = new ArrayList<>();
        for (int i=0;i<n;i++){
            x.add(scanner.nextInt());
            y.add(scanner.nextInt());
        }
        double instance = 0;
        for (int i=0;i<n;i++){
            for (int j=0;j<n;j++){
                instance += Math.sqrt((x.get(i)-x.get(j))*(x.get(i)-x.get(j))+(y.get(i)-y.get(j))*(y.get(i)-y.get(j)));
            }
        }
        System.out.println(instance/n);

    }

}

Measured memory_bytes: 21844
N, K = map( int, input().split())
S = input()
l = 0
now = S[0]
k = 0
if now == "0":
    k = 1
r = 0
for i in range(1, N):
    if now == "1":
        if S[i] == "1":
            r = i
        else:
            k += 1
            if k > K:
                break
            r = i
            now = "0"
    else:
        r = i
        now = S[i]
ans = r - l + 1
while r < N - 1:
    if S[l] == "0":
        for i in range(l,N):
            if S[i] == "1":
                l = i
                break
    else:
        now = "1"
        for i in range(l, N):
            if now == "1":
                now = S[i]
            else:
                if S[i] == "1":
                    l = i
                    break
    now = "0"
    for i in range(r+1, N):
        if now == "0":
            now = S[i]
            r = i
        else:
            if S[i] == "0":
                r = i - 1
                break
            else:
                r = i
    if ans < r-l+1:
        ans = r-l+1
print(ans)


Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;

int N;
string S;

int main() {
    cin >> N >> S;
    int left = 0;
    string ans = "";
    for (int i = 0; i < N; i++) {
        left += S[i] == '('? 1: -1;
        if (left < 0) {
            ans = '(' + ans;
            left++;
        }
        ans += S[i];
    }
    for (int i = 0; i < left; i++) {
        ans += ')';
    }
    cout << ans << endl;
}



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

using namespace std;

typedef long long ll;

const int INF = 1000000009;

void solve() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h);
    for (int i = 0; i < h; ++i) {
        cin >> s[i];
    }
    
    int ans = 0;
    for (int mi = 0; mi < (1 << h); ++mi) {
        for (int mj = 0; mj < (1 << w); ++mj) {
            int ck = 0;
            for (int i = 0; i < h; ++i) {
                for (int j = 0; j < w; ++j) {
                    if (s[i][j] == '.') {
                        continue;
                    }
                    if ((mi >> i) & 1) {
                        continue;
                    }
                    if ((mj >> j) & 1) {
                        continue;
                    }
                    ++ck;
                }
            }
            if (ck == k) {
                ++ans;
            }
        }
    }
    
    cout << ans << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    int t = 1;
    //cin >> t;
    for (int qq = 0; qq < t; ++qq) {
       solve();
    }
   
    return 0;
}

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

int main(void)
{
  int d,t,s;
  
  scanf("%d%d%d", &d,&t,&s);
  
  if(d/s == t&&d%s>0){
    printf("No");
     return 0;
  }
  
  if(d/s > t)
    printf("No");
  else
    printf("Yes");

  return 0;
}

Measured memory_bytes: 1732
import numpy as np
H, W = map(int, input().split())
map_lis = [input() for i in range(H)]
ans = 0

def prob(x,y,h,w):
  if 0<=x<h and 0<=y<w:
    return True
  else:
    return False

def count(x,y,lis):
  if not lis[x][y]:
    return True
  else:
    return False

def maze(x,y,lis):
  if lis[x][y] == ".":
    return True
  else:
    return False

for i in range(H):
  for j in range(W):
    k = 0
    count_lis = np.zeros((H,W))
    num_lis = [[] for i in range(1000)]
    if maze(i,j,map_lis):
      count_lis[i][j] = 1
      num_lis[0].append([i,j])
    while True:
      for l in num_lis[k]:
        if prob(l[0]-1,l[1],H,W) and count(l[0]-1,l[1],count_lis) and maze(l[0]-1,l[1],map_lis):
          num_lis[k+1].append([l[0]-1,l[1]])
          count_lis[l[0]-1][l[1]] = 1
        if prob(l[0],l[1]-1,H,W) and count(l[0],l[1]-1,count_lis) and maze(l[0],l[1]-1,map_lis):
          num_lis[k+1].append([l[0],l[1]-1])
          count_lis[l[0]][l[1]-1] = 1
        if prob(l[0]+1,l[1],H,W) and count(l[0]+1,l[1],count_lis) and maze(l[0]+1,l[1],map_lis):
          num_lis[k+1].append([l[0]+1,l[1]])
          count_lis[l[0]+1][l[1]] = 1
        if prob(l[0],l[1]+1,H,W) and count(l[0],l[1]+1,count_lis) and maze(l[0],l[1]+1,map_lis):
          num_lis[k+1].append([l[0],l[1]+1])
          count_lis[l[0]][l[1]+1] = 1
      new_ans = 0
      for m in num_lis[1:]:
        if m != []:
          new_ans += 1
        if m == []:
          break
      ans = max(ans, new_ans)
      k += 1
      if num_lis[k] == []:
        break
                                     
print(ans)

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

  if(n==3) cout << "bon" << endl;
  else if(n==0||n==1||n==6||n==8) cout << "pon" << endl;
  else cout << "hon" << endl;
  
  return 0;
}

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

int main()
{
	int a,b,c,d,sum=0;
	string s;
    cin>>s;
    for(int i=0;i<3;i++)
    {
        if(s[i]=='o')
            sum++;
    }
	cout<<700+100*sum<<endl;
	
	return 0;
}
	

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define arrdump(n,a) for(int i=0;i<n;i++) {cout<<((i>0)? " ":"")<<a[i];}cout<<"\n";


typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_B&lang=jp

#define MAX 1000005

int N;
int A[MAX];
int cnt;

static void merge(int l, int m, int r) {
    int n1 = m - l;
    int n2 = r - m;
    int L[n1+5], R[n2+5];
    REP(i, n1) L[i] = A[l+i];
    REP(i, n2) R[i] = A[m+i];
    L[n1] = R[n2] = INF;
    int i = 0, j = 0;

    for (int k = l; k < r; k++) {
        if (L[i] <= R[j]) {
            A[k] = L[i++];
        } else {
            A[k] = R[j++];
        }
        cnt ++;
    }
}

static void mergeSort(int l, int r) {
    if (l+1 < r) {
        int m = (l+r) /2;
        mergeSort(l, m);
        mergeSort(m, r);
        merge(l, m, r);
    }
}

int main() {
    cin >> N;
    REP(i, N) cin >> A[i];
    mergeSort(0, N);
    arrdump(N, A);
    cout << cnt << "\n";
    return 0;
}



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

using namespace std;

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

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

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

ll C[205][205];

int main() {
    ll N, M, R;
    cin >> N >> M >> R;
    vector<ll> r(R);
    REP(i, R) {
        cin >> r[i];
        r[i]--;
    }

    REP(i, N) {
        REP(j, N) {
            C[i][j] = INF;
        }
        C[i][i] = 0;
    }
    REP(i, M) {
        ll a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        C[a][b] = C[b][a] = std::min({C[a][b], C[b][a], c});
    }

    REP(k, N) {
        REP(i, N) {
            REP(j, N) {
                C[i][j] = std::min(C[i][j], C[i][k] + C[k][j]);
            }
        }
    }

    sort(r.begin(), r.end());
    ll ans = INF;
    do {
        ll c = 0;
        REP(i, R - 1) {
            c += C[r[i]][r[i + 1]];
        }
        ans = std::min(ans, c);
    } while (next_permutation(r.begin(), r.end()));
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
// AOJ Vol3-0393: Design of a Mansion
// 2018.12.25
 
//#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main()
{
	int H, A, B, i, ans;

	scanf("%d%d%d", &H, &A, &B);
	for (ans = 0, i = A; i <= B; i++)
		if (H % i == 0) ans++;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 2104
/*
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,fma,tune=native")
//*/
#include <bits/stdc++.h>

using namespace std;

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn  = 2e5+100;
const ll mod =1e9+7;
const ld PI = acos((ld)-1);

#define pb push_back
#define endl '\n'
#define dokme(x) return(cout << x , 0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ms(x , y) memset(x , y , sizeof x);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}

string s , ans;
int dp[maxn][27];

int32_t main(){
    migmig
    cin >> s;
    int n = s.size();
    for(int i = 0 ; i < 26 ; i ++)
        dp[n][i] = 1;
    for(int i = n-1 ; i >= 0 ; i --){
        int mn = n;
        for(int j = 0 ; j < 26 ; j ++) mn = min(mn , dp[i+1][j]);
        for(int j = 0 ; j < 26 ; j ++) dp[i][j] = min(mn + 1 , dp[i+1][j]);
        if(mn == dp[i + 1][s[i] - 'a'])dp[i][s[i] - 'a'] = mn + 1;
    }
    for(int i = 0 ; i <= n; i ++){
        int mn = n, anss = 0;
        for(int j = 0 ; j < 26 ; j ++)
            if(dp[i][j] < mn)
                mn = dp[i][j] , anss = j;
        ans += char(anss + 'a');
        if(mn == 1)
            break;
        while(s[i]!=char(anss + 'a'))i++;
    }
    cout << ans;
    return(0);
}

Measured memory_bytes: 24892
/**/
#include <bits/stdc++.h>
using namespace std;
/***********************************************/
/* Dear online judge:
 * I've read the problem, and tried to solve it.
 * Even if you don't accept my solution, you should respect my effort.
 * I hope my code compile and get accepted.
 *      ____________
 *     /         __ \
 *    /   __    |  | \
 *   /   |__|   |  |  \
 *  (           |__|   )
 *   \                /
 *    \      ___     /
 *     \____________/
 *
 *
 */
const long long mod = 1000000007;

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

	int K,T;
	cin>>K>>T;
	vector<int> a(T);
	for(int i = 0;i < T;i++){
		cin>>a[i];
	}
	sort(a.begin(),a.end());
	if(K == 1){
		cout<<"0\n";
		return 0;
	}
//	if(T == 1){
//		cout<<K-1<<'\n';
//		return 0;
//	}
	if(a[T-1] <= (K+1)/2){
		cout<<"0\n";
		return 0;
	}
	if(K%2 == 0){
		cout<<(a[T-1]-(K+1)/2)*2 - 1<<'\n';
	}else{
		cout<<(a[T-1]-(K+1)/2)*2<<'\n';
	}
	return 0;
}
/**/


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

bool perfect[10];

bool check(int n){
	int t=n;
	while(t>0){
		if(!perfect[t%10])return false;
		t/=10;
	}
	return true;
}

int main(){
    memset(perfect,true,sizeof(perfect));
    int n,d,k;
    cin>>n>>k;
    for(int i=0;i<k;i++){
    	cin>>d;
    	perfect[d]=false;
	}
	for(;;n++){
		if(check(n)){
			cout<<n;
			break;
		}
	}
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int enemy = sc.nextInt();
    int pp = sc.nextInt();sc.nextLine();
    String[] string = sc.nextLine().split(" ");
    long[] input = new long[enemy];
    
    for(int i = 0; i < enemy; i++){
      input[i] = Long.parseLong(string[i]);
    }
    Arrays.sort(input);
    while(pp > 0){
      enemy--;
      pp--;
    }
    long sum = 0;
    for(int i = 0; i < enemy; i++){
      sum += input[i];
    }
    
    
    System.out.println(sum);
  }
}

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

int main() {
  string s;
  long long k;
  cin >> s >> k;
  for(int i = 0;i < s.size();i++){
    if(s.at(i) != '0' && s.at(i) != '1'){
      cout << s.at(i) << endl;
      return 0;
    }
    if(k <= i+1){
      cout << 1 << endl;
      return 0;
    }
    if(i == s.size()-1){
      cout << 1 << endl;
    }
  }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main()
        {
            var a = Console.ReadLine().ToCharArray();
            var b = string.Empty;
            if(!char.IsUpper(a[0]))
            {
                b = "a";
            }
            else
            {
                b = "A";
            }
            Console.WriteLine(b);
        }
    }
}

Measured memory_bytes: 25884
from queue import Queue
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

q = Queue()
searched = [[False for _ in range(W)] for __ in range(H)]
dist = [[-1 for _ in range(W)] for __ in range(H)]

def bfs(x, y, d):
    if not (0 <= x < W and 0 <= y < H):
        return
    if S[y][x] == '#':
        return
    if searched[y][x]:
        return
    searched[y][x] = True
    dist[y][x] = d
    q.put([x, y, d])
    return

ans = 0
for s_y in range(H):
    for s_x in range(W):
        if S[s_y][s_x] == '#':
            continue
        
        q = Queue()
        searched = [[False for _ in range(W)] for __ in range(H)]
        dist = [[-1 for _ in range(W)] for __ in range(H)]
        
        dist[s_y][s_x] = 0
        searched[s_y][s_x] = True
        
        q.put([s_x, s_y, 0])
        
        while not q.empty():
            x, y, d = q.get()
            bfs(x-1, y, d+1)
            bfs(x+1, y, d+1)
            bfs(x, y-1, d+1)
            bfs(x, y+1, d+1)
        
        dist_max = max(list(map(lambda x: max(x), dist)))
        ans = max(ans, dist_max)

print(ans)
        


Measured memory_bytes: 77292
N = int(input())
task = [list(map(int,input().split())) for i in range(N)]
task.sort(key= lambda x:x[1])

curtime = 0
for i in task:
  curtime += i[0]
  if curtime > i[1]:
    print("No")
    break

if curtime <= i[1]:
  print("Yes")

Measured memory_bytes: 53724
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define NUM 1000000007
#define MAX 100001
#define INF LLONG_MAX
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin>>s;
    int n = s.length();
    if(s[n-1]=='s')
        cout<<s<<"es"<<endl;
    else
        cout<<s<<"s"<<endl;
    return 0;
}


Measured memory_bytes: 3648
# coding: utf-8

import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def MI() : return map(int, input().split())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def chkprint(*args) : names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}; print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

N, R = MI()

print(R if N >= 10 else R + 100 * (10 - N))


Measured memory_bytes: 43376