akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.util.stream.Collectors;

public class Main {
  public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    HashMap<String, Integer> map = new HashMap<>();

    int n = sc.nextInt();
 	for(int i=0;i<n;i++){
      String sval = sc.next();
      map.put(sval,map.getOrDefault(sval,0)+1);
    }
    
    int m = sc.nextInt();
    for(int j=0;j<m;j++){
      String sval = sc.next();
      map.put(sval,map.getOrDefault(sval,0)-1);
    }
    
    map = map.entrySet().stream()
				.sorted(Map.Entry.<String,Integer>comparingByValue().reversed())
				.collect(Collectors.
						toMap(Map.Entry::getKey,Map.Entry::getValue,(val, sval)->val,LinkedHashMap::new));
    
    System.out.println(Math.max(map.values().stream().findFirst().get(), 0));
    
  }
}

Measured memory_bytes: 27472
// atcoder/abc138/D/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

const int N = 2 * 1e5 + 5;
lli x[N];
vector<int> g[N];

void rec(int curr, int prev)
{
  if (prev != -1) {
    x[curr] += x[prev];
  }
  each (next, g[curr]) {
    if (next != prev) rec(next, curr);
  }
  return ;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, q;
  while (cin >> n >> q) {
    fill(x, x + N, 0);
    fill(g, g + N, vector<int>());
    for (int i = 0; i < n - 1; ++i) {
      int a, b;
      cin >> a >> b;
      --a;
      --b;
      g[a].push_back(b);
    }
    for (int i = 0; i < q; ++i) {
      int p, y;
      cin >> p >> y;
      --p;
      x[p] += y;
    }
    rec(0, -1);
    for (int i = 0; i < n; ++i) {
      cout << x[i] << ' ';
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 24320
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{
  public static void main (String[] args){

	int A,B,C;
	int[] MAX = new int[3];
	int max = 0;
	int tmp = 0;
	Scanner sc = new Scanner (System.in);
		A=sc.nextInt();
		B=sc.nextInt();
		C=sc.nextInt();

	MAX[0] = A*10 + B    + C;
	MAX[1] = A    + B*10 + C;
	MAX[2] = A    + B    + C*10;

	for(int i = 0; i < MAX.length; i++)
		max = Math.max(max,MAX[i]);

		System.out.println(max);

  }

}

Measured memory_bytes: 21716
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
#include <climits>
#include <chrono>
#include <fstream>
using namespace std;

#pragma region

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

const double PI = acos(-1.0);

using ll = long long;
using P = pair<int, int>;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter = " ") { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

#pragma endregion


int main() {
    string s;
    cin >> s;
    int len = s.size();
    bool ok = true;
    if (len % 2) ok = false;
    else {
        rep(i, len / 2) if (s.substr(i * 2, 2) != "hi") ok = false;
    }
    cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3600
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]
ninf = -float("inf")
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？


n=ii()
arr=limii()

dp = [[0]*(2) for _ in range(n+1)]

dp[0][1]=ninf
for i in range(n):
    dp[i+1][0]=max(dp[i][0]+arr[i],dp[i][1]-arr[i])
    dp[i+1][1]=max(dp[i][0]-arr[i],dp[i][1]+arr[i])

print(dp[n][0])





Measured memory_bytes: 92940
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int max(int a,int b){
    return a > b ? a : b;
}
int main(void){
    int N,M,K;
    cin >> N >> M >> K;
    long A[200001];
    long B[200001];
    A[0] = B[0] = 0;
    int ans = 0;
    for(int i=1;i<=N;i++)cin >> A[i];
    for(int i=1;i<=M;i++)cin >> B[i];
    
    for(int i=1;i<N;i++){
        A[i+1] += A[i];
    }
    for(int i=1;i<M;i++){
        B[i+1] += B[i];
    }
    
    int j = M;
    for(int i=0;i<=N;i++){
        if(A[i] > K)break;
        while(A[i]+B[j] > K){
            j--;
        }
        ans = max(ans,i+j);
    }
    cout << ans << endl;
    
}


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

using namespace std;
using ll = long long;
using v1 = vector<int>;
using vl = vector<long long>;
using v2 = vector<vector<int>>;
using v3 = vector<vector<char>>;

int main(){
	int n;
	cin >> n;
	int p = 0;
	while(p < n){
		p += 1000;
	}
	cout << p - n << endl;
}


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

#define rep(i,n) for(int i=0;i<(n);++i)
#define loop for(;;)
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;
#define all(v) begin(v),end(v)
#define pb push_back
#define inf (1e9)
#define eps (1e-9)

typedef long long Integer ;
typedef long double Real;
const Real PI = acosl(-1);
typedef pair<int, int> P;

template<class S, class T> inline
ostream& operator<<(ostream&os, pair<S,T> p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template<class S, class T, class U> inline
ostream& operator<<(ostream&os, tuple<S,T,U> t) {
  return os << '('
    << get<0>(t) << ", "
    << get<1>(t) << ", "
    << get<2>(t) << ')';
}

template<class T> inline
ostream& operator<<(ostream&os, set<T> v) {
  os << "(set";
  for (T item: v) os << ' ' << item;
  os << ")";
  return os;
}

template<class T> inline
ostream& operator<<(ostream&os, vector<T> v) {
  if (v.size() == 0) { return os << "(empty)"; }
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

template<class T> inline
istream& operator>>(istream&is, vector<T>&v) {
  rep (i, v.size()) is >> v[i];
  return is;
}

//           ^   >  v   <
int dx[] = { -1, 0, 1,  0 };
int dy[] = {  0, 1, 0, -1 };

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<bool> vb;

char f[100][100];
string s[100][100];

bool comp(string s, string t) {
  if (s.size() != t.size()) return (s.size() < t.size());
  rep (i, s.size()) if (s[i] != t[i]) return (s[i] < t[i]);
  return true;
}

int main()
{

  int w, h;
  while (cin >> w >> h, w and h)
  {
    rep (i, h) rep (j, w) cin >> f[i][j];
    rep (i, h) rep (j, w) s[i][j] = "";

    rep (i, h) {
      rep (j, w) {
        char c = f[i][j];
        if (not isdigit(c)) continue;
        if (i == 0 and j == 0) {
          if (c != '0') s[i][j] += c;
        }
        else if (i == 0) {
          s[i][j] = s[i][j-1] + c;
          if (s[i][j] == "0") s[i][j] = "";
        }
        else if (j == 0) {
          s[i][j] = s[i-1][j] + c;
          if (s[i][j] == "0") s[i][j] = "";
        }
        else {
          if (comp(s[i-1][j], s[i][j-1])) {
            s[i][j] = s[i][j-1] + f[i][j];
          } else {
            s[i][j] = s[i-1][j] + f[i][j];
          }
          if (s[i][j] == "0") s[i][j] = "";
        }
      }
    }

    string ans = "";
    rep (i, h) {
      rep (j, w) {
        if (comp(ans, s[i][j])) ans = s[i][j];
      }
    }
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 1444
function f(x, y) {
  if (x < y) {
    return "<";
  } else if(x > y) {
    return ">";
  }
  return "=";
}

function main(input) {
  input = input.split("\n");
  const xy = input[0].split(" ");
  const result = f(xy[0], xy[1]);
  console.log(result);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

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

    string S;
    cin >> S;
    int cnt = 0;
    for (int i = 0; i < S.size() / 2; i++) {
        if (S[i] != S[S.size() - i - 1]) cnt++;
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<int,int>
#define print(n) cout<<n<<endl
const int M=100010;
const int MOD=1000000007;
const int INF=1000000007;
using ll=long long;

ll n,x,ans=0;
ll a[50]={},p[50]={};

ll dfs(ll n,ll x){
	if(n==0){
		if(x<=0)return 0;
		else return 1;
	}
	if(x<=a[n-1]+1)return dfs(n-1,x-1);
	else return p[n-1]+1+dfs(n-1,x-a[n-1]-2);
}

int main(){
	cin>>n>>x;
		a[0]=p[0]=1;
	rep(i,1,n+1){
		a[i]=a[i-1]*2+3;
		p[i]=p[i-1]*2+1;
	}
	print(dfs(n,x));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;

int main()
{
	int n,c,k;
	cin >> n >> c >> k;
	vector<int> T(n);
	rep(i,n)
	cin >> T[i];
	sort(ALL(T));

	int now = T[0];
	int ans =1;
	int kyaku=1;
	rep(i,n)
	{
		
		if(now+k<T[i]||kyaku==c+1)
		{
			//cout<<now<<';'<<kyaku<<';'<<endl;
			now = T[i];
			kyaku=1;
			
			ans++;
		}
		kyaku++;

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

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

using namespace std;

typedef long long ll;

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

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

	cout << max({a + b, a - b, a * b}) << endl;
}


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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define chmax(s, t) s=max(s,t);
#define chmin(s, t) s=min(s,t); 

#define deg2rad(deg) (((deg)/360)*2*M_PI)
#define rad2deg(rad) (((rad)/2/M_PI)*360)

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const ll INF = (1LL<<60);
const int INFi = (1<<29);

/*素数判定*/
bool is_prime(ll n){
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return true;
}

/*約数列挙*/
vll enum_divisors(ll n){
    vll l;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            l.push_back(i);
            if(n/i != i) l.push_back(n/i);
        }
    }
   sort(all(l));
   return l;
}

/*素因数分解*/
vector<P> prime_factorize(ll n){
    vector<P> l;
    for(ll i=2;i*i<=n;i++){
        if(n%i!=0) continue;
        ll e = 0;
        while(n%i==0){
            e++;
            n /= i;
        }
        l.push_back({i, e});
    }
    if(n!=1) l.push_back({n, 1});
    return l;
}

/*最小公倍数*/
ll lcm(ll a, ll b){
    return a*b/__gcd(a,b);
}

/*最大公約数*/
ll gcd(ll a, ll b){
    return __gcd(a,b);
}

/*組み合わせ(Combination)*/
const ll CMAX = 1010000;
const ll CMOD = 1e9+7;
ll fac[CMAX], finv[CMAX], inv[CMAX];
// テーブルを作る前処理
void combinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < CMAX; i++) {
		fac[i] = fac[i - 1] * i % CMOD;
		inv[i] = CMOD - inv[CMOD%i] * (CMOD / i) % CMOD;
		finv[i] = finv[i - 1] * inv[i] % CMOD;
	}
}
// 二項係数計算
ll comb(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % CMOD) % CMOD;
}

/*階乗*/
ll factorial(ll n){
    const ll FMOD = 1e9+7;
    ll ret = n;
    for(ll i=n-1;i>0;i--){
        ret*=i;
        ret%=FMOD;
    }
    return (ret?ret:1);
}


int main(){

    string s; cin >> s;
    set<char> st;
    map<char, ll> mp;

    for(char c:s){
        mp[c]++;
        st.insert(c);
    }

    for(char c:st){
        if(mp[c] != 2){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <climits>
#include <algorithm>
using namespace std;

// 入力
int n, W;
int weight[110], value[110];

// DPテーブル
int dp[110][10010];

int main() {
  cin >> n >> W;
  for (int i = 0; i < n; ++i) cin >> value[i] >> weight[i];

  // DP初期条件: dp[0][w] = 0
  for (int w = 0; w <= W; ++w) dp[0][w] = 0;

  // DPループ
  for (int i = 0; i < n; ++i) {
    for (int w = 0; w <= W; ++w) {
      if (w >= weight[i]) dp[i+1][w] = max(dp[i][w-weight[i]] + value[i], dp[i][w]);
      else dp[i+1][w] = dp[i][w];
    }
  }

  cout << dp[n][W] << endl;
}


Measured memory_bytes: 7068
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int A[200010];
    rep(i, N) cin >> A[i];
    ll ans = 0;
    int height = A[0];
    rep(i, N) {
        ans += max(0, height - A[i]);
        height = max(height, A[i]);
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 4416
//“ In order to be irreplaceable, one must always be different”
#include <bits/stdc++.h>
using namespace std;
# define ll long long
#define endl "\n"
# define pi 3.14159265359
#define MOD 1000000007
# define str string
# define vll vector<ll>
# define vstr vector<str>
# define vchar vector<char>
# define pb push_back
# define mll map<ll,ll>
#define mchar map<char, ll>
# define mstr map<str,ll>
# define vp vector< pair<ll,ll> >
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
# define f(x,y) for(int x=0;x<y;x++)
# define r(x,y) for(int x=y;x>=0;x--)
# define loop(x,y,z) for(int x=y;x<z;x++)
ll power(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll logx(ll base, ll num){int cnt=0;while(num!=1){num/=base; ++cnt;}return cnt;}
ll gcd(ll a, ll b){
    if(b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b){
    return (a/gcd(a, b))*b;
}
void print(vll a){
    for(int i=0;i<a.size();i++){
        cout<<a[i]<<' ';
    }
    cout<<endl;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll x,y;
    cin>>x>>y;
    if(y==0){
        cout<<x;
        return 0;
    }
    mll m;
    ll a[y];
    f(i,y){
        cin>>a[i];
        m[a[i]]++;
    }
    ll x1=x;
    while(true){
        if(m.find(x1)==m.end()){
            cout<<x1;
            break;
        }
        else{
            x1--;
        }
        if(m.find(x)==m.end()){
            cout<<x;
            break;
        }
        else{
            x++;
        }
    }
    return 0;
}

Measured memory_bytes: 3664
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
 class Node{
	
	String name;
	int time;
	
	public Node(String name, int time) {
		this.name = name;
		this.time = time;
	}
}

public class Main{
	
	public static void main(String[] args) {
		Queue<Node> q = new LinkedList<>();
		Queue<String> result = new LinkedList<>();
		Scanner in = new Scanner(System.in);
		int processes = in.nextInt();
		int quantum = in.nextInt();
		
		for(int i = 0; i < processes; i++) {
			q.add(new Node(in.next(), in.nextInt()));
		}
		
		int timer = 0;
		while(!(q.isEmpty())) {
			Node task = q.remove();
			if(task.time <= quantum) {
				timer = timer + task.time;
				System.out.println(task.name + " " + Integer.toString(timer));
			}
			else {
				task.time = task.time - quantum;
				q.add(task);
				timer = timer + quantum;
			}
			
			
		}
			
	}
		
}
	


Measured memory_bytes: 76640
#define __USE_MINGW_ANSI_STDIO
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef long long ull;
typedef pair<ll, ll> ii;

#define all(v)		((v).begin()), ((v).end())
#define sz(v)		((int)((v).size()))
#define endl		"\n"
#define fx(n)		fixed<<setprecision(n)
#define mk			make_pair	

void File()
{
#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
#ifdef ONLINE_JUDGE
	/*freopen("output.txt", "w", stdout);
	freopen("commandos.in", "r", stdin);*/
#endif
}
void fast()
{
	ios::sync_with_stdio(NULL);
	cout.tie(NULL);
	cin.tie(NULL);
	//File();
}
const double pi = acos(-1.0);
const ll oo = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int nn = 1e3 + 15;
int dx[8] = { 1, 0, -1, 0, 1, -1, 1, -1 };
int dy[8] = { 0, 1, 0, -1, 1, -1, -1, 1 };

int n, m;
int dp[nn][nn];
char grid[nn][nn];
int main()
{
	fast();
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
	for (int j = 1; j <= m; j++)
		cin >> grid[i][j];
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			if (i == j&&j == 1)
				dp[i][j] = 1;
			else if (grid[i][j] == '.')
				dp[i][j] = (dp[i - 1][j] % MOD + dp[i][j - 1] % MOD) % MOD;
		}
	}
	cout << dp[n][m] << endl;
	return 0;
}

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

int main() {
    int max, cent, min;
    cin >> max >> cent >> min;

    if (max < cent) {
        int temp = max;
        max = cent;
        cent = temp;
        if (min > max) {
            int temp = max;
            max = min;
            min = temp;
        }
    }
    if (cent < min) {
        int temp = min;
        min = cent;
        cent = temp;
   }
    cout << min <<" "<< cent << " " << max << endl;
}


Measured memory_bytes: 3104
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		long[] A = new long[N];
		for (int i = 0; i < A.length; i++) {
			A[i] = in.nextLong();
		}
		long[] left = new long[N + 1];
		long[] right = new long[N + 1];
		for (int i = 0; i < N; i++) {
			left[i + 1] = gcd(left[i], A[i]);
		}
		for (int i = N - 1; i >= 0; --i) {
			right[i] = gcd(right[i + 1], A[i]);
		}
		long ans = 0;
		for (int i = 0; i < N; i++) {
			long l = left[i];
			long r = right[i + 1];
			ans = Math.max(ans, gcd(r, l));
		}
		System.out.println(ans);
		in.close();
	}

	static long gcd(long m, long n) {
		if (m < n) {
			long d = n;
			n = m;
			m = d;
		}
		if (n <= 0) {
			return m;
		}
		long temp;
		while (m % n != 0) {
			temp = n;
			n = m % n;
			m = temp;
		}
		return n;
	}
}

Measured memory_bytes: 52924
// Gaurav Aggarwal
 
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii > vii;
typedef vector<pll > vll;
#define pb push_back
#define mp make_pair 
#define mod 1000000007
#define F first
#define S second
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define For(i, a, b) for(__typeof (a) i=a; i<=b; i++)
#define inp_arr(a,n) for(__typeof (n) i=0; i<n; ++i) {cin>>a[i];}
#define debug_arr(a,n) {{for(__typeof (n) i=0; i<n; ++i) {cout<<a[i]<<" ";}cout<<"\n";}}
 
ll power(ll x, ll y) 
{ 
    ll res = 1;   
    while (y > 0) { 
        if (y & 1) 
            res = (res*x)%mod; 
        y = y>>1;
        x = (x*x)%mod; 
    } 
    return res%mod; 
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("out.txt", "w", stdout); 
    // #endif  

  	string s,t;
  	cin>>s>>t;
  	cout<<t<<s<<"\n";

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n;
    cin >> n;

    string s;
    cin >> s;

    int p[3] = {};
    for (int i = 0; i < n; i++) {
        p[s[i] %= 3]++;
    }

    ll r = (ll)p[0] * p[1] * p[2];

    for (int i = 0; i < n; i++) {
        for (int j = i + 2; j < n; j += 2) {
            int k = (i + j) / 2;
            if ((s[i] ^ s[j] ^ s[k]) == 3) r--;
        }
    }

    cout << r << endl;

    return 0;
}

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

typedef long long ll;

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int n;
    ll x;
    cin >> n >> x;
    vector<ll> a(n),b(n);
    for (int i = 0;i < n;++i) cin >> a[i];
    for (int j = 0;j < n;++j) b[j] = a[j];
    ll ans = (1LL<<45);
    for (int i = 0;i < n;++i) {
        ll temp = 0;
        for (int j = 0;j < n;++j) {
            if (b[j] > a[(j-i+n)%n]) b[j] = a[(j-i+n)%n];
            temp += b[j];
        }
        if (ans > temp+x*i) ans = temp+x*i;
    }
    cout << ans << endl;
    return 0;
}

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


int main(){

	string s;
	cin >> s;

	if(s == "Sunny") cout << "Cloudy" << endl;
	if(s == "Cloudy") cout << "Rainy" << endl;
	if(s == "Rainy") cout << "Sunny" << endl;

	return 0;
}

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

typedef long long ll;

ll n, x;
ll GetAns(ll a, ll b) {
	if(a < b) std::swap(a, b);
	return a % b ? GetAns(b, a % b) + 2 * (a / b) * b : 2 * (a / b) * b - b;
}

int main() {
	scanf("%lld%lld", &n, &x);
	printf("%lld", GetAns(x, n - x) + n);
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)

	m := [10][10]int{}
	for i := 1; i <= n; i++ {
		s := strconv.Itoa(i)
		l, r := s[:1], s[len(s)-1:]
		li, _ := strconv.Atoi(l)
		ri, _ := strconv.Atoi(r)
		m[li][ri]++
	}

	ans := 0
	for i := 1; i <= n; i++ {
		s := strconv.Itoa(i)
		l, r := s[:1], s[len(s)-1:]
		li, _ := strconv.Atoi(l)
		ri, _ := strconv.Atoi(r)
		ans += m[ri][li]
	}

	fmt.Println(ans)
}


Measured memory_bytes: 3200
N, x, y = map(int, input().split())

cnt = {n: 0 for n in range(1, N)}
for i in range(1, N + 1):
    for j in range(i+1, N + 1):
        d1 = abs(i - j)
        d2 = 1 + min(abs(x - i) + abs(y - j), abs(x - j) + abs(y - i))
        cnt[min(d1, d2)] += 1

for k in range(1, N):
    print(cnt[k])


Measured memory_bytes: 50268
use std::io;

fn gets() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn main() {
    let line = gets();
    let n = line.trim().parse::<usize>().ok().unwrap();
    let (mut ac, mut tle, mut wa, mut re) = (0, 0, 0, 0);
    for _ in 0..n {
        let line = gets();
        let s = line.trim();
        match s {
            "AC" => ac += 1,
            "TLE" => tle += 1,
            "WA" => wa += 1,
            _ => re += 1,
        }
    }
    println!("AC x {}", ac);
    println!("WA x {}", wa);
    println!("TLE x {}", tle);
    println!("RE x {}", re);
}


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

#define fast_cin() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define FOR(i, x, n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()
#define pb push_back
#define eb emplace_back
#define trav(a, x) for(auto& a: x)
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define MOD 1000000007

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

int main() {
    fast_cin();
    int n, r;cin>>n>>r;
    int ans = r + 100*(10-n);
    if(n<10)
        cout<<ans<<endl;
    else
        cout<<r<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

int MOD = 1e9 + 7;

int add(int a, int b) {
    a += b;
    if (a >= MOD) {
        a -= MOD;
    }
    return a;
}

int mult(int a, int b) {
    return ((ll) a * b) % MOD;
}

int binpow(int a, int b) {
    if (b == 0) {
        return 1;
    }
    if (b == 2 || (b & 1)) {
        return mult(a, binpow(a, b - 1));
    }
    return binpow(binpow(a, b / 2), 2);
}

int rev(int a) {
    return binpow(a, MOD - 2);
}

const int maxn = 200100;
int fact[maxn], rev_fact[maxn];

void pre_calc() {
    fact[0] = rev_fact[0] = 1;
    for (int i = 1; i < maxn; i++) {
        fact[i] = mult(fact[i - 1], i);
        rev_fact[i] = rev(fact[i]);
    }
}

int f(int n, int k) {
    return mult(mult(fact[n + k], rev_fact[n]), rev_fact[k]);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;

    pre_calc();

    int h, w, a, b;
    cin >> h >> w >> a >> b;

    int ans = 0;
    for (int i = 1; i <= h - a; i++) {
        ans = add(ans, mult(f(i - 1, b - 1), f(h - i, w - b - 1)));
    }
    cout << ans << '\n';

    return 0;
}

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

#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
#define CININIT cin.tie(0),ios::sync_with_stdio(false)
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }

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

int main(){
    CININIT;
    ll N;
    cin >> N;
    vector<ll> a(N);
    rep(i,N){
        cin>>a[i];
        a[i]--;
    }

    ll ans=0;
    rep(i,N){
        int b = a[i];
        if(i==a[b]) ans++;
    }
    cout << ans/2 << endl;
}


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<cstdlib> 
#include<string>
#include<math.h>
#include<bitset>
#include<algorithm>
#include<vector>
#include<set>
#include<stack>
#include<queue>
using namespace std;

unsigned long long x = 1000000007;
 
unsigned long long kaijou(unsigned long long a){
    if(a==1){
        return 1;
    }else{
        unsigned long long b = a * kaijou(a-1) % x;
        return b;
    }
}
 
int main(){
 
	unsigned long long n,m;
	cin>>n>>m;
	
	if(n-m==1 || n-m==-1){
	    unsigned long long ans = kaijou(n)*kaijou(m)%x;
        cout<<ans<<endl;
	}else if(n==m){
	    unsigned long long ans =2 * kaijou(n)*kaijou(m)%x;
	    cout<<ans<<endl;
	}else{
	   cout<<0<<endl; 
	}
 
	//while(1);
 
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
int f(int x) {
	return 1 + std::min(abs(0 - x), std::abs(2000 - x));
}
int main() {
	int n;
	while (std::cin >> n) {
		int comb = 0;
		for (int i = 0; i <= 2000; ++i) {
			int x0 = i;
			int x1 = n - x0;
			if (x1 < 0) {
				continue;
			}
			if (2000 < x1) {
				continue;
			}
			comb += f(x0) * f(x1);
		}
		std::cout << comb << std::endl;
	}
	return 0;
}

Measured memory_bytes: 3088
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
	string s;
	int N;
	cin >>N >>s;
	int cnt=0;
	for (int i = 2; i < s.size(); i++){
		if (s[i - 2] == 'A'&&s[i - 1] == 'B'&&s[i] == 'C'){
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}

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

int main() {
    double l;
    cin >> l;
    printf("%.12f\n", (double)l*l*l/27);

}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
#define int long long
#define rep(i,n) for(int i = 0; i < n; i++)
#define INF (long long)(1e18)
#define MOD (int)(1e9+7)
#define yn(f) (f?"Yes":"No")
#define YN(f) (f?"YES":"NO")
#define MAX_N 1
#define MAX_V 1

signed main(){
	int N, T, c, t, ans = INF, temp = 0;
	
	cin>>N>>T;
	for(int i = 1; i <= N; i++){
		cin>>c>>t;
		if(t <= T){
			if(ans > c){
				ans = c;
				temp = i;
			}
		}
	}
	
	if(ans == INF) cout<<"TLE"<<endl;
	else cout<<ans<<endl;
	return 0;
}

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

const int mod = 1E+09 + 7;

template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }

  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }

  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }

  static int get_mod() { return mod; }
};

using modint = ModInt< mod >;

template< typename T >
struct Combination {
  vector< T > _fact, _rfact, _inv;

  Combination(int sz) : _fact(sz + 1), _rfact(sz + 1), _inv(sz + 1) {
    _fact[0] = _rfact[sz] = _inv[0] = 1;
    for(int i = 1; i <= sz; i++) _fact[i] = _fact[i - 1] * i;
    _rfact[sz] /= _fact[sz];
    for(int i = sz - 1; i >= 0; i--) _rfact[i] = _rfact[i + 1] * (i + 1);
    for(int i = 1; i <= sz; i++) _inv[i] = _rfact[i] * _fact[i - 1];
  }

  inline T fact(int k) const { return _fact[k]; }

  inline T rfact(int k) const { return _rfact[k]; }

  inline T inv(int k) const { return _inv[k]; }

  T P(int n, int r) const {
    if(r < 0 || n < r) return 0;
    return fact(n) * rfact(n - r);
  }

  T C(int p, int q) const {
    if(q < 0 || p < q) return 0;
    return fact(p) * rfact(q) * rfact(p - q);
  }

  T H(int n, int r) const {
    if(n < 0 || r < 0) return (0);
    return r == 0 ? 1 : C(n + r - 1, r);
  }
};

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

    modint ans(0);
    Combination<modint> COM(s+5);
    for(int i = 1; ; i++){
        if (i*3 > s)break;

        int res = s - i*3;
        ans += COM.C(res+i-1, i-1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3200
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
ll n;
ll a[1000010];
ll *p, *q;

int main() {
	while (cin >> n, n)
	{
		ll res = 0, t, s, color;
		for (int i = 0; i < n;i++)scanf("%lld", &a[i]);
		sort(a, a + n);
		color = a[0];
		t=res = upper_bound(a, a + n, a[0]) - lower_bound(a, a + n, a[0]);
		for (p = &a[0]; t < n; ) {
			p = upper_bound(a, a + n, *p);
			s = upper_bound(a, a + n, *p) - lower_bound(a, a + n, *p);
			t += upper_bound(a, a + n, *p) - lower_bound(a, a + n, *p);
			if (res < s) {
				res = s;
				color = *p;
			}
		}
		if (2 * res > n ) { cout << color << endl; }
		else cout << "NO COLOR" << endl;
	
	}
}

Measured memory_bytes: 11048
#include <cstdio>
#include <algorithm>
#define maxn 100010
using namespace std;
int n;
long long a[maxn];
long long ans1,ans2;
long long sum;
int main() {
	scanf("%d",&n);
	for (int i=1;i<=n;i++) {
		scanf("%lld",&a[i]);
	}
	sum=0LL; ans1=0LL;
	for (int i=1;i<=n;i++) {
		sum+=a[i];
		if (i%2==1) {
			if (sum<=0) {
				ans1+=1-sum;
				sum=1;
			}
		}
		else if (sum>=0) {
			ans1+=sum+1;
			sum=-1;
		}
	}
	sum=0LL; ans2=0LL;
	for (int i=1;i<=n;i++) {
		sum+=a[i];
		if (i%2==0) {
			if (sum<=0) {
				ans2+=1-sum;
				sum=1;
			}
		}
		else if (sum>=0) {
			ans2+=sum+1;
			sum=-1;
		}
	}
	printf("%lld\n",min(ans1,ans2));
	return 0;
}

Measured memory_bytes: 896
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().run();
	}

	public void run() {
		Scanner sc = new Scanner();
		int N = sc.nextInt();
		int C = sc.nextInt();
		int[][] D = new int[C][C];
		int[][] c = new int[N][N];
		for (int i = 0; i < C; ++i) {
			for (int j = 0; j < C; ++j) {
				D[i][j] = sc.nextInt();
			}
		}
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < N; ++j) {
				c[i][j] = sc.nextInt() - 1;
			}
		}

		int[][] rec = new int[3][C];
		for (int col = 0; col < C; ++col) {
			for (int i = 0; i < N; ++i) {
				for (int j = 0; j < N; ++j) {
					rec[(i + j) % 3][col] += D[c[i][j]][col];
				}
			}
		}

		int ans = Integer.MAX_VALUE / 3;
		for (int c1 = 0; c1 < C; ++c1) {
			for (int c2 = 0; c2 < C; ++c2) {
				for (int c3 = 0; c3 < C; ++c3) {
					if (c1 == c2 || c2 == c3 || c3 == c1)
						continue;
					int cur = rec[0][c1] + rec[1][c2] + rec[2][c3];
					ans = Math.min(ans, cur);
				}
			}
		}
		System.out.println(ans);
	}

	class Scanner {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;

		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[ptr++];
			else
				return -1;
		}

		private boolean isPrintableChar(int c) {
			return 33 <= c && c <= 126;
		}

		private void skipUnprintable() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr]))
				ptr++;
		}

		public boolean hasNext() {
			skipUnprintable();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while (true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}

		int nextInt() {
			return (int) nextLong();
		}
	}

}


Measured memory_bytes: 24252
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll n, m;
  string s, t;
  cin >> n >> m >> s >> t;
  
  rep(i, gcd(m,n)) if(s[i*n/gcd(m,n)]!=t[i*m/gcd(m,n)]) {cout << -1 << newl; return 0;}
  cout << lcm(m,n) << newl;
  return 0;
}

Measured memory_bytes: 3808
#include<bits/stdc++.h>
using namespace std;
#define de(x) cout<<#x<<"="<<x<<endl
const int N = 1e4+55;
int main(){
    int n,l,r,ans=0;
    cin>>n;
    for(int i=0;i<n;i++){
        scanf("%d %d",&l,&r);
        ans+=r-l+1;
    }
    cout<<ans<<endl;
}


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

q=0
print(q)
zero=input()

if zero=="Vacant":
    exit()

ll=1
rr=n-1

for _ in range(19):
    q=(ll+rr)//2
    print(q)
    s=input()
    if s=="Vacant":
        exit()
    elif q%2==0:
        if s==zero:
            ll=q+1
        else:
            rr=q
    else:
        if s==zero:
            rr=q
        else:
            ll=q+1



Measured memory_bytes: 61968
#include <bits/stdc++.h>
//登録しよう！→ https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示

void solve(long long L){
  double x = L/3.0;
  cout << syo(6) << x*x*x << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long L;
    scanf("%lld",&L);
    solve(L);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (long long i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair <int, int>;
const double PI = acos(-1);
const ll MOD = 1000000007;

int main() {
int N, A;
cin >> N >> A;
vector<int> X(N);
rep(i,N) cin >> X[i];

vector<vector<vector<ll>>> dp(51,vector<vector<ll>>(51,vector<ll> (2501,0)));



rep(j,N+1){
  rep(k,N+1){
    rep(s,N*50+1){
      if(j==0 && k == 0 && s == 0)dp[j][k][s] = 1;
      else if(j > 0 && s < X[j-1]) dp[j][k][s] = dp[j-1][k][s];
      else if(j > 0 && k > 0 && s >= X[j-1]) dp[j][k][s] = dp[j-1][k][s] + dp[j-1][k-1][s-X[j-1]];
      else dp[j][k][s] = 0;
      //cout << dp[j][k][s] << " ";
    }
    //cout << endl;
  }
  //cout << endl;
}

ll ans = 0;
rep(k,N+1) ans += dp[N][k][k*A];

cout << ans-1 << endl;

}


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

int main() {
	int N, K;
	cin >> N >> K;
	int p = 1;
	int count = 0;
	if (K > N) cout << 1 << endl;
	else {
		while (p < N) {
			p *= K;
			if (p == N) count++;
			count++;
		}
		cout << count << endl;
	}
}

Measured memory_bytes: 256
open System
open System.Runtime.InteropServices

let read() = Console.ReadLine() |> int

let A = read()
let B = read()
let C = read()
let X = read()

let cnt = ref 0

for c500 in 0..A do 
    for c100 in 0..B do 
        for c50 in 0..C do 
            if 500*c500 + 100*c100 + 50*c50 = X then
                incr cnt

cnt.Value
|> printfn "%i"


Measured memory_bytes: 14044
import itertools
n=int(input())
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))
seq=list(range(1,n+1))
l=list(itertools.permutations(seq))
p_i=l.index(p)
q_i=l.index(q)
print(abs(p_i-q_i))

Measured memory_bytes: 8052
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

typedef unsigned int uint;
typedef long long llong;
typedef unsigned long long ullong;
typedef long double ldouble;

typedef vector<llong> vecllong;
typedef vector<vecllong> vvecllong;

const llong MOD = 1e9 + 7;
const llong INF = 1e17;

#define FOR(i, n) for (llong i = 0; i < n; i++)
#define FORS(i, a, b) for (llong i = a; i < b; i++)
#define FORR(i, n) for (llong i = n; i > 0; i++)

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

    llong N;
    cin >> N;

    vecllong fact;
    llong div = 1;
    while(div * div <= N) {
        if(N % div == 0) {
            fact.push_back(div);
            fact.push_back(N / div);
        }
        div++;
    }

    llong ans = 0;
    for_each(fact.begin(), fact.end(), [&](llong div){
        if(div != N) {
            llong m = N / div - 1;
            llong q = N / m;
            llong r = N % m;
            if(q == r) {
                ans += m;
            }
        }
    });

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
import numpy as np
import sys

N = int(input())
#I = np.array(sys.stdin.read().split(), np.int64)
#A = I[:N]
#B = I[N:2*N]
#C = I[2*N:]

A = np.array(list(map(int,input().split())))
B = np.array(list(map(int,input().split())))
C = np.array(list(map(int,input().split())))

A.sort()
C.sort()

ans = 0
for i in range(N):
	b = B[i]
	A_cnt = np.searchsorted(A, b, side='left')
	C_cnt = np.searchsorted(C, b, side='right')
	ans += A_cnt * (N-C_cnt)

print(ans)

Measured memory_bytes: 24832
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include <fstream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#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())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define pb push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
#define MAX 100000 
using namespace std;
typedef long long int lli;
typedef unsigned long long ULL;
typedef long double LD;

int main(){
    string s;
    cin >> s;
    string t = "";
    for(int i = s.length()-3; i< s.length(); i++){
        t+=s[i];
    }
    if(t == "ABC"){
        cout << "ARC" << endl;
    }
    else{
        cout << "ABC" << endl;
    }
}

Measured memory_bytes: 3096
#include <iostream>
#include <string>
#include <bitset>
using namespace std;
int main(void){

    string S;
    cin >> S;
    
    for(int tem = 0; tem < (1 << 4); tem++){
        bitset<4> bit(tem);
        
        string s = "";
        s += S[0];
        int ans = stoi(S.substr(0,1));
        
        for(int i = 0; i < 3; i++){
            if(bit.test(i)){
                ans += stoi(S.substr(i+1,1));
                s += "+";
                s += S[i+1];
            }
            else{
                ans -= stoi(S.substr(i+1,1));
                s += "-";
                s += S[i+1];
            }
        }
        if(ans == 7){
            cout << s << "=7" << endl;
            return 0;
        }
    }
}

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

int lu(vector<int> &l, int N)
{
  if (N - 2 == 0)
  {
    return 0;
  }
  int sum = l.at(N - 1) + l.at(N - 2);
  return sum + lu(l, N - 1);
}

int main()
{
  int N;
  cin >> N;
  vector<int64_t> l(N + 1);
  l.at(0) = 2;
  l.at(1) = 1;
  //cout << lu(l, N) << endl;
  for (int i = 2; i <= N; i++)
  {
    l.at(i) = l.at(i - 1) + l.at(i - 2);
  }
  cout << l.at(N) << endl;
}


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

int main(){

int n;
long long a;
long long sum=0;
long long min=1000000;
long long max=-1000000;

cin >>n;

for(int i=0;i<n;i++){
cin >>a;
if(a<min) min=a;
if(a>max) max=a;
sum+=a;
}

cout << min <<" " <<max <<" " <<sum <<endl;

return 0;
}

Measured memory_bytes: 3088
#include <cstdio>
#include <algorithm>
using namespace std;
int n, cx, cy, x[100009], y[100009];
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d%d", &cx, &cy);
		x[i] = cx + cy;
		y[i] = cx - cy;
	}
	int xa = *min_element(x, x + n);
	int ya = *min_element(y, y + n);
	int xb = *max_element(x, x + n);
	int yb = *max_element(y, y + n);
	int ret1 = 0, ret2 = 0;
	for (int i = 0; i < n; i++) {
		int v1 = min(max(x[i] - xa, y[i] - ya), max(xb - x[i], yb - y[i]));
		int v2 = min(max(x[i] - xa, yb - y[i]), max(xb - x[i], y[i] - ya));
		ret1 = max(ret1, v1);
		ret2 = max(ret2, v2);
	}
	printf("%d\n", min(ret1, ret2));
	return 0;
}

Measured memory_bytes: 3480