akhauriyash/Code-Regression huggingface dataset:
import java.io.*;

class Main {
	
    public static void main(String[] args) {
        BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
        try {
            int n = Integer.parseInt( kb.readLine() );
			int[] A = new int[n];
            int i, j;
                        
            for( i=0; i<n; i++ ) {
            	A[i] = Integer.parseInt( kb.readLine() );
            }
			
			shellSort( A, n );
			
			StringBuilder output = new StringBuilder( n+1 );	
			output.append( A[0] );
            for( i=1; i<n; i++ ) {
            	output.append( "\n" );
               	output.append( A[i] );
            }
            System.out.println( output );

	 
            kb.close();
        } catch( IOException e ) {
            System.err.println( e );
        }        
    }
    static void shellSort( int[] A, int n ) 
    {
        int i, j;
        
        int cnt = 0;
        int m = 1;
        int mcnt;
        int[] G = new int[ 100+1 ];
        
		G[0] = 1;
        for( i=1; i<100; i++ ) {
        	G[i] = G[i-1]*3+1;
        	if( n < G[i] ) { 
        		m = i;
        		break;
        	}
        }
 		G[0] = G[m-1];
        for( i=1; i<100; i++ ) {
        	G[i] = G[i-1]/3;
        	if( G[i] <= 1 ) { break; }
        }       
        
		StringBuilder output = new StringBuilder( 200 );
        output.append( m );
        output.append( "\n" );
        output.append( G[0] );
         for( i=1; i<m; i++ ) {
 	        output.append( " " );
	        output.append( G[i] );
	    }  
        System.out.println( output );
        
        for( i=0; i<m; i++ ) {
        	cnt += insertionSort( A, n, G[i] );
        }
        System.out.println( cnt );
        return;
    }    
    static int insertionSort( int[] A, int n, int g ) 
    {
    	int i, j;
    	int v;
		int cnt = 0;
   		for( i=g; i<n; i++ ) {
   			v = A[i];
   			j = i - g;
   			while( 0 <= j && v < A[j] ) {
   				A[ j+g ] = A[j];
   				j = j - g;
   				cnt++;
   			}
   			A[ j+g ] = v;
   		}
   		return cnt;
    }
}

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

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};


const int MOD = 1000000007;
using mint = Fp<MOD>;


int modpow(int a,int x){
  if(a<0)a+=MOD;
  int ans=1;
  while(x>0){
    if(x&1) ans=ans*a%MOD;
      a=a*a%MOD;
      x>>=1;
  }
  return ans;
}
int gyaku(int n){
    return modpow(n,MOD-2);
}

map<int,int> prime;//素因数分解でそれぞれの素数がいくつ出てきたかを保存するmap

//O(√n)
//整列済み(mapはkeyで自動で整列される)
void prime_factorize(int n){
    if(n<=1) return;
    int l=sqrt(n);
    for(int i=2;i<=l;i++){
        if(n%i==0){
        prime_factorize(i);prime_factorize((int)(n/i));return;
        }
    }
    //mapでは存在しないkeyの場合も自動で構築される
    prime[n]++;return;
}
////////////////////////////////////////////////////////////////////////
vector<int>va(50),vb(50);
void f(int n,vector<int>&v){
  for(int i=0;i<50;i++){
    int syuuki=pow(2,i+1);
    if((n+1)%syuuki>pow(2,i)){
      v[i]=((n+1)/syuuki)*pow(2,i)+((n+1)%syuuki)-pow(2,i);
    }
    else v[i]=((n+1)/syuuki)*pow(2,i);
  }
}
signed main() {
  int a,b;
  cin>>a>>b;
  f(a-1,va);
  f(b,vb);
  int ans=0;
  int c=1;
  rep(i,50){
    if((va[i]+vb[i])%2==1)ans+=c;
    c*=2;
  }
  cout<<ans<<endl;
  }


Measured memory_bytes: 4056
#include<iostream>
#include<algorithm>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

int hasDupulication_sorted(int A[] , int arrlen){
    int pre = A[0];
    for(int i=1; i<arrlen; i++){
        if(A[i] == pre) return true;
        pre = A[i];
    }
    return false;
}
int hasDuplication(int A[], int arrlen, int target){
    for(int i=0; i<arrlen; i++){

        if(A[i] == target) return true;
    }
    return false;
}

int main(void){
    int N;
    std::cin >> N;
    int A[N];
    std::string ans="YES";
    for(int i=0; i<N; i++){
        std::cin >> A[i];
    }
    std::sort(A, A + SIZE_OF_ARRAY(A));
    if(hasDupulication_sorted(A, N)) ans ="NO";

    std::cout << ans << std::endl;

}


Measured memory_bytes: 1024
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>
 
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
 
#define pb push_back
#define popb pop_back
#define si size()
#define be begin()
#define en end()
#define all(v) v.be, v.en
#define le length()
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
 
#define forz(i, n) for (int i = 0; i < n; i++)
#define bui(i, m, n) for (int i = m; i < n; i++)
#define rforz(i, n) for (int i = n - 1; i >= 0; i--)
#define mui(i, m, n) for (int i = n - 1; i >= m; i--)
#define deci(n) fixed << setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n) __builtin_ctz(n)
#define lb lower_bound
#define ub upper_bound
#define er equal_range
#define maxe *max_element
#define mine *min_element
#define mod 1000000007
#define mod2 998244353
#define kira ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
 
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
 lli power(lli x,lli y,lli p)
{
  lli res=1;
  x=x%p;
  while(y>0)
  {
    if(y&1)
      res=(res*x)%p;
    //y must be even now
    y=y>>1; //y=y/2
    x=(x*x)%p;
  }
  return res;
}
 
lli gcd(lli a, lli b)
{
  if (b == 0)
    return a;
  return gcd(b, a % b);
}
lli lcm(lli a, lli b)
{ return a * b / gcd(a, b); }
lli max(lli a, lli b)
{
  if (a > b)
    return a;
  return b;
}
lli min(lli a, lli b)
{
  if (a < b)
    return a;
  return b;
}
using namespace std;

int main()
{  
    kira;
    //freopen("input.txt","r",stdin);
    lli n;
    cin>>n;
    if(n<=99)
      cout<<min(n,9)<<endl;
    else
      if(n<=9999)
        cout<<min(909,n-90)<<endl;
      else
        cout<<min(90909,n-90-9000)<<endl;
      return 0;
}

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

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] d = new int[n];
		int sum = 0;
		
		for (int i = 0; i < n; i++) d[i] = sc.nextInt();
		for (int i = 0; i < n-1; i++) {
			for (int j = i+1; j < n; j++) {
				sum += d[i]*d[j];
			}
		}
		
		
	
		System.out.println(sum);

	}
}


Measured memory_bytes: 22740
let prim a n =
  let d = Array.make n max_int in
  let z = Array.make n (-1) in
  let b = Array.make n false in
  let rec dudu i m u =
    if i = n then u
    else if b.(i) = false && m > d.(i) then dudu (i + 1) d.(i) i
    else dudu (i + 1) m u
  and wa j u =
    if j < n then begin
      if b.(j) = false && a.(u).(j) <> max_int && d.(j) > a.(u).(j) then begin
        d.(j) <- a.(u).(j);
        z.(j) <- u
      end;
      wa (j + 1) u
    end
  and doit () =
    let u = dudu 0 max_int (-1) in
    if u <> (-1) then (b.(u) <- true; wa 0 u; doit ())
  in
  d.(0) <- 0;
  doit ();
  let rec sum i acc =
    if i = n then acc
    else sum (i + 1) (acc + (if z.(i) <> (-1) then a.(i).(z.(i)) else 0))
  in
  sum 0 0

let () =
  let n = read_int () in
  let a = Array.make_matrix n n max_int in
  let rec read i =
    if i < n then
      let rec aux j =
        if j < n then begin
          let x = Scanf.scanf " %d " (fun x -> x) in
          if x <> (-1) then a.(i).(j) <- x;
          aux (j + 1)
        end
      in
      aux 0;
      read (i + 1)
  in
  read 0;
  Printf.printf "%d\n" (prim a n)

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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define all(x) (x).begin(),(x).end()

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
template<typename... Args> void rd(Args&... args) {((cin >> args), ...);}
template<typename... Args> void write(Args... args) { ((cout << args << " "), ...); cout<<endl;}

vector<int> a,ans;
const int N=2e5+5;
vector<int> G[N];
int stk[N];
void dfs(int u,int fa,vector<int>& lis){
    int flag;
    int pos=lower_bound(all(lis),a[u])-lis.begin();
    if(pos==lis.size()) lis.push_back(a[u]),flag=-1;
    else flag=lis[pos],lis[pos]=a[u];
    ans[u]=lis.size();
    for(auto it:G[u]){
        if(it==fa) continue;
        dfs(it,u,lis);
    }
    if(flag==-1) lis.pop_back();
    else lis[pos]=flag;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    a=ans=vector<int>(n+1);
    for1(i,n) cin>>a[i];
    forn(i,n-1){
        int x,y;
        cin>>x>>y;
        G[x].push_back(y);
        G[y].push_back(x);
    }
    vector<int> v{};
    dfs(1,-1,v);
    for1(i,n) cout<<ans[i]<<endl;
    return 0;
}



Measured memory_bytes: 29924
using System;
using CompLib.Util;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        long a = sc.NextInt();
        long b = sc.NextInt();
        if ((a * b) % 2 == 0)
        {
            Console.WriteLine("Even");
        }
        else
        {
            Console.WriteLine("Odd");
        }
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <vector>
using namespace std;
int main(){
  vector<string> s(2);
  cin>>s[0]>>s[1];
  bool b = true;
  for(int i=0;i<3;++i){
    if(s[0][i] == s[1][2-i]) b = true;
    else{
      b = false;
      break;
    }
  }
  if(b) cout << "YES"<<endl;
  else cout << "NO"<<endl;

  return 0;
}

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

namespace Contest
{
    class Program
    {
        static int Main(string[] args)
        {
            new Program().Process();

            return 0;
        }

        private CommonInput cin;

        private void Process()
        {
            this.cin = new CommonInput();

            int N, count;
            List<int> l = new List<int>();

            N = cin.GetInt();
            count = 0;

            while (count < N)
            {
                l.Clear();

                for (int i = 0; i < 3; i++)
                    l.Add(cin.GetInt());

                l = l.OrderByDescending(x => x).ToList();

                Console.WriteLine("{0}", l[0] * l[0] == l[1] * l[1] + l[2] * l[2] ? "YES" : "NO");

                count++;
            }
        }
    }

    public class CommonInput
    {
        public CommonInput()
        {
            this._s = new string[0];
            this._i = 0;
        }

        private string[] _s;
        private int _i;
        private char[] _sep = { ' ' };

        public string GetLine()
        {
            if (this._i < this._s.Length)
                return this._s[this._i++];

            string line;
            this._i = 0;
            do
            {
                line = Console.ReadLine();
            } while (line == "");

            this._s = line.Split(this._sep, StringSplitOptions.RemoveEmptyEntries);

            return this._s[this._i++];
        }

        public int GetInt()
        {
            return int.Parse(this.GetLine());
        }

        public long GetLong()
        {
            return long.Parse(this.GetLine());
        }

        public double GetDouble()
        {
            return double.Parse(this.GetLine());
        }
    }
}

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

int main() {
  int n, x;
  bool arr[2000], changed[2000];
  memset(arr,  0, sizeof(arr));
  memset(changed, 0, sizeof(changed));
  scanf("%d\n", &n);
  for (int i = 0; i < n; i++) {
    char m;
    scanf("%c", &m);
    if (m == '1') arr[i] = 1;
  }
  cin >> x;
  for (int i = 0; i < n; i++) {
    if(x == 0) break;
    if (arr[i] == 0) arr[i] = 1, changed[i] = 1,x--;
  }
  
  for (int i = n  - 1 ; i >=0 ; i--) {
    if (x == 0) break;
    if (!changed[i]) arr[i] = 0,x--;
  }
 
  for (int i = 0; i < n; i++) cout << arr[i];
  cout << endl;
}

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

using namespace std;
using ll = long long;
using ld = long double;

namespace NyaGadgetCpp17
{
	/**
	@brief 最大公約数を計算する関数
	@note
	 aとbの最大公約数を返す
	**/
	long long Gcd(long long a, long long b)
	{
		return b ? Gcd(b, a % b) : a;
	}
	/**
	@brief 最小公倍数を計算する関数
	@note
	 aとbの最小公倍数を返す
	**/
	long long Lcm(long long a, long long b)
	{
		return a / Gcd(a, b) * b;
	}
};

#define all(collection) (collection).begin(), (collection).end()  // begin to end
#define ceil(a, b) ceil((ld) a / (ld) b);                         // div ceiling
#define each(e, collection) for(auto& e: collection)              // for each
#define rep(i, begin, end) for (ll i = begin; i < end; i++)       // repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)      // repeat reverse
#define size(collection) ((ll) (collection).size())               // collection size

using namespace NyaGadgetCpp17;

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

	bool same = true;
	rep(i, 0, size(s))
	{
		if (s[0] != s[i])
			same = false;
	}
	if (same)
	{
		cout << 1;
		return 0;
	}

	ll ans = 0;
	rep(i, 0, size(s))
	{
		if (s[i] != s[i + 1])
			ans++;
	}

	cout << ans;
	return 0;
}


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

struct StPoint
{
  StPoint() :
    m_nTime(0), m_nPntX(0), m_nPntY(0)
  { }

  int m_nTime;
  int m_nPntX;
  int m_nPntY;
};

void fnInput(vector<StPoint>& rvoPoint)
{
  StPoint oPoint;
  int nSiz;
  cin >> nSiz;

  rvoPoint.resize(nSiz + 1, oPoint);
  for (int i = 0; i < nSiz; i++)
    cin >> rvoPoint[i + 1].m_nTime >> rvoPoint[i + 1].m_nPntX >> rvoPoint[i + 1].m_nPntY;
}

int fnTravel(const vector<StPoint>& cnrvoPoint)
{
  for (int i = 0; i < cnrvoPoint.size() - 1; i++)
  {
    int nTime = cnrvoPoint[i + 1].m_nTime - cnrvoPoint[i].m_nTime;
    int nDist = abs(cnrvoPoint[i + 1].m_nPntX - cnrvoPoint[i].m_nPntX)
              + abs(cnrvoPoint[i + 1].m_nPntY - cnrvoPoint[i].m_nPntY);

    if (nTime < nDist)           return 0;
    if (nTime % 2 != nDist % 2)  return 0;
  }
  return 1;
}

int main()
{
  vector<StPoint> oPoint;

  fnInput(oPoint);
  if (fnTravel(oPoint))  cout << "Yes" << endl;
  else                   cout << "No"  << endl;

  return 0;
}

Measured memory_bytes: 1408
import sys
import math
n, m = map(int, sys.stdin.buffer.readline().split())
a = tuple(map(int, sys.stdin.buffer.readline().split()))

lim = math.ceil(sum(a) / (4 * m))
c = sum(1 for aa in a if aa >= lim)
print('Yes' if c >= m else 'No')


Measured memory_bytes: 9232
#include <iostream>
typedef long long ll;
using namespace std;

int main(){
    ll N, Q, A[100000], X;
    cin >> N >> Q;
    for(int i=0;i<N;i++) cin >> A[i];
    for(int i=0;i<Q;i++){
        cin >> X;
        ll sum = 0;
        int right = 0;
        ll count = 0;
        for(int left=0;left<N;left++){
            while(right<N&&sum+A[right]<=X){
                sum+=A[right];
                right++;
            }
            count += right - left;
            if(right==left) right++;
            else sum-=A[left];
        }
        cout << count << endl;
    }
    return 0;
}



Measured memory_bytes: 3880
// A - Frog 1

// 問題文
// N個の足場があります。 足場には 1,2,…,N と番号が振られています。 各 i (1≤i≤N) について、
// 足場 iの高さはhiです。最初、足場1にカエルがいます。 カエルは次の行動を何回か繰り返し、足場 N
// まで辿り着こうとしています。足場iにいるとき、足場 i+1 または i+2へジャンプする。
 // このとき、ジャンプ先の足場を jとすると、コスト |hi−hj|を支払う。カエルが足場 Nに辿り着くまでに支払うコストの
 // 総和の最小値を求めてください。

// 制約
// 入力はすべて整数である。
// 2≤N≤10の５乗
// 1≤hi≤10の4乗
// 入力
// 入力は以下の形式で標準入力から与えられる。
// N
// h1 h2 …hN
// 出力
// カエルが支払うコストの総和の最小値を出力せよ。
// 入力例 1 
// Copy
// 4
// 10 30 40 20
//  出力例 1 
// Copy
// 30
// 足場 
// 1→ 2→ 4
 // と移動すると、コストの総和は |10−30|+|30−20|=30となります。
// 入力例 2 
// Copy
// 2
// 10 10
// 出力例 2 
// Copy
// 0
// 足場 
// 1→ 2と移動すると、コストの総和は |10−10|=0となります。

// 入力例 3 
// Copy
// 6
// 30 10 60 10 60 50
// 出力例 3 
// Copy
// 40
// 足場 
// 1→ 3→ 5→ 6と移動すると、コストの総和は |30−60|+|60−60|+|60−50|=40となります。
//miss
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cmath>
using namespace std;
int main(void){
	long long N,h[100100]={0};
	long long dp[100100]={0};
	long long inf=1e9;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>h[i];
	}
	for(int i=0;i<N;i++){
		dp[i]=inf;
	}
	dp[0]=0;
	for(int i=0;i<N;i++){
		dp[i+1]=min(dp[i+1],dp[i]+abs(h[i+1]-h[i]));
		dp[i+2]=min(dp[i+2],dp[i]+abs(h[i+2]-h[i]));
	}
	cout<<dp[N-1]<<endl;
	return 0;
}

Measured memory_bytes: 1792
//https://atcoder.jp/contests/agc020/tasks/agc020_a
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
#define dcml(n) fixed<<setprecision(n)
//CONST
//------------------------------------------
const ll INF=1010000000000000017LL;
const ll MOD=1000000007LL;
const ld EPS=1e-12;
const ld PI=3.14159265358979323846;
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define  FORS(i,m,n) for(ll (i)=(m);   (i)<=(n); (i)++)
#define  RFOR(i,m,n) for(ll (i)=(n)-1; (i)>=(n); (i)--)
#define RFORS(i,m,n) for(ll (i)=(n);   (i)>(n);  (i)--)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
#define WREPS(i,in,j,jn) REPS(i,in)REPS(j,jn)
//-----------------------------------------
//namespace
using namespace std;
//ライブラリはここに
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

//-----------------------------------------
int main(void){
    ll N;cin>>N;
    ll a,b;cin>>a>>b;
    while(true){
        if(a+1!=b)a++;
        else a--;
        if(a==0){
            cout<<"Borys\n";
            return 0;
        }

        if(b-1!=a)b--;
        else b++;
        if(b==N+1){
            cout<<"Alice\n";
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std; 
string str; 
int ans; 

int main()
{
	cin >> str; 
	for (int i = 0; i < str.length() / 2; ++i)
	{
		if (str[i] != str[str.size() - i - 1])
			++ans; 
			//cout << str[i] << " " << str[str.size() - i] << endl; 
	}
	cout << ans; 
	return 0; 
}

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

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

  vector<int> v(N),w(N);
  for (int i = 0; i < N; i++)
  {
    cin >> v[i] >> w[i];
  }

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


Measured memory_bytes: 6848
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
// const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

void solve(int n, vector<int> &a){
    vector<int> ans(n);
    int m = n / 2;
    if(n % 2 == 0){
        for (int i=0; i<m; ++i){
            ans[i] = a[(n - 1) - 2 * i];
        }
        for (int i=0; i<m; ++i){
            ans[(n - 1) - i] = a[(n - 2) - 2 * i];
        }
    }
    else {
        for (int i=0; i<m+1; ++i){
            ans[m - i] = a[2 * i];
        }
        for (int i=0; i<m; ++i){
            ans[m + 1 + i] = a[2 * i + 1];
        }
    }
    bool isFirst = true;
    for (int i=0; i<n; ++i){
        if(isFirst){
            isFirst = false;
            printf("%d", ans[i]);
        }
        else {
            printf(" %d", ans[i]);
        }
    }
    printf("\n");
    return;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i=0; i<n; ++i){
        cin >> a[i];
    }
    solve(n, a);
    return 0;
}

Measured memory_bytes: 3712
#include<iostream>
using namespace std;
const int MAX_N = 1000000;
int par[MAX_N];
bool marked[MAX_N];

void init(int n) {
    for (int i = 0; i < n; i++) par[i] = i;
}
int find(int x) {
    if (par[x] == x) {
        return x;
    } else {
        return find(par[x]);
    }
}
int find_marked(int x) {
    if (marked[x] || par[x] == x) {
        return x;
    } else {
        return find_marked(par[x]);
    }
}
//順序固定、yをxにくっつける
void unite(int x, int y){
    if (x == y) return;
    par[y] = x;
}

int N, Q;

int main() {
    while (cin>>N>>Q) {
    if (N == 0 && Q == 0) break;
    init(N);
    fill(marked,marked+N,false);
    marked[0] = true;
    int tmp;
    char q;

    for (int i = 1; i < N; i++) {
        cin >> tmp;
        unite(tmp-1, i);
    }
    
    long long res = 0;
    for (int i = 0; i < Q; i++) {
        cin >> q; cin >> tmp;
        if (q == 'Q') {
            res += (long long) (find_marked(tmp-1) + 1);
        }
        else if (q == 'M') {
            marked[tmp-1] = true;
        }
    }
    cout << res << "\n";
    }
}


Measured memory_bytes: 3484
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
typedef long long int lld;
typedef vector<lld> vi;
typedef pair<lld, lld> pi;
#define F first
#define S second
#define N 1000007
#define MOD 998244353
#define PB push_back
#define MP make_pair
#define rep(i, a, b) for (lld i = a; i < b; i++)
lld r, j, l, m, n, s, q, i, k, t, p,z,timer,x,y;string s1, s2;
lld a[N],dp[N];
int main()
{
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  cin>>n;
  rep(i,1,n+1)cin>>a[i];
  rep(i,1,n)dp[i]=MOD;
  dp[n-1]=abs(a[n]-a[n-1]);
  for(i=n-2;i>=1;i--)
  {
  	dp[i]=min(dp[i+1]+abs(a[i]-a[i+1]),dp[i+2]+abs(a[i]-a[i+2]));
  }
  cout<<dp[1];
}

Measured memory_bytes: 5120
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#define cs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i,b)  for(int i=0;i<(int)(b);i++)
#define Rep(i,n) for(int i=1;i<(int)(n);i++)
#define repp(i,a,b)  for(int i=a;i<=(int)(b);i++)
#define Repp(i,a,b)  for(int i=a;i>=(int)(b);i--)
#define bye(x) {cout<<x;return 0;}
typedef long long ll;
typedef long double ld;

using namespace std;

int main(){
    cs
    ld a,b,c,i;
    cin>>a>>b>>c;
    if(c>=b) {
        i=b-1;
        cout<<floor(a*i/b)-a*floor(i/b);
    }
    else {
        i=c;
        cout<<floor(a*i/b)-a*floor(i/b);
    }
}

Measured memory_bytes: 3828
#include<stdio.h>
int main()
{
    int N,A,B;
    scanf("%d%d%d",&N,&A,&B);
    if(N>=1&&N<=20&&A>=1&&A<=50&&B>=1&&B<=50)
    {
        int a;
        a=N*A;
        if(a<B)
        {
            printf("%d\n",a);
        }
        if(a>B)
        {
            printf("%d\n",B);
        }
        if(a==B)
        {
            printf("%d\n",B);
        }
    }
}


Measured memory_bytes: 2152
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T & a, U & ... b) { cin >> a; IN_(b ...); };
template<typename T> void OUT(T && a) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

template<typename T> istream & operator>>(istream & s, vector<T> & v) { RF(e, v) { s >> e; } return s; }
template<typename T> ostream & operator<<(ostream & s, vector<T> const & v) {
	inc(i, SI(v)) { s << (i == 0 ? "" : " ") << v[i]; }
	return s;
}

template<typename T, size_t N> istream & operator>>(istream & s, array<T, N> & a) { RF(e, a) { s >> e; } return s; }
template<typename T, size_t N> ostream & operator<<(ostream & s, array<T, N> const & a) {
	inc(i, SI(a)) { s << (i == 0 ? "" : " ") << a[i]; }
	return s;
}

int main() {
	IN(int, n, m, q);
	vector<array<int, 4>> v(q);
	cin >> v;
	RF(e, v) { e[0]--; e[1]--; }
	
	vector<int> a(n);
	auto p = [&]() -> bool {
		int d = -1;
		dec(i, n) { if(a[i] < m - 1) { d = i; break; } }
		if(d == -1) { return false; }
		int x = a[d] + 1;
		incID(i, d, n) { a[i] = x; }
		return true;
	};
	
	int ans = 0;
	do {
		int s = 0;
		inc(i, q) {
			if(a[v[i][1]] - a[v[i][0]] == v[i][2]) { s += v[i][3]; }
		}
		setmax(ans, s);
	} while(p());
	OUT(ans);
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int a, p;
    cin >> a >> p;
    println((a * 3 + p) / 2);
    return 0;
}

Measured memory_bytes: 3560
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
struct node{
	int id;
	int nu;
}b[maxn];
int n;
int a[maxn];
int main()
{
	int i,j;
	while(scanf("%d",&n)!=EOF)
	{
		for(i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
		}
		sort(a,a+n);
		i=n-1;
		int cnt=0;
		int num=0;
		while(i>=0)
		{
			num++;
			for(j=i;j>=0;j--)
			{
				if(a[j]!=a[i])
					break;
				else cnt++;
			}
			b[num].id=a[i];
			b[num].nu=cnt;
			cnt=0;
			i=j;
		}
		int c[2];
		int s=0;
		c[0]=-1;
		c[1]=-1;
	//	for(i=1;i<=num;i++)
		//	cout<<b[i].nu<<endl;
		for(i=1;i<=num;i++)
		{
			//	cout<<"!"<<endl;	
			 if(b[i].nu>=4)
			{
				
				c[s]=b[i].id;
				s++;
				if(s>=2) break;
				c[s]=b[i].id;
				break;
			}
			if(b[i].nu>=2)
			{
			//	cout<<"!"<<endl;
			   c[s]=b[i].id;
			   	s++;
			}
		
			if(s>=2) break;
		}
		//cout<<c[0]<<" "<<c[1]<<endl;
		if(c[0]==-1||c[1]==-1) 
		printf("0\n");
		else printf("%lld\n",1ll*c[0]*c[1]);
	}
	
}


Measured memory_bytes: 1408
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MAX(a,b) ((a)>(b)?(a):(b))

int gcd(int a, int b){
   if (a * b == 0) return a == 0 ? b : a;
   if(a > b){int tmp = a; a = b; b = tmp;} // make sure a <= b 
   int r = b % a;
   return r == 0 ? a : gcd(r, a); // gcd(a, b) = gcd(b % a, a)
}


int main(void) {
   int n;
   scanf("%d", &n);
   int *L = (int *)malloc(n * sizeof(int));
   int *M = (int *)calloc(n+1 , sizeof(int));
   int *N = (int *)calloc(n+1 , sizeof(int));
   for (int i = 0; i < n; i++) {
      scanf("%d", &L[i]);
   }
   for (int i = 0; i < n; i++) {
      M[i+1] = gcd(M[i], L[i]);
      int k = n - i - 1;
      N[i+1] = gcd(N[i], L[k]);
   }
   int ans = 0;
   for (int i = 0; i < n; i++) {
      int cand = gcd(M[i], N[n-i-1]);
      ans = MAX(ans,cand);
   }
   printf("%d\n",ans);
   free(L);
   free(M);
   free(N);
   return 0;

}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
const int INF = 1e9;
typedef long long ll;

int N;
string S[100100];
int main(){
    cin >> N;
    REP(i,N) cin >> S[i];
    ll lastA = 0, firstB = 0,both = 0, cntAB = 0;
    REP(i,N){
        string s = S[i];
        REP(j,s.size()-1){
            if(s[j]=='A' && s[j+1]=='B') ++cntAB;
        }
        if(s[0]=='B' && s[s.size()-1]=='A') ++both;
        if(s[0]=='B') ++firstB;
        if(s[s.size()-1]=='A') ++lastA;
    }

    if(both > 0 && firstB == both && lastA == both) cout << cntAB + both - 1 << "\n";
    else cout << cntAB + min(lastA,firstB) << "\n";

    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define REP(i,n) for (long i=0;i<(n);i++)
#define FOR(i,a,b) for (long i=(a);i<(b);i++)
#define RREP(i,n) for(long i=n;i>=0;i--)
#define RFOR(i,a,b) for(long i=(a);i>(b);i--)
#define dump1d_arr(array) REP(i,array.size()) cerr << #array << "[" << (i) << "] ==> " << (array[i]) << endl;
#define dump2d_arr(array) REP(i,array.size()) REP(j,array[i].size()) cerr << #array << "[" << (i) << "]" << "[" << (j) << "] ==> " << (array[i][j]) << endl;
#define dump(x)  cerr << #x << " => " << (x) << endl;
#define CLR(vec) { REP(i,vec.size()) vec[i] = 0; } 
#define llINF (long long) 9223372036854775807
#define loINF (long) 2147483647
#define shINF (short) 32767
#define SORT(c) sort((c).begin(),(c).end())

using namespace std;
typedef vector<long> VI;
typedef vector<VI> VVI;

// グラフのdfs
VI sorted_ver;
VI used;
VVI edge;

long dfs(long node){
	if (used[node] == 1) return (-1);
	if (used[node] == 2) return 0;
	used[node] = 1;
	REP(i,edge[node].size()) {
		if(dfs(edge[node][i]) == (-1)) return (-1);
	}
	used[node] = 2;
	sorted_ver.push_back(node);
	return 0;
}

int main(void){
	long V,E;
	cin >> V >> E;
	sorted_ver = VI(0);
	used = VI(V,0);
	edge = VVI(V,VI(0));

	REP(i,E){
		long s,t;
		cin >> s >> t;
		edge[s].push_back(t);
	}

	REP(i,V){
		if (used[i] != 2) {
			if (dfs(i) == (-1)) {
				cout << 1 << endl;
				exit(0);
			}
		}
	}
	
	#ifdef DEBUG
		dump2d_arr(edge);
		dump1d_arr(sorted_ver);
	#endif
	cout << 0 << endl;

	return 0;
}



Measured memory_bytes: 3176
H, W = gets.split.map(&:to_i)
A = H.times.map{gets.chomp.split("")}
moved_times = A.map{|a| a.count("#")}.inject(:+)

puts  (moved_times == H+W-1 && A[0][0] == "#" && A[-1][-1] == "#") ? "Possible" : "Impossible"

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define SORT(x) sort((x).begin(),(x).end(),greater<int>())
using LL=long long;
using ULL=unsigned long long;
using PII=pair<int,int>;
const int INF = numeric_limits<int>::max();
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    int N;
    cin >> N;
    vector<int> A( N );
    for( auto &x : A )
    {
        cin >> x;
    }
    map<int,int> mp;
    REP( i, N )
    {
        mp[ A[ i ] ]++;
        mp[ A[ i ] + 1 ]++;
        mp[ A[ i ] - 1 ]++;
    }
    int res{};
    for( auto x : mp )
    {
        res = max( res, x.second );
    }
    cout << res << endl;
    return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

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

void Main(){
    int h, w, d; cin >> h >> w >> d;
    map<int, P> co;
    
    rep(i, h){
        rep(j, w){
            int a; cin >> a; a--;
            co[a] = P(i, j);
        }
    }

    auto dist = [&](int i, int j){
        return abs(co[i].fi - co[j].fi) + abs(co[i].se - co[j].se); 
    };
    
    vvi MP(d, {0});
    rep(i, d){
        int now = i;
        int next = i + d;
        while(next < h * w){
            MP[i].pb(dist(now, next));
            now += d;
            next += d;
        }
    }
    
    vvi ruiseki(d);
    rep(i, d){
        int now = 0; 
        int next;
        for(auto v : MP[i]){
            next = now + v;
            ruiseki[i].pb(next);
            now = next;
        }
    }
    
    /*
    rep(i, d){
        cout << i << ": " << endl;
        for(auto v : ruiseki[i]) cout << v << " ";
        cout << endl;
    }
    //*/
    
    int q; cin >> q;
    while(q--){
        int l, r; cin >> l >> r; l--; r--;
        int rem = l % d;
        int st = (l - rem) / d;
        int go = (r - rem) / d;
        // cout << rem << " " << st << " " << go << endl;
        cout << ruiseki[rem][go] - ruiseki[rem][st] << endl;
    }
    return;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 18640
#include <stdio.h>
#define N 110
#define INF -1

/*
int m[N][N] = {0};
int p[N] = {0};
*/

int main(){
  int n=0, i=0, j=0, k=0, l=0, q=0;
  int trash;
  int m[N][N] = {0};
  int p[N] = {0};

  for( i = 0 ; i < N ; i++){
    m[i][i] = 0;
  }

  scanf("%d", &n);
  for ( i = 0; i < n; i++ ){
    scanf("%d%d", &p[i] ,&trash );
  }
  p[i] = trash;

  for( l = 2 ; l <= n ; l++ ){
    for( i = 1 ; i <= (n-l+1) ; i++){
      j = i + l - 1;
      m[i][j] = INF;
      for( k = i ; k <= (j-1) ; k++ ){
	q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
	if( m[i][j] == INF || m[i][j] > q){
	  m[i][j] = q;
	}
      }
    }
  }


  printf("%d\n" ,m[1][n]);

  return 0; // Don't forget return 0
}

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


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

void solve() {
    int A, B;
    cin >> A >> B;


    for (int i = 1; i < 1100; ++i){
        bool eight = false;
        bool ten = false ;
        if( (int)(i * 0.08) == A) eight = true;
        if( (int)(i * 0.1) == B ) ten = true;

        if(eight and ten){
            cout << i << endl;
            return;
        }
    }

    cout << "-1" << "\n";
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

int main(){
  int K,A,B;
  cin>>K>>A>>B;
  int ans=0;
  rep(i,10000){
    if(i>=A and i<=B){
      if(i%K==0) ans=1;
    }
  }
  if(ans) cout<<"OK"<<endl;
  else cout<<"NG"<<endl;
}


Measured memory_bytes: 3624
#include <stdio.h>

int main(void)
{
	int n, a;
	int b[6] = {0};
	float height[40];
	
	scanf("%d", &n);
	
	a = n;
	
	for ( n = 0; n < a; n++){
		scanf("%f", &height[n]);
		
		if (height[n] < 165.0){
			b[0] = b[0] + 1;
		}
		else if(165.0 <= height[n] && height[n] < 170.0){
			b[1] = b[1] + 1;
		}
		else if(170.0 <= height[n] && height[n] < 175.0){
			b[2] = b[2] + 1;
		}
		else if(175.0 <= height[n] && height[n] < 180.0){
			b[3] = b[3] + 1;
		}
		else if(180.0 <= height[n] && height[n] < 185.0){
			b[4] = b[4] + 1;
		}
		else if(185.0 <= height[n]){
			b[5] = b[5] + 1;
		}
		
	}
	
	a = 0;
	n = 1;
	
	while (a != 6) {
		printf("%d:", n);
		
		while (b[n-1]--){
			printf("*");
		}
		printf("\n");
		n++;
		a++;
	}
	return (0);
}

Measured memory_bytes: 636
#include<iostream>
using namespace std;
int main()
{
	int k,i;
	int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	cin>>k;
	cout<<a[k-1];
}

Measured memory_bytes: 256
n,m=map(int,input().split())
lis=[[] for i in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    lis[a-1].append(b-1)
    lis[b-1].append(a-1)

ans=[-1]*n
ans[0] = 0
from collections import deque
q = deque([0])
while q:
    a=q.popleft()
    for i in lis[a]:
        if ans[i]==-1:
            ans[i]=a
            q.append(i)
print("Yes")
for i in range(1,len(ans)):
    print(ans[i]+1)

Measured memory_bytes: 34040
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

//#define int long long
//using ll = boost::multiprecision::cpp_int;
using ll = long long;
//constexpr int INF = 1e9;//INT_MAX=(1<<31)-1=2147483647
constexpr ll INF = (ll)1e18;//(1LL<<63)-1=9223372036854775807
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-9;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var) std::cout<<var<<std::endl
#define rep(i, n)   for(ll i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(ll i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define PI (acos(-1))
template<typename T> inline T power(T x, T n){ return n ? power(x*x%MOD,n/2)*(n%2?x:1)%MOD : 1; }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/

constexpr ll N_MAX = 100000;
constexpr ll H_I_MAX = 1000000000;

ll N;
ll H[N_MAX];

void input() {
	scanf("%lld", &N);
	rep(i, N) scanf("%lld", H + i);
}

void solve() {
	ll ans = 0;

	rep(i,N-1){
		if(H[i]>H[i+1]){
			p("No");
			return;
		}else if(H[i]==H[i+1]){

		}else{
			H[i+1]--;
		}
	}

	p("Yes");return;
}

signed main() {
	input();
	solve();
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600
#define long long long // for codeforces

int main(){
  int n;
  cin>>n;
  vector<bool> col(8,0);
  int cnt=0;
  rep(i,n){
    int d;
    cin>>d;
    d/=400;
    if(d>=8) cnt++;
    else col[d]=true;
  }

  int c=0;
  rep(i,8)if(col[i])c++;

  if(c==0) cout << 1 << " " << cnt << endl;
  else cout << c << " " << c+cnt << endl;


  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define set_bits(a) __builtin_popcount(a)
#define pb push_back
#define pf push_front
#define mod 1000000007
#define M 998244353
#define fi first
#define se second
#define endl '\n'
#define INF 1e18
#define PI 3.14159265358979323846
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


int main()
{
    ll k,a,b;
    cin>>k>>a>>b;
    ll i;
    ll flag=0;
    for(i=a;i<=b;i++)
    {
        if(i%k==0)
        {
            flag=1;
            break;
        }
    }
    if(flag)
    {
        cout<<"OK";
    }
    else
    {
        cout<<"NG"<<endl;
    }
}


Measured memory_bytes: 3636
K, X = map(int, input().split())
lst = [X]
for i in range(1, K):
	lst.append(X+i)
	lst.append(X-i)
lst.sort()
ans = str(lst[0])
for i in range(1, len(lst)):
	ans = ans + ' ' + str(lst[i])
print(ans)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,x;
  cin >> n >> x;
  vector<int>vec(n);
  for(int i = 0;i<n;i++) cin >> vec[i];
  sort(vec.begin(),vec.end());
  int count = 0;
  int total = 0;
  for(int i = 0;i<n;i++){ 
    if(vec[i] <= x) {
      x -= vec[i];
      count++;
   }
  }
  if(x>0 && n == count) count--;
  cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <regex>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;

vector<string> dfs(string s, ll depth, vector<char> symbol)
{
    vector<string> ret;
    if (depth == 0)
    {
        ret.push_back(s);
        return ret;
    }

    for (ll i = 0; i < symbol.size(); i++)
    {
        auto vec = dfs(s + symbol[i], depth - 1, symbol);
        for (auto &&e : vec)
        {
            ret.push_back(e);
        }
    }
    return ret;
}

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

int main()
{
    set<ll> a;
    set<ll> b;
    set<ll> c;

    a.insert(1);
    a.insert(3);
    a.insert(5);
    a.insert(7);
    a.insert(8);
    a.insert(10);
    a.insert(12);

    b.insert(4);
    b.insert(6);
    b.insert(9);
    b.insert(11);

    c.insert(2);

    ll x, y;
    cin >> x >> y;
    bool ok = (a.count(x) && a.count(y)) || (b.count(x) && b.count(y)) || (c.count(x) && c.count(y));

    if (ok)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
def eq1(A,B,x):
    temp = (A*x)
    temp //= B
    return temp

def eq2(A,B,x):
    temp = x//B
    temp = temp*A
    return temp

def main():
    A,B,N = map(int,input().split())

    if B <= N:
        x = B-1
        ans = eq1(A,B,x) - eq2(A,B,x)
        return ans
    else:
        x = N
        ans = eq1(A,B,x) - eq2(A,B,x)
        return ans

print(main())


Measured memory_bytes: 9132
n = int(input())
a = list(map(int, input().split()))
r, d, count = 0, 0, 0
for l in range(n):
    while True:
        if r == n or d & a[r] > 0:
            break
        d += a[r]
        r += 1
    d -= a[l]
    count += r - l

print(count)


Measured memory_bytes: 24712