akhauriyash/Code-Regression huggingface dataset:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
s = ''.join(sorted(S()))
t = ''.join((sorted(S(), reverse=True)))
if s < t:
    print('Yes')
else:
    print('No')

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

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vll;

int main() {
    ll n, c;
    cin >> n >> c;
    vll d(n), v(n);
    for (int i = 0; i < n; ++i) {
        cin >> d[i] >> v[i];
        if (i > 0) v[i] += v[i - 1];
    }
    vll cw(n), ccw(n);
    for (int i = 0; i < n; ++i) {
        cw[i] = v[i] - d[i];
        if (i > 0) cw[i] = max(cw[i], cw[i - 1]);
    }
    for (int i = n - 1; i >= 0; --i) {
        if (i == 0) {
            ccw[i] = v.back() - (c - d[i]);
        } else {
            ccw[i] = (v.back() - v[i - 1]) - (c - d[i]);
        }
        if (i < n - 1) ccw[i] = max(ccw[i], ccw[i + 1]);
    }
    ll cw_ccw = 0, ccw_cw = 0;
    for (int i = 0; i < n - 1; ++i) {
        cw_ccw = max(cw_ccw, v[i] - 2 * d[i] + ccw[i + 1]);
    }
    for (int i = n - 1; i > 0; --i) {
        ccw_cw = max(ccw_cw, v.back() - v[i - 1] - 2 * (c - d[i]) + cw[i - 1]);
    }
    ll ans = max(cw_ccw, ccw_cw);
    ans = max(ans, cw.back());
    ans = max(ans, ccw.front());
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3456
N, A, B = [int(x) for x in input().split()]
S = input()

ans = []
num_passed = 0
num_foreign = 0
for ch in S:
    if ch == "a":
        ans.append(num_passed < A + B)
    elif ch == "b":
        num_foreign += 1
        ans.append((num_passed < A + B) and (num_foreign <= B))
    else:
        ans.append(False)

    num_passed += 1 if ans[-1] else 0

print("\n".join(map(lambda x: "Yes" if x else "No", ans)))


Measured memory_bytes: 5108
from math import log2, ceil
N, K = map(int, input().split())

ans = 0
j = 1.0
for x in range(N, 0, -1):
    if x >= K:
        ans += 1.0 * (1 / N)
    else:
        while x * j < K:
            j *= 2.0
        ans += (1.0 / j) * (1 / N)
print(ans)


Measured memory_bytes: 9172
#include <iostream>
using namespace std;
int main(void){
    int n = 0;
    cin >> n;
    long A[1000], B[1000];
    for(int i = 0; i < 1000; i++){
        A[i] = 0;
        B[i] = 0;
    }
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }
    for(int i = 0; i < n; i++){
        B[i] = A[i];
    }
    int q = 0;
    cin >> q;
    for(int i = 0; i < q; i++){
        int b = 0, e = 0, m = 0;
        cin >> b >> m >> e;
        for(int j = 0; j < (e-b); j++){
            B[b+((j+(e-m)) % (e-b))] = A[b+j];
        }
        for(int j = 0; j < n; j++){
            A[j] = B[j];
        }
    }
    for(int i = 0; i < n-1; i++){
        cout << B[i] << " ";
    }
    cout << B[n-1] << endl;
    return 0;
}



Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    int N;cin >> N;
    vector<int> A(N),B(N);
    ll suma = 0,sumb = 0;
    REP(i,N){
        cin >> A[i];
        suma += A[i];
    }
    REP(i,N){
        cin >> B[i];
        sumb += B[i];
    }
    ll cnta = sumb - suma,cntb = sumb - suma;
    REP(i,N){
        if(B[i] - A[i] > 0){
            int s = B[i] - A[i];
            if(s % 2 == 1){
                cnta -= (s+1)/2;
                cntb--;
            }
            else cnta -= s/2;
        }
        else if(B[i] - A[i] < 0){
            int s = A[i] - B[i];
            cntb -= s;
        }
    }
    if(cnta >= 0 && cntb >= 0 && 2*cnta == cntb){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
       ll n;
      cin>>n;
       bool flag = false;
      while(n)
      {
        if(n%10 == 7)
        {
           cout<<"Yes"<<endl;
            flag = true;
           break;
        }
        n = n/10;
      }
      if(!flag)  cout<<"No"<<endl;
}

Measured memory_bytes: 3640
import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  type IP = (Int, Int)

  def check(p: IP, ps: IP, pl: IP): Boolean = {
    val (nx, ny) = p
    ps._1 <= nx && nx <= pl._1 && ps._2 <= ny && ny <= pl._2
  }


  val N, K = in.next().toInt
  val pos = new Array[IP](N)
  var xs = new Array[Int](N)
  var ys = new Array[Int](N)

  for(i <- 0 until N) {
    val x, y = in.next().toInt
    pos(i) = (x, y)
    xs(i) = x
    ys(i) = y
  }

  xs = xs.sorted
  ys = ys.sorted


  // imos
  val imos: Array[Array[Int]] = Array.ofDim[Int](N+1, N+1)
  for((nx, ny) <- pos) {
    var xi = -1; var yi = -1

    for(i <- 0 until N) {
      if(xs(i) == nx)
        xi = i
      if(ys(i) == ny)
        yi = i
    }

    imos(yi)(xi) += 1
  }

  for(y <- 0 until N)
    for(x <- 0 until N)
      imos(y)(x+1) += imos(y)(x)
  for(x <- 0 until N)
    for(y <- 0 until N)
      imos(y+1)(x) += imos(y)(x)


  var ans: Long = Long.MaxValue

  def calc(p: IP): Int = {
    val (nx, ny) = p
    if(nx >= 0 && ny >= 0)
      imos(ny)(nx)
    else
      0
  }

  for(ix <- 0 until N; jx <- 0 until N; iy <- 0 until N; jy <- 0 until N) {
    val hoge = imos(jy)(jx) - calc((jx, iy-1)) - calc((ix-1, jy)) + calc((ix-1, iy-1))

    if(hoge >= K)
      ans = Math.min(ans, (xs(jx).toLong-xs(ix))*(ys(jy)-ys(iy)))
  }
  println(ans)
}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}


Measured memory_bytes: 49176
#include <iostream>

constexpr int P = 1'000'000'007;

int powmod (int a, int b) {
  int ans = 1;
  for (; b > 0; b >>= 1, a = 1LL * a * a % P)
    if (b % 2) ans = 1LL * ans * a % P;
  return ans;
}

int binom (int m, int n) {
  int ans = 1;
  for (int i = 1; i <= n; ++i)
    ans = 1LL * ans * (m - i + 1) % P * powmod (i, P-2) % P;
  return ans;
}

int main () {
  int n, a, b;
  std::cin >> n >> a >> b;
  int ans = (powmod (2, n) - 1 + P) % P;
  ans = (ans - binom (n, a) + P) % P;
  ans = (ans - binom (n, b) + P) % P;
  std::cout << ans << "\n";
  return 0;
}

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

namespace ABC140_B_Buffet
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var B = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var C = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var result = 0;
            for (var i = 0; i < A.Length; i++)
            {
                result += B[A[i] - 1];
                if(i > 0 && A[i] - 1  == A[i - 1])
                {
                    result += C[A[i - 1] - 1];
                }
            }
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13396
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

koho = [6]
i = 1
while True:
    koho.append(i*7+1)
    koho.append(i*7+6)
    if i*7 > 300005:
        break
    else:
        i += 1

prime = []
limit = math.sqrt(koho[-1])
while True:
    p = koho[0]
    if limit <= p:
        prime = prime + koho
        break
    else:
        prime.append(p)
        koho = [e for e in koho if e%p != 0]


while True:
    N = inp()
    if N == 1:
        break
    else:
        ans = []
        for p in prime:
            if N%p == 0:
                ans.append(p)
        print(str(N)+':',' '.join(map(str,ans)))



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

typedef long long int ll;
typedef pair<ll,ll> P;

int main(){
    ll a,v,b,w;
    cin>>a>>v>>b>>w;
    ll t;
    cin>>t;
    ll sign=1;
    if(a>b){
        sign=-1;
    }
    if(sign*b+w*t-(sign*a+v*t)>0){
        cout<<"NO";
    }else{
        cout<<"YES";
    }

    return 0;
}


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

int main(void){
    queue<int> s[1010];
    int n, q;
    cin >> n >> q;
    for(int i=0; i<q; i++){
        int num, t, x;
        cin >> num;
        if(num==0){
            cin >> t >> x;
            s[t].push(x);
        }
        else if(num==1){
            cin >> t;
            if(s[t].size()>0)
            cout << s[t].front() << "\n";
        }
        else{
            cin >> t;
            if(s[t].size()>0)
            s[t].pop();
        }
    }
    
    return 0;
}



Measured memory_bytes: 4388
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

int A,B;
int x[111];
ll coudp[111][111][5555];
string divide[4] = { "dream","dreamer","erase","eraser" };
int main()
{

	char op;
	cin >> A >> op >> B;

	if (op == '+')
	{
		cout << A + B << endl;
	}
	else if (op == '-')
	{
		cout << A - B << endl;
	}

	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

m = [0 for i in range(n)]
for i in range(n):
    if i%2 == 0:
        m[0] += a[i]
    else:
        m[0] -= a[i]
for i in range(1, n):
    m[i] = 2*a[i-1] - m[i-1]

print(' '.join(map(str, m)))

Measured memory_bytes: 103124
def main():
    X = int(input())
    ans = 1
    b = 2
    while b**2 <= X:
        p = 2
        while b**p <= X:
            ans = max(ans, b**p)
            p += 1
        b += 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 38256
#include<bits/stdc++.h>
#include <assert.h>
using namespace std;
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define ll long long 
#define sum(a,b) a=a+b

int a[3];

int main() {

string s;

cin>>s;

if(s=="abc"||s=="acb"||s=="bac"||s=="bca"||s=="cba"||s=="cab"){
    cout<<"Yes"<<endl;
}else{
    cout<<"No"<<endl;
}


return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<utility>
#include<set>
using namespace std;
using ll = long long;

int main(){
    while(1){
        ll n,sum=0,cnt=0;
        cin >> n;
        if(n==0)    break;
        vector<ll> a(n);
        for(ll i=0;i<n;i++){
                cin >> a[i];
                sum+=a[i];
        }
        sum/=n;
        for(ll i=0;i<n;i++){
            if(a[i]<=sum)   cnt++;
        }
        cout << cnt << endl;
    }
}



Measured memory_bytes: 3128
#include <bits/stdc++.h>
const long long MOD = 1000000007;
const int INF = INT_MAX / 2;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
using namespace std;
string s;
vector<ll> v;
vector<pair<ll, ll>> vp;
vector<vector<ll>> vv(110, vector<ll>(50, 0));
vector<tuple<ll, ll, ll>> vt;
set<ll> st;
map<char, ll> mp;

typedef int Weight;
struct Edge
{
	int from, to; Weight cost;
	bool operator < (const Edge& e) const { return cost < e.cost; }
	bool operator > (const Edge& e) const { return cost > e.cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
void add_edge(Graph &g, int from, int to, Weight cost)
{
	g[from].push_back(Edge{ from, to, cost });
}

typedef pair<Weight, Edge> P;

int main()
{
	ll n, m, ans = 0;
	cin >> n >> m;
	ans += min(n, m / 2);
	m -= ans * 2;
	ans += m / 4;
	cout << ans << endl;
}

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

int main(){
	int n,k;
	cin >> n >> k;
	int ans = n-k+1 , last = n , cont = 0;
	bool t = false;
	vector<int> x(n);
	set<int> s;
	for(int i = 0 ; i < n ; i += 1){
		cin >> x[i];
		if(x[i] > last){
			cont += 1;
		}else{
			cont = 1;
		}
		last = x[i];
		if(i >= k){
			s.erase(x[i-k]);
		}
		if(cont >= k){
			t = true;
			ans -= 1;
		}else if(i >= k){
			if(x[i-k] < *s.begin() && x[i] > *s.rbegin()){
				ans -= 1;
			}
		}
		s.insert(x[i]);
	}
	ans += t;
	cout << ans << endl;
}

Measured memory_bytes: 10368
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int N = fs.nextInt();
        String S = fs.next(), T = fs.next();
        for (int i = 0; i < N; i++) System.out.print(S.charAt(i) + "" + T.charAt(i));
    }
}

class FastScanner {
    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 static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        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();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

Measured memory_bytes: 21460
#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
using namespace std;

/// Info.
///****************************************************************************************************************************************///
/// author                : BAHAA El-DEEN OSAMA .
/// Problem name          : A - Choose Two Numbers
/// Method                : brute force
/// Online judge          : vjudge(Contest)
/// Date                  : 8/6/2020
///****************************************************************************************************************************************///

string str;
int n,AC=0,WA=0,TLE=0,RE=0;

int main()
{

cin>>n;
for(int i=0 ; i<n ;i++)
{
    cin>>str;
    if(str == "AC"){++AC;}
    else if(str == "WA"){++WA;}
    else if(str == "TLE"){++TLE;}
    else if (str == "RE"){++RE;}
}






cout << "AC" << " x " << AC <<endl;
cout << "WA" << " x " << WA <<endl;
cout << "TLE" << " x " << TLE <<endl;
cout << "RE" << " x " << RE <<endl;



return 0;
}


Measured memory_bytes: 3612
/** Author : Parth Prajapati
 * 	Institute : Pandit Deendayal Petroleum University
**/
#include<bits/stdc++.h>

using namespace std;

#define l long // -2^31 to +2^31-1 (upper limit ~ 2*(10^9))
#define ul unsigned long // 0 to +2^32-1
#define ll long long // -2^63 to +2^63-1 (upper limit ~ 9*(10^18))
#define ull unsigned long long // 0 to +2^64-1
#define mod(x, m) ((((x)%(m))+(m))%(m))
#define vi vector<int>
#define pi pair<int,int>
#define vl vector<ll int>
#define pl pair<ll int,ll int>
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const ll MOD = 1e9 + 7;
const double pie = 3.141592653589793;
const ll int MD = 998244353 ;

#define setcount(x) __builtin_popcount(x) // counts set bits
#define parity(x) __builtin_parity(x) // checks parity of the number
#define lzcount(x) __builtin_clz(x) // count leading zeros in binary representation of number
#define tzcount(x) __builtin_ctz(x) // count trailing zeros in binary representation of number

template<typename T> T inf() { return (T)__builtin_inf();} // syntax for use inf<datatype>();
template<typename T> T gcd(T a,T b){ if(b>a) return gcd(b,a);return b==0?a:gcd(b,a%b); }
template<typename T> T lcm(T a, T b) { return (a*b)/gcd(a,b); }
template<typename T> T fast_power(T x,T y,ll m=MOD){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}

string IntToString(ll a){ ostringstream temp; temp << a; return temp.str();}
ll findMMI_fermat(ll n,ll M) {ll ans= fast_power(n,M-2,M);return ans;}//i.e In (a/b)%M..it calculates MMI of b wrt M,only if M is prime
ll add(ll a,ll b,ll M) { return ( mod(a,M ) + mod(b,M ))%M; }
ll sub(ll a, ll b,ll M) { return (mod(a,M ) + M - mod(b,M ))%M; }
ll mult(ll a,ll b,ll M) { return  ( mod(a,M)*mod(b,M) ) %M ; }
bool isprime(ll a){ if(a==2) {return 1;}if(!(a&1) ) {return 0;}for(ll i=3;i*i<=a;i+=2){if(a%i==0) {return 0;} } return 1;} 

/************************** main program **************************/

int main()
{
	FASTIO
	//code
	int n;
	cin>>n;
	string s,t;
	cin>>s>>t;
	int i;
	for(i=0;i<n;++i)
	{
		cout<<s[i]<<t[i];
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		double x1 = sc.nextDouble();
		double y1 = sc.nextDouble();
		double x2 = sc.nextDouble();
		double y2 = sc.nextDouble();
		
		System.out.println(String.format("%f", Math.pow(Math.pow(x1-x2, 2)+Math.pow(y1-y2, 2),0.5)));
	}
}


Measured memory_bytes: 28124
#include <iostream>
#include <map>
#include <cstdio>		// require scanf printf
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <fstream>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;

//bool hash[244140625LL];

int stoi (string s )
{
	stringstream ss (s );
	int res;
	ss >> res;

	return res;
}

ll encode_code (char s[] )
{
	const char code[] = { ' ', 'A', 'T', 'C', 'G' };
 
	ll res = 0LL;
	for (int i = 0; s[i] != '\0'; i++ ){
		ll curr = 0LL;
		rep (j, sizeof(code)/sizeof(code[0] ) ){
			if (s[i] == code[j] ){
				curr = (ll)j;
				break;
			} // end if
		} // end rpe
		res += curr;
		res *= 5LL;
	} // end rep

	return res;		
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.search_iii2", "r", stdin );
	int n;
	string str = "";
	getline (cin, str );
	n = stoi (str );
	map<ll, bool> hash;
	hash.clear();

	rep (i, n ){
		char com[7], s[12];
		scanf ("%s %s", com, s );
		if (com[0] == 'i' ){
			ll encode = encode_code (s );
			hash[encode] = true;
		}else{	// if (com == "find" )
			ll encode = encode_code (s );
//			if (hash[encode] ){
			if (hash.count (encode ) ){
				printf ("yes\n" );
			}else{
				printf ("no\n");
			} // en dif
		} // end if
	} // end rep
		
	return 0;
}

Measured memory_bytes: 9572
#include <iostream>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <algorithm>
using namespace std;

using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define REP1(i, n) for (ll i = 1; i <= n; i++)
#define REPR(i, n) for (ll i = n - 1; i >= 0; i--)
#define REPR1(i, n) for (ll i = n; i >= 1; i--)
#define FOR(i, m, n) for (ll i = m; i <= n; i++)

int gcd(int a, int b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

int main() {
    ll H;
    cin >> H;

    ll ans = 0;
    ll c = 1;

    while (H > 0) {
        H = H / 2;
        ans += c;
        c *= 2;
    }

    cout << ans << endl;

    return 0;
}


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

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("C0DEFESTIVAL2O16");
            //2
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("FESTIVAL2016CODE");
            //16
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        string S = InputList[0];

        int Answer = 0;
        string wkStr = "CODEFESTIVAL2016";
        for(int I=0;I<=wkStr.Length-1;I++){
            if (wkStr[I] != S[I]) Answer++;
        }
        Console.WriteLine(Answer);
    }
}


Measured memory_bytes: 2904
#include<bits/stdc++.h>
using namespace std;
int main() 
{
	ios::sync_with_stdio(false);
	int max = 0,sum=0;
	int n,a;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a;
		if (a >= max)
		{
			sum++;
			max = a;
		}
	}
	cout << sum;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			int t = sc.nextInt();
			int l = sc.nextInt();
			int b = sc.nextInt();
			if((n|t|l|b) == 0)break;
			int [] lList = new int[n+1];
			int [] bList = new int[n+1];
			for(int i = 0; i < l; i++){
				lList[sc.nextInt()] = 1;
			}
			for(int i = 0; i < b; i++){
				bList[sc.nextInt()] = 1;
			}
			double [][] dp = new double[t + 1][n + 1];
			for(int i = 0; i <= t; i++){
				Arrays.fill(dp[i], 0.0);
			}
			dp[0][0] = 1.0;
			for(int i = 0; i < t; i++){
				for(int j = 0; j < n; j++){
					for(int k = 1; k <= 6; k++){
						int  nextind = j + k;
						if(nextind <= n){
							
						}
						else{
							int diff = nextind - n;
							nextind = n - diff;
						}
						if(bList[nextind] == 1){
							dp[i+1][0] += dp[i][j] * (1.0 / 6);
						}
						else if(lList[nextind] == 1){
							if(i+2 <= t){
								dp[i+2][nextind] += dp[i][j] * (1.0 / 6);
							}
						}
						else{
							dp[i+1][nextind] += dp[i][j] * (1.0 / 6);
						}
					}
				}
				//n
				dp[i+1][n] += dp[i][n];
			}
			System.out.printf("%.6f\n",dp[t][n]);
		}
	}

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

Measured memory_bytes: 12000
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
int SIZE(string s){ return (int)s.size(); }
int n;
vector<vector<int>> t;

int wait(int ter, int time){
    if(time <= t[ter][1]) return t[ter][1] - time;
    else{
        int s = t[ter][1], f = t[ter][2];
        int num = (time-s)%f;
        if(num == 0) return 0;
        else return f- num;
    }
}

int main(){
    cin >> n;
    t.resize(n-1, vector<int>(3));
    rep(i,n-1) cin >> t[i][0] >> t[i][1] >> t[i][2];
    rep(i,n-1){
        int time = 0;
        for(int j = i; j < n-1; j++){
            time += wait(j,time);
            time += t[j][0];
        }
        cout << time << endl;
    }
    cout << 0 << endl;
    return 0;
}


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

int main(){
  string s;
  cin >> s;
  string t = "abcdefghijklmnopqrstuvwxyz";
  vector<int> b;
  for(char j : t){
    vector<int> a;
    int count = 0;
    for(int i = 0; i < s.size(); i++){
      if(s.at(i) != j) count++;
      if(s.at(i) == j){
        a.push_back(count);
        count = 0;
      }
      if(i == s.size() - 1){
        a.push_back(count);
      }
    }
    sort(a.rbegin(), a.rend());
    b.push_back(a.at(0));
  }
  sort(b.begin(), b.end());
  cout << b.at(0);
}

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

int main(){
	int N;
	cin >> N;
	ll H[N];
	rep(i,N) cin >> H[i];
	int ans = 0;
	int tmp = 0;
	for (int i = N-2; i >=0; i--) {
		if (H[i]>=H[i+1]) {
			tmp++;
			ans = max(ans,tmp);
		}
		else tmp = 0;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4372
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <climits>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cassert>
#include <vector>
#define all(x) x.begin() , x.end()
#define fi first
#define se second
#define pb push_back
#define umax( x , y ) x = max( x , (y) )
#define umin( x , y ) x = min( x , (y) )
#define For( i , a ) for(int i=1;i<=a;i++)
#define ort (b+s)/2
#define y2 asrwjaelkf
#define y1 asseopirwjaelkf
#define set multiset

using namespace std;

inline int read() {
    int res = 0 ;int neg ;
    while(true){char ch = getchar();if(ch>='0' && ch<='9' || ch=='-'){if(ch=='-') neg = -1;else neg = 1 , res = ch-'0';break;} }
    while(true){char ch = getchar();if(ch>='0' && ch<='9') res*=10 , res+=ch-'0';else break;}
    return res*neg;
}


typedef long long Lint;
typedef double db;
typedef pair<int,int> ii;
typedef pair<db,db> dd;
typedef pair<ii,int> iii;
typedef pair<ii,ii> i4;

const int maxn = 100020;
const int maxm = 1000020;
const int MOd = 1e9 + 7;
const int K = 320;

Lint a, b;

int main() {

    //freopen("asd.in.c","r",stdin);
    //freopen("asd.out.c","r",stdout);
    cin >> a >> b;
    Lint ans = a;
    a -= b;
    if( a > b ) swap( a, b );
    while( a ) {
        ans += (b/a) * a * 2;
        b %= a;
        if( b == 0 ) { ans -= a; break; }
        swap( a, b );
    }
    cout << ans << endl;
    return 0;
}




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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)

int main(){
	fast;
	char C;
	cin>>C;
	
	if (isupper(C)) cout<<'A';
	else cout<<'a';
}



Measured memory_bytes: 3688
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

A,B,C,D=map(int,input().split())

B2=B-B//C-B//D+B//lcm(C,D)
A2=(A-1)-(A-1)//C-(A-1)//D+(A-1)//lcm(C,D)

print(B2-A2)



Measured memory_bytes: 5432
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
typedef pair<ll, ll> P;
const int INF = 2e9;
int N;
ll M, A[100002], SM[100002]; // sumはNコメからidx番目までの総和

// 価値X以上が選ばれるとした時に、idx番目の左手は何番目の右手とまで握手できるか
// 計算量O(log(N))
int calc1(int idx, ll X) {
  ll base = X-A[idx];
  return lower_bound(A, A+N, base)-A;
}

// 価値X以上が選ばれるとなった時に、全体で何個あるかと総和はいくらか
// 計算量O(N*log(N))
P calc2(ll X) {
  ll ret_cnt = 0ll;
  ll ret_sum = 0ll;
  for (int i=N-1; i>=0; i--) {
    int idx = calc1(i, X);
    if (idx==N) return P(ret_cnt, ret_sum);
    ret_cnt+= (N-idx);
    ret_sum+= (N-idx)*A[i]+SM[idx];
  }
  return P(ret_cnt, ret_sum);
}

// K番目のときの最小価値を求める。returnはそのときの総和
// 計算量O(log(A)*N*log(N))
ll calc3() {
  ll ng = 2*A[0], ok = 2*A[N-1];
  ll ret = 0ll;
  ll cnt = 0ll;
  while(ok-ng>1) {
    ll mid = (ok+ng)/2;
    P p = calc2(mid);
    cnt = p.first;
    ret = p.second;
    if (cnt<M) ok=mid; // 個数が少ないので基準を下げて緩くする
    else ng = mid; // 個数が多いので制限を基準をあげて厳しくする
  }
  return ret+(M-cnt)*ng; //　M-cnt個の価値ngを足すこと
}


int main() {
  INCANT;
  cin >> N >> M;
  rep(i, N) cin >> A[i];
  sort(A, A+N);
  SM[N-1] = A[N-1];
  for (int i=N-2; i>=0; i--) SM[i] = SM[i+1]+A[i];
  cout << calc3() << "\n";
  return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define Pll pair<llint,llint>
#define keta(a)  fixed << setprecision(a)
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
const llint INF = 100000000;


int main() {
	int n;
	cin >> n;
	hei(llint) a(n);
	rep(i, 0, n)cin >> a[i];
	llint now = 1000; llint kabu = 0;
	rep(i, 0, n-1) {
		now += kabu * a[i];
		kabu = 0;
		if (a[i] < a[i + 1]) {
			kabu = now / a[i];
			now %= a[i];
		}
	}
	llint ans = a[n - 1] * kabu + now;
	cout << ans << endl;
	return 0;
}


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

using namespace std;

typedef long long int lli;

int main() {
    int n, q, s, t, x, d;
    vector<pair<int, pair<int, int>>> events;

    cin >> n >> q;
    for (int i=0; i<n; i++) {
        cin >> s >> t >> x;
        events.push_back(make_pair(s-x, make_pair(1, x)));
        events.push_back(make_pair(t-x, make_pair(0, x)));
    }

    for (int i=0; i<q; i++) {
        cin >> d;
        events.push_back(make_pair(d, make_pair(2, 0)));
    }

    sort(events.begin(), events.end());

    multiset<int> st;
    for (auto& itr : events) {
        int a = itr.first, b = itr.second.first, c = itr.second.second;
        switch (b) {
        case 0:
            st.erase(c);
            break;
        case 1:
            st.insert(c);
            break;
        default:
            cout << ((st.empty()) ? -1 : *st.begin()) << endl;
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 17768
//
//  ABC060pA.cpp
//  
//
//  Created by 楊承昊 on 2017/4/29.
//
//

#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    char a[20],b[20],c[20];
    while(cin>>a>>b>>c)
    {
        int stra=strlen(a),strb=strlen(b),strc=strlen(c);
        if(a[stra-1]==b[0]&&b[strb-1]==c[0])
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int gcd(int m, int n) { return n == 0 ? m : gcd(n, m % n); }
int main()
{
    int N, K; cin >> N >> K;
    vector<int> A(N); for (int& a : A) cin >> a;
    int g = A[0];
    for (int i = 1; i < N; i++) {
        g = gcd(g, A[i]);
    }
    for (int i = 0; i < N; i++) {
        if (A[i] >= K && (K - A[i]) % g == 0) {
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
const int MOD=(int)1e9+7;
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    if(n%k==0) cout<<0<<endl;
    else cout<<1<<endl;
    }

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		sc.nextLine();
		String S = sc.nextLine();

		int left_w = 0;
		int left_e = 0;
		int right_w = 0;
		int right_e = 0;

		for (int i = 0; i < N; i++) {
			if (S.charAt(i) == 'W') {
				right_w++;
			} else {
				right_e++;
			}
		}

		int ans = Integer.MAX_VALUE;

		for (int i = 0; i < N; i++) {
			char c = S.charAt(i);

			int turn = 0;
			
			if (c == 'W')
				right_w--;
			else
				right_e--;

			turn = right_e + left_w;
			if (ans > turn) {
				ans = turn;
			}
			
			if (c == 'W')
				left_w++;
			else
				left_e++;

		}
		
		System.out.println(ans);
	}

}

Measured memory_bytes: 29792
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> G(N, vector<int>());
    for(int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    vector<int> ord(N);
    rep(i, N) ord[i] = i;
    int res = 0;
    do {
        if(ord[0] != 0)
            continue;
        for(int i = 0; i < N - 1; i++) {
            int ok = 0;
            for(auto x : G[ord[i]]) {
                if(x == ord[i + 1])
                    ok = 1;
            }
            if(!ok)
                break;
            if(ok && i == N - 2)
                res++;
        }
    } while(next_permutation(All(ord)));
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstdio>
#include <queue>
#include <list>
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<vector<int> > v(n, vector<int>(n));

  for(int i=0;i<n;i++){
    int t, a;  cin >> a >> t;
    for(int j=0;j<t;j++){
      int val;cin >> val;
      v[a-1][val-1]++;
    }
  }

  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      cout << v[i][j];
      if(j != n-1)  cout << " ";
    }
    cout << endl;
  }
  return 0;
}

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

    const int MOD = 1000000007;
    const double PI = acos(-1); 

    //long long
    using ll = long long;

    //出力系
    #define print(x) cout << x << endl
    #define yes cout << "Yes" << endl
    #define YES cout << "YES" << endl
    #define no cout << "No" << endl
    #define NO cout << "NO" << endl
    
    // begin() end()
    #define all(x) (x).begin(),(x).end()

    //for
    #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

    //最大公約数（ll）
    ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;}

    //素因数分解
    vector<pair<ll, int>>factorize(ll n){
      vector<pair<ll, int>> res;
      for(ll i = 2; i * i <= n; ++i){
        if(n % i) continue;
        res.emplace_back(i, 0);
        while(n % i == 0){
          n /= i;
          res.back().second++;
        }
      }
    if(n != 1) res.emplace_back(n, 1);
    return res;
    }



  // // 二分探索(最小値を出す問題は疑う)
  // bool C(ll x){
  //     ll res = 0;
  //     for(int i = 0; i < N; ++i){
  // 		res += max(0ll, A[i]-x/F[i]);
  //     }
  //     return res <= K;
  // }

  //   ll binary_search(ll ok, ll ng){
  //     while(abs(ok - ng) > 1){
  //       ll mid = (ok + ng) / 2;
  //       if(C(mid)) ok = mid;
  //       else ng = mid;
  //     }
  //     return ok;
  //   }


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

    ll g = gcd(A, B);
    ll ans = A / g * B;
    print(ans);
  
  }

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <map>
#include <cstdio>
#include <math.h>
using namespace std;

#define ll long long
#define vecint vector<int>
#define listint list<int>
#define Pii pair<int, int>

#define REP(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define print(a) cout << a << endl

#define MOD 1000000007
#define NIL -1


int main(){
  ll N,K;
  ll ans=1;
  ll mod=pow(2,31);

  cin>>N>>K;

  ans*=K;
  REP(i,1,N){
    ans*=K-1;
    ans%=mod;
  }

  print(ans);

  return 0;
}


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

int main() {
  int N, a, b, c, d;
  cin >> N;
  a = N % 10;
  b = (N / 10) % 10;
  c = (N / 100) % 10;
  d = N / 1000;
  if (a == b && b == c) {
    cout << "Yes" << endl;
  }
  else if ( b == c && c == d ){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
//### In The Name Of GOD ###

//%% Remember; (((He))) is The (((Accepter))) %%

// GOD IS GREATER ...

#include <bits/stdc++.h>

using namespace std;

typedef long long ll ;
typedef long double ld ;

//#define int ll
#define pb push_back
#define bp pop_back
#define pf push_front
#define fp pop_front
#define X first
#define Y second
#define sz(a) (int)(a.size())
#define sg(a, b) (a + b - 1) / b

const int MOD = 1000 * 1000 * 1000 + 7;
const int INF = 1000 * 1000 * 1000 + 10 ;
const int MAXN = 1000;
const int MLOG = 17;
const int NMAX = 20;

signed main() {
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int n, m;
	cin >> n >> m;
	int ans[MAXN] = {};
	bool p = true;
	char ch;
	for(int i = 0; i < n; i++)
		for(int j = 0; j < m; j++) {
			cin >> ch;
			if(ch == '#') ans[i + j]++;
			if(ans[i + j] > 1) p = false;
		}
	cout << ((p) ? "Possible" : "Impossible");
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String[] t=br.readLine().split("\\ ");
        int H=Integer.parseInt(t[0]); int N=Integer.parseInt(t[1]);
        int[] dmg=new int[N];
        int[] cost=new int[N];
        for(int i=0;i<N;i++){
            t=br.readLine().split("\\ ");
            dmg[i]=Integer.parseInt(t[0]);
            cost[i]=Integer.parseInt(t[1]);
        }
        int[] dp=new int[H+1];
        Arrays.fill(dp,1555555555);
        dp[0]=0;
        for(int i=1;i<=H;i++){
            for(int j=0;j<N;j++){
                dp[i]=Math.min(dp[i],cost[j]+dp[Math.max(i-dmg[j],0)]);
            }
        }
        System.out.println(dp[H]);
    }
    
}


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

int main() {
	// your code goes here
	char str1[11], str2[11], str3[11];
	int i,j,k;
	int l1,l2,l3;
	
	cin>>str1>>str2>>str3;
	
	l1 = strlen(str1);
	l2 = strlen(str2);
	l3 = strlen(str3);
	
	if (str1[l1-1] == str2[0] && str2[l2-1]==str3[0]){
	   cout<<"YES";
	}else
	    cout<<"NO";
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
typedef long long int ll;
typedef string S;
#define M 1e18
#define AS 250002
#define in(x)  cin>>x
#define o(x)  cout<<x
#define sp cout<<' '
#define nw cout<<endl
#define rt return
#define fr(i,a,n) for(ll i=a;i<=n;i++)
#define frm(i,a,n) for(ll i=n;i>=a;i--)
#define P pair<ll,ll>
#define vc vector<P>
#define pb push_back
#define MP map<ll,ll>
bool sortin(const pair<ll,ll> &e,const pair<ll,ll> &f){return (e.first<f.first);}
bool POT(ll x){return x && (!(x&(x-1)));}
ll i,j,k,l,m,n,p,q,r,a,b,c,x,y,z,ts,mn=1e18,mod=1e9+7;
ll ar[AS],br[AS],xr[AS];
ll board[502][502];
int main()
{
    fast;
    in(n);
    fr(i,0,n-1)in(ar[i]);
    fr(i,0,n-1)
    {
        fr(j,i+1,n-1)
        {
            fr(k,j+1,n-1)
            {
                if(ar[i]==ar[j] or ar[i]==ar[k] or ar[j]==ar[k])continue;
                c=ar[i]+ar[j]+ar[k];
                p=(max(ar[i],max(ar[j],ar[k])));
                c-=p;
                if(c>p)l++;
            }
        }
    }
    o(l);
}


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

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

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

int main() {
   string s;
   cin >> s;
   cout << 700 + 100 * count(all(s), 'o') << endl;

   return 0;
}

Measured memory_bytes: 764
n = int(raw_input())
minv = int(raw_input())
maxv = -1*10**9
  
for j in range(n-1):
  num = int(raw_input())  
  diff = num - minv
  if maxv < diff:
    maxv = diff
  if num < minv:
    minv = num
  
print maxv

Measured memory_bytes: 12688
//Littleboy123 Template 1.6
#include <bits/stdc++.h>
using namespace std;
 
//pragmas
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
 
 
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
 
const long double pi = acos(-1.0);
 
#define FOR(a,b,c) for(ll (a)=(b);(a)<(c);++(a))
#define FORE(a,b,c) for(ll (a)=(b);(a)<=(c);++(a))
#define FORN(a,b,c) for(ll (a)=(b);(a)>(c);--(a))
#define FORNE(a,b,c) for(ll (a)=(b);(a)>=(c);--(a))
#define MEM(a,b) memset((a), (b), sizeof((a)))
#define MAX(a,b) (a) = max((a), (b))
#define MIN(a,b) (a) = min((a), (b))
#define nl '\n'
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
 
void init(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
 
void infile(){
    freopen("input.in", "r", stdin);
}
 
void outfile(){
    freopen("output.out", "w", stdout);
}
 
ll modex(ll a, ll b, ll mod){
    if(b == 0)
        return 1;
    if(b == 1)
        return a;
    ll tmp = modex(a, b/2, mod);
    tmp = (tmp * tmp) % mod;
    if(b & 1)
        tmp = (tmp * a) % mod;
    return tmp;
}
 
//End of template
 
int main(){
    init();
 
    ll n;
    cin >> n;
    ll ans = 1000000000000LL;
    for(ll i = 1; i * i <= n; i++){
        if(n % i == 0){
            ans = min(i-1 + n/i - 1, ans);
        }
    }
    cout << ans << nl;
    return 0;   
}

Measured memory_bytes: 256
<?php
    
    $N = intval(trim(fgets(STDIN)));
    
    $P_array = array_map('intval',explode(" ",trim(fgets(STDIN))));

    //一桁の時
    if($N==1){
        echo $P_array[0];
        exit;
    }
    $count=0;
    $min=$P_array[0];

    for($i=1;$i<$N;$i++){
        //最小値を更新していく
        if($P_array[$i]<$min){
            $count++;
            $min = $P_array[$i];
        }
    }
    echo $count+1;

?>

Measured memory_bytes: 36120
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <utility>
using namespace std;


int main(){
    string s;
    long long k;
    long long inf = pow(2, 5000000000000000);
    int i=0;
    int flag = 0;
    cin >> s >> k;
    while(i < k){
        if(s[i] != '1'){
            if(s[i] == 2 && flag == 0 && k > inf){
                flag = 1;
            }
            else{
                cout << s[i] << endl;
                return 0;
            }
        }
        i++;
    }
    cout << "1" << endl;
	
	return 0;
}


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

#define pb(a) push_back((a))
#define mp(a, b) make_pair((a), (b))
#define REP(a, b) for (ll i = (a); i < (b); i++)
#define REP2(a, b) for (ll j = (a); j < (b); j++)
#define REPE(a, b, c, d) \
	REP(a, b)            \
	for (ll j = (c); j < (d); j++)
#define REPV(a, b, c) for (ll(a) = b; (a) < (c); (a)++)
#define IREP(a, b) for (ll i = (a); i >= (b); i--)
#define IREP2(a, b) for (ll j = (a); j >= (b); j--)
#define IREPV(a, b, c) for (ll(a) = b; (a) >= (c); (a)--)
#define all(v) (v).begin(), (v).end()
#define Trvs(c) for (auto &it : c)
#define INF INT_MAX
#define sz(x) x.size()
#define flash                         \
	ios_base::sync_with_stdio(false); \
	cin.tie(0);                       \
	cout.tie(0);
#define F first
#define S second
#define MOD 1000000007

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;

auto cmp = [](pair<ll, pair<ll, ll>> a, pair<ll, pair<ll, ll>> b) {
	if (a.F == b.F)
		return a.S.F > b.S.F;
	return a.F > b.F;
};
//decltype(cmp)
//set<,decltype(cmp)> st(cmp);
void solve()
{
	ll a;
	string b;
	cin >> a >> b;
	ll cnt = 0;

	ll bb = 0, i = 0;
	ll flag = 0;
	while ((i) < b.size())
	{
		if (b[i] == '.')
		{
			flag = 1;
			i++;
			continue;
		}
		if (flag)
			cnt++;
		bb *= 10;
		// cout << bb << endl;

		bb += b[i] - '0';
		// cout << bb << endl;
		i++;
	}
	// cout << a << " " << bb;
	ll ans = a * bb;
	while (cnt--)
		ans /= 10;
	cout << ans;
}

int main()
{
	flash


	// seive(100000);
	// calculatepi();
	// ll t;
	// cin >> t;
	// while (t--)
	solve();
	return 0;
}


Measured memory_bytes: 3616
object Main {
  def main(args: Array[String]): Unit = {
    solve
  }

  def solve(): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextLine
    val s = sc.nextLine

    var num = 0
    for(i <- 0 until s.length - 2){
      val substr = s.substring(i, i + 3)
      if(substr == "ABC") {
        num += 1
      }
    }

    println(num)
  }
}


Measured memory_bytes: 27472
#include<iostream>
using namespace std;
int main()
{
  int n,last;
  cin>>n;
   last=n%10;
   
    if(last==2||last==4||last==5||last==7||last==9)
       cout<<"hon";
    else if(last==0||last==1||last==6||last==8)
       cout<<"pon";
    else 
       cout<<"bon";
  return 0;
}


Measured memory_bytes: 3624