akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <cstring>

#include <inttypes.h>
using namespace std;

int main()
{
	int32_t N, T;
	scanf("%d%d", &N, &T);

	int32_t A[100000];
	for (int32_t i = 0; i < N; i++) {
		scanf("%d", &A[i]);
	}

	int32_t _max[100000];
	_max[N - 1] = A[N - 1];
	for (int32_t i = N - 2; i >= 0; i--)
		_max[i] = max(A[i], _max[i + 1]);

	int32_t diff[100000];
	int32_t max_diff = -1;
	for (int32_t i = 0; i < N; i++) {
		diff[i] = _max[i] - A[i];
		max_diff = max(max_diff, diff[i]);
	}

	int32_t res = 0;
	for (int32_t i = 0; i < N; i++)
		if (diff[i] == max_diff)
			res++;

	printf("%d\n",  res);

	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

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

    int x = 0, max_x = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'I') x++;
        else x--;
        max_x = max(x, max_x);
    }

    cout << max_x << endl;
}

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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

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

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

  REP(i,3){
    if(s[i]=='7'){
      ANS("Yes");
      return 0;
    }
  }
  ANS("No");

  return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <map>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

    if(y%2==1){
        cout << "No" << endl;
        return 0;
    }
    if(y>=2*x && y<=4*x){
        cout <<"Yes"<<endl;
    }else{
        cout << "No"<<endl;
    }
    return 0;
}


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

int main(){
  int n;
  cin >> n;
  int a[]={11,31,41,61,71,101,131,151,181,191,211,241,251,271,281,311,331,401,421,431,461,491,521,541,571,601,631,641,661,691,701,751,761,811,821,881,911,941,971,991,1021,1031,1051,1061,1091,1151,1171,1181,1201,1231,1291,1301,1321,1361,1381};
  for(int i=0;i<n;i++){
    cout << a[i] << " ";
  }
}

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

#define num_relatives_max 10
#define JPY_per_BTC       380000.0

int main (void)
{
	/* variables for main process */
	
	double      buffer_val;
	double      val_BTC[num_relatives_max];
	double      val_JPY[num_relatives_max];
	double      val_total_JPY;
	int         num_relatives;
	int         num_BTC;
	int         num_JPY;
	std::string buffer_str;

	/* support variables for main process */


	// STEP.01
	// read out the number of relatives
	std::cin >> num_relatives;

	// STEP.02
	// read out the values of the given money

		// STEP.02.01
		// initialize the counter
		num_BTC = (int)0;
		num_JPY = (int)0;

		// STEP.02.02
		for(int itr = 0; itr < num_relatives; itr++)
		{
			// STEP.02.01
			// read out the written data
			std::cin >> buffer_val >> buffer_str;

			// STEP.02.02
			// allot the read data
			if( buffer_str == "BTC" )
			{ val_BTC[num_BTC] = buffer_val; num_BTC++; }
			else
			{ val_JPY[num_JPY] = buffer_val; num_JPY++; }
		}

	// STEP.03
	// calculate the total value [JPY]

		// STEP.03.01
		// initialize the variable to store the total value
		val_total_JPY = 0.0;

		// STEP.03.02
		// calculate the sum of BTC
		for(int itr = 0; itr < num_BTC; itr++)
		{
			val_total_JPY += val_BTC[itr];
		}

		val_total_JPY *= JPY_per_BTC;

		// STEP.03.03
		// calculate the sum of JPY
		for(int itr = 0; itr < num_JPY; itr++)
		{
			val_total_JPY += val_JPY[itr];
		}
		
	// STEP.04
	// output the result
	std::cout << val_total_JPY << std::endl;

	// STEP.END
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
  string s,a,b="";
  int c=0;
  map<string,int> m;
  while(cin>>s){
    if(s.length()>b.length())b=s;
    m[s]++;
  }
  map<string,int>::iterator it = m.begin();
  while(it!=m.end()){
    if((*it).second>c)c=(*it).second,a=(*it).first;
    it++;
  }
  cout<<a<<" "<<b<<endl;
  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
  
int main(void)
{
  int n,i;
  int x=100000;
  scanf("%d",&n);
    for(i=0;i<n;i++){
      x=x*1.05;     
  
     if(x%1000 != 0){
       x += 1000 - (x%1000);}
  }  
  
printf("%d\n",x);
  
   return 0;
}

Measured memory_bytes: 592
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cctype>
using namespace std;
int a[100000];
int main()
{     int n,i;
      cin>>n;
      for(i=1;i<=n;i++)cin>>a[i];
      sort(a+1,a+n+1);
      cout<<a[n]-a[1]<<endl;
	  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef LOCAL
#define debug(x)   cerr<<#x<<" = "<<x<<endl
#else
#define debug(x) 
#endif
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define input_from_file freopen("input.txt","r",stdin)
#define output_to_file freopen("output.txt" , "w",stdout)
#define pii pair<int,int>
#define endl '\n'
#define pb push_back
#define fi first
#define se second 
#define mp make_pair
#define int long long
const int inf = 1e18 + 5;
int dp[3002][6009];

signed main()
{
    #ifdef LOCAL
        input_from_file;
        output_to_file;
    #endif 
    IOS
    int n,W; cin>>n>>W;
    pair<int, int> wei[n];
    for(int i=0;i<n;i++)
    {
        cin>>wei[i].fi>>wei[i].se;
    }
    sort(wei, wei+n);
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=W+3000;j++)
        {
            dp[i][j] = dp[i-1][j];
            if(j >= wei[i-1].fi && j-wei[i-1].fi < W) dp[i][j] = max(dp[i][j] , dp[i-1][j-wei[i-1].fi] + wei[i-1].se);  
        }
        for(int j=1;j<=W+3000;j++)
            dp[i][j] = max(dp[i][j], dp[i][j-1]);
    }
    int ans = 0;
    for(int i=0;i<=W+3000;i++) ans = max(ans , dp[n][i]);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 141184
#include <bits/stdc++.h>
using namespace std;
//#define DEBUG_MODE
#define endl '\n'
#ifdef DEBUG_MODE
#define DEBUG(X) debug_func(X, #X)
#define DEBUG_ENDL endl << flush
#define DEBUG_SEPARATOR_LINE cout<<"=================\n"
#else
#define DEBUG(X) 0
#define DEBUG_ENDL 0
#define DEBUG_SEPARATOR_LINE 0
#endif
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
#define DEBUG_ENDL_S(S) ((S).size() ? "\n" : "") << flush;
template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename Head, typename... Tail> const Head& var_min(const Head &head, const Tail&... tail) { return min(head, var_min(tail...)); }
template <typename Head, typename... Tail> const Head& var_max(const Head &head, const Tail&... tail) { return max(head, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
void debug_func_preffix(const string &s) { if(s.size()) cout << s << " = "; }
template <typename T>
void debug_func(const T &t, const string &s = "") {
    debug_func_preffix(s);
    cout << t << DEBUG_ENDL_S(s);
}
template <typename T, typename U>
void debug_func(const P<T, U> &p, const string &s = "") {
    debug_func_preffix(s);
    cout << "(";
    debug_func(p.first);
    cout << ", ";
    debug_func(p.second);
    cout << ")" << DEBUG_ENDL_S(s);
}
template <typename T>
void debug_func(const V<T> &v, const string &s = "") {
    for(ll i = 0; i < v.size(); i++) {
        string t = s + "[" + to_string(i) + "]";
        debug_func(v[i], t);
    }
}

void init_io() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(30);
}

const ll INF = 5e15;

int main() {
    init_io();
    ll K;
    cin >> K;
    V<ll> visited(K + 10, INF);
    deque<PLL> deq;
    visited[1] = 1;
    deq.emplace_back(1, 1);
    while(deq.size()) {
        ll now, d;
        tie(now, d) = deq.front();
        DEBUG(now);
        DEBUG(d);
        deq.pop_front();
        V<PLL> edges;
        edges.emplace_back((now + 1) % K, 1);
        edges.emplace_back((now * 10) % K, 0);
        for(PLL p : edges) {
            ll nxt, cost;
            tie(nxt, cost) = p;
            DEBUG(nxt);
            if(visited[nxt] <= d + cost) continue;
            visited[nxt] = d + cost;
            if(cost == 1) deq.emplace_back(nxt, d + cost);
            else deq.emplace_front(nxt, d);
        }
    }
    cout << visited[0] << endl;
    return 0;
}


Measured memory_bytes: 1920
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int A, B, ans;

int main()
{
	in >> A >> B;
	for (int n = A; n <= B; ++n)
	{
		if ((n / 10000) == (n % 10) && (n / 1000 % 10) == (n % 100 / 10)) ++ans;
	}
	out << ans << std::endl;
	return 0;
}

Measured memory_bytes: 256
import Data.List
import Data.Char
import Data.Maybe
import qualified Data.ByteString.Char8 as BS8

main :: IO ()
main = do
    n <- fst . fromJust . BS8.readInteger <$> BS8.getLine
    vi <- unfoldr (BS8.readInteger . BS8.dropWhile isSpace) <$> BS8.getLine
    let v = reverse $ sort [toRational x | x <- vi]

    print $ fromRational $ foldr (\x y -> ((x + y) / 2)) (last v) (init v)


Measured memory_bytes: 508
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<string>
#include<list>
#include<utility>
#include<tuple>
#include<cstdio>
#include<map>
#include<unordered_map>
#include<ios>
#include<iomanip>
#include<complex>
using namespace std;
typedef long long llong;
llong gcd(llong a, llong b) {
	if (a < b) std::swap(a, b);
	if (a % b == 0) return b;
	else return gcd(b, a % b);
}
llong lcm(llong a, llong b) {
	llong g = gcd(a, b);
	return a * b / g;
}
//ここまで共通
llong S;
llong a, b, c, d, e, f;
int main() {
	// input
	cin >> S;
	// 
	a = 0;
	b = 0;
	c = 1000000000;
	d = 1;
	f = (S + 999999999) / 1000000000;
	e = 1000000000 * f - S;
	
	//output
	cout << a << ' ' << b << ' ' << c << ' ' << d << ' ' << e << ' ' << f << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<vi> vii;
typedef map<int, int> mp;
typedef multiset<int> mset;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
typedef vector<int64> vi64;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define form(i,j,k,l) for(int i=j;i<int(k);i+=l)
#define rform(i,j,k,l) for(int i=int(j);i>int(l);i-=l)
#define rep(i, j) for(int i=0;i<int(j);i++)
#define rrep(i, j) for(int i=int(j);i>=0;i--)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define forc(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define INF (int)1e9
#define INF64 (int64)1e18
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define F first
#define S  second
const double pie = acos(-1.0);
template <typename T>
T Max(T x, T y)
{
  return (x > y) ? x : y;
}
template <typename T>
T Min(T x, T y)
{
  return (x > y) ? y : x;
}
int gcd(int n1, int n2)
{
  if (n2 != 0) return gcd(n2, n1 % n2);
  else return n1;
}
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
clock_t time_p = clock();
void rtime() { time_p = clock() - time_p; cerr << "Time Taken : " << (float)1000 * (time_p) / CLOCKS_PER_SEC << "\n";}
int main()
{ fast;
  int x;
  cin >> x;
  int l = 100001;
  for (int i = 1; i < l; i++)
  { int t = (i * (i + 1)) / 2;
    if (t < x)
      continue;
    else
    { int r = t - x;
      if (r <= i)
      { cout << i;
        return 0;
      }
    }
  }

}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <fstream>
#include <sstream>
using namespace std;

const unsigned long long BASE = 1e9 + 7;

int main()
{
    int x, a, b;
    cin >> x >> a >> b;
    cout << (x - a) % b << endl;
    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
  
using namespace std;
  
int main()
{
    int health, n;
    cin >> health >> n;
    int total = 0;
    
    for (int i = 0, k ; i < n; i++){
        cin >> k;
        total += k;
    }
    
    if (total < health){
        cout << "No";
    }
    else{
        cout << "Yes";
    }
    
} 


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

#include <cstring>

using namespace std;
 
int main(){
   
  int r, c;
 
  cin >> r >> c;
 
  int sheet[r+1][c+1];
   
  memset(sheet, 0, sizeof sheet);
 
  for(int i = 0; i < r; i++){
    for(int j = 0; j < c; j++){
      cin >> sheet[i][j];
    }
  }
 
  for(int i = 0; i < r+1; i++){
    for(int j = 0; j < c+1; j++){
      cout << sheet[i][j];
      if(j < c){
    cout << " ";
      }else{
    cout << endl;
      }
      if(i < r){
    sheet[r][j] += sheet[i][j];
    sheet[i][c] += sheet[i][j];
      }
    }
  }
 
  return 0;
}

Measured memory_bytes: 1204
def main():
    A,B,C,K = map(int, input().split())
    if K%2==0:
        if abs(A-B)>10e18:
            return "Unfair"
        else:
            return A-B
    else:
        if abs(A-B)>10e18:
            return "Unfair"
        else:
            return -A+B

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 2940
a,b=map(int,input().split())
def func(x):
    cnt=(x+1)//2
    if x%2==1:
        if cnt%2==0:
            return 0
        else: return 1
    else:
        if cnt%2==0:
            return 0^x
        else: return x^1

print(func(b)^func(a-1))

Measured memory_bytes: 38384
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();
        int c = sc.nextInt();
        if(a<b){
            if(b<c){
                System.out.printf("%d %d %d\n",a,b,c);
            }else if(a<c){
                System.out.printf("%d %d %d\n",a,c,b);
            }else{
                System.out.printf("%d %d %d\n",c,a,b);
            }
        }else{
            if(c<b){
                System.out.printf("%d %d %d\n",c,b,a);
            }else if(c<a){
                System.out.printf("%d %d %d\n",b,c,a);
            }else{
                System.out.printf("%d %d %d\n",b,a,c);
            }
        }
        sc.close();
    }
}


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

int n, a[50];

bool solve(int i, int m){
    if(m == 0) return true;
    if(i >= n || m < 0) return false;
    return (solve(i + 1, m) || solve(i + 1, m - a[i]));
}



int main()
{
    int m, q;
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i];
    cin >> q;
    for(int i = 0; i < q; i++){
        cin >> m;
        if(solve(0, m)) cout << "yes"  << endl;
        else cout << "no" << endl;
    
    }
    
    return 0;
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
typedef  pair<double,pair<int,int> > VP;
bool kyk(int,int);
int main(){
  vector<int> jj(10005);
  for(int i=0;i<=10004;i++){
    jj[i]=i*i;
  }
  while(1){
    int p,n;
    cin >> p >> n;
    if(p==0&&n==0)break;
    vector<VP> sm;
    vector<VP> la;
    for(int i=1;i<=n;i++){
      VP pul;
      VP pus;
      pus.second.second=i;
      pul.second.second=i;      
      int bns=lower_bound(jj.begin(),jj.end(),jj[i]*p)-jj.begin();
      if(bns-1>n)break;
      pul.second.first=jj[bns];
      pus.second.first=jj[bns-1];
      pul.first=(double)pul.second.first/(i*i);
      pus.first=(double)pus.second.first/(i*i);
      sm.push_back(pus);
      la.push_back(pul);
    }
    //cout << i*i << " "<<  pus.first << endl;
    //cout << pul.first << endl << endl;
    sort(sm.begin(),sm.end());
    sort(la.begin(),la.end());
    for(int i=0;i<la.size();i++){
      if(kyk(la[i].second.first,la[i].second.second)&&la[i].second.first<=n*n){
	cout << (int)sqrt(la[i].second.first)<<"/"<<la[i].second.second<<" ";
	break;
      }
    }
    for(int i=sm.size()-1;i>=0;i--){
      if(kyk(sm[i].second.first,sm[i].second.second)&&sm[i].second.first<=n*n){
	cout << (int)sqrt(sm[i].second.first)<<"/"<<sm[i].second.second<<endl;
	break;
      }
    }	
  }
  
  return 0;
}
bool kyk(int a,int b){
  //cout << a << b <<endl;
  if(a==0||b==0)return 0;
  if(b!=1&&a==b*b)return 0;
  if(b!=1&&a%b==0)return 0;
  for(int i=2;i*i<=b*b;i++){
    if(a%i==0&&b%i==0)return 0;
  }
  return 1;
}

      

Measured memory_bytes: 3176
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod=1e9+7;

int main(){
	int K,X;
	cin >> K >> X;

	for(int i=X-(K-1); i<X+K; i++){
		cout << i << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define p64 PRId64
#include <cinttypes>
#include <cstdio>
#include <tuple>
#include <vector>

using namespace std;
using ll = int64_t;

// グラフ)深さ優先探索 Depth-First Search
// input
// 3 3
// 1 2 1
// 2 3 1
// 1 3 2

// 0-indexed
// 逆辺 マイナス

// process
// go
// e = 0 ->
// e = 1 ->
// e = 1 pos check(s = 0) ->
// e = 2 ->
// e = 2 pos check(s = 1) ->
// e = 2 pos check(s = 0) ->

// back
// -> e = 2 dfs true
// -> e = 1 dfs true
// -> e = 0
// -> e = 0 pos check(s = 2)
// -> e = 0 dfs true

vector<bool> check;
vector< vector<tuple<int, int> > > es;
vector<ll> pos;

template<class T> void gc(T &x)
{
    char c;
    int s = 0;
    x = 0;

    c = getchar_unlocked();

    if (c == '-') s = 1;
    else if ('0' <= c && c <= '9')  x = c - '0';

    while (true)
    {
        c = getchar_unlocked();

        if (c < '0' || c > '9') break;
        x = x * 10 + (c - '0');
    }

    if (s) x = -x;
}

// グラフ)深さ優先探索 Depth-First Search
bool dfs(int e)
{
    // e 訪問済
    // pos 設定済
    check[e] = true;

    // e -> s
    for (auto next : es[e])
    {
        int s = get<0>(next);
        int d = get<1>(next);

        ll spos = d + pos[e];

        if (check[s])
        {
            // s 訪問済 pos 比較
            if (spos != pos[s]) return false;
            continue;
        }
        else
        {
            // s 未訪問 pos 設定
            pos[s] = spos;

            // s を e として再帰
            if (!dfs(s)) return false;
        }
    }

    return true;
}

int main()
{
    int N, M;

    gc(N);
    gc(M);

    es.resize(N);

    for (int i = 0; i < M; i++)
    {
        int l, r, d;
        gc(l);
        gc(r);
        gc(d);

        // 0-indexed
        l--;
        r--;

        es[l].push_back(make_tuple(r, d));
        // 逆辺は マイナス
        es[r].push_back(make_tuple(l, -d));
    }

    // 初期値 0
    pos.resize(N);

    // 初期値 false
    check.resize(N);

    for (int i = 0; i < N; i++)
    {
        // 頂点の集合が分裂していなければ
        // 1回の dfs でチェック済みとなる
        if (check[i]) continue;

        // 最初の頂点 距離 0
        pos[i] = 0;

        // グラフ)深さ優先探索 Depth-First Search
        if (!dfs(i))
        {
            printf("%s\n", "No");
            return 0;
        }
    }

    printf("%s\n", "Yes");
    return 0;
}


Measured memory_bytes: 12416
using System;
public class Hello
{
    public static void Main ()
    {
        long n;
        long sum = 0;
        n = int.Parse(Console.ReadLine());
        long[] a = new long[n];
        string[] str = Console.ReadLine().Split(' ');
        for(int i=0;i<n;i++)
        {
            a[i] = long.Parse(str[i]);
            sum += a[i];
        }
        Array.Sort(a);
        Console.WriteLine("{0} {1} {2}",a[0],a[n-1],sum);
        return ;
        
    }
}


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

int ans[100];

class G{
public:
  int id,n,a,d; //??°???????????????,?????°,??°?????????,?£??????????

  G(int i){
    id = i;
    n = (i % 5 == 1 ? 5 : 2);
    a = 5 * i;
    d = 17 * (i % 2) + 3 * (i % 3) + 19;
  }
};

//n?????£?¶???§???????¢??????§????????´????????????
int indexOfSeat(int *seat,int n){
  int count = 0;

  for(int i=0;i<17;i++){
    if(!seat[i]){
      count++;
      if(count == n) return i - n + 1;
    }
    else{
      count = 0;
    }
  }

  return -1;
}

void solve(void){
  vector<G> v; //????????????
  for(int i=0;i<100;i++) v.push_back(G(i));

  int time = 0; //?????¨?????????
  int seat[17]; //????????±
  memset(seat,0,sizeof(seat));

  while(!v.empty()){
    while(!v.empty() && v[0].a<=time){
      int idx = indexOfSeat(seat,v[0].n);
      if(idx != -1){
        for(int i=idx;i<idx+v[0].n;i++) seat[i] = v[0].d;
        ans[v[0].id] = time - v[0].a;
        v.erase(v.begin());
      }
      else{
        break;
      }
    }

    time++;
    for(int i=0;i<17;i++) if(seat[i] > 0) seat[i]--;
  }
}

int main(void){
  solve();

  int n;
  while(cin>>n) cout<<ans[n]<<endl;

  return 0;
}

Measured memory_bytes: 1204
N = int(input())
B = list(map(int,input().split()))
A = []
while B:
    flag = True
    for i in reversed(range(len(B))):
        if B[i] == i + 1:
            flag = False
            A.append(B[i])
            B.pop(i)
            break
    if flag:
        print(-1)
        break
        
if flag == False:
    for a in reversed(A):
        print(a)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
int main() {
	int n, x;
	scanf("%d%d", &n, &x);
	vector<int> a(n), b(n);
	for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
	iota(b.begin(), b.end(), 0);
	sort(b.begin(), b.end(), [&](int i, int j) {
		return a[i] < a[j];
	});
	ll ans = LLONG_MAX;
	for (int m = 0; m < n; ++m) {
		set<int> S;
		for (int i = 0; i < n; ++i) S.insert(i);
		ll tot = 0;
		for (int i : b) {
			for (;;) {
				if (S.empty()) break;
				auto it = S.lower_bound(i);
				if (it == S.end()) it = S.begin();
				int j = *it;
				if ((j - i + n) % n <= m) {
					S.erase(it);
					tot += a[i];
				} else break;
			}
		}
		assert(S.empty());
		ans = min(ans, (ll)x * m + tot);
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 384
"use strict";
const Main = (input) =>{
   let xs = input.trim().split(' ');
   let X = xs[0].charCodeAt(0);
   let Y = xs[1].charCodeAt(0);
   
   if(X>Y){
     console.log('>');
   }else if(X<Y){
     console.log('<');
   }else if(X==Y){
     console.log('=');
   }

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




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

int main() {
  string N; cin >> N;
    
   if ( N.at(0) == N.at(1) &&  N.at(0) == N.at(2)){
        cout << "Yes" <<endl;
     }
  else if ( N.at(1) == N.at(2) &&  N.at(1) == N.at(3)){
        cout << "Yes" <<endl;
     }
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,P> PP;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=9999999999;


int main(){
    int n;
    cin>>n;
    map<ll,ll> mp;
    for(int i=0;i<n;i++){
        ll a;
        cin>>a;
        mp[a]++;

    }
    ll ans=0;
    for(auto p:mp){
        ll key=p.first;
        ll num=p.second;
        if(num<key){
            ans+=num;
        }else{
            ans+=num-key;
        }
    }
    cout<<ans<<endl;
    
    
}

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

string s;

string get(int pos)
{
	string res = "";
	for (int i = 0; i <= pos; ++i) res += s[i];
	int len = s.size();
	for (int i = len - (7 - pos - 1); i < len; ++i) res += s[i];
	return res;
}

bool work()
{
	for (int i = 0; i < 7; ++i)
	{
		string tmp = get(i);
		if (tmp == "keyence") return 1;
	}
	return 0;
}

int main()
{
	while (cin >> s) puts(work() ? "YES" : "NO");
	return 0;
}


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

#define MAX_N 300000
#define MAX_Q 100000
int N, Q;
bool c[MAX_N + 1] = {false}, found = false;
int q[MAX_Q];
int ub, lb, range;

int main(){
	int input;
	
	range = 0;
	scanf("%d%d", &N, &Q);
	for(int i = 0; i < N; i++){
		scanf("%d", &input);
		c[input] = true;
		range = max(range, input);
	}
	for(int i = 0; i < Q; i++) scanf("%d", &q[i]);
	
	for(int i = 0; i < Q; i++){
		lb = 0; ub = q[i];
		int bucket = 0;
		while(ub - lb > 1){
			found = false;
			int mid = (lb + ub) / 2;//目安
			for(int p = bucket * q[i] + mid; p <= range; p += mid){
				for(int j = 0; j < (q[i] - mid); j++){
					if(c[p]){
						found = true;
						bucket = p / q[i];
						lb = p % q[i];
						break;
					}
					p++;
				}
				if(found) break;
			}
			if(!found){
				ub = mid;
			}
		}
		printf("%d\n", lb);
	}
	return 0;
}

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


def sum_digits(n):
    s = 0
    while n:
        s += n % 10
        n //= 10
    return s


res = 10e5
for a in range(1, N):
    b = N - a
    s = sum_digits(a) + sum_digits(b)
    if s < res:
        res = s
print(res)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int arr[101],w[101],n,W;
long long dp[101][100001];
long long f(int pos,int val){
	if(pos==-1){
		return (val?1000000000000000000LL:0);
	}
	long long &res=dp[pos][val];
	if(~res)return res;
	res=f(pos-1,val);
	if(arr[pos]<=val)res=min(res,f(pos-1,val-arr[pos])+w[pos]);
	return res;
}

int main(int argc, char const *argv[])
{
	memset(dp,-1,sizeof dp);
	cin>>n>>W;
	for(int i=0;i<n;i++)cin>>w[i]>>arr[i];
	for(int i=100000;i>=0;i--){
		if(f(n-1,i)<=W){
			printf("%d\n", i);
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 79232
#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 REPS(i,n) FOR(i,1,n+1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int MOD=1e9+7;
const int INF=1e18;

int powMOD(int x,int r){
    if(r==0)return 1;
    if(r&2==0)return powMOD(x,r/2)+powMOD(x,r/2)%MOD;
    return x*powMOD(x,r-1)%MOD;
}

signed main(){
    string S;cin>>S;
    int N=S.size();
    int dp[100010][4];
    REP(i,100010)REP(j,4)dp[i][j]=0;
  	dp[0][0]=1;
    REP(i,N){
        if(S[i]=='?'){
            REP(j,4)dp[i+1][j]+=dp[i][j]*3;
            REP(j,3)dp[i+1][j+1]+=dp[i][j];
        }
        if(S[i]=='A'){
            REP(j,4)dp[i+1][j]+=dp[i][j];
            dp[i+1][1]+=dp[i][0];
        }
        if(S[i]=='B'){
            REP(j,4)dp[i+1][j]+=dp[i][j];
            dp[i+1][2]+=dp[i][1];
        }
        if(S[i]=='C'){
            REP(j,4)dp[i+1][j]+=dp[i][j];
            dp[i+1][3]+=dp[i][2];
        }
        REP(j,4)dp[i+1][j]%=MOD;
    }
    cout<<dp[N][3]<<endl;
}

Measured memory_bytes: 3584
#include<stdio.h>

#define MAX 10000
#define NIL -1

struct Node
{
    int p;
    int l;
    int r;
};

struct Node T[MAX];
int n;

void preParse(int u)
{
    if(u == NIL) return;
    printf(" %d",u);
    preParse(T[u].l);
    preParse(T[u].r);
}

void inParse(int u)
{
    if(u == NIL) return;
    inParse(T[u].l);
    printf(" %d",u);
    inParse(T[u].r);
}

void postParse(int u)
{
    if(u == NIL) return;
    postParse(T[u].l);
    postParse(T[u].r);
    printf(" %d",u);
}

int main()
{
    int i,v,l,r,root;

    scanf("%d",&n);

    for(i=0;i<n;i++)
    {
        T[i].p = NIL;
    }

    for(i=0;i<n;i++)
    {
        scanf("%d %d %d",&v,&l,&r);

        T[v].l = l;
        T[v].r = r;
        if(l != NIL)T[l].p = v;
        if(r != NIL)T[r].p = v;
    }

    for(i=0;i<n;i++)
    {
        if(T[i].p == NIL)
           root = i;
    }

    printf("Preorder\n");
    preParse(root);
    printf("\n");

    printf("Inorder\n");
    inParse(root);
    printf("\n");

    printf("Postorder\n");
    postParse(root);
    printf("\n");

    return 0;
    
}


Measured memory_bytes: 2060
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

struct node {
  node *left, *right;
  double w;
  node() { left = right = NULL; }
  node(node *left, node *right) : left(left), right(right) {}
};

struct P {
  double w;
  double l, r;
  P(double l, double r, double w) : l(l),r(r),w(w) {}
};
int s;

map<vector<double>, vector<P> > memo;

vector<P> solve(vector<double> w) {
  if (memo.count(w)) return memo[w];
  int m = w.size();
  if (m == 1) {
    return vector<P>(1,P(0,0,w[0]));
  }
  vector<P> res;
  for (int S=1; S<(1<<m)-1; ++S) {
    vector<double> lw, rw;
    REP(i, m) {
      if (S>>i & 1) lw.push_back(w[i]);
      else rw.push_back(w[i]);
    }
    vector<P> lp = solve(lw);
    vector<P> rp = solve(rw);
    // cout << "lp = ";
    // FOR(it, lw)
    //   cout << *it << " ";
    // cout << endl;
    // cout << "rp = ";
    // FOR(it, rw)
    //   cout << *it << " ";
    // cout << endl;
    FOR(lit, lp) {
      FOR(rit, rp) {
        //printf("((%f, %f), (%f,%f))\n", lit->l,lit->r,rit->l,rit->r);
        double a = rit->w/(lit->w+rit->w);
        double b = 1-a;
        res.push_back(P(min(-a+lit->l, b+rit->l), max(-a+lit->r, b+rit->r), lit->w+rit->w));
      }
    }
  }
  return memo[w] = res;
}

int main() {
  int N;
  cin >> N;
  while(N--) {
    double r ;
    cin >> r;
    cin >> s;
    vector<double > w(s);
    REP(i, s)
      cin >> w[i];
    memo.clear();
    vector<P> res = solve(w);
    double ans = -1;
    FOR(it, res) {
      //cout << it->r - it->l << endl;;
      if (it->r - it->l < r)
        ans = max(ans, it->r - it->l);
    }
    if (ans == -1)
      cout << -1 << endl;
    else
      printf("%.16f\n", ans);
  }
}

Measured memory_bytes: 0
import java.util.Scanner;

/**
 * Count ABC
 */
public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            String S = sc.next();

            int c = 0;
            for (int i = 0; i < N - 2; i++) {
                if (S.substring(i, i + 3).equals("ABC")) {
                    c++;
                }
            }

            System.out.println(c);
        }
    }

}


Measured memory_bytes: 21844
#include<stdio.h>
#include<math.h>
int main(){
  int data[5];
  int i=0,j=0,k;
  while(i<5){
    scanf("%d",&data[i]);
    i++;
  }
  scanf("%d",&k);
  for(i=0;i<4;i++){
  	for(j=i+1;j<5;j++){
      if(abs(data[i]-data[j])>k){
        puts(":(");
        return 0;
      }
    }
  }
  puts("Yay!");
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int,int>P;
struct edge{int to,cost;};
const long long minf= -1145141919;
int l[200005],r[200005],d[200005];
int par[100005],rnk[100005];
vector<edge>G[100005];
bool visit[100005];
int dis[100005];

void init(int n) {
	for (int i = 0; i<n; i++) {
		par[i] = i;
		rnk[i] = 0;
	}
}
int find(int x) {
	if (par[x] == x)return x;
	return par[x] = find(par[x]);
}
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rnk[x]<rnk[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rnk[x] == rnk[y])rnk[x]++;
	}
}
bool same(int x, int y) {
	return find(x) == find(y);
}

bool bfs(int s){
	dis[s]=0;
	queue<int>Q;
	Q.push(s);
	visit[s]=false;
	while(Q.size()){
		int v=Q.front();
		Q.pop();
		for(int i=0;i<G[v].size();i++){
			edge e=G[v][i];
			if(dis[e.to]!=minf){
				if(dis[e.to]!=dis[v]+e.cost)
				return false;
				}
			else{
				dis[e.to]=dis[v]+e.cost;
				Q.push(e.to);
				visit[e.to]=false;
				}	
			}
		}return true;
	}

signed main(){
	int n,m;
	cin>>n>>m;
	init(n);
	fill(dis,dis+n,minf);
	fill(visit,visit+n,false);	
	for(int i=0;i<m;i++){
		cin>>l[i]>>r[i]>>d[i];
		unite(l[i]-1,r[i]-1);
		G[l[i]-1].push_back({r[i]-1,d[i]});
		G[r[i]-1].push_back({l[i]-1,-1*d[i]});
		visit[l[i]-1]=visit[r[i]-1]=true;
		}
	for(int i=0;i<n;i++){
		if(visit[i]){
		if(bfs(i)==false){
			puts("No");
			return 0;
			}
		}
		}	
		puts("Yes");
	}


Measured memory_bytes: 20352
/*
 * main.cpp
 *
 *  Created on: ??‏/??‏/????
 *      Author: Israa
 */

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

unordered_map <string, int> mp;
string verdicts[5] = {"AC", "WA", "TLE", "RE"}, s;

int main() {
	ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int n;
    cin>>n;
	while(n--) {
		cin>>s;
		mp[s]++;
	}
	for(int i=0; i<4; i++) {
		cout<<verdicts[i]<<" x "<<mp[verdicts[i]]<<"\n";
	}
	return 0;
}

Measured memory_bytes: 3608
/*  ex4_3
    Graku   */
#include<stdio.h>
int get_snow_depth(int len_above_west, int len_above_east);

int main(void) {
    int len_above_west, len_above_east;
    scanf("%d %d", &len_above_west, &len_above_east);

    printf("%d\n", get_snow_depth(len_above_west, len_above_east));

    return 0;
}

int get_snow_depth(int len_above_west, int len_above_east) {
    int tower_num = len_above_east - len_above_west; //higher(east) tower's number
    int tower_hight = (1 + tower_num)*tower_num / 2; // higher(east) tower's height

    return tower_hight - len_above_east; //depth of snow
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
  
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 
  
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
  
typedef long long int ll;
  
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;
const ll maxn =5*100001;
ll power(ll x, ll n) {
  ll res = 1;
  for (; n > 0; n >>= 1) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
  }
  return res;
}

int32_t main()
{
    
   

  
    IOS
	ll n;
	cin>>n;
	ll ans=n-1;
	for(ll i=1;i*i<=n;i++)
	{
		if(n%i==0)
		{
			ans=min(ans,i-1+(abs((n/i)-1)));
		}
	}
	cout<<ans<<endl;
	
}
  
           
         
       


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

using namespace std;

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

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-9;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

bool used[125];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int n, k;
  cin>>n>>k;
  REP(i, k){
    int d;
    cin>>d;
    REP(j, d){
      int a;
      cin>>a;
      --a;
      used[a]=true;
    }
  }
  int ans=0;
  REP(i, n){
    if(!used[i]){
      ++ans;
    }
  }
  cout<<ans<<'\n';
  return 0;
}


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

// 約数の列挙
vector<int> divisor(int n) {
    vector<int> res;
    for (int i=1;i*i<=n;++i) {
        if (n%i == 0) {
            res.push_back(i);
            if (i != n/i) res.push_back(n/i);
        }
    }
    return res;
}

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    ll sum = 0;
    rep(i, N) {
        cin >> A[i];
        sum += A[i];
    }

    vector<int> tmp = divisor(sum);
    int ans = 0;

    vector<ll> sum1(N+1, 0), sum2(N+1, 0);
    vector<int> a(N);
    rep(i, tmp.size()) {


        rep(j, N) a[j] = A[j]%tmp[i];
        sort(a.begin(), a.end());

        for (int j=1; j<=N; ++j) {
            sum1[j] = sum1[j-1] + a[j-1];
            sum2[j] = sum2[j-1] + (tmp[i] - a[j-1]);
        }

        for (int j=1; j<N; ++j) {
            ll a = sum1[j];
            ll b = (sum2[N] - sum2[j]);
            if (a % tmp[i] == b % tmp[i] and max(a, b) <= K) {
                ans = max(ans, tmp[i]);
            }
        }
    }

    cout << ans << endl;

}


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

#define MAX(x,y) (x>y?x:y)
#define MIN(x,y) (x<y?x:y)
#define ABS(x) (x>0?x:-(x))

#define INF 1000000000

void swap(int* a, int* b)
{
	int tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

int gcd(int a, int b)
{
	if (a < b)
		swap(&a, &b);

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

int lcm(int a, int b)
{
	return a*b/gcd(a, b);
}

void bubble_sort(int* p, int n)
{
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n - i - 1; j++)
		{
			if (p[j] > p[j + 1])
				swap(&p[j], &p[j + 1]);
		}
	}
}

int array_max(int* p, int n)
{
	int max = 0;
	for (int i = 0; i < n; i++)
	{
		if (p[i] > max)
			max = p[i];
	}
	return max;
}

int binary_search(int* p, int key, int n)
{
	int low = 0, high = n - 1;
	int middle;

	while (low <= high)
	{
		middle = (low + high) / 2;

		//printf("low %d  middle %d  high %d\n", low, middle, high);

		//for (int i = 0; i < n; i++)
		//{
		//	if (i == middle)
		//		printf(" ^ ");
		//	else if (i == low)
		//		printf(" [ ");
		//	else if (i == high)
		//		printf(" ] ");
		//	else if (i == middle)
		//		printf(" ^ ");
		//	else
		//		printf("   ");
		//}
		//printf("\n");

		if (key == p[middle])
			return key;
		else if (key < p[middle])
			high = middle - 1;
		else if (key > p[middle])
			low = middle + 1;
	}

	//printf("low %d  middle %d  high %d\n", low, middle, high);
	return -1;
}

int main()
{
	long long int A, B, K;
	long long int tmp;

	scanf("%lld%lld%lld", &A, &B, &K);

	tmp = A;

	if (K - A > 0)
	{
		if (K - A <= B)
			B -= (K - A);
		else 
			B = 0;

		A = 0;
	}
	else
		A -= K;

	printf("%lld %lld\n", A, B);

	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<math.h>

int main(void){
  int i, count;
  char S[4], prev;

  scanf("%s", S);
  prev='S';
  count=0;
  for(i=0; i<3; i++){
    if(S[i]=='R'){
      if( S[i]==prev )  count++;
      else count=1;
    }
    prev=S[i];
}
  printf("%d", count);
  return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <queue>
#include <stack>
#include <string.h>
#include <list>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define all(a)  (a).begin(), (a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i = 0; i < n; i++)
#define repR(i,n) for(int i = n-1; i >= 0; i--)
#define FOR(i,m,n) for(int i = m; i < n; i++)
#define PB push_back
#define MP make_pair
#define INF (1e12)
#define MAX 500000



int main(){
    int n, m;
    map<string, int> mp;
    cin >> n;
    rep(i,n){
        string s;
        cin >> s;
        if(mp.find(s) == mp.end()) mp[s] = 1;
        else mp[s]++;
    }

    cin >> m;
    rep(i,m){
        string t;
        cin >> t;
        if(mp.find(t) == mp.end()) mp[t] = -1;
        else mp[t]--;
    }
    
    int ans = 0;
    for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
        if (itr->second > ans) {
            ans = itr->second;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if ((a * b) % 2 == 0)
            System.out.println("Even");
        else
            System.out.println("Odd");
    }
}

Measured memory_bytes: 22740
from itertools import permutations

n = int(input())
p1 = [int(x) for x in input().split()]
p2 = [int(x) for x in input().split()]
p1 = tuple(p1)
p2 = tuple(p2)
first = [x for x in range(1, n+1)]

for i, p in enumerate(permutations(first)):
    if p == p1:
        a = i
    if p == p2:
        b = i

print(abs(a-b))


Measured memory_bytes: 3060
/* while(!success_achieved())
      work_hard();

   code by:aman_ayush
  */
#include <bits/stdc++.h>
using namespace std;

#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ll long long
#define ldb long double 
#define db double
#define str string

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

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

#define vi vector<int>
#define vll vector<ll>
#define vdb vector<db>
#define vldb vector<ldb>
#define vpi vector< pi >
#define vpll vector< pll >

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


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

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

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

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

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

int main()
{
    fast;
     int n,k;
     cin>>n>>k;
     db p=0;
     for(int i=1;i<=n;i++)
     {
         if(i>=k)
         {
             db y=(double)(1.00)/(double)(n);
             p+=y;
         }
          else
          {
              int l=1,z=i*2;
              while(z<k)
              {
               l++;
               z*=2;
              }
               //cout<<l<<"\n";
              db pw=pow(0.5,l);
              db y=(double)(1.00)/(double)(n);
              p+=pw*y;
          }
     }
     cout.precision(17);
     cout<<p<<"\n";
     return 0;
}

Measured memory_bytes: 256
import math
from itertools import accumulate

def eratosthenes(n):
    is_prime = [True for _ in range(n)]
    is_prime[0] = False

    for i in range(2, n+1):
        if is_prime[i-1]:
            j = 2 * i
            while j <= n:
                is_prime[j-1] = False
                j += i
    table = [i for i in range(1, n+1) if is_prime[i-1]]
    return table

max_lr = 100000
er_list = eratosthenes(max_lr)
count = [0] * max_lr


for i in range(len(er_list)):
    if (er_list[i]+1)//2 in er_list:
        count[er_list[i]] = 1
            
count = list(accumulate(count))
            
Q = int(input())
for i in range(Q):
    l, r = map(int, input().split())
    print(count[r]-count[l-1])

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
  string s; cin>>s;
  ll res = 700;
  if(s.at(0)=='o')res+=100;
  if(s.at(1)=='o')res+=100;
  if(s.at(2)=='o')res+=100;
  cout<<res<<endl;
}


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

int main() {
    ll n;
    std::cin >> n;
    vector<ll> a(n);
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        sum = sum^a[i];
    }
    for (int i = 0; i < n; i++) {
        std::cout << (sum^a[i])<<" ";
    }
    std::cout << std::endl;
}


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

using namespace std;

#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair
#define fi first
#define se second

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

int main() {
	lli n, k, l[15], r[15], bigmod = 998244353, suff[200005], x, y, temp;
	scanf("%lld %lld", &n, &k);
	for (lli i = 0; i < k; i++)
		scanf("%lld %lld", &l[i], &r[i]);
	suff[n + 1] = 0;
	suff[n] = 1;
	for (lli i = n - 1; i > 0; i--) {
		suff[i] = 0;
		for (lli j = 0; j < k; j++) {
			x = l[j];
			y = min(r[j], n - i);
			if (x > y)
				continue;
			temp = (suff[i + x] - suff[i + y + 1] + bigmod) % bigmod;
			suff[i] = (suff[i] + temp) % bigmod;
		}
		suff[i] = (suff[i] + suff[i + 1]) % bigmod;
	}
	printf("%lld\n", (suff[1] - suff[2] + bigmod) % bigmod);
}

Measured memory_bytes: 5364