akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC085A
{
    class Program
    {
        static void Main(string[] args)
        {
            string s;

            s = Console.ReadLine();

            char[] cs = s.ToCharArray();

            cs[3] = '8';

            Console.WriteLine(cs);

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	if(n%2!=0){
		cout << 0;
		return 0;
	}
	ll ans=0;
	ll sum=10;
	while(sum<=n){
		ans+=n/sum;
		sum*=5;
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  ll a, b, k;
  cin >> a >> b >> k;

  ll c = min(a, k);
  a -= c;
  k -= c;
  b -= min(b, k);

  cout << a << " " << b << endl;


  
  return 0;
}

Measured memory_bytes: 256
my @r = ();
my $N = glob<>;
my @H = glob<>;
for($i=0;$i<$N;$i++){
    if($i==0){
        push(@r,0);
    }elsif($i==1){
        push(@r, abs($H[1] - $H[0]));
    }else{
        $a = abs($H[$i] - $H[$i-1]) + $r[$i-1];
        $b = abs($H[$i] - $H[$i-2]) + $r[$i-2];
        $res = $a > $b ? $b : $a;
        push(@r, $res);
    }
}
print @r[$N-1];

Measured memory_bytes: 26496
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (long long i = 0; i < n; i++)
#define RREP(i, n) for (long long i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (long long i = start; i < end; i++)
#define RFOR(i, start, end) for (long long i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}

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

    int N;
    cin >> N;
    vector<int> a(N);
    bool f = false;
    for (auto &&i : a) {
        cin >> i;
        if (i % 2 == 1)
            f = true;
    }
    auto yes = []() {
        print("first");
        exit(0);
    };
    auto no = []() {
        print("second");
        exit(0);
    };

    if (f)
        yes();
    else
        no();

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <iomanip>
#include <cmath>
#include <functional>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 1e9 + 7;

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int A,B;cin >> A >> B;
    if(A>8 || B>8) cout << ":(" << endl;
    else cout << "Yay!" << endl;
    return 0;
}

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


int main() {
  
  int H,W;
  cin  >> H >> W;
  
  string S;
  
  for(int j; j<W+2; j++)
    cout << "#";
  cout << endl;
  
  for(int i; i<H; i++){
    cin >> S;
    cout << "#"<< S <<"#" << endl;
  }
  
  for(int j; j<W+2; j++)
    cout << "#";
  cout << endl;
  
}

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

int main(){
  int n,l,ans,p;
  ans = 0;
  p = 0;
  cin >> n >> l;
  for(int i=0;i<n;i++){
    p += l+i;}
    
    
  if(l>0){ans  = p-l;}
  else if(l+n-1<0){ans = p-l-n+1;}
  else if(l<=0 && l+n-1>=0){ans = p;}
  cout << ans << endl;
  return 0;
}
  
    
    
  


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>

using namespace std;

#define LL long long

int n,a,b;

int main() {
    scanf("%d",&n);
    for(int i = 1 ; i <= sqrt(n) ; i++) {
        a = i, b = n / i;
        if(a * b == n && a > 0 && a <= 9 && b > 0 && b <= 9) {
            puts("Yes");
            return 0;
        }
    }
    puts("No");
    //system("pause");
    return 0;
}

Measured memory_bytes: 256
if __name__ == '__main__':
	sx, sy, tx, ty = map(int, input().split())
	h = ty - sy
	w = tx - sx

	ans = ''

	for i in range(0,2):
		if i == 0:
			ans += 'LU'
		for j in range(0,h):
			ans += 'U'
		for j in range(0,w):
			ans += 'R'
		if i == 0:
			ans += 'RD'

		if i == 0:
			ans += 'RD'
		for j in range(0,h):
			ans += 'D'
		for j in range(0,w):
			ans += 'L'
		if i == 0:
			ans += 'LU'

	print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int N;
	cin>>N;
	string S;
	cin>>S;
	if(N%2!=0){
		cout<<"No";
		return 0;
	}else{
		int G=N/2-1;
		int H=G+1;
		string I,J;
		I=S.substr(0,H);
		J=S.substr(H,H);
		if(I==J)
		cout<<"Yes";
		else
		cout<<"No";
	}
	return 0;
}     	

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String N=sc.next();
        int A=Integer.parseInt(N);
        int leng=N.length();
        int ans=0;
        for(int i=0;leng>i;i++){
            char s=N.charAt(i);
            ans+=Integer.parseInt(""+s);
        }
        if(A%ans==0){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23764
/***********************************************
 *                   _ooOoo_                   *
 *                  o8888888o                  *
 *                  88" . "88                  *
 *                  (| -_- |)                  *
 *                  O\  =  /O                  *
 *               ____/`---'\____               *
 *             .'  \\|     |//  `.             *
 *            /  \\|||  :  |||//  \            *
 *           /  _||||| -:- |||||-  \           *
 *           |   | \\\  -   * |    |           *
 *           | \_|  ''\---/''  |   |           *
 *           \  .-\__  `-`  ___/-. /           *
 *         ___`. .'  /--.--\  `. . __          *
 *      ."" '<  `.___\_<|>_/___.'  >'"".       *
 *     | | :  `- \`.;`\ _ /`;.`/ - ` : | |     *
 *     \  \ `-.   \_ __\ /__ _/   .-` /  /     *
 *======`-.____`-.___\_____/___.-`____.-'======*
 *                   `=---='                   *
 *^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

             佛祖保佑       永无BUG

   本程序已经经过开光处理，绝无可能再产生bug
 **********************************************/
#include<algorithm>
#include <iostream>
#include  <cstdlib>
#include  <cstring>
#include   <string>
#include   <vector>
#include   <cstdio>
#include    <queue>
#include    <stack>
#include    <ctime>
#include    <cmath>
#include      <map>
#include      <set>
#define ll long long
#define INF 0x3f3f3f3f
#define db1(x) cout<<#x<<"="<<(x)<<endl
#define db2(x,y) cout<<#x<<"="<<(x)<<", "<<#y<<"="<<(y)<<endl
#define db3(x,y,z) cout<<#x<<"="<<(x)<<", "<<#y<<"="<<(y)<<", "<<#z<<"="<<(z)<<endl
using namespace std;

long long num[200010],cnt[200020];

int main(void)
{
    #ifdef test
    freopen("in.txt","r",stdin);
    //freopen("in.txt","w",stdout);
    clock_t start=clock();
    #endif //test

    int n;scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&cnt[i]);
        num[cnt[i]]++;
    }
    long long sum=0;
    for(int i=1;i<=n;i++)
        sum+=num[i]*(num[i]-1)/2;
//    db1(sum);
    for(int i=1;i<=n;i++)
    {
//        db3(cnt[i],sum,num[cnt[i]]);
        printf("%lld\n",sum-num[cnt[i]]+1);
    }

    #ifdef test
    clockid_t end=clock();
    double endtime=(double)(end-start)/CLOCKS_PER_SEC;
    printf("\n\n\n\n\n");
    cout<<"Total time:"<<endtime<<"s"<<endl;        //s为单位
    cout<<"Total time:"<<endtime*1000<<"ms"<<endl;    //ms为单位
    #endif //test
    return 0;
}


// ━━━━━━神兽出没━━━━━━
//      ┏┓       ┏┓
//     ┏┛┻━━━━━━━┛┻┓
//     ┃           ┃
//     ┃     ━     ┃
//     ????━????   ┃
//     ┃           ┃
//     ┃    ┻      ┃
//     ┃           ┃
//     ┗━┓       ┏━┛
//       ┃       ┃
//       ┃       ┃
//       ┃       ┗━━━┓
//       ┃           ┣┓
//       ┃           ┏┛
//       ┗┓┓┏━━━━━┳┓┏┛
//        ┃┫┫     ┃┫┫
//        ┗┻┛     ┗┻┛
//
// ━━━━━━感觉萌萌哒━━━━━━


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

using namespace std;

#define mem(a,b) memset(a,b,sizeof(a))
#define FOR(i,j,k) for(int i=j;i<=k;i++)
#define REV(i,j,k) for(int i=j;i>=k;i--)
#define inf         freopen("in.txt", "r", stdin)
#define outf        freopen("out.txt", "w", stdout)
#define pf          printf
#define sf(n)       scanf("%d", &n)
#define sff(a,b)    scanf("%d %d", &a, &b)
#define sfff(a,b,c)    scanf("%d %d %d", &a, &b, &c)
#define minn          (long long)-1000000000000000000
#define maxx          (long long) 1000000000000000000
#define mod          1000000007
#define LL           long long
#define NL '\n'
#define MAX 100005
#define cnd tree[idx]
#define lnd (2*idx)
#define rnd ((2*idx)+1)
#define PB push_back
#define F first
#define S second
#define MK make_pair
typedef pair<int,int> pr;

int n;
struct Matrix
{
    LL mat[52][52];
};

Matrix mat_mul(const Matrix &a,const Matrix &b)
{
    Matrix c;
    FOR(i,1,n)
    FOR(j,1,n)
    {
        LL x=0, y, z;
        FOR(k,1,n)
        {
            x += (a.mat[i][k]*b.mat[k][j]);
            if(x>mod) x%=mod;
        }
        c.mat[i][j]=x;
    }
    return c;
}

Matrix bm(Matrix ba,LL p)
{
    if(p==1||p==0) return ba;
    Matrix ret=bm(ba, p/2);
    ret=mat_mul(ret,ret);
    if(p%2) ret=mat_mul(ret,ba);
    return ret;
}

int main()
{
    ios::sync_with_stdio(false);
    //inf;
    //outf;
    Matrix go;
    LL k, prin = 0;

    cin >> n >> k;
    FOR(i,1,n)
    FOR(j,1,n) cin >> go.mat[i][j];

    go = bm(go, k);
    FOR(i,1,n)
        FOR(j,1,n)
            prin += go.mat[i][j], prin %= mod;

    cout << prin << endl;

    return 0;
}



Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct Item {
  int v, w;
  ll d;
  string t, s;
  Item(){}
  Item(int v0, int w0, string t0, ll d0, string s0)
  : v(v0), w(w0), t(t0), d(d0), s(s0){}
  bool operator < (const Item other) const{
      if(v != other.v)    return v < other.v;
      if(w != other.w)    return w < other.w;
      if(t != other.t)    return t < other.t;
      if(d != other.d)    return d < other.d;
      return s < other.s;
  }
};
int main(){
  int n, v, w;
  ll d;
  string t, s;

  cin >> n;
  vector<Item> items(n);
  for(int i = 0; i < n; i++){
    cin >> v >> w >> t >> d >> s;
    items[i] = Item(v, w, t, d, s);
  }
  sort(items.begin(), items.end());
  int cnt = 0;
  for(Item x : items){
    printf("%d %d %s %lld %s\n", x.v, x.w, x.t.c_str(), x.d, x.s.c_str());
  }
  return 0;
}


Measured memory_bytes: 16940
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
using namespace std;
typedef long long ll;
#define rep(i,a,n)	for(int i=a;i<n;i++)
#define rrep(i,a,n) for(int i=(a-1);i>=n;i--)
 
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
ll lcm(ll a,ll b){
	ll g=gcd(a,b);
	return a/g*b;
}
 
ll digitsum(ll a){
	ll x=0;
	while(a>0){
		x+=a%10;
		a/=10;
	}
	return x;
}
int main(){
	ll a,b;
	cin>>a>>b;
	cout<<(b*2)-a<<endl;
}

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) {
  int64 n, x;
  while (cin >> n >> x &&n + x) {
    int64 res = 0;
    FOR(i, 1, n + 1) {
      FOR(j, i + 1, n + 1) {
        if (x - i - j > j && x - i - j <= n) res++;
      }
    }
    cout << res << endl;
  }
}


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

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

    long long n;
    cin >> n;
    map<long long, int> powers;
    int ans = 0;

    for (long long i = 2; i * i <= n; i++)
        while (n % i == 0)
            n /= i, powers[i]++;
    if (n > 1)
        powers[n]++;

    for (auto x : powers) {
        int power = x.second;
        for (int i = 1; power - i >= 0; i++)
            power -= i, ans++;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3660
#define _GLIBCXX_DEBUG //配列の略記用
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)

int main(){
    int H, W;
    cin >> H >> W;
    
    const int INF = 1e8;
    vector<vector<int>> cost(10, vector<int>(10, INF));
    rep(i, 10){
        rep(j, 10){
            cin >> cost[i][j];
        }
    }

    rep(k, 10){
        rep(i, 10){
            rep(j, 10){
                cost[i][j] = min(cost[i][j], cost[i][k]+cost[k][j]);
            }
        }
    }

    int ans = 0;

    rep(i, H){
        rep(j, W){
            int wall;
            cin >> wall;
            if (wall == -1 || wall == 1){
                continue;
            }else{
                ans += cost[wall][1];
            }
        }
    }

    cout << ans;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int values[] = {A,B,C};
		Arrays.sort(values);
		int answer = values[2]*10 + values[1] +values[0];
 		System.out.println(answer);
	}
}

Measured memory_bytes: 22484
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,p=62,q=-1;scanf("%lld%lld",&a,&b);
	for (int i=62;i>=0;i--)
	{
		if (a>=(1ll<<i)) {a-=(1ll<<i);b-=(1ll<<i);}else if (b>=(1ll<<i)) break;
	}
	while ((b<(1ll<<p))&&(p>=0)) p--;
	if (b==0) {printf("1\n");return 0;}
	for (int i=p-1;i>=0;i--) if (b&(1ll<<i)) {q=i;break;}q++;
	if (a==0) {printf("%lld\n",1ll<<(p+1));return 0;}
	if ((1ll<<q)-1<a) printf("%lld\n",2*((1ll<<p)-a)+(1ll<<q));
	else printf("%lld\n",((1ll<<p)-a)+(1ll<<p));
}

Measured memory_bytes: 384
a,b,h,m = map(int,input().split())

from math import sqrt,cos,sin,pi
# input p [x1,y1]
# input q [x2,y2]
# sqrt((x1-x2)**2+(y1-y2)**2)
def dist(p,q):
  x1,y1 = p
  x2,y2 = q
  return sqrt((x1-x2)**2+(y1-y2)**2)
  
a_theta = (h*60+m)/720*2*pi
a_edge = [a*cos(a_theta),a*sin(a_theta)]

b_theta = (m)/60*2*pi
b_edge = [b*cos(b_theta),b*sin(b_theta)]

print(dist(a_edge,b_edge))

Measured memory_bytes: 9592
#include<iostream>
using namespace std;
int gcd(int a,int b){
    if(b==0)
        return a;
    return gcd(b,a%b);
}
int main(){
    int n,a[100010],d1[100010],d2[100010];
    int i,j,x,y,f=1;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> a[i];
    }
    d1[0]=a[0];
    j=n-1;
    d2[j]=a[n-1];
    for(i=1;i<n;i++){
        if(d1[i-1]>a[i])
            d1[i]=gcd(d1[i-1],a[i]);
        else
            d1[i]=gcd(a[i],d1[i-1]);
        j--;
        if(d2[j+1]>a[j])
            d2[j]=gcd(d2[j+1],a[j]);
        else
            d2[j]=gcd(a[j],d2[j+1]);
    }
    x=y=d2[1];
    for(i=0;i<n-2;i++){
        x=gcd(d1[i],d2[i+2]);
        if(x>y)
            y=x;
    }
    if(d1[n-2]>y)
        y=d1[n-2];
    cout << y << endl;
    return 0;
}



Measured memory_bytes: 1408
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

struct Bipartite_Matching {
  vector< vector< int > > G;
  vector< int > match, alive, used;
  int timestamp;

  Bipartite_Matching(int n) {
    timestamp = 0;
    G.resize(n);
    alive.assign(n, 1);
    used.assign(n, 0);
    match.assign(n, -1);
  }

  void add_edge(int u, int v) {
    G[u].push_back(v);
    G[v].push_back(u);
  }

  bool dfs(int v) {
    used[v] = timestamp;
    for (int u : G[v]) {
      int w = match[u];
      if(alive[u] == 0) continue;
      if(w == -1 || (used[w] != timestamp && dfs(w))) {
        match[v] = u;
        match[u] = v;
        return true;
      }
    }
    return false;
  }

  int bipartite_matching() {
    int ret = 0;
    rep(i, G.size()) {
      if(alive[i] == 0) continue;
      if(match[i] == -1) {
        ++timestamp;
        ret += dfs(i);
      }
    }
    return ret;
  }
};

struct Lexicographically_Matching : Bipartite_Matching {
  Lexicographically_Matching(int n) : Bipartite_Matching(n) {}

  int back(int k) {
    match[match[k]] = -1;
    match[k] = -1;
    ++timestamp;
    dfs(k);
    return match[k];
  }

  void decide(int k) {
    alive[match[k]] = 0;
    alive[k] = 0;
  }
};


int N;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  Lexicographically_Matching bip((N-1)*2);
  rep(i, N-1) {
    rep(j, N-1) {
      int x;
      cin >> x;
      if (x) bip.add_edge(i, j+N-1);
    }
  }
  if (bip.bipartite_matching() < N-1) {
    cout << "no\n";
    return 0;
  }
  cout << "yes\n";
  rep(i, N-1) {
    bip.decide(bip.back(i+N-1));
    cout << bip.match[i+N-1]+1 << "\n";
  }
  return 0;
}

Measured memory_bytes: 3268
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <sstream>
#include <iomanip>

using namespace std;


int main(void)
{
	int a[100], g = 0,co = 0;

	while (cin >> g)
	{
		if (g != 0)
		{
			co++;
			a[co] = g;
		}
		else
		{
			cout << a[co] << endl;
			a[co] = 0;
			co--;
		}
	}
	return 0;
}




Measured memory_bytes: 3036
import java.util.Scanner;

//第一回日本最強プログラマー学生選手権-予選-
//A	Takahashi Calendar
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int M = Integer.parseInt(sc.next());
		int D = Integer.parseInt(sc.next());
		sc.close();

		long ans = 0;
		for (int d = 22; d <= D; d++) {
			int d2 = (d % 10);
			int d1 = (d - d2) / 10;
			int dxd = 0;
			if (d1 >= 2 && d2 >= 2) {
				dxd = d1 * d2;
			}
			if (dxd > 0 && dxd <= M) {
				ans++;
			}
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;cin>>a>>b;
  int c;
  if(b<10)c=10*a+b;
  if(b>=10&&b<100)c=100*a+b;
  if(b>=100)c=1000*a+b;
  for(int i=0;i*i<=c;i++){
    if(i*i==c){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 256
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
size_t strlen(const char* s);
#define rep(i,n) for(long long int i=0;i<n;i++)
#define sz(x) ((int)(x).size())

using namespace std;
struct ToUpper {
	char operator()(char c) { return toupper(c); }
};
struct ToLower {
	char operator()(char c) { return tolower(c); }
};
const int N = 200010;
const int P = 1000000007;
using ll = long long;

//絶対値
int ze(int a, int b) {
	if (a > b) {
		return a - b;
	}
	else {
		return b - a;
	}
}
//小さい方
long long int min(long long int a, long long int b) {
	if (a > b) {
		return b;
	}
	else {
		return a;
	}
}
//大きい方
long long int max(long long int a, long long int b) {
	if (a > b) {
		return a;
	}
	else {
		return b;
	}
}
// a^n mod 
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// a^{-1} mod 
long long modinv(long long a, long long mod) {
	return modpow(a, mod - 2, mod);
}

//mod掛け算
long long mt(long long a, long long b, long long mod) {
	return (a * b) % mod;
}

//メモ

/*
	memset(b, '\0', sizeof(b));
初期化*/

/*
	char s[N];
	strlen(s)
*/

/*
	if(  <  )puts("Yes");
	else puts("No");
*/

/*文字列比較
if(strcmp(name[i],s)==0)
*/

/*
	graph[a].push_back(b);//graph[a][i番目に入れた]==b
	graph[j].size()	//forで回すときとか

*/

/*添字1がa個、2がb個
  vector<vector<ll>> map(a,vector<ll>(b));
*/

int main() {
  string s;
  cin>>s;
  if(s=="RRR"){
    cout<<3<<endl;
  }else if(s=="RRS"||s=="SRR"){
    cout<<2<<endl;
  }else if(s=="SSS"){
    cout<<0<<endl;
  }else{
    cout<<1<<endl;
  }
}

Measured memory_bytes: 3652
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

N,K = II()
h = III()

ans = 0
for i in range(N):
    if h[i]>=K:
        ans += 1
    
print(ans)

Measured memory_bytes: 51440
#include<bits/stdc++.h>
#include<math.h>
#include<vector>
using namespace std;
int mincost[10][10];
int main(void){
	int i,j,N,sumtime,now;
	cin >> N;
	int C[N-1];
	int F[N-1];
	int S[N-1];
	int result[N-1];
	for(i=0;i<N-1;i++){
		cin >> C[i] >> S[i] >> F[i];
	}
	for(i=0;i<N-1;i++){
		sumtime = 0;
		now = i; 
		while(now<N-1){
			sumtime += (F[now] - (sumtime % F[now]))%F[now];
			if(sumtime<S[now]){
				sumtime = S[now];
			}
			sumtime +=C[now];
			now += 1;
		}
		cout << sumtime << endl;
	}
	cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long int  modu=1e9+7;
#define endl '\n'
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define inp(x)  for(auto &t:x) cin>>t;
#define itr     vector<int>::iterator
#define debug(a) cout << #a << "=" << a << ' '<<endl;
#define out(x)  for(auto &t:x) cout<<t<<" "; cout<<endl;
#define ff first
#define ss second
#define pb push_back
#define initialize(a,v)  for(int i=0;i<a.size();++i) a[i]=v;
#define all(x) x.begin(),x.end()
#define mpt(mp) for(auto it=mp.begin();it!=mp.end();it++)
#define trav(x) for(int i=0;i<(int)x.size();++i)
#define mkp(a,b) make_pair(a,b)
#define sz(x)  (int)x.size()

int noofdig(int N)
{
	return floor(log10(N))+1;
}
int bits_count(unsigned int u)
{
     unsigned int uCount;

     uCount = u - ((u >> 1) & 033333333333) - ((u >> 2) & 011111111111);
     return ((uCount + (uCount >> 3)) & 030707070707) % 63;
}
bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 

ll f(ll a)
{

return 0;

}



void pre()
{

}



void solve()
{
	int n;
	cin>>n;
	vl a(n),b(n);
	inp(a)
	inp(b)
	reverse(all(b));
	int l=0,r=n-1;
	
	for(int i=0;i<n;++i)
	{
		if(a[i]==b[i])
		{
			if(a[l]!=b[i] and b[l]!=a[i])
			{
				swap(b[i],b[l]);
				++l;
			}
			else
			if(a[r]!=b[i] and b[r]!=a[i])
			{
				swap(b[i],b[r]);
				--r;
			}
			else
			{
				cout<<"No"<<endl;
				return;
			}
		}
	}
	
	cout<<"Yes"<<endl;
	out(b)






}



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

	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}


Measured memory_bytes: 6384
#include <bits/stdc++.h>
const int MAX = 500000;
const int S = 2000000000;
using namespace std;
int L[MAX/2 + 2],R[MAX/2 + 2];
int cnt;
void merge(int A[],int n,int left,int mid,int right)
{
	int n1 = mid - left;
	int n2 = right - mid;
	for(int i = 0;i < n1;i++)	L[i] = A[left + i];
	for(int i = 0;i < n2;i++)   R[i] = A[mid + i];
	L[n1] = R[n2] = S;
	int i = 0,j = 0;
	for(int k = left;k < right;k++)
	{
		cnt++;
		if(L[i] <= R[j])
		{
			A[k] = L[i++];
		}
		else
		{
			A[k] = R[j++];
		}
	}
}
void mergesort(int A[],int n,int left,int right)
{
	if(left + 1 < right)
	{
		int mid = (left + right) / 2;
		mergesort(A,n,left,mid);
		mergesort(A,n,mid,right);
		merge(A,n,left,mid,right);
	}
}
int main(int argc, char const *argv[])
{
	int A[MAX],n,i;
	cnt = 0;
	cin>>n;
	for(int i = 0;i < n;i++)
	{
		cin>>A[i];
	}
	mergesort(A,n,0,n);
	for(i = 0;i < n;i++)
	{
		if(i) cout<<" ";
		cout<<A[i];
	}
	cout<<endl;
	cout<<cnt<<endl;
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string a[7] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
  string s;
  cin >> s;
  rep(i, 7) {
    if (s == a[i]) {
      cout << 7 - i;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main(){
    long n;
    cin >> n;
    vector<long long> a(n);
    for(long i =0;i<n;i++){
        long long num;
        cin >> num;
        a[i] = num-i-1;
        // cerr << a[i]<<endl;
    }
    long long ans;
    stable_sort(a.begin(),a.end());
    long long ave=a[floor(n/2)];
    // cerr << ave<<endl;
 
    for(long i =0;i<n;i++){
        cerr << a[i] << " ";
    }
    cerr << endl;
    long long sum = 0;
    for(long i =0;i<n;i++){
        sum += abs(a[i] - ave);
        // cerr << abs(a[i]-ave)<<endl;
        // cerr << sum<<endl;
    }
    ans = sum;
    cout <<sum <<endl;
}

Measured memory_bytes: 2560
#include<iostream>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm> 
using namespace std;
 
const int limit = 200000;

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;

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

    vector<long long int> v(n);
    vector<long long int> l(n);
    vector<long long int> r(n);

    long long int sum=0;
    for(int i=0;i<n;i++){
        long long int a;cin >> a ;
        v[i]=a;
        sum += a;
        l[i]=sum;
    }

    sum = 0;
    for(int i=n-1;i>=0;i--){
        sum += v[i];
        r[i]=sum;
    }

    long long int gap = abs(l[0]-r[1]);
    for(int i=2;i<n;i++){
        gap=min(gap,abs(l[i-1]-r[i]));
    }
    p(gap)
}

Measured memory_bytes: 4992
import Control.Applicative
import Control.Monad
import Data.Array.IO
import Data.List
import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import Data.Bits
import Data.Ord

listToTuple3 [a,b,c] = (a,b,c)

thrd (_,_,x) = x
tuple3To2 (x,y,_) = (x,y)

unite (x:[]) = [x]
unite ((a,b):xs) = if b==c then (a,d):ys else (a,b):(c,d):ys
  where ((c,d):ys) = unite xs

modifyArray arr i f = readArray arr i >>= \x -> writeArray arr i (f x)

main = do
  (n:c:_) <- map read . words <$> getLine :: IO [Int]

  arr <- newArray (0,200002) 0 :: IO (IOArray Int Int)

  dat <- map (unite . sort . map tuple3To2) . groupBy (\x y -> thrd x == thrd y) . sortBy (comparing thrd) . map (listToTuple3 . map (fst . fromJust . BS.readInt) . BS.words) . BS.lines <$> BS.getContents :: IO [[(Int,Int)]]
    
  forM_ (zip [0..] dat) $ \(i,xs) -> do
    forM_ xs $ \(s,t) -> do
      modifyArray arr (2*s-1) (\x -> x + 1)
      modifyArray arr (2*t) (\x -> x - 1)

  (l,r) <- getBounds arr
  forM_ [l+1..r] $ \i -> do
    readArray arr (i-1) >>= \x -> modifyArray arr i (+x)

  print =<< maximum <$> getElems arr


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

using namespace std;
typedef long long ll;

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

int main() {
    int k;
    cin >> k;
    ll ans = 0;
    for (int a = 1; a <= k; a++) {
        for (int b = 1; b <= k; b++) {
            for (int c = 1; c <= k; c++) {
                ans += gcd(a, gcd(b, c));
            }
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 3636
#include <algorithm>
#include <vector>
#include <iostream>

using namespace std;

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

    vector<long long> a(N);
    long long sum_a = 0;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        sum_a += a[i];
    }

    long long min_diff = 1LL << 62;
    long long sum_sunuke = 0;
    long long sum_raccoon = sum_a;
    for (int i = 0; i + 1 < N; i++) {
        sum_sunuke += a[i];
        sum_raccoon -= a[i];
        min_diff = min(abs(sum_sunuke - sum_raccoon), min_diff);
    }

    cout << min_diff << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define fr(i,a,b) for(int i=a;i<b;i++)
#define frr(i,a,b) for(int i=a;i>=b;i--)
//vector
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define pp pop_back
//pair
#define pi pair<int ,int >
#define mk make_pair
#define ff first
#define ss second
//set
#define si set<int>
#define sit set<int>::iterator 
using namespace std;
int main()
{
fast;
int n;cin>>n;
  if(n>=30) cout<<"Yes\n";
  else cout<<"No"<<endl;
return 0;
}

Measured memory_bytes: 3648
import java.util.*;
//üespectüü³ñÌideaðQlipNjÉµ½
//IOIªÇÌ­ç¢±¢Ä¢éÌ©ðzñansÉÛ¶µ»ÌÈ©Åðð½µÄ¢éàÌð¦ã°½

class Main{

    public static void main(String[] args){
	int n,m,cou=0;
	String s;
       

	Scanner nariyoshitool = new Scanner(System.in);

	while(true){
	n = nariyoshitool.nextInt();
	if(n == 0)break;
	m = nariyoshitool.nextInt();
	if(m == 0){}
	s = nariyoshitool.next();
	char c[] = s.toCharArray();
	int[] ans = new int[m];
	//Arrays.fillÍC++Å¢¤memset
	Arrays.fill(ans,0);

	for(int i=0;i<s.length()-2;i++){
	    if(c[i] == 'I' && c[i+1] == 'O' && c[i+2] == 'I'){
		ans[i+2]=ans[i]+1;//±±dv
	    }
	}
	for(int i=0;i<m;i++){
	    if(ans[i]>=n)cou++;
	}
	System.out.println(cou);
	cou=0;


	}




    }

}

Measured memory_bytes: 22000
#include<iostream>
#include<cstring>
#include<set>
using namespace std;
char s[100010];
set<int> num;
int main()
{
    cin>>s;
    int len = strlen(s);
    int ans = len/2-1;
    int maxn = ans;
    while(ans<=len){
        int flag = 1;
        int now = s[len-ans];
        for(int i=len-ans;i<ans;i++){
            if(s[i]!=now)
                flag = 0;
        }
        if(flag)
            maxn = ans;
        else
            break;
        num.clear();
        ans++;
    }
    cout<<maxn<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <algorithm>
// #include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <bitset>
using namespace std;
typedef long long LL;
typedef double db;
const int oo=2139063143;
const int N=1010000;
const int P=1000000007;
const db eps=1e-7;
#define pritnf printf
//char buf[1<<22],*p1=buf,*p2=buf,obuf[1<<22],*O=obuf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template <typename T>
inline void sc (T &x)
{
    x=0; static int p; p=1; static char c; c=getchar();
    while (!isdigit(c)) { if (c=='-') p=-1; c=getchar(); }
    while ( isdigit(c)) { x=(x<<1)+(x<<3)+(c-48); c=getchar(); }
    x*=p;
}
template <typename T>
inline void print (T x)
{
    if (x< 0) putchar('-'),x=-x;
    if (x>=10) print(x/10);
    putchar(x%10+'0');
}
template <typename T>
inline void pr (T x) { print(x),putchar('\n'); }
template <typename T1,typename T2>
void chkmax (T1 &A,T2 B) { A=A>=B?A:B; }
template <typename T1,typename T2>
void chkmin (T1 &A,T2 B) { A=A<=B?A:B; }
int n,m,a[N],b[N];
struct EDGE { int v,nx; }lb[N]; int tot=1,top[N];
void add (int u,int v) { lb[++tot]=(EDGE){v,top[u]},top[u]=tot; }
LL f[N],s[N];
void dfs (int u)
{
	s[u]=b[u];
	for (int kb=top[u]; kb; kb=lb[kb].nx)
	{
		int v=lb[kb].v;
		dfs (v);
		s[u]+=s[v];
	}
	f[u]=s[u]+a[u];
	for (int kb=top[u]; kb; kb=lb[kb].nx)
	{
		int v=lb[kb].v;
		chkmin (f[u],s[u]-s[v]+max (f[v],(LL)a[u]));
	}
}
#define pb push_back
vector <int> G[N];
int fa[N];
int getf (int x) { return fa[x]==x?x:fa[x]=getf (fa[x]); }
int id[N]; bool vis[N];
int main ()
{
    // freopen (".in","r",stdin);
    // freopen (".out","w",stdout);
	sc(n),sc(m);
	for (int i=1; i<=n; i++)
		sc(a[i]),sc(b[i]),a[i]=max (a[i]-b[i],0);
	for (int i=1; i<=m; i++)
	{
		int x,y; sc(x),sc(y);
		G[x].pb (y),G[y].pb (x);
	}
	for (int i=1; i<=n; i++)
		id[i]=i;
	sort (id+1,id+n+1,[](int A,int B) { return a[A]< a[B]; });
	for (int i=1; i<=n; i++)
		fa[i]=i;
	for (int i=1; i<=n; i++)
	{
		int u=id[i]; vis[u]=1;
		for (int v:G[u]) if (vis[v])
		{
			int f=getf (v);
			if (f!=u) fa[f]=u,add (u,f);
		}
	}
	int rt=getf (1);
	dfs (rt);
	pr(f[rt]);

    return 0;
}


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

prod_max = 10**18
prod = A[0]

if 0 in A:
    print(0)
else:
    for i in range(N-1):
        prod *= A[i+1]
        if prod > prod_max:
            print('-1')
            break
        if i == N - 2:
            print(prod)

Measured memory_bytes: 21692
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)
#define loop(i,N,M) for(int i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

//変数
ll N, K;
vector<ll> vec(4);

//解法
void solve() {
	
	SORTL2S(ll, vec);
	
	if (vec[0] == 2 && vec[1] == 2 && vec[2] == 1 && vec[3] == 1) {
		cout << "YES";
	}
	else {
		cout << "NO";
	}


	return;
}

int main() {

	//入力
	rep(i, 6) { 
		int j;
		cin >> j;
		vec[j-1]++;
	}


	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	public static void main(String tok[])
	{
		int n,a,b,c,d,co;
		Scanner ui = new Scanner (System.in);
	    while(ui.hasNext()){
      n=ui.nextInt();
      co=0;
	        for(a=0;a<=9;a++){
	            for(b=0;b<=9;b++){
	                for(c=0;c<=9;c++){
	                    for(d=0;d<=9;d++){
	                        if(a+b+c+d==n)co++;
	                    }
	                }
	            }
	        }
	   System.out.println(co);
	    }
	    ui.close();
	    
	}
}

Measured memory_bytes: 18928
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp> 
using namespace std;

vector<string> inputVS(void);

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

    int X;
    cin >> X;

    int y500 = X / 500;
    X %= 500;
    int y5 = X / 5;

    cout << (y500 * 1000) + (y5 * 5) << "\n";

    return 0;
}

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

namespace Program
{
    public class ABC075D
    {
        static class Console_
        {
            private static Queue<string> param = new Queue<string>();
            public static int NextInt() => int.Parse(NextString());
            public static long NextLong() => long.Parse(NextString());
            public static string NextString()
            {
                if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item);
                return param.Dequeue();
            }
        }
        static public void Main(string[] args)
        {
            var N = Console_.NextInt();
            var K = Console_.NextInt();


            var xary = new long[N];
            var yary = new long[N];
            var pos = new Tuple<long, long>[N];
            for (int i = 0; i < N; ++i)
            {
                var x = Console_.NextLong();
                var y = Console_.NextLong();
                xary[i] = x;
                yary[i] = y;
                pos[i] = Tuple.Create(x, y);
            }
            Array.Sort(xary);
            Array.Sort(yary);

            var ans = 0L;
            for (int xl = 0; xl <= N - K; ++xl)
            {
                for (int xr = N - 1; xr >= K - 1; --xr)
                {
                    for (int yl = 0; yl <= N - K; ++yl)
                    {
                        for (int yr = N - 1; yr >= K - 1; --yr)
                        {
                            var count = 0;
                            for (int i = 0; i < N; ++i)
                            {
                                if (xary[xl] <= pos[i].Item1 && pos[i].Item1 <= xary[xr] &&
                                    yary[yl] <= pos[i].Item2 && pos[i].Item2 <= yary[yr])
                                {
                                    ++count;
                                }
                            }
                            if (count >= K)
                            {
                                var anstmp = (xary[xr] - xary[xl]) * (yary[yr] - yary[yl]);
                                if (ans == 0 || ans > anstmp) ans = anstmp;
                            }
                        }
                    }
                }
            }

            Console.WriteLine(ans);
        }
    }
}


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

for i in range(n-1,0,-1):

    if h[i-1] - h[i] > 1:
        print('No')
        break

    elif  h[i-1] - h[i] == 1:
        h[i-1] -= 1

else:
    print('Yes')



Measured memory_bytes: 63984
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
vector<int> gr[N], vec;
int n, rn, cmp, a[N], b[N], cnt[N], x;
bool mark[N];
void compress() {
	sort(vec.begin(), vec.end());
	vec.resize(unique(vec.begin(), vec.end()) - vec.begin());
	if (vec.size() > n + 1) {
		cout << -1;
		exit(0);
	}
	for (int i = 0; i < n; i++)
		a[i] = lower_bound(vec.begin(), vec.end(), a[i]) - vec.begin(), b[i] = lower_bound(vec.begin(), vec.end(), b[i]) - vec.begin();
	x = lower_bound(vec.begin(), vec.end(), x) - vec.begin();
	return;
}
void dfs(int v) {
	mark[v] = 1;
	for (auto u : gr[v])
		if (!mark[u])
			dfs(u);
	return;
}	
int main() {
	ios_base::sync_with_stdio (false), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i], x ^= a[i], vec.push_back(a[i]);
	for (int i = 0; i < n; i++)
		cin >> b[i], vec.push_back(b[i]);
	vec.push_back(x);
	compress();
	for (int i = 0; i < n; i++)
		cnt[a[i]]++, cnt[b[i]]--;
	cnt[x]++;
//	cout << "X = " << x << endl;
//	for (int i = 0; i < n; i++) {
//		cout << "I = " << i << " : " << a[i] << ", " << b[i] << endl;
//	}
	for (int i = 0; i <= n; i++) {
		if (cnt[i] < 0) {
			cout << -1;
			return 0;
		}
	}
	for (int i = 0; i < n; i++) {
		if (a[i] != b[i])
			rn++, gr[a[i]].push_back(b[i]), gr[b[i]].push_back(a[i]);
	}
	for (int i = 0; i <= n; i++) {
		if (!mark[i] && (i == x || !gr[i].empty()))
			dfs(i), cmp++;
	}
	cout << rn + cmp - 1;
	return 0;
}

Measured memory_bytes: 13808
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1000000007;
#define Sort(a) sort(a.begin(), a.end())

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  
  int n;
  cin >> n;
  string s;
  vector<vector<int>> a(26, vector<int>(n));
  for (int i = 0; i < n; i++) {
    cin >> s;
    for (int j = 0; j < s.size(); j++) {
      a[s[j]-97][i]++;
    }
  }
  int b[26] = {0};
  for (int i = 0; i < 26; i++) {
    if (n == 1) {
      b[i] = a[i][0];
    }
    else {
      for (int j = 0; j < n-1; j++) {
        if (j == 0) {
          b[i] = min(a[i][j], a[i][j+1]);
        }
        else {
          b[i] = min(b[i], a[i][j+1]);
        }
      }
    }
  }
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < b[i]; j++) {
      cout << char(97 + i);
    }
  }
  cout << '\n';
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	long long  n,i,a[10000],min=1000000,max=-1000000,sum=0;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a[i];
		if(a[i]<min){
			min=a[i];
		}
		if(a[i]>max){
			max=a[i];
		}
		sum+=a[i];
	}
		cout<<min<<" "<<max<<" "<<sum<<endl;
}

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

#define mem(arr, i) fill(arr, arr + sizeof(arr), i)
#define MEM(arr, i) memset(arr, i, sizeof(arr))
#define Push push_back
#define Pair make_pair
#define ALL(x) x.begin(), x.end()
#define X first
#define Y second
#define ACCEL ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef unsigned long long ull;
typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef pair<pll,lli> p3l;
typedef vector<int> vcI;
typedef vector<lli> vcL;
typedef vector<pii> vPI;
typedef vector<pll> vPL;
typedef vector<p3l> v3L;
typedef vector<vcL> vvL;
//typedef priority_queue<T> prior_S<T>;
//typedef priority_queue< T, vector<T>, greater<T> > prior_B<T>;
const double PI = 3.141592653589793;
const lli I_MAX = 1LL << 60;
      lli   mod = 1000000007;

/// templates ///

const lli maxN = 2E5;

vcL inv(maxN+5, 1);
vcL fac(maxN+5, 1);

void ADD(lli &x, lli y) {
	x += y;
	if (x >= mod) x -= mod;
	if (x < 0) x += mod;
}

void MUL(lli &x, lli y) {
	x *= y;
	x = (x % mod + mod) % mod;
}

lli mypow(lli b, lli e) {
	lli ans = 1;
	while (e) {
		if (e & 1) MUL(ans, b);
		MUL(b, b);
		e >>= 1;
	}
	return ans;
}

lli modinv(lli n) {
	return mypow(n, mod - 2);
}

void calcInv(lli n) {
	for (int i = 2; i <= n; ++i) {
		inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	}
}

void calcFac(lli n) {
	for (int i = 2; i <= n; ++i) {
		fac[i] = fac[i - 1] * i % mod;
	}
}

lli cm(lli a, lli b) {
	lli ans = 1;
	if (a < b) return 0;

	MUL(ans, inv[fac[a - b]]);
	MUL(ans, inv[fac[b]]);
	MUL(ans, fac[a]);

	return ans;
}

lli Lucas(lli n, lli m) {
	if (m == 0) return 1;
	return cm(n % mod, m % mod) * Lucas(n / mod, m / mod) % mod;
}

lli doLucas(lli n, lli m) {
	calcInv(mod);
	calcFac(mod);
	return Lucas(n, m);
}

/// coding area ///

const lli maxn = 1E5;

void precal() {

	return;
}

void solve() {
	string s, t;
	cin >> s >> t;
	
	int sz = s.size(), tz = t.size();
	
	lli lcs[sz + 1][tz + 1];
	int mark[sz + 1][tz + 1]; // 1 for pick, 2 for left, 3 for up
	memset(lcs, 0, sizeof(lcs));
	memset(mark, 0, sizeof(mark));
	
	for (int i = 1; i <= sz; ++i) {
		for (int j = 1; j <= tz; ++j) {
			if (s[i - 1] == t[j - 1]) {
				lcs[i][j] = lcs[i - 1][j - 1] + 1;
				mark[i][j] = 1;
			}
			else if (lcs[i][j - 1] > lcs[i - 1][j]) {
				lcs[i][j] = lcs[i][j - 1];
				mark[i][j] = 2;
			}
			else {
				lcs[i][j] = lcs[i - 1][j];
				mark[i][j] = 3;
			}
//			lcs[i][j] = max({lcs[i - 1][j], lcs[i][j - 1], lcs[i - 1][j - 1] + (s[i - 1] == t[j - 1])});
		}
	}
	
	int rS = sz, rT = tz;
	string rev;
	
	while (mark[rS][rT]) {
		if (mark[rS][rT] == 1) {
			--rS;
			--rT;
			rev += s[rS];
		}
		else if (mark[rS][rT] == 2) {
			--rT;
		}
		else if (mark[rS][rT] == 3) {
			--rS;
		}
	}
	
	for (int i = lcs[sz][tz]-1; i >= 0; --i) {
		cout << rev[i];
	}
	cout << '\n';
}

int main() {
	precal();
	int t = 1;
	#ifdef LOCAL
		t = INT_MAX;
	#else
		ACCEL;
	#endif
//	cin >> t;
	for (int i = 1; i <= t; ++i) {
//		printf("Case #%d: ", i );
		solve();
	}
	return 0;
}




Measured memory_bytes: 108928
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long doubl
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif


int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  const int MAX = 1e9;
  int s;
  cin >> s;
  cout << "0 0 " << MAX << " " << (MAX - s % MAX) % MAX << " 1 " << (s + MAX-1) / MAX << "\n";
}


Measured memory_bytes: 256