akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif
 
using namespace std;
 
const int MOD=998244353;
int N, P2[200001], V[200001];
bool chk[200001];
string X;
 
bool check(int SZ)
{
	for(int p=0;p*SZ<N;p++) {
		for(int i=0;i<SZ;i++) {
			if(X[p*SZ+i]<(X[i]-'0'^(p&1))+'0') return false;
			if(X[p*SZ+i]>(X[i]-'0'^(p&1))+'0') return true;
		}
	}
	return true;
}
 
int solve(int SZ)
{
	int ret=0;
	if(check(SZ)) ret=1;
	for(int i=SZ-1;i>=0;i--) if(X[i]=='1') ret=(ret+P2[SZ-1-i])%MOD;
	return ret;
}
 
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt","r",stdin));
	TEST(freopen("output.txt","w",stdout));
	TEST(freopen("debug.txt","w",stderr));
	int ans;
	cin>>N>>X;
	P2[0]=1; ans=2*N;
	for(int i=N-1;i>=0;i--) {
		if(X[i]=='1') ans=(ans+2LL*N*P2[N-1-i])%MOD;
		P2[N-i]=(2*P2[N-1-i])%MOD;
	}
	if(N&1) {
		chk[1]=true;
		V[1]=solve(1);
	}
	for(int i=2;i*i<=N;i++) if(N%i==0) {
		if(N/i&1) {
			chk[i]=true;
			V[i]=solve(i);
		}
		if(i*i!=N && (i&1)) {
			chk[N/i]=true;
			V[N/i]=solve(N/i);
		}
	}
	for(int i=1;i<=N;i++) if(chk[i]) {
		ans=(ans+2LL*(N-i)*(MOD-V[i]))%MOD;
		for(int j=3*i;j<=N;j+=2*i) V[j]=(V[j]+MOD-V[i])%MOD;
	}
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 2196
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <sstream>
#include <iterator>

using namespace std;

#define endl ("\n")
#define pi (3.141592653589)
#define mod 1000000007
#define int int64_t
#define float double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define rrep(i, n) for(int i=n-1;i>=0;i--)
#define rep(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)

struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;

int32_t main() 
{
    fast;
	int D;
	cin >> D;
	if (D==25) cout << "Christmas";
	else if(D==24) cout << "Christmas Eve";
	else if(D==23) cout << "Christmas Eve Eve";
	else cout << "Christmas Eve Eve Eve";
}





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

using namespace std;

#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define sz(a) static_cast<int>((a).size())
#define pb emplace_back
#define mp make_pair
#define endl '\n'
#define f first
#define s second

#ifdef SEREZHKA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) { cerr << _s << " = " << _h << "\n"; }

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;
    
    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;
    
    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

using ll = long long;

const ll INF = static_cast<ll>(1e9) + 7ll;
const ll LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;

int n, m;
string s[MAXN];

bool read() {
    if (!(cin >> n >> m))
        return false;

    forn (i, n)
        cin >> s[i];

    return true;
}

void solve() {
    forn (i, n) {
        forn (j, m)
            cout << ".#"[j != m - 1 && (j == 0 || i % 2 == 0 || s[i][j] == '#')];

        cout << endl;
    }

    cout << endl;

    forn (i, n) {
        forn (j, m)
            cout << ".#"[j != 0 && (j == m - 1 || i % 2 == 1 || s[i][j] == '#')];

        cout << endl;
    }
}

int main() {
    cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    
    while (read())
        solve();
    
    return 0;
}



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

using namespace std;
typedef long long ll;

int l,r,k;

int main()
{
	scanf("%d%d%d",&k,&l,&r);
	int x = k;
	while(x <= r){
		if(x >= l){
			puts("OK");
			return 0;
		}
		x += k;
	}
	puts("NG");
} 

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

int main() {
  int n;

  vector<int> lower;
  vector<int> upper;

  string line;
  getline(cin, line);
  n = stoi(line);

  for (int i = 0; i < n; i++) {
    getline(cin, line);
    istringstream iss(line);
    int a, b;
    iss >> a >> b;
    lower.push_back(a);
    upper.push_back(b);
  }

  sort(lower.begin(), lower.end());
  sort(upper.begin(), upper.end());

  int answer;

  if (n % 2 == 0) {  // Even
    int top_mid_n = n / 2;
    int bottom_mid_n = top_mid_n - 1;
    double lowest_possible = (lower[top_mid_n] + lower[bottom_mid_n]) / 2.0;
    double highest_possible = (upper[top_mid_n] + upper[bottom_mid_n]) / 2.0;
    double range = highest_possible - lowest_possible;
    answer = range / 0.5 + 1;
  } else {  // Odd
    int mid_n = (n - 1) / 2;
    answer = upper[mid_n] - lower[mid_n] + 1;
  }

  cout << answer << endl;
}

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

// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;

// container util
// -----------------------------------------------------------------------------
#define ALL(c)  (c).begin(),(c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(),(c).end())

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

// constant
// -----------------------------------------------------------------------------
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

// debug
// -----------------------------------------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    ll L, R; cin >> L >> R;
    ll ans = INF;
    FOR(i, L, min(R, L + 2019)) {
        FOR(j, i + 1, min(R + 1, i + 2020)) {
            ans = min(ans, ((i % 2019) * (j % 2019)) % 2019);
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3656
/*input
3 1
ABC
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

int main(){
	IOS;
	int n,k;
	string s;
	cin>>n>>k>>s;
	k--;
	s[k]+=(int)'a'-'A';
	cout<<s;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	int w, lbill, tbill, set, cho;
	
	lbill = 4280;
	
	while(1){
		scanf("%d",&w);
		if(w==-1){
			break;
		}else if(w<=10){
			tbill = 1150;
			set = lbill - tbill;
			printf("%d\n",set);
		}else if(w>10 && w<=20){
			cho = 125*(w-10);
			tbill = 1150 + cho;
			set = lbill - tbill;
			printf("%d\n",set);
		}else if(w>20 && w<=30){
			cho = (125*10)+((w-20)*140);
			tbill = 1150 + cho;
			set = lbill - tbill;
			printf("%d\n",set);
		}else if(w>30){
			cho = (125*10)+(140*10)+((w-30)*160);
			tbill = 1150 + cho;
			set = lbill - tbill;
			printf("%d\n",set);
		}
	}
	
	return 0;
	
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string s, t, u;
  int a, b;
  cin >> s >> t >> a >> b >> u;
    
  if(u == s) a--;
  if(u == t) b--;
  
  cout << a << " " << b << endl;
}

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

template <typename T>
void print(const T &v);

int main()
{
    ll n, W;
    cin >> n >> W;
    vector<ll> w(n), v(n);
    for (int i = 0; i < n; i++)
    {
        cin >> w[i] >> v[i];
    }
    vector<vector<ll>> dp(n + 1, vector<ll>(W + 1, 0));
    for (int i = 0; i < n; i++)
    {
        for (int j = 1; j <= W; j++)
        {
            if (j < w[i])
            {
                dp[i + 1][j] = dp[i][j];
            }
            else
            {
                dp[i + 1][j] = max(dp[i][j - w[i]] + v[i], dp[i][j]);
            }
        }
    }
    cout << dp[n][W] << endl;
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

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

int main() {
  int N, x;
  cin >> N >> x;
  vector<int> a(N);
  for (int i= 0; i < N; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  
  int sum = 0;
  int out = 0;
  for (int i = 0; i < N; i++) {
    sum += a.at(i);
    if (sum > x) {
      out = i;
      break;
    }
    else if (sum == x && i == N-1) {
      out = N;
      break;
    }
    else if (sum < x && i == N-1) {
      out = N-1;
      break;
    }
  }
  cout << out << endl;
}

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

using namespace std;

int main()

{

    int n;
    cin>>n;

   int m = n;

   int cnt = 0;
   while(m!=0)
   {
       m = m/10;
       cnt++;
   }

   if(cnt==1)
   {
       cout<<n<<endl;
       return 0;
   }
     if(cnt==2)
   {
       cout<<"9"<<endl;
       return 0;
   }
     if(cnt==3)
   {
       cout<<n-100+10<<endl;
       return 0;
   }
     if(cnt==4)
   {
       cout<<"909"<<endl;
       return 0;
   }
    if(cnt==5)
   {
       cout<<n-10000+910<<endl;
       return 0;
   }
     if(cnt==6)
   {
       cout<<"90909"<<endl;
       return 0;
   }

    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import math


def solve(A: int, B: int):
    # INF = 1001001
    ans = 1
    for _ in range(1100):
        e = math.floor(ans * 0.08)
        t = math.floor(ans * 0.1)
        if e == A and t == B:
            print(ans)
            return
        ans += 1
    print(-1)
    return


# 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)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b)
{
    if (a > b)
        a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b)
{
    if (a < b)
        a = b;
}

int main()
{
    ll a, b;
    cin >> a >> b;
    if (a <= 9 && b <= 9)
        cout << a * b << endl;
    else
        cout << -1 << endl;
}

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

namespace ABC099
{
    class Program
    {
        static void Main(string[] args)
        {
            List<string> list = new List<string>();
            while (true)
            {
                string line = Console.ReadLine();
                if (line == null) break;
                list.Add(line);
            }
            var str = list[0].ToCharArray();

            int start = 0;
            int end=0;
            foreach (var item in str.Select((Value, Index) => new { Value, Index }))
            {
                if (item.Value.Equals('A'))
                {
                    start = item.Index+1;
                    break;
                }
            }
            var ss= str.Reverse();
            int c = ss.Count();
            foreach (var item in ss.Select((Value, Index) => new { Value, Index }))
            {
                if (item.Value.Equals('Z'))
                {
                    end = item.Index+1;
                    break;
                }
            }

            Console.WriteLine(c-end - start + 2);


        }

    }
}


Measured memory_bytes: 17120
#include<bits/stdc++.h>
using namespace std;
struct point{
	double x;
	double y;
};
int n;
void koch(struct point a, struct point b, int r){
	
	if(r<n){
		struct point s;
		s.x = (2*a.x+b.x)/3.0;
		s.y = (2*a.y+b.y)/3.0;
		struct point t;
		t.x = (a.x+2*b.x)/3.0;
		t.y = (a.y+2*b.y)/3.0;
		struct point u;
		u.x = (t.x-s.x)*(1/2.0) - (t.y-s.y)*(sqrt(3)/2.0) + s.x;
		u.y = (t.x-s.x)*(sqrt(3)/2.0) + (t.y-s.y)*(1/2.0) + s.y;
		koch(a,s,r+1);
		koch(s,u,r+1);
		koch(u,t,r+1);
		koch(t,b,r+1);
	}else{
		printf("%.8f %.8f\n", b.x, b.y);
	}
	
}
int main(){
	
	cin >> n;
	struct point a;
	a.x = 0;
	a.y = 0;
	
	struct point b;
	b.x = 100;
	b.y = 0;
	printf("%.8f %.8f\n", a.x, a.y);
	koch(a,b,0);
	return 0;
} 


Measured memory_bytes: 3216
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>

using namespace std;

int main(void) {
	int n;
	cin >> n;
	vector<int>a(n);
	for (int i = 0; i < n; i++)cin >> a[i];
	map<int, int>m;
	for (int i = 1; i <= n; i++) {
		m.insert(make_pair(i, a[i - 1]));
	}
	int k;
	for (int i = 1; i <= n; i++) {
		if (i == 1) {
			k = m[1];
		}
		else {
			k = m[k];
		}
		if (k == 2) {
			cout << i;
			return 0;
		}
	}
	cout << -1;
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  int ret = 0;
  if (s[0] == '1') ret++;
  if (s[1] == '1') ret++;
  if (s[2] == '1') ret++;
  cout << ret << endl;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define f first
#define s second

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

const int INF = 1e9;
const int M = 1e9+7;
const int MXN = 1e5+5;

int N, W, w, v;
vpii items;
long long table[101][MXN], ans = 0;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> N >> W;
	for (int i=0;i<N;++i) {
		cin >> w >> v;
		items.pb(mp(v,w));
	} sort(items.begin(),items.end());
	table[0][items[0].f] = items[0].s;
	for (int i=1;i<N;++i) {
		for (int j=0;j<items[i].f;++j) table[i][j] = table[i-1][j];
		for (int j=items[i].f;j<MXN;++j) {
			if (table[i-1][j-items[i].f] || j-items[i].f == 0) {
				if (table[i-1][j]) table[i][j] = min(table[i-1][j],table[i-1][j-items[i].f]+items[i].s);
				else table[i][j] = table[i-1][j-items[i].f]+items[i].s; 
			} else table[i][j] = table[i-1][j];
		}
	}
	for (int j=0;j<MXN;++j)
		if (table[N-1][j] && table[N-1][j] <= W) ans = max(ans,(ll) j);
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 77568
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>
#include <queue>
using namespace std;
using ll=long long;
//using R=double;

const int INF = 10000000;
typedef pair<int, int> p;

int main(){

    int N,i;
    cin >> N >> i;

    cout << N-i+1 << endl;

    return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <map>
using namespace std;
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))

int main() {
  int N, C, K; scanf("%d%d%d", &N, &C, &K);
  map<int, int>T;
  int t;
  for (int i{0}; i < N; ++i) {
    scanf("%d", &t); ++T[t];
  }

  int total{0};

  for (auto& kv : T) {
    if (kv.second == 0) continue;
    int temp = kv.second;
    if (temp % C != 0) {
      decltype(T)::iterator it = T.lower_bound(kv.first + 1);
      decltype(T)::iterator last = T.upper_bound(kv.first + K);
      while (it != last) {
        int add = MIN(C - temp % C, it->second);
        temp += add;
        it->second -= add;
        if (temp % C == 0) break;
        ++it;
      }
    }
    total += (temp + (C - 1)) / C;
  }

  printf("%d\n", total);
  return 0;
}


Measured memory_bytes: 4992
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define PB push_back
#define MP make_pair
#define all(x) x.begin(),x.end()
#define MOD 1000000007

int main(){
	int m = 0;
	int ans = 0;
	for(int i=0; i<5; i++){
		int tmp;
		cin >> tmp;
		int x = ((tmp-1)/10+1)*10;
		ans += x;
		m = max(m, x-tmp);
	}
	cout << ans - m << endl;

	return 0;
}


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

signed main(){
    int N;
    cin >>N;
    vector<tuple<string,int,int>>vec(N);
    REP(i,N){
        string S;
        int P;
        cin>>S>>P;
        vec[i]=make_tuple(S,-P,i+1);
    }
    sort(vec.begin(),vec.end());
    REP(i,N){
        int t=get<2>(vec[i]);
        cout<<t<<endl;
    }
}


Measured memory_bytes: 3644
// Problem Title : Comparing Strings
// Link : https://atcoder.jp/contests/abc152/tasks/abc152_b
// Date : 03-09-2020 17:32:52

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int a, b;
	cin >> a >> b;

	if(a < b) swap(a, b);

	for(int i = 0; i < a; i++) {
		cout << b;
	}
	cout << '\n';
	
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    private static Scanner sc;
    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
        try {
            int N = sc.nextInt();
            int K = sc.nextInt();
            int[] h = new int[N];
            for (int i = 0; i < N; i++) {
                h[i] = sc.nextInt();
            }

            Arrays.sort(h);
            int min = Integer.MAX_VALUE;
            int tmp;
            for (int i = 0; i < N - K + 1; i++) {
                tmp = h[i+K-1] - h[i];
                if (min > tmp ) min = tmp;
            }
            System.out.println(min);


        } catch (Exception e) {
            e.printStackTrace();
        }
    }

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

    private int gcd(int[] param) {
        final int len = param.length;
        int g = gcd(param[0], param[1]);
        for (int i = 1; i < len - 1; i++) {
            g = gcd(g, param[i+1]);
        }
        return g;
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
}

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

int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll max;

  max = a * c;
  if(max < (a * d)) max = a * d;
  if(max < (b * c)) max = b * c;
  if(max < (b * d)) max = b * d;

  cout << max << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  string s;
  cin >> s;
  if(s=="ABC"){
    cout << "ARC" << endl;
  }
  else{
    cout << "ABC" << endl;
  }
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,K; cin >> N >> K;
    vector<int> cnt(N,1);
    for (int i=0;i<K;++i){
        int d; cin >> d;
        for (int j=0;j<d;++j){
            int A; cin >> A;
            cnt[--A]=0;
        }
    }
    int ans=accumulate(cnt.begin(),cnt.end(),0);
    cout << ans << '\n';
}

Measured memory_bytes: 3620
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        double a = scan.nextInt();
        double b = scan.nextInt();
        double c = scan.nextInt();
        double max = 0;
        double x = 0;
        double y = 0;

        if( a == b && b == c){
            System.out.println("Yes");
        }else{
            System.out.println("No");
    }
}
}

Measured memory_bytes: 21716
package main

import "fmt"
import "bufio"
import "os"
import "strconv"
import "sort"

var _sw = bufio.NewScanner(os.Stdin)

type Pt struct {
	x int
	y int
}

func main() {
	var H, W int
	fmt.Scan(&H, &W)

	C := make([][]bool, H)
	B := []Pt{}
	for y := range C {
		var s string
		fmt.Scan(&s)

		C[y] = make([]bool, W)
		for x := range C[y] {
			C[y][x] = s[x] == '#'
			if C[y][x] {
				B = append(B, Pt{x, y})
			}
		}
	}

	cnt := 0
	done := len(B)
	next := append([]Pt{}, B...)
	for {
		if done == H*W {
			break
		}
		next_ := []Pt{}
		for _, b := range next {
			for _, d := range []Pt{{-1, 0}, {+1, 0}, {0, -1}, {0, +1}} {
				p := Pt{Bounded(0, b.x+d.x, W-1), Bounded(0, b.y+d.y, H-1)}
				if C[p.y][p.x] {
					continue
				}

				C[p.y][p.x] = true
				next_ = append(next_, p)
				done++
			}
		}
		next = next_
		cnt++
	}

	fmt.Println(cnt)
}

func init() {
	_sw.Split(bufio.ScanWords)
}

func NextInt() int {
	if _sw.Scan() == false {
		panic(_sw.Err())
	}
	i, e := strconv.Atoi(_sw.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func NextString() string {
	if _sw.Scan() == false {
		panic(_sw.Err())
	}
	return _sw.Text()
}

func Max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func Min(x, y int) int {
	if x > y {
		return y
	}
	return x
}

func Bounded(lower, n, upper int) int {
	return Min(upper, Max(lower, n))
}

func SortInts(xs []int) {
	sort.Sort(sort.IntSlice(xs))
}

func ReverseSortInts(xs []int) {
	sort.Sort(sort.Reverse(sort.IntSlice(xs)))
}


Measured memory_bytes: 42368
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main()
{
    int A, B;
    cin >> A >> B;

    if (B % A == 0)
    {
        cout << A + B << endl;
    }
    else
    {
        cout << B - A << endl;
    }
}

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

using namespace std;

int N,Z,W;
vector<int> A;
int main(void) {
    cin>>N>>Z>>W;

    for(int i = 0;i < N;i++) {
        int temp;
        cin>>temp;
        A.push_back(temp);
    }

    if(N == 1) {
        cout<<abs(A[0] - W)<<endl;
    } else {
        cout<<max(abs(A[N-1]-W),abs(A[N-1] - A[N-2]))<<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++)
typedef long long ll;
const ll INF = 1LL<<60;
/////////////////////////////////
ll mod = 998244353;
ll dp[200010];
ll s[200010];
int main(){
    int n,k;
    cin >> n >> k;
    vector<pair<int, int>> v(k);
    rep(i,k){
        int a, b;
        cin >> a >> b;
        v[i]=make_pair(a,b);
    }
    s[1] = 1;
    dp[0] = 1;
    for (int i = 1; i < n; i++){
    
        rep(j,k){
            int l, r;
            tie(l, r) = v[j];
            l = max(0, i-l+1);
            r = max(0,i-r);
            dp[i] += s[l] - s[r];
            dp[i] = (dp[i]+mod)%mod;
        }
        s[i + 1] = (s[i] + dp[i])%mod;
        s[i + 1] = (s[i + 1] + mod) % mod;
    }
    cout << dp[n - 1] << endl;
}

Measured memory_bytes: 6668
A, B, K = map(int, input().split(' '))

if(A >= K):
    A = A - K
    print(str(A) + ' ' + str(B))
else:
    K = K - A
    A = 0
    if(B >= K):
        B = B - K
        K = 0
        print(str(A) + ' ' + str(B))
    else:
        print('0 0')

Measured memory_bytes: 3060
N = int(input())
e = [0] * (N+1)
for i in range(2,N+1):
    cur = i
    for j in range(2,i+1):
        while cur % j == 0:
            e[j]+=1;
            cur //=j

def num(m):
    return len(list(filter(lambda x: x >=m-1,e)))
    
print(num(75) + num(25) * (num(3)-1) + num(15)*(num(5)-1) + num(5) * (num(5)-1) * (num(3)-2) // 2)


Measured memory_bytes: 3060
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <time.h>
#include <cmath>
#include <cstdio>
#include <complex>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;

int main() {
	ll n, a[110];
	cin >> n;
	ll cnt = 1, ans = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (i) {
			if (a[i] == a[i - 1])cnt++;
			else {
				ans += cnt / 2;
				cnt = 1;
			}
		}
	}
	ans += cnt / 2;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include<vector>
#include<algorithm>
#include<utility>
#include<queue>
#include<math.h>
#include<stack>
#include<set>
#include<map>
#define INF 1000000007
#define rep(i,n,m) for(int i=n;i<m;i++)

using namespace std;

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

	vector<long long int>a(n + 1), b(m + 1);
	a[0] = 0;
	b[0] = 0;
	long long int x;
	rep(i, 0, n) {
		cin >> x;
		a[i + 1] = a[i] + x;
	}
	rep(i, 0, m) {
		cin >> x;
		b[i + 1] = b[i] + x;
	}
	int ans = 0;
	rep(i, 0, n + 1) {
		for (int j = m; j >= 0; j--) {
			if (a[i] + b[j] <= k) {
				ans = max(ans, i + j);
				m = j;
				break;
			}
		}
	}
	cout << ans << endl;
}



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

int main(){
	int n;	cin>>n;
	string s;	cin>>s;
	if(n%2){
		cout<<"No"<<endl;
		return 0;
	}

	string t;
	for(int i=0; i<n/2; i++)t.push_back(s[i]);

	t+=t;
	if(t==s)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(){
	int n = 0; cin >> n;
	for (int i = 0; i < n; ++i) {
		int outcount = 0, point = 0, runner = 0;
		string input;
		while ( outcount < 3 ) {
			cin >> input;
			if (input == "HIT") {
				if (runner >= 3)
					++point;
				else
					++runner;
			} else if (input == "HOMERUN") {
				point += runner + 1;
				runner = 0;
			} else {
				++outcount;
			}
		}
		cout << point << endl;
	}
}

Measured memory_bytes: 1208
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#include<map>
#include<cmath>
#include<stdio.h>
#include<stdlib.h>
#include<set>
#include<iomanip>

#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define MOD 1000000007

using namespace std;
typedef long long int ll;
typedef pair<int,int> P;

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    COMinit();
    int N,K;
    cin >> N >> K;
    ll ans=0;
    for(int i=0;i<K;i++){
        ans = (COM(K-1,i)*COM(N-K+1,i+1))%MOD;
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 12160
X,Y = map(int,input().split())
M = max(X,Y)
m = min(X,Y)
mod = 10 ** 9 + 7

con = (X + Y) // 3
dif = M - m
n = (con - dif) // 2

if (X + Y) % 3 != 0 or n < 0:
  print(0)
  
else:
  def comb(n, r):
    n += 1
    over = 1
    under = 1
    for i in range(1,r + 1):
      over = over * (n - i) % mod
      under = under * i % mod
    #powでunder ** (mod - 2) % modを実現、逆元を求めている
    return over * pow(under,mod - 2,mod) % mod
  
  ans = comb(con,n)
  
  print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
long long a,b,x,ans;
long long na,nb;
int main(){
	scanf("%lld %lld %lld",&a,&b,&x);
	na=(a-a%x)/x;nb=(b-b%x)/x;
	ans=nb-na;
	if (a%x==0)ans++;
	printf("%lld\n",ans);
}


Measured memory_bytes: 128
num = input().split()
A = int(num[0])
B = int(num[1])
if A % 3 == 0:
    print('Possible')
elif B % 3 == 0:
    print('Possible')
elif (A+B) % 3 == 0:
    print('Possible')
else:
    print('Impossible')

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
int main(void){
int a,b;
int snow=0;
int tall=0;
int count=1;
int aa=0,bb=0;
int takasa[1001];
int flag=0;
takasa[0]=1;
scanf("%d %d",&a,&b);
printf("%d\n",(b-a)*(b-a+1)/2-b);



}

Measured memory_bytes: 128
k = int(input())
dp = [[0 for _ in range(10)] for __ in range(50)]
wa = [[0 for _ in range(10)] for __ in range(50)]

if k < 10:
    print(k)
    exit()

for j in range(10):
    dp[0][j] = 1
    wa[0][j] = j

isFinish =False
for i in range(1,15):
    for j in range(10):
        dp[i][j] = dp[i-1][j]
        if j > 0:
            dp[i][j] += dp[i-1][j-1]
        if j < 9:
            dp[i][j] += dp[i-1][j+1]
        if j == 0: continue
        if j == 1:
            wa[i][j] = wa[i-1][9] + dp[i][j]
        else:
            wa[i][j] = wa[i][j-1] + dp[i][j]
        if wa[i][j] >= k:
            keta = i
            num = j
            isFinish = True
            break
    if isFinish: break
ans = 0
k -= wa[keta][num-1] if num > 1 else wa[keta-1][9]
while keta+1:
    ans += num * pow(10,keta)
    if keta ==0:
        break

    for i  in range(3):
        nextnum = num + i-1
        if nextnum < 0 or nextnum > 9:
            continue
        k -= dp[keta-1][nextnum]
        if k <= 0:
            k += dp[keta-1][nextnum]
            num = nextnum
            break
    keta -= 1
print(ans)


Measured memory_bytes: 3188
#include <iostream>

using namespace std;

int ans, len;
string a;
int main()
{
    cin >> a;
    len = a.size();
    for ( int i=0; i< len/2; i++) {
        if (a[i] != a[len-1-i]) {
            ans ++;
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
map<ll,ll> insuu;
void prime_factor(ll n){
    ll k=n;
	for(ll i=2;i*i<=n;i++){
	    while(k%i==0){
	        insuu[i]++;
	        k/=i;
	    }
	}
	if(k!=1) insuu[k]++;
	return ;
}
int main(){
  ll n;
  cin>>n;
  for(int i=2;i<=n;i++){
    prime_factor(i);
  }
  ll ans=1;
  for(auto p:insuu){
    ans*=(p.S+1);
    ans%=MOD;
  }
  COUT(ans);
}

Measured memory_bytes: 256
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
    return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}



int main()
{

    fastread();

    ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r;

    bool flag=false;

    string str;

    cin>>n>>k>>d;

    if(n<0)
    {
        a=0-n;

        ll need=a/d;

        if(need<k)
        {
            n+=(d*need);

            ll c1=n,c2=n;

            ll pk=k;

            k-=need;
            k--;

            c1+=d;

            if(k&1)
                c1-=d;

            pk-=need;


            if(pk&1)
                c2+=d;

            c1=abs(c1);
            c2=abs(c2);

            cout<<min(c1,c2)<<endl;

        }
        else
        {
            n+=(d*k);

            cout<<abs(n)<<endl;
        }
    }
    else
    {
        a=n;

        ll need=a/d;


        if(need<k)
        {
            n-=(d*need);

            ll c1=n,c2=n;

            ll pk=k;

            k-=need;
            k--;

            c1-=d;

            if(k&1)
                c1+=d;

            pk-=need;


            if(pk&1)
                c2-=d;

            c1=abs(c1);
            c2=abs(c2);

            cout<<min(c1,c2)<<endl;

        }
        else
        {
            n-=(d*k);

            cout<<abs(n)<<endl;
        }

    }





}



Measured memory_bytes: 3652
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();
		String ans = "No";
		for (int i= 0; i<=a; i++) {
			if (b == i*2 +(a-i)*4) {
				ans = "Yes";
				break;
			}
		}
		System.out.println(ans);
	}
}


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

int a[100010], b[100010], c[100010];
int n;
int memo[100010][4];
int dp(int idx, int prev) {
    if (idx == n) return 0;
    if (memo[idx][prev] != -1) return memo[idx][prev];
    int x, y, z;
    x = y = z = - (1 << 30);
    if (prev != 0) x = a[idx] + dp(idx + 1, 0);
    if (prev != 1) y = b[idx] + dp(idx + 1, 1);
    if (prev != 2) z = c[idx] + dp(idx + 1, 2);
    int res = max(x, max(y,z));
    return memo[idx][prev] = res;
}

int main() {
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i] >> b[i] >> c[i];
    memset(memo, -1, sizeof(memo));
    int res = dp(0, 3);
    cout << res << "\n";
    return 0;
}

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

int main() {
  int N, A = 0;;
  string x;
  cin >> N;
  
  for(int i = 0; i < N; i++){
  	cin >> x;
    if(x == "Y"){
      cout << "Four" << endl;
      A = 1;
      break;
    }
    else {
    continue;
    }
  }
  if(A != 1){
  cout << "Three" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin>>S;
  if(S=="SUN"){
    cout<<7<<endl;
  }
  else if(S=="MON"){
    cout<<6<<endl;
  }
  else if(S=="TUE"){
    cout<<5<<endl;
  }
  else if(S=="WED"){
    cout<<4<<endl;
  }
  else if(S=="THU"){
    cout<<3<<endl;
  }
  else if(S=="FRI"){
    cout<<2<<endl;
  }
  else{
    cout<<1<<endl;
  }
}

Measured memory_bytes: 3568
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
const long long oo=1e15;
struct Node
{
	Node *lch,*rch;
	int l,r;
	long long v1,v2,lz;
}*rt;
void update(Node *x)
{
	x->v1=min(x->lch->v1,x->rch->v1);
	x->v2=min(x->lch->v2,x->rch->v2);
}
void add(Node *x,long long v)
{
	x->lz+=v;
	x->v1+=v;
	x->v2+=v;
}
void down(Node *x)
{
	if(x->lz)
	{
		add(x->lch,x->lz);
		add(x->rch,x->lz);
		x->lz=0;
	}
}
int a,b;
Node *Build(int l,int r)
{
	Node *ret=new Node;
	ret->l=l;
	ret->r=r;
	ret->lz=0;
	if(l==r)
	{
		ret->v1=abs(l-a)-l;
		ret->v2=abs(l-a)+l;
		ret->lch=ret->rch=NULL;
		return ret;
	}
	int mid=(l+r)>>1;
	ret->lch=Build(l,mid);
	ret->rch=Build(mid+1,r);
	update(ret);
	return ret;
}
long long query(Node *x,int l,int r,int dir)
{
	if(l<=x->l&&r>=x->r)
	{
		if(dir==1)
			return x->v1;
		else
			return x->v2;
	}
	down(x);
	int mid=(x->l+x->r)>>1;
	long long ret=oo;
	if(l<=mid)
		ret=min(ret,query(x->lch,l,r,dir));
	if(mid<r)
		ret=min(ret,query(x->rch,l,r,dir));
	return ret;
}
void modify(Node *x,int p,long long v)
{
	if(x->l==x->r)
	{
		x->v1=min(x->v1,v-p);
		x->v2=min(x->v2,v+p);
		return ;
	}
	down(x);
	int mid=(x->l+x->r)>>1;
	if(p<=mid)
		modify(x->lch,p,v);
	else
		modify(x->rch,p,v);
	update(x);
}
long long findans(Node *x)
{
	if(x->l==x->r)
		return x->v1+x->l;
	down(x);
	return min(findans(x->lch),findans(x->rch)); 
} 
int main()
{
	int n,q,la,x;
	long long mi;
	scanf("%d%d%d%d",&n,&q,&a,&b);
	la=b;
	rt=Build(1,n);
	for(int i=1;i<=q;i++)
	{
		scanf("%d",&x);
		mi=min(query(rt,1,x,1)+x,query(rt,x,n,2)-x);
		add(rt,abs(x-la));
		modify(rt,la,mi);
		la=x;
	}
	printf("%lld",findans(rt));
	return 0;
}

Measured memory_bytes: 25344
#include <stdio.h>
struct trump{
  char moji;
  int num;
};

void bubble(struct trump *,int);
void insertion(struct trump *,int);
int judge(struct trump *,struct trump *,int);

void bubble(struct trump k1[],int n){
  int i,j;
  struct trump tmp;
  for(i=0;i<n;i++){
    for(j=n-1;j>i;j--){
      if(k1[j].num < k1[j-1].num) {
	tmp = k1[j];
	k1[j] = k1[j-1];
	k1[j-1] = tmp;
      }
    }
  }
}

void insertion(struct trump k2[],int n){
  int i,j;
  struct trump tmp;
  int minj;
  for(i=0;i<n;i++){
    minj = i;
    for(j=i;j<n;j++){
      if(k2[minj].num > k2[j].num)minj = j;
    }
    tmp = k2[minj];
    k2[minj]=k2[i];
    k2[i] = tmp;
  }
}

int judge(struct trump k1[],struct trump k2[],int n){
  int i;
  for(i=0;i<n;i++){
    if(k1[i].moji != k2[i].moji) return 0;
  }
  return 1;
}

int main(){
  struct trump k[36], k2[36];
  int i,j,n;
  char ik;
  scanf("%d%c",&n,&ik);
  for(i=0;i<n;i++){
    scanf("%c%d%c",&k[i].moji,&k[i].num,&ik);
  }
  for(i=0;i<n;i++){
    k2[i]=k[i];
  }
  bubble(k,n);
  insertion(k2,n);
  for(i=0;i<n-1;i++){
    printf("%c%d ",k[i].moji,k[i].num);
  }
  
  printf("%c%d\nStable\n",k[i].moji,k[i].num);
  for(i=0;i<n-1;i++){
    printf("%c%d ",k2[i].moji,k2[i].num);
  }
  printf("%c%d\n",k2[i].moji,k2[i].num);
  if(judge(k,k2,n)) printf("Stable\n");
  else printf("Not stable\n");
  
  return 0;
}

Measured memory_bytes: 608
#include<stdio.h>

int main(){
  long long int x;
  long long int ans;

  scanf("%lld", &x);
  if(x%11 == 0){
    ans = (x/11)*2;
  }else if(x%11<=6) {
    ans = (x/11)*2 + 1;
  }else{
    ans = (x/11)*2 + 2;
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 128
while True:
    n,x = map(int,input().split())
    if n == 0 and x == 0:
        break
    count = 0
    for i in range(1,n+1):
        for j in range(1,i):
            for k in range(1, j):
                if j + k + i == x:
                    count += 1
    print("{}".format(count))



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

namespace AtCoder_20190707_1
{    class Program
    {
        static void Main(string[] args)
        {
            string[] NK = Console.ReadLine().Split(' ');

            int N = int.Parse(NK[0]);
            int K = int.Parse(NK[1]);

            string[] s = Console.ReadLine().Split(' ');
            int[] p = new int[s.Length + 1];
            int sum = 0;

            for(int i = 1; i < p.Length; i++)
            {
                sum += int.Parse(s[i - 1]);
                p[i] = sum;
            }

            double max = 0;

            for(int i = 0; i < p.Length - K; i++)
            {
                if (max < p[i + K] - p[i])
                {
                    max = p[i + K] - p[i];
                }
            }

            max = (max + K) / 2;

            Console.WriteLine(max);
        }
    }
}

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

using namespace std;

struct T {
  int a, b, c, d;
};

int main() {
  int N, M, Q;
  cin >> N >> M >> Q;
  vector<T> v(Q);
  for (auto& item : v) {
    cin >> item.a >> item.b >> item.c >> item.d;
  }

  int result = 0;
  vector<int> A(N, 1);
  for ( ; ; ) {
    int tmp = 0;
    for (auto& item : v) {
      if (A[item.b - 1] - A[item.a - 1] == item.c) {
        tmp += item.d;
      }
    }
    if (result < tmp) result = tmp;

    int i = 0;
    while (i + 1 < N) {
      if (A[i] < A[i + 1]) break;
      A[i++] = 1;
    }
    if (((i + 1) == N) && (A[i] == M)) break;
    ++(A[i]);
  }

  cout << result << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>

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

using namespace std;

int main(){
    string s; cin >> s;
    int a = s[0] - '0';
    int b = s[1] - '0';
    int c = s[2] - '0';
    int d = s[3] - '0';
    int before = a*10 + b;
    int after = c*10 + d;
    bool afterOK;
    bool beforeOK;
    if(1 <=after && after <= 12){
        afterOK = true;
    } else {
        afterOK = false;
    }
    if(1<=before && before <= 12){
        beforeOK = true;
    } else {
        beforeOK= false;
    }
    if(beforeOK && afterOK){
        cout << "AMBIGUOUS" << endl;
    } else if(beforeOK && !afterOK){
        cout << "MMYY" << endl;
    } else if(!beforeOK && afterOK){
        cout << "YYMM" << endl;
    } else {
        cout << "NA" << endl;
    }
}



Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <set>
#include <vector>
#include <algorithm>
#define MOD 1000000007
using namespace std;

long long int n, arr[200010], cvp;
vector<pair<long long int, long long int> > something;
set<long long int> step;

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for(long long int i=1;i<=n;i++){
		cin>>arr[i];
		something.push_back(make_pair(arr[i], i));
	}
	sort(something.begin(), something.end());
	cvp=something[0].second*(n-something[0].second+1);
	step.insert(something[0].second);
	for (long long int i = 1; i < n; ++i){
		long long int bas, son;
		set<long long int>::iterator it=step.lower_bound(something[i].second);
		if(it==step.end())son=n+1;
		else son=*it;
		if(it==step.begin())bas=0;
		else{
			it--;
			bas=*it;
		}
		cvp+=something[i].first*(something[i].second-bas)*(son-something[i].second);
		step.insert(something[i].second);
	}
	cout<<cvp;
	return 0;
}

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

using namespace std;

using ll = long long;

#define MOD_NUMBER 1000000007

template <class T> void vector_print(vector<T> vec) {
  for (unsigned int i = 0; i < vec.size(); i++) {
    cout << vec.at(i);
    if (i < vec.size()-1) {
      cout << " ";
    } else if (i == vec.size()-1) {
      cout << endl;
    }
  }
}

int main() {
  ll r;
  cin >> r;
  cout << r*r << endl;
  return 0;
}


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

int main()
{
	int a[10];
	for (int i = 0; i < 10; i++)
	{
		cin >> a[i];
	}
	sort(a,a+10,greater<int>());
	for (int i = 0; i < 3; i++)
	{
		cout << a[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 3108