akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
 
#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
void cpp(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
 
int main(){
    cpp();
    ll n;
    cin>>n;
    vector<ll> v(n+1);
    for(ll i=1; i<=n; i++){
        for(ll j=i; j<=n; j+=i){
            v[j]++;
        }
    }
    ll ans = 0;
    for(ll i=1; i<=n; i++){
        ans+=(i*v[i]);
    }
    cout<<ans<<endl;
    return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main() {
  int i;
  int A, B;
  ll a[200020], b[200010];
  map<int, int> mpa, mpb;
  cin >> A;
  for(int i = 0; i < A; i++) scanf("%d", &a[i]);
  cin >> B;
  for(int i = 0; i < B; i++) scanf("%d", &b[i]);

  for(i = 0; i < A; i++) mpa[a[i]]++;
  for(i = 0; i < B; i++) mpb[b[i]]++;

  for(int i = 0; i < B; i++) {
    int x = b[i];
    if(mpb[x] > mpa[x]) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;

  return 0;
}

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

int main() {
    int n, m, temp, minimum, maximum;
    cin >> n >> m >> maximum >> minimum;
    rep(i, n) {
        cin >> temp;
        maximum = max(maximum, temp);
    }
    rep(i, m) {
        cin >> temp;
        minimum = min(minimum, temp);
    }
    if(maximum < minimum) cout << "No War" << endl;
    else cout << "War" << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  int N, X, ans;
  cin >> N >> X;
  ans=0;
  vector<int> D(N+1);
  D[0]=0;
  vector<int> L(N);
  for (int k=0; k<N; k++) {
    cin >> L[k];
  }
  for (int i=0; i<N; i++) {
    D[i+1]=D[i]+L[i];
  }
  for (int j=0; j<N+1; j++) {
    if (D[j]<=X) {
      ans=ans+1;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v){stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modpow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}
void YN(bool z){cout<<(z?"YES\n":"NO\n");}
void Yn(bool z){cout<<(z?"Yes\n":"No\n");}
void yn(bool z){cout<<(z?"yes\n":"no\n");}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
const int N = 100;
ll n, x[N], y[N], h[N];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, n) cin >> x[i] >> y[i] >> h[i];
  FOR(_x, 0, 101)FOR(_y, 0, 101){
    ll _h = linf;
    FOR(i, 0, n) mins(_h, h[i] + abs(x[i]-_x) + abs(y[i]-_y));
    FOR(i, 0, n) if (h[i] != max(_h - abs(x[i]-_x) - abs(y[i]-_y), 0ll)) goto here;
    cout << _x << " " << _y << " " << _h << endl;
    return 0;
    here: ;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;



//bit全探索
vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}



int main(){
    double n, m;
    cin >> n >> m;
    vector<double>A(n);
    double sum = 0;
    rep(i, n){
        cin >> A[i];
        sum += A[i];
    }
    double c = sum / (4 * m);

    int cnt = 0;
    rep(i, n){
        if(A[i] >= c)cnt++;
    }
    cout << (cnt >= m ? "Yes" : "No");
}



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

#define ll long long
#define ft first
#define sd second
#define pb push_back
using namespace std;
const ll mod = 1e9+7;
// const int N = 1e5+9;


signed main() {  

    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
    int n; cin >> n;
    cout << n * n * n << endl;

    return 0;
    
}


Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <iomanip>
#include <tuple>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i=a;i<n;++i)
#define repeq(i, a, n) for(int i=a;i<=n;++i)
#define repi(m, itr) for (auto itr = m.begin();itr != m.end();++itr)
#define per(i, a, n) for (int i=n-1; i>=a;--i)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
 
// 
int N, X;
int point[101000];
int diff[101000];
int ans = 0;
 
 
int gcd(int a,int b)
{
	if (a%b==0)
	{
		return(b);
    }
	else
	{
		return(gcd(b,a%b));
    }
}
 
 
int main(){
    cin >> N >> X;
 
    rep(i, 0, N){
        cin >> point[i];
        diff[i] = abs(point[i] - X);
    }
    
    if(N == 1){
        ans = diff[0];
    }else{
        int tmp = diff[0];
        if(tmp == 0) tmp = diff[1];
        rep(i, 0, N){
            if(diff[i] == 0) continue;
            tmp = gcd(tmp, diff[i]);
        }
        ans = tmp;
    }
 
    cout << ans << endl;
    return 0;
}

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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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

template<typename T>
void print1(T begin, T end) {
  while (begin != end) {
    cout << (*begin) << " ";
    *begin++;
  }
  cout << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cout << " " << Array[i][j];
    }
    cout << endl;
  }
}

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

signed main() {
  int n, a, b;
  cin >> n >> a >> b;
  cout << min(a, b) << " " << max(0LL, a+b-n) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;

int main() {
    vector<ll> F(5, 0);
    int N; cin >> N;
    for (int i = 0; i < N; i++) {
        string s; cin >> s;
        if (s.front() == 'M') F[0]++;
        if (s.front() == 'A') F[1]++;
        if (s.front() == 'R') F[2]++;
        if (s.front() == 'C') F[3]++;
        if (s.front() == 'H') F[4]++;
    }

    ll ans = 0;
    for (int i = 0; i < 5; i++) {
        for (int j = i + 1; j < 5; j++) {
            for (int k = j + 1; k < 5; k++) {
                ans += F[i] * F[j] * F[k];
            }
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var x string
	fmt.Scan(&x)

	ans := len(x)
	cnt := 0
	for _, r := range x {
		if r == 'S' {
			cnt++
		} else if r == 'T' && cnt > 0 {
			cnt--
			ans -= 2
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1920
#include <stdio.h>
int main(void){
    int i, j, K, cnt;
    
    cnt = 0;
    scanf("%d", &K);
    
    for(i = 1; i <= K; i++){
        for(j = 1; j <= K; j++){
            if(i%2 == 0 && j%2 == 1){
                cnt = cnt + 1;
            }
        }
    }
    printf("%d", cnt);
}


Measured memory_bytes: 128
import java.util.*;
class Main
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
	  
    int n=sc.nextInt();
    int m=sc.nextInt();
    int sum=0;
    int a[]=new int[m];
    for(int i=0;i<m;i++)
    {
      a[i]=sc.nextInt();
    }
    for(int i=0;i<m;i++)
    {
      sum=sum+a[i];
    }
    if(sum > n)
    {
      System.out.println("-1");
    }
    else
    {
      System.out.println(n-sum);
    }
  }
}
      
    

Measured memory_bytes: 46308
#include<bits/stdc++.h>
#define ll long long int
#define vec vector<ll>
#define mat vector<vec>

using namespace std;

const ll mod=1000000007;
const ll inf=LONG_LONG_MAX;
ll dx4[4]={1,0,-1,0};
ll dy4[4]={0,-1,0,1};
ll dx8[8]={1,0,-1,1,-1,1,0,-1};
ll dy8[8]={1,1,1,0,0,-1,-1,-1};

ll powmod(ll a,ll n,ll m) {
    if(n == 0)
        return 1;

    if(n % 2 ==0){
        ll r = powmod(a,n/2,m);
        return r*r % m;
    }

    return a*powmod(a,n-1,m)%m;
}

ll factmod(ll a,ll b,ll m) {
  if(a<b)return 0;
  ll s=1;
  while(a>=b){
    s = s*a % m;
    a -= 1;
  }
  return s;
}

ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

ll combmod(ll a,ll b,ll m){
  if(b==0)return 1;
  ll c=factmod(a,a-b+1,m);
  ll d=modinv(factmod(b,1,m),m);
  ll e=(c*d)%m;
  return e;
}

void modsum(ll &a,ll b,ll m){
  a+=b;
  a%=m;
}

void modsub(ll &a,ll b,ll m){
  a-=b;
  a+=m;
  a%=m;
}

void modmul(ll &a,ll b,ll m){
  a*=b;
  a%=m;
}

void modquo(ll &a,ll b,ll m){
  a*=modinv(b,m);
  a%=m;
}

int main(){

  ll n;
  cin >> n;
  ll a[n];
  for(ll i=0;i<n;i++)cin >> a[i];

  ll ans=0;
  ll s=0;
  for(ll i=0;i<n;i++)modsum(s,a[i],mod);
  modmul(s,s,mod);
  for(ll i=0;i<n;i++)modsub(s,a[i]*a[i]%mod,mod);
  modquo(s,2,mod);
  cout << s << endl;


}

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

int main(){
	int A, B;
	cin >> A >> B;
	
	if(A >= 13){
		cout << B << endl;
	} 
	else if(A >= 6){
		cout << B / 2 << endl;
	}
	else {
		cout << 0 << endl;
	}
}

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

int M;
int a[7];
int s, g;
int N[301];

bool isChecked[301];
vector<int> milestone[301];  //そのマスで出せばゴールにたどり着ける目を格納する

int iabs(int x){ return x >= 0 ? x : -x; }

bool search(int now){
	if (isChecked[now]) return false;
	if (now == g)  return true;

	isChecked[now] = true;
	for (int dice = 1; dice <= 6; dice++){
		if (now + a[dice] <= M && search(now + a[dice] + N[now + a[dice]])){
			milestone[now].push_back(a[dice]);
		}
		if (now - a[dice] >= 1 && search(now - a[dice] + N[now - a[dice]])){
			milestone[now].push_back(-a[dice]);
		}
	}

	return milestone[now].size() > 0 ? true : false;
}

int main(){
	cin >> M;
	for (int i = 1; i <= 6; i++){
		cin >> a[i];
	}
	cin >> s >> g;
	for (int i = 1; i <= M; i++){
		cin >> N[i];
	}
	bool canGoal = search(s);

	int now = s; //自分が今いるマスの番号
	for (;;){
		int dice;
		cin >> dice;

		bool found = false;
		for (vector<int>::iterator it = milestone[now].begin(); it != milestone[now].end(); it++){
			if (iabs(*it) == a[dice]){
				if (*it > 0){
					now = now + a[dice] + N[now + a[dice]];
					cout << 1 << endl;
				}
				else{
					now = now - a[dice] + N[now - a[dice]];
					cout << -1 << endl;
				}
				found = true;
				break;
			}
		}
		if(!found) cout << 0 << endl;
		cout.flush();

		if (now == g) return 0;
	}
	
	return 0;
}

Measured memory_bytes: 1308
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
const int mod=1e9+7;
string s;
int n;
int main(){
	 cin>>n>>s;
 	for(int i=0;i<s.size();i++){
 		s[i]=char((((s[i]-'A')+n)%26)+'A');
 	}
 	cout<<s;
 }

Measured memory_bytes: 3620
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXP=300;
const int MAXS=300;

int np,ns;
int prf[MAXP][MAXS];

bool have[MAXS];
int at[MAXP];
int cnt[MAXS];

void run() {
	scanf("%d%d",&np,&ns); REP(i,np) REP(j,ns) scanf("%d",&prf[i][j]),--prf[i][j];

	REP(j,ns) have[j]=true; REP(i,np) at[i]=0;
	int ret=INT_MAX;
	while(true) {
		REP(j,ns) cnt[j]=0; REP(i,np) { while(at[i]<ns&&!have[prf[i][at[i]]]) ++at[i]; if(at[i]<ns) ++cnt[prf[i][at[i]]]; }
		int mxj=-1; REP(j,ns) if(have[j]&&(mxj==-1||cnt[j]>cnt[mxj])) mxj=j; if(mxj==-1) break;
		ret=min(ret,cnt[mxj]); have[mxj]=false;
	}
	printf("%d\n",ret);
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int ans=0;
    if(s.size()%2!=0){
        ans=1;
    }
    if(ans==0){
        for(long long i=0;i<s.size();i++){
            if(i%2==0){
                if(s[i]!='h'){
                    ans=1;
                    break;
                }
            }
            else if(i%2==1){
                if(s[i]!='i'){
                    ans=1;
                    break;
                }
            }
        }
    }
    if(ans==0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<string>
#include <iomanip>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<complex>
#include<ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;

int main(void)

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

	ll n;
	cin >> n;

	vector<ll> ans(9);
	for (int i = 0; i < 9; i++)
		ans[i] = i + 1;

	ll rightpos = ans.size();
	ll leftpos = 0;

	while (ans.size() < 200000)
	{
		for (int i = leftpos; i < rightpos; i++)
		{
			if (ans[i] % 10 == 0)
			{
				ans.push_back(ans[i] * 10);
				ans.push_back(ans[i] * 10 + 1);
			}
			else if (ans[i] % 10 == 9)
			{
				ans.push_back(ans[i] * 10 + 8);
				ans.push_back(ans[i] * 10 + 9);
			}
			else
			{
				ans.push_back(ans[i] * 10 + ans[i]%10 - 1);
				ans.push_back(ans[i] * 10 + ans[i]%10);
				ans.push_back(ans[i] * 10 + ans[i]%10 + 1);
			}
		}
		leftpos = rightpos;
		rightpos = ans.size();
	}
	sort(ans.begin(), ans.end());

	cout << ans[n - 1] << endl;

	return 0;
}

Measured memory_bytes: 7024
using System.IO;
using System;

class Program
{
    static void Main()
    {
        string[] str = Console.ReadLine().Split(' ');
        int width = int.Parse(str[0]);
        int height = int.Parse(str[1]);
        
        Console.WriteLine("{0} {1}", width*height, (width+height)*2);
    }
}

Measured memory_bytes: 9172
import sys
input = sys.stdin.readline

n,m = map(int,input().split())
li = [list(map(int,input().split())) for _ in range(m)]

ans = 0
now = -1

li.sort(key = lambda x:x[1])

for i in range(m):
    if li[i][0] > now or li[i][1] <= now:
        ans += 1
        now = li[i][1] - 1

print(ans)


Measured memory_bytes: 29028
N, M, Q = gets.split(" ").map(&:to_i)
abcd = []
ans = 0
Q.times do |i|
    abcd[i] = gets.split(" ").map(&:to_i)
end

[*1..M].repeated_combination(N) do |arr|
    score = 0
    abcd.each do |e|
        a, b, c, d = [e[0] - 1, e[1] - 1, e[2], e[3]]
        score += d if arr[b] - arr[a] == c
    end
    ans = [score, ans].max
end

puts ans


Measured memory_bytes: 14632
#include<stdio.h>
int main(){
	int arr[]={0,0,0}, n=10, cur,i,j;
	char buf[8];
	//freopen("data.txt","r",stdin);
	while(n-->0){
		fgets(buf, 8, stdin);
		cur= strtol(buf, NULL, 10);
		i=2;
		while(i>=0 && cur>=arr[i]) i--;
		if(i<2) {
			i+=1;			
			for(j=2;j>i;j--){
				arr[j]=arr[j-1];
			}
			arr[i]=cur;
		}
		//printf("%d,%d,%d--%d,%d\n",arr[0],arr[1],arr[2],cur,i+1);
	}
	for(i=0;i<3;i++) printf("%d\n", arr[i]);
	return 0;
}

Measured memory_bytes: 528
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll c(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }

int main(void) {
	int n;
	cin >> n;
	ll c = 0, ans = 1;
	vector<ll> a(n), b(n);
	ll b0 = 0, a0 = 0, r0 = 0;
	map<pair<ll,ll>, pair<ll, ll>> mp;
	rep(i, 0, n) {
		cin >> a[i] >> b[i];
		if (b[i] == 0 && a[i] == 0) {
			r0++;
		}
		else if (b[i] == 0) {
			b0++;
		}
		else if (a[i] == 0) {
			a0++;
		}
		else if((a[i] > 0) ^ (b[i] < 0))
			mp[make_pair(abs(a[i] / gcd(a[i], b[i])), abs(b[i] / gcd(a[i], b[i])))].first++;
		else mp[make_pair(abs(b[i] / gcd(a[i], b[i])), abs(a[i] / gcd(a[i], b[i])))].second++;
	}
	for (auto m : mp) {
		ans *= (mpower(2, m.second.second) + mpower(2, m.second.first) - 1) % mod;
		ans %= mod;
	}
	ans *= (mpower(2, a0) + mpower(2, b0) - 1) % mod;
	ans %= mod;
	ans += r0 % mod + mod - 1;
	ans %= mod;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 21768
from bisect import bisect_left
def main():
    k, t = map(int, input().split())
    a = list(map(int, input().split()))
    ans = 0
    pre = -1
    a.sort()
    for _ in range(k):
        x = bisect_left(a, a[t-1])
        if x == pre:
            if t > 1 and a[x-1] > 0:
                x = bisect_left(a, a[x-1])
            else:
                ans += 1
        a[x] -= 1
        pre = x
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
// AOJ - ALDS1
// ALDS1_1_A - Bubble sort
package main

import "fmt"

func bsort(a []int) (c int) { // len(a)個の要素を含む0indexedの配列
	flag := true // 大小逆転している要素が存在する
	n := len(a)
	for flag { // フラグが立っていなければソート完了
		flag = false
		for j := n - 1; j >= 1; j-- { // 後ろから見ていく
			if a[j] < a[j-1] { // 大小関係が逆転している
				a[j], a[j-1] = a[j-1], a[j]
				flag = true
				c++
			}
		}
	}
	return
	// この実装だと、ソート済みの部分もチェックしているため無駄がある。
}
func bsortx(a []int) (c int) {
	n, i := len(a), 0
	flag := true
	for flag {
		flag = false
		for j := n - 1; j >= i+1; j-- {
			if a[j] < a[j-1] {
				a[j], a[j-1] = a[j-1], a[j]
				flag = true
				c++
			}
		}
		i++
	}
	return
	// 計算量はO(N^2)であるものの、ソート済みの部分を見ないようにしたバージョン
}

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}
	c := bsortx(a)
	for i := range a {
		if i > 0 {
			fmt.Print(" ")
		}
		fmt.Print(a[i])
	}
	fmt.Println()
	fmt.Println(c)
}



Measured memory_bytes: 1168
N=int(input())  #数値入力 「N」だけの入力のとき
A=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

# from functools import lru_cache
# @lru_cache(maxsize=100000)

# 一度差を出してから，どんどんi-1, i+1の和で縮めていく．

def check_distance():
    ret = []
    left = A[0]
    right = sum(A[1:])
    tmp_a = abs(left - right)
    ret.append(tmp_a)

    for i in range(1, N-1):
        left += A[i]
        right -= A[i]
        tmp_a = abs(left - right)
        ret.append(tmp_a)
    return min(ret)

print(check_distance())

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

int main()
{
    //データ定義
    int n;
    int cards[4][13];
    char suit;
    int num;
    int i;
    int j;
    char suits[] = {'S', 'H', 'C', 'D'};
    
    //初期化
    for (i = 0; i < 4; i++){
        for (j = 0; j < 13; j++){
            cards[i][j] = 0;
        }
    }
    //カードの枚数を取得
    cin >> n;

    //メイン処理
    for(i = 0; i < n; i++){
        //カードの情報を取得
        cin >> suit >> num;
        
        //カード配列を更新
        switch (suit)
        {
            case 'S':
                cards[0][num - 1] = 1;
                break;
            case 'H':
                cards[1][num - 1] = 1;
                break;
            case 'C':
                cards[2][num - 1] = 1;
                break;
            case 'D':
                cards[3][num - 1] = 1;
                break;
            default:
                break;
        }
    }
    //結果出力
    for(i = 0; i < 4; i++){
        for (j = 0; j < 13; j++)
        {
            if(cards[i][j] == 0){
                cout << suits[i] << " " << j + 1 << endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3052
N, M = map(int, input().split())
a = set([int(input()) for _ in range(M)])
INF = 1000000007

dp = [0] * (N + 1)
dp[0] = 1
if 1 not in a:
	dp[1] = 1
else:
	dp[1] = 0
for i in range(2, N + 1):
	if i in a:
		continue
	dp[i] = dp[i - 1] + dp[i - 2]
	dp[i] %= INF

print(dp[N])

Measured memory_bytes: 13320
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a>b){
    swap(a,b);
  }
  if(b>c){
    swap(b,c);
  }
  if(a>b){
    swap(a,b);
  }
  if(a+b==c){
    cout<<"Yes";
  }
  else if(a+b!=c){
    cout<<"No";
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  int n=sc.nextInt();
	  int sum=0;
	  while(sum<n) {
		  sum+=1000;
	  }
	  System.out.println(sum-n);
  }
}


Measured memory_bytes: 35748
#include <iostream>
#include <vector>

using namespace std;

struct UnionFind {
    vector<int> data;

    explicit UnionFind(int sz) {
        data.assign(sz, -1);
    }

    int Root(int x) {
        if (data[x] < 0) {
            return x;
        }

        return data[x] = Root(data[x]);
    }

    void Unite(int x, int y) {
        x = Root(x);
        y = Root(y);

        if (x == y) {
            return;
        }

        if (data[y] < data[x]) {
            swap(x, y);
        }

        data[x] += data[y];
        data[y] = x;
    }

    bool Same(int x, int y) {
        return Root(x) == Root(y);
    }

    int Size(int x) {
        return -data[Root(x)];
    }
};

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

    int n, q;
    cin >> n >> q;

    UnionFind uf(n);

    while (q--) {
        int com, x, y;
        cin >> com >> x >> y;

        if (com == 0) {
            uf.Unite(x, y);
        }
        else {
            cout << uf.Same(x, y) << '\n';
        }
    }

    return 0;
}


Measured memory_bytes: 3244
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef pair<int,int> pi;
typedef pair<lld,lld> pl;
typedef vector<int> vit;
typedef vector<vit> vitt;
typedef vector<lld> vlt;
typedef vector<vlt> vltt;
typedef vector<pi> vpit;
typedef vector<vpit> vpitt;
typedef long double ld;
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define mk(a,b) make_pair(a,b)
bool isrange(int y,int x,int n,int m){
	 if(0<=y&&y<n&&0<=x&&x<m) return true;
	 return false;
}
int dy[4] = {1,0,-1,0},dx[4]={0,1,0,-1},ddy[8] = {1,0,-1,0,1,1,-1,-1},ddx[8] = {0,1,0,-1,1,-1,1,-1};
lld dp[4][66][66];
int main(void){
	int n;
	scanf("%d",&n);
	for(int e=0;e<n;e++){
		string a;
		cin >> a;
		lld ll = 0,rr = 0,sz = 1,ty = 0;
		for(int e=0;e<sz(a);e++){
			if(a[e]=='.'){
				ty = 1;
				continue;
			}
			if(ty==0){
				ll = ll*10 + (a[e]-'0');
			}else{
				rr = rr*10 + (a[e]-'0');
				sz *= 10;
			}
		}
		ll *= sz;
		ll += rr;
		lld lm = __gcd(ll,sz);
		ll /= lm;
		sz /= lm;
		int f2 =0,f5 =0,s2 =0, s5=0;
		while(ll!=0){
			if(ll%2==0){
				f2++;
				ll/=2;
			}else if(ll%5==0){
				f5++;
				ll/=5;
			}else break;
		}
		while(sz!=0){
			if(sz%2==0){
				s2++;
				sz/=2;
			}else if(sz%5==0){
				s5++;
				sz/=5;
			}else break;
		}
		if(s2==0&&s5==0){
			dp[0][f2][f5]++;
		}else if(f2&&f5==0&&s2==0&&s5){
			dp[1][f2][s5]++;
		}else if(f2==0&&f5&&s2&&s5==0){
			dp[2][f5][s2]++;
		}else if(f2==0&&f5==0){
			dp[3][s2][s5]++;
		}
	}
	lld ans = 0;
	lld tot1 = 0;
	for(int e=0;e<66;e++){
		for(int p=0;p<66;p++){
			tot1 += dp[0][e][p];
		}
	}
	ans += (tot1*(tot1-1))/2;
	for(int e=0;e<66;e++){
		for(int p=0;p<66;p++){
			for(int q=0;q<=e;q++){
				for(int r=0;r<=p;r++){
					ans += (dp[0][e][p]*dp[3][q][r]);
				}
			}
		}
	}
	for(int e=0;e<66;e++){
		for(int p=0;p<66;p++){
			for(int q=0;q<66;q++){
				for(int r=0;r<=p;r++){
					ans += (dp[0][e][p]*dp[1][q][r]);
				}
			}
			for(int q=0;q<=e;q++){
				for(int r=0;r<66;r++){
					ans += (dp[0][e][p]*dp[2][r][q]);
				}
			}
		}
	}
	for(int e=0;e<66;e++){
		for(int p=0;p<66;p++){
			for(int q=p;q<66;q++){
				for(int r=0;r<=e;r++){
					ans += (dp[1][e][p]*dp[2][q][r]);
				}
			}
		}
	}
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 3784
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;

  vector<pair<int, int>> vec;
  for (int i = 0; i < m; ++i)  {
    int s, c;
    cin >> s >> c;
    vec.push_back(make_pair(s, c));
  }

  bool flag;
  for (int i = 0; i < 1000; ++i) {
    if (not ((i == 0 && n == 1) || (pow(10,n-1) <= i && i < pow(10, n))))
      continue;

    flag = true;
    for (auto &v : vec) {
      int s = v.first;
      int c = v.second;
      if (c != ((i / int(pow(10, n - s))) % 10)) {
        flag = false;
        break;
      }
    }

    if (flag) {
      cout << i << endl;
      return EXIT_SUCCESS;
    }
  }

  cout << -1 << endl;
}

Measured memory_bytes: 256
n=int (input())
w=input().split()
w = list(map(int,w))
i=1
answer = 101

for i in range(1,n):
  left= w[:i]
  right = w[i:]
  right_wight= sum(right)
  left_wight = sum(left)
  tmp_abs = abs(right_wight-left_wight)
  answer = min(answer,tmp_abs)
print(answer)

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

int main() {
  int N;
  cin >> N;
  
  bool A = false;
  
  if(N%1==0 && N/1<10){
    A = true;
  } else if(N%2==0 && N/2<10){
    A = true;
  } else if(N%3==0 && N/3<10){
    A = true;
  } else if(N%4==0 && N/4<10){
    A = true;
  } else if(N%5==0 && N/5<10){
    A = true;
  } else if(N%6==0 && N/6<10){
    A = true;
  } else if(N%7==0 && N/7<10){
    A = true;
  } else if(N%8==0 && N/8<10){
    A = true;
  } else if(N%9==0 && N/9<10){
    A = true;
  }
  
  if(A == true){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
}


Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <iomanip>
# define M_PIl        3.141592653589793238462643383279502884
using namespace std;

typedef long long ll;
typedef long double ld;

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

  vector<ll> arr1(n);
  vector<ll> arr2(m);
  for(ll i=0;i<n;i++){
    cin >> arr1[i];
  }
  for(ll i=0;i<m;i++){
    cin >> arr2[i];
  }

  vector<ll> arrr1(n);
  vector<ll> arrr2(m);
  arrr1[0]=arr1[0];
  for(ll i=1;i<n;i++){
    arrr1[i]=arrr1[i-1]+arr1[i];
  }
  arrr2[0]=arr2[0];
  for(ll i=1;i<m;i++){
    arrr2[i]=arrr2[i-1]+arr2[i];
  }

  ll ans = 0;

  auto it = upper_bound(arrr2.begin(), arrr2.end(),k);
  ans = it-arrr2.begin();

  for(ll i=0;i<n;i++){
    if((k-arrr1[i])<0){
      break;
    }
    auto it = upper_bound(arrr2.begin(), arrr2.end(),(k-arrr1[i]));
    ans = max(ans,i+1+(it-arrr2.begin()));
  }
  cout << ans << endl;
}

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

const long long MOD = 998244353;

ll dp[3001][3001];

void solve(long long N, long long S, std::vector<long long> A){
    
    // memset(dp,0,sizeof(dp));
    dp[0][0] = 1;
    ll ans =0;
    for(int i=0;i<N;i++){
        for(int j=0;j<=S;j++){
            if(j<A[i]){
                dp[i+1][j] = dp[i][j];
            }else{
                dp[i+1][j] = (dp[i][j-A[i]] + dp[i][j])%MOD;
            }
            if(j==0){
                dp[i+1][j]++;
            }
           
        }
        
        // cerr << "i+1=" <<i+1 <<"num =" <<dp[i+1][S] << endl;
        ans = (ans + dp[i+1][S])%MOD;
    }
    cout <<ans << endl;

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long S;
    scanf("%lld",&S);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, S, std::move(A));
    return 0;
}


Measured memory_bytes: 70656
//-----------------------
// author : xyqkoala
// time : 2020-07-12
//-----------------------

#include<iostream>
#include<vector>
#include<string>
#include<deque>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<numeric>
using namespace std;

typedef long long LL;
const int MOD = 1e9+7;

void solve();


int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T = 1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


void solve(){
	int n;
	cin>>n;
	vector<int> nums(n,0);
	int res = 0;
	for(int i=0;i<n;i++){
		cin>>nums[i];
		if(i%2==0 && nums[i]%2) res++;
	}
	cout<<res<<endl;
}


Measured memory_bytes: 3608
#include<iostream>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  int a[n];
  for(int i=0;i<n;i++)a[i]=-1;
  for(int i=0;i<m;i++){
    int s;
    cin>>s;
    s--;
    if(a[s]==-1)cin>>a[s];
    else{
      int t;
      cin>>t;
      if(t!=a[s]){
        cout<<-1<<endl;
        return 0;
      }
    }
  }
  if(a[0]==0){
    if(n>1){
      cout<<-1<<endl;
      return 0;
    }
  }if(a[0]==-1)a[0]=n>1?1:0;
  for(int i=0;i<n;i++)cout<<(a[i]==-1?0:a[i]);
  endl(cout);
}

Measured memory_bytes: 256
import Data.List

main = getContents >>= putStrLn.solve.parseInput.tail.lines
  where
    buildingSep = replicate 20 '#'
    floorSep = "\n"
    space = ' '
    parseInput = map (map read . words)
    solve input = intercalate floorSep . intersperse buildingSep $ buildings
      where
        buildings = [intercalate floorSep $ floors b | b <- [1..4]]
        floors b = [space:(unwords $ rooms b f) | f <- [1..3]]
        rooms b f = [show $ numPersons b f r input | r <- [1..10]]
        numPersons b f r input = numPersons' b f r 0 input
        numPersons' _ _ _ acc [] = acc
        numPersons' b f r acc ([xb, xf, xr, xv]:xs)
          | b == xb && f == xf && r == xr = numPersons' b f r (acc + xv) xs
          | otherwise = numPersons' b f r acc xs




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

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

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

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const double PI = acos(-1.0);
const double EPS = 1e-10;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    cout<<3*n*n<<endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace ITP1_9_A
{
    class Program
    {
        static void Main(string[] args)
        {
            string W = Console.ReadLine().ToUpper();
            int count = 0;
            while (true)
            {
                string input = Console.ReadLine();
                if (input == "END_OF_TEXT")
                    break;
                string[] T = input.ToUpper().Split(' ');
                count += T.Count(t => t == W);
            }
            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 9404
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 2e5 + 5;
const ll LINF = 1e18 + 5;
int n;
ll a[N], sum[N]; 
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> n;
 	for(int i=1;i<=n;i++)
 	{
 		cin >> a[i];
 		sum[i] = sum[i-1] + a[i];
 	}
 	ll ans = LINF;
 	for(int i=1;i<n;i++)
 	{
 		ll pre = sum[i];
 		ll suf = sum[n] - sum[i];
 		ans = min(ans,llabs(pre-suf));
 	}
 	cout << ans;
	return 0;
}


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

int main(void){
    int N;
    cin >> N;
  	int height[100010];
  	int count = 0;
  	int ans = 0;
  	for(int i=0;i<N;i++){
      	cin >> height[i];
      	if(i!=0){
      		if(height[i]<=height[i-1]){
            	count++;
            }else{
              	if(count > ans)ans = count;
              	count = 0;
            }
        }
    }
  	if(count > ans)ans = count;
  	cout << ans <<"\n";
    return 0;
}

Measured memory_bytes: 640
def solve():
    from collections import deque
    K = int(input())
    q = deque([])
    cnt = 1
    while cnt <= K:
        if cnt < 10:
            q.append(cnt)
            cnt += 1
        else:
            base = q.popleft()
            last_digit = base % 10
            for diff in [-1, 0, 1]:
                if cnt > K:
                    continue
                new_last_digit = last_digit + diff
                if 0 <= new_last_digit <= 9:
                    new_lunlun = base*10 + new_last_digit
                    q.append(new_lunlun)
                    cnt += 1
    print(q[-1])

if __name__ == "__main__":
    solve()

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

using namespace std;


int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    vector <int> a(n);
    for (int i=0;i<n;i++)
        cin >> a[i];

    vector <int> b=a;
    sort(b.begin(),b.end());

    int kol=0;
    for (int i=0;i<n;i++)
    {
        if (b[i]!=a[i])
            kol++;
    }

    if (kol<=2)
        cout << "YES";
        else
            cout << "NO";
}


Measured memory_bytes: 256
#include <iostream>

int main() {
  int N;
  std::cin >> N;

  int M=0;
  {
    int sum=0;
    for (int i=1; sum<N; i++) {
      M=i;
      sum+=i;
    }
  }

  for (int i=M; N>0; i--) {
    if (i<=N) {
      std::cout << i << '\n';
      N -= i;
    }
  }

  return 0;
}


Measured memory_bytes: 256
/*
...........__________    							 |										    ___  __
.............|       |     						     |											 |   /
.............|       |     						     |									  		 |  /
.............|       |                               |                         __                | /      _______
.............|_______|  _______            _______   |______   ________   /|  /  |               |/       |      |
.............| \               | |      | |          |      |          | / | /   |               |\       |
.............|  \       _______| |      | |_______   |      |   _______|   |/    |               | \      |
.............|   \      |      | |      |         |  |      |  |       |   |     |               |  \     |
.........  __|    \__|  |______| |______| ________|  |      |_ |_______|   |     |__|           _|   \__ _|        .

*/
#include<bits/stdc++.h>
using namespace std ;
#define int 				long long
#define ull 				unsigned long long int
#define ld 					long double
#define vi 					vector<int>
#define vii 				vector<pair<int,int>>
#define vvi 				vector<vector<int>>
#define pf 					push_front
#define popb 				pop_back
#define pb 					push_back
#define eb 					emplace_back
#define pii 				pair<int,int>
#define prec(x) 			fixed<<setprecision(15)<<x
#define all(x) 				x.begin(),x.end()
#define rall(x) 			x.rbegin(),x.rend()
#define mset(a,b) 			memset(a,b,sizeof(a))
#define mcpy(a,b) 			memcpy(a,b,sizeof(a))
#define fo0(i,n) 			for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n) 			for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b) 			for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)			for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)			for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define inf 1e18
const int mod=1e9+7;
const int N=4e5+10;

void raushan_kumar(){
	int n;cin>>n;
	vector<string> v(n);
	map<string,int> m;
	fo0(i,n){
		cin>>v[i];
		m[v[i]]++;
	}
	int ans=-1;
	set<string> s;
	for(auto i: m){
		if(i.second>ans){
			ans=i.second;
		}
	}
	for(auto i: m){
		if(i.second==ans){
			s.insert(i.first);
		}
	}
	for(auto i: s){
		cout<<i<<endl;
	}
}

int32_t main()
{
	
	fast;int t=1;
	//cin>>t;
	while(t--){
		raushan_kumar();
	}

}	

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;


string solve() {
    int h1, s1, h2, s2; cin >> h1 >> s1 >> h2 >> s2;
    int player = 0;
    while (true) {
        if (player == 0) h2 -= s1;
        else h1 -= s2;

        if (h1 <= 0 || h2 <= 0) break;
        
        player ^= 1;
    }
    
    return (h2 <= 0) ? "Yes" : "No";
}

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

	cout << solve() << endl;
}


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


int main() {
    int n; cin >> n;
    vector<int> lines(n);
    for(int i = 0; i < n; i++){
        cin >> lines[i];
    }
    int sum = 0;
    sort(lines.begin(), lines.end());
    reverse(lines.begin(), lines.end());
    for(int i = 1; i < n; i++){
        sum += lines[i];
    }
    if(lines[0] < sum) cout << "Yes";
    else cout << "No";
}


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

int gcd(int m,int n){
	if(n==0)
		return m;
		
	return gcd(n,m%n);
}

int main(){
	while(true){
		int a,b;
		cin>>a>>b;
		
		if(cin.eof())
			break;
			
		int g=gcd(a,b);
		cout<<g<<' '<<a/g*b<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 3052
fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let s: String = std::io::Read::bytes(stdin.lock())
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    s.parse().ok().expect("error")
}

fn main() {
    let a: u32 = input();
    let b: u32 = input();
    println!("{}", (a - 1) * (b - 1));
}

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

int main() 
{ 
    double n,d;
    ll c=0;
    cin>>n>>d;
    while(n--){
        double x,y;
        cin>>x>>y;
        if(sqrt((x*x)+(y*y))<=d)c++;
    }
    cout<<c;
	return 0; 
} 


Measured memory_bytes: 3840
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cassert>
using namespace std;
typedef long long ll;

#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define FOREQ(i, k, n) for (int i = (k); i <= (int)(n); ++i)
#define DEC(i, k) for (int i = (k); i >= 0; --i)
#define FORIT(i, c) for (__tyoeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define SZ(v) (int)((v).size())
#define MEMSET(v, h) memset((v), (h), sizeof(v))
#define FIND(m, w) ((m).find(w) != (m).end())
#define ALL(c) (c).begin(), (c).end()

struct FenwickTree {
    int tree[100100];
    void change(int index, int value) {
        for (index++; index < 100010; index += index & -index) {
            tree[index] += value;
        }
    }
    int sum(int index) {
        int ret = 0;
        for (index++; index > 0; index -= index & -index) {
            ret += tree[index];
        }
        return ret;
    }
};

FenwickTree ftree;

int main()
{
    memset(&ftree, 0, sizeof(ftree));
    ftree.change(0, 1);
    int n;
    scanf("%d", &n);
    REP(i, n) {
        int a, b;
        scanf("%d %d", &a, &b);
        ftree.change(a, 1);
        ftree.change(b + 1, -1);
    }
    int ans = 0;
    FOREQ(i, 1, n + 1) {
        if (ftree.sum(i) >= i) {
            ans = i - 1;
        }
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  
  int ans = 0;
  vector<int> B(N-1);
  for(int i = 0; i< N-1;i++){
    cin >> B.at(i);
    
    if(i > 0){
      ans += min(B.at(i) ,B.at(i-1));
    }
    else{
      ans += B.at(i);
    }
  }
  
  cout << ans + B.at(N-2);
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set

using namespace std;

const ll MOD = 1000000007;

int main() {
  ll n;
  scanf("%lld", &n);

  if (n % 2 == 0) {
    cout << (n / 2) << endl;
  } else {
    cout << (n / 2 + 1) << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int H, W;
    int field[101][101];
    char str[101];
    int out;
    int i, j;
    
    scanf("%d%d", &H, &W);
    for (i = 1; i <= H; i++){
        scanf("%s", str);
        for (j = 1; j <= W; j++){
            if (str[j - 1] == '.'){
                field[i][j] = 0;
            }
            else {
                field[i][j] = 1;
            }
        }
    }
    
    for (i = 1; i <= H; i++){
        out = -1;
        for (j = 1; j <= W; j++){
            if (field[i][j] == 0){
                if (out >= 0){
                    out++;
                }
            }
            
            if (field[i][j] == 1){
                out = 0;
            }
            if (j != 1){
                printf(" ");
            }
            printf("%d", out);
        }
        printf("\n");
    }
    return (0);
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
int fg(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}
signed main(){
 int N;
  cin>>N;
  vector <string> v(N);
  map<string,int> a;
  int q=0;
  rep(i,N){
   cin>>v[i] ;
    if(a.count(v[i])){
      continue;
    }
    else{
      a[v[i]]=1;
      q++;
    }
  }
  cout<<q;
}


Measured memory_bytes: 25096
using System;

class Program
{
  static void Main(string[] args)
  {
    string[] sum = Console.ReadLine().Split(' ');
    string[] nums = Console.ReadLine().Split(' ');
    int Sh = int.Parse(sum[0]);
    int Sw = int.Parse(sum[1]);
    int Nh = int.Parse(nums[0]);
    int Nw = int.Parse(nums[1]);
    
    int maxtile = Sh * Sw;
    int selecttile = Nh * Sw + Nw * Sh - Nh * Nw;
    Console.Write(maxtile - selecttile);
  }
}

Measured memory_bytes: 13140