akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#ifndef LOCAL
#define endl '\n'
#endif

#define fr(i, a, b) for(int i = a; i <= b; i++)
#define rf(i, a, b) for(int i = a; i >= b; i--)
#define pf push_front
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound

typedef long long ll;
typedef long double f80;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int pct(int x) { return __builtin_popcount(x); }
int pct(ll x) { return __builtin_popcountll(x); }
int bt(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))
int bt(ll x) { return 63 - __builtin_clzll(x); } // floor(log2(x))
int cdiv(int a, int b) { return a / b + !(a < 0 || a % b == 0); }
ll cdiv(ll a, ll b) { return a / b + !(a < 0 || a % b == 0); }
int nxt_C(int x) { int c = x & -x, r = x + c; return (((r ^ x) >> 2) / c) | r; }
ll nxt_C(ll x) { ll c = x & -x, r = x + c; return (((r ^ x) >> 2) / c) | r; }

vector<int> get_bits(int mask) {
	vector<int> bb;
	while(mask) { int b = bt(mask); bb.pb(b); mask ^= (1 << b); }
	reverse(all(bb));
	return bb;
}

int get_mask(vector<int> v) {
	int mask = 0;
	for(int x : v) { mask ^= (1 << x); }
	return mask;
}

template<typename T>
void uniq(vector<T> &v) { sort(all(v)); v.resize(unique(all(v)) - v.begin()); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll rand(ll l, ll r){
	uniform_int_distribution<ll> uid(l, r);
	return uid(rng);
}

void sc() {}

template <typename Head, typename... Tail>
void sc(Head &H, Tail &... T) { cin >> H; sc(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L:" << __LINE__ << "][" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// #ifndef LOCAL
// string to_string(__int128 x) {
// 	string s = "";
// 	bool neg = 0;
// 	if(x < 0) { s += "-"; neg = 1; x = -x; }
// 	if(!x) s += '0';
// 	while(x) {
// 		int rem = x % 10;
// 		s += to_string(rem);
// 		x /= 10;
// 	}
// 	reverse(s.begin() + neg, s.end());
// 	return s;
// }
// #endif

const int mod = 1e9 + 7; // 998244353;

int pwr(int a,ll b) {
	int ans = 1;
	while(b) {
		if(b & 1) ans = (ans * 1LL * a) % mod;
		a = (a * 1LL * a) % mod;
		b >>= 1;
	}
	return ans;
}

/*
	Lookout for overflows!!
	Check array sizes!!
	Clear before test cases!!
	Use the correct modulo!!
	Check for corner cases!!
	Are you forgetting something?!
	Read problem statement carefully!!!
*/

const int N = 1e5 + 5;
ll a[N];

void solve() {
	int n;
    sc(n);
    ll l = 2, r = 2;
    fr(i, 1, n) {
        sc(a[i]);
    }
    rf(i, n, 1) {
        l = cdiv(l, a[i]) * a[i];
        r = (r / a[i]) * a[i];
        if(l > r) {
            cout << -1;
            return;
        }
        r += a[i] - 1;
    }
    cout << l << " " << r << endl;
}

int main() {
	ios :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	// cin >> t;
	for(int tt = 1; tt <= t; tt++) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 4416
namespace Test
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    public class Test
    {
        public static void Main(string[] args)
        {
            var test = new Test();
            var input = test.ConvertIntArray(test.ReadInput());
            var a = test.ConvertIntArray(test.ReadInput());
            var b = test.ConvertIntArray(test.ReadInput());
            int[] array = new int[input[2]];
            int[] m = new int[3];
            var ans = int.MaxValue;
            for (var i = 0; i < input[2]; i++)
            {
                m = test.ConvertIntArray(test.ReadInput());
                var val = a[m[0] - 1 ] + b[m[1] - 1 ] - m[2];
                if (val < ans)
                {
                    ans = val;
                }
            }

            Array.Sort(a);
            Array.Sort(b);
            var val2 = a[0] + b[0];
            if (val2 < ans)
            {
                ans = val2;
            }

            Console.WriteLine(ans);

        }



        public int Gcd(int a, int b)
        {
            for (var i = b; i > 1; i -= 1)
            {
                if (a % i == 0 && b % i == 0)
                {
                    return i;
                }
            }
            return 1;
        }
        public string[] ReadInput()
        {
            return Console.ReadLine().Split(' ');
        }

        public int[] ConvertIntArray(string[] x)
        {
            var convertedArray = new int[x.Length];
            for (var i = 0; i < x.Length; i++)
            {
                convertedArray[i] = int.Parse(x[i]);
            }

            return convertedArray;
        }

        public double[] ConvertDoubleArray(string[] x)
        {
            var convertedArray = new double[x.Length];
            for (var i = 0; i < x.Length; i++)
            {
                convertedArray[i] = int.Parse(x[i]);
            }

            return convertedArray;
        }

        public long[] ConvertLongArray(string[] x)
        {
            var convertedArray = new long[x.Length];
            for (var i = 0; i < x.Length; i++)
            {
                convertedArray[i] = long.Parse(x[i]);
            }

            return convertedArray;
        }

        public int CountContainWords(string source, string word)
        {
            var count = 0;
            var loopCount = source.Length - (word.Length - 1);
            for (var i = 0; i < loopCount; i++)
            {
                if (source.Substring(i, word.Length) == word)
                {
                    count++;
                }
            }
            return count;
        }
    }
}

Measured memory_bytes: 36956
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int N;
	cin >> N;
	cout << "ABC" << N << endl;
}

Measured memory_bytes: 256
#include<iostream>

int main(){
    int x[2], y[2];
    std::cin >> x[0] >> y[0] >> x[1] >> y[1];
    std::cout << x[1] - y[1] + y[0] << " " << y[1] + x[1] - x[0] << " ";
    std::cout << x[0] - y[1] + y[0] << " " << y[0] + x[1] - x[0] << std::endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Anirudh Rayabharam (mail@anirudhrb.com)
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        GridColoring solver = new GridColoring();
        solver.solve(1, in, out);
        out.close();
    }

    static class GridColoring {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int h = in.nextInt();
            int w = in.nextInt();
            int n = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            int[][] g = new int[h][w];
            int curI, curJ;
            curI = curJ = 0;
            boolean right = true;
            for (int i = 1; i <= n; i++) {
                for (int j = 0; j < a[i - 1]; j++) {
                    g[curI][curJ] = i;
                    if (right) {
                        if (curJ + 1 == w) {
                            curI++;
                            right = false;
                        } else {
                            curJ++;
                        }
                    } else {
                        if (curJ - 1 < 0) {
                            curI++;
                            right = true;
                        } else {
                            curJ--;
                        }
                    }
                }
            }
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    out.print(g[i][j] + " ");
                }
                out.println();
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

int main(){
    while (1){
        int h, w;
        cin >> h >> w;
        if (h == 0) break;
        int x = 150;
        int y = 150;
        for (int i = 1; i <= 150; i++){
            for (int j = i + 1; j <= 150; j++){
                if (h * h + w * w < i * i + j * j){
                    if (x * x + y * y > i * i + j * j){
                        x = i;
                        y = j;
                    }
                    else if (x * x + y * y == i * i + j * j){
                        if (x > i){
                            x = i;
                            y = j;
                        }
                    }
                }
                if (h * h + w * w == i * i + j * j){
                    if (h >= i) continue;
                    if (x * x + y * y > i * i + j * j){
                        x = i;
                        y = j;
                    }
                    else if (x * x + y * y == i * i + j * j){
                        if (x > i){
                            x = i;
                            y = j;
                        }
                    }
                }
            }
        }
        cout << x << " " << y << endl;
    }
}


Measured memory_bytes: 3028
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

/* UnionFind */

struct UnionFind{
  vector<int> data;
  UnionFind(int s):data(s, -1) {}

  int root(int x){
    if(data[x] < 0) return x;
    return data[x] = root(data[x]);
  }

  bool set(int x, int y){
    x = root(x); y = root(y);
    if (x == y) return false;
    if (data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return true;
  }

  bool check(int x, int y){
    return root(x) == root(y);
  }

  int size(int x){
    return -data[root(x)];
  }
};

int main() {
  int N, M;

  cin >> N >> M;

  UnionFind uf(N);

  int ans = N;

  for (int i=0; i<M; i++) {
    int X, Y, Z;
    cin >> X >> Y >> Z;
    ans -= uf.set(X-1, Y-1);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>

using namespace std;

const int N = 1e6 + 5;
const int inf = 1e9 + 7;

vector <int> v[30];

int main() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size() - 2; i ++) {
		if (s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2]) {
			cout << i + 1 << " " << i + 3 << endl;
			return 0;
		}
	}
	if (s.size() == 2 && s[0] == s[1]) {
		cout << "1 2" << endl;
		return 0;
	}
	cout << -1 << " " << -1 << endl;
	return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

const int mod = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

int main(){
	int n,k; cin>>n>>k;
	vector<int> a(n);
	rep(i,n) cin>>a[i];
	rep(i,n-k){
		cout << (a[i+k] > a[i] ? "Yes" : "No") << endl;
	}
}

Measured memory_bytes: 4048
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  
  vector<int>d(N);
  
  for(int i=0;i<N;i++){
    cin>>d.at(i);
  }
  
  sort(d.begin(),d.end());
  
  int sum=0;
  int min=d.at(N-1);
  
  for(int i=N-1;i>=0;i--){
    if(d.at(i)<min){
      min=d.at(i);
      sum++;
    }
  }
  
  cout<<sum+1<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int h,w,i,j;
  cin >> h >> w;
  vector<bool> ki(h+5,true),kj(w+5,true);
  vector<string> g(h+5,"");
  for (i=0;i<h;i++) cin >> g.at(i);
  for (i=0;i<h;i++){
    for (j=0;j<w;j++) if (g.at(i).at(j)!='.') break;
    if (j==w) ki.at(i)=false;
  }
  for (j=0;j<w;j++){
    for (i=0;i<h;i++) if (g.at(i).at(j)!='.') break;
    if (i==h) kj.at(j)=false;
  }
  for (i=0;i<h;i++){
    for (j=0;j<w;j++) if (ki.at(i)&&kj.at(j)) cout << g.at(i).at(j);
    if (ki.at(i)) cout << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <cmath>
#include <iostream>
#include <unordered_map>
#include <algorithm>
#include <set>

using namespace std;

int n;

bool cmp(pair<int, int> a, pair<int, int> b) {

    return a.first > b.first;
}
int main() {
    int n;
    cin >> n;
    unordered_map<string, int> m;
    for(int i = 0; i < n; i++) {
        string s;
        cin >> s;
        m[s]++;
    }
    cout << m.size() << '\n';
    return 0;
}

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

using namespace std;

int main()
{
    int n = 0;
    string s;

    cin >> s;

    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] == '+')
            n++;
        else
            n--;
    }

    cout << n << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lp(i, x, y) for(ll i = x ; i < y ; i++)
#define lp_rev(i, x, y) for(int i = x ; i >= y ; i--)
#define ff first
#define ss second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(v)  v.begin(), v.end()
#define vll vector<long long int>
#define vi vector<int>
#define Fasttt ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
typedef unsigned long long ull;
typedef long long ll;
#define endl "\n"
ll mod = 1000000007;

int main()
{
	Fasttt;
	int n, k;
	cin>> n>> k;
	vi v(n), dp(n);
	lp(i, 0, n)
		cin>> v[i];
	dp[0] = 0;
	dp[1] = abs(v[1] - v[0]);
	lp(i, 2, n)
	{
		dp[i] = INT_MAX;
		lp(j, 1, k + 1)
			if(i - j >= 0)
				dp[i] = min(dp[i], dp[i - j] + abs(v[i] - v[i - j]));
	}
	cout<< dp[n - 1];
	return 0;
}		

Measured memory_bytes: 1024
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List
import Test.HUnit

main :: IO ()
-- main = runTestTT (TestList tests) >> return ()
main = do
  [yz,tz] <- getl $ split toInt
  when (yz /= 0 || tz /= 0) $ do
    n <- getl toInt
    xs <- getl $ split toInt
    putStrLn $ solve (yz,tz) xs
    main

solve :: (Int,Int) -> [Int] -> String
solve (yz,tz) xs
  | alvFrog [(yz,tz)] (mkzl xs) = "OK"
  | otherwise = "NA"

mkzl :: [Int] -> [(Int,Int)]
mkzl [] = []
mkzl (x:y:ys) = (x,y) : mkzl ys

mvFrog :: (Int,Int) -> (Int,Int) -> [(Int,Int)]
mvFrog (yzf,tzf) (yzs,tzs) = intersect fzs szs
  where
    fzs = [(i,j) | (i,j) <- f (yzf,tzf), i >= 0, i <= 9,j >= 0, j <= 9]
    szs = [(i,j) | (i,j) <- g (yzs,tzs), i >= 0, i <= 9,j >= 0, j <= 9]
    f (i,j) = [(i-2,j),(i-2,j-1),(i-2,j+1),(i,j-2),(i-1,j-2),(i+1,j-2),(i,j+2),(i-1,j+2),(i+1,j+2),(i+2,j),(i+2,j-1),(i+2,j+1)]
    g (i,j) = [(i,j),(i-1,j),(i+1,j),(i,j-1),(i-1,j-1),(i+1,j-1),(i,j+1),(i-1,j+1),(i+1,j+1)]

alvFrog :: [(Int,Int)] -> [(Int,Int)] -> Bool
alvFrog xs [] = (not . null) xs
alvFrog xs (s:ss) = alvFrog (nub $ concatMap (flip mvFrog s) xs) ss

toInt :: String -> Int
toInt s = read s

split :: (String -> a) -> String -> [a]
split f = map f . words

getl :: (String -> a) -> IO a
getl f = f <$> getLine

Measured memory_bytes: 4060
n = int(input())
h = list(map(int, input().split()))

for i in range(n-1):
  if h[i] == h[i+1]:
    continue
  elif h[i] <= h[i+1]-1:
    h[i+1]-=1
    continue
  else:
    print("No")
    quit()
    
print("Yes")

Measured memory_bytes: 63856
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VII;
typedef pair<int,int> PII;

int main(){
  int N;
  cin>>N;
  VI X(N);
  rep(i,N) cin>>X[i];
  int Y=0,ans=0;
  rep(i,N){
    if(i){
      if(X[i-1]>=X[i]){
        Y++;
        ans=max(ans,Y);
      }else Y=0;
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 640
import java.util.Scanner;
class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		long num,fact=1;
		
		num = scan.nextInt();
		
		while(num > 1){
			fact *= num;
			num--;
		}
		
		System.out.println(fact);
	}
}

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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int  i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int  i = (0; i < n; i++)
#define irrep2(i,a,n) for(int i = (a); i <= (int)(n); i++)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std; 

v_int cost(10, INF);
v2_int c(10, v_int(10, 0));

void dfs(int start, int from, v_bool &used, int value)
{
    if(from == 1) {
        cost[start] = min(cost[start], value);
        return;
    }

    irep2(i, 0, 9) {
        if(used[i] == false && start != i) {
            used[i] = true;
            dfs(start, i, used, value+c[from][i]);
            used[i] = false;
        }
    }
}

int main(void)
{
    int h, w;
    cin >> h >> w;
    

    irep(i, 10) {
        irep(j, 10) {
            cin >> c[i][j];
        }
    }

    v2_int a(h, v_int(w, 0));
    irep(i, h) {
        irep(j, w) {
            cin >> a[i][j];
        }
    }

    irep2(start, 0, 9) {
        v_bool used(10, false);
        int n = 0;

        dfs(start, start, used, n);
    }
    
    int ans = 0;
    irep(i, h) {
        irep(j, w) {
            if(a[i][j] == 1 || a[i][j] == -1) {
                continue; 
            } else {
                ans += cost[a[i][j]];    
            }
        }
    }
    cout << ans << endl;
    return 0;
}
/** atcoder **/


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

using P = pair<int,int>;

int main(){
    int n;
    cin >> n;
    vector<P> x(n);
    vector<int> ans(n);
    for(int i=0;i<n;i++){
        cin >> x[i].first;
        x[i].second = i;
    }
    sort(x.begin(), x.end());
    for(int i=0;i<n;i++){
        int b = (i<n/2 ? x[n/2].first : x[n/2-1].first);
        ans[x[i].second] = b;
    }
    for(int i=0;i<n;i++){
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 4480
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
using namespace std;

//ABC138 B
int main() {
	int n;
	cin >> n;
	double A[1010];
	for (int i=0; i<n; i++) {
		cin >> A[i];
	}
	double ans = 0.0;
	for (int i=0; i<n; i++) {
		double inv = 1/A[i];
		ans += inv;
	}
	ans = 1/ans;

	cout << ans << endl;
}

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

ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    ll r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}
int main (){
    int n;
    int ans=0;
    cin >> n;
    vector<int>a(n+2);
    a[0]=0;
    a[n+1]=0;
    for(int i=1;i<=n;i++){
        int x;
        cin >> x;
        a[i]=x;
        ans+=abs(a[i]-a[i-1]);
    }
    ans+=abs(a[n+1]-a[n]);
    for(int i=1;i<=n;i++){
        cout << ans-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i+1]-a[i-1]) <<endl;
    }
    return 0;
}



Measured memory_bytes: 1664
n,m=map(int,input().split())
k,l=set(),set()
for i in range(m):
  s=list(map(int,input().split()))
  if 1 in s:
    k|={s[1]}
  if n in s:
    l|={s[0]}
print('POSSIBLE' if len(k&l)>0 else 'IMPOSSIBLE')

Measured memory_bytes: 19000
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

string str;

int main(void){
	cin >> str;
	if(str[0]==str[1] && str[1]==str[2]){
		printf("Yes\n");
		return 0;
	}
	if(str[1]==str[2] && str[1]==str[3]){
		printf("Yes\n");
		return 0;
	}
	printf("No\n");
	return 0;
}

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

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

int main()
{
    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    vector<ll> p(a), q(b), r(c);
    for (int i = 0; i < a; i++)
    {
        cin >> p[i];
    }
    for (int i = 0; i < b; i++)
    {
        cin >> q[i];
    }
    for (int i = 0; i < c; i++)
    {
        cin >> r[i];
    }
    sort(p.begin(), p.end());
    reverse(p.begin(), p.end());
    sort(q.begin(), q.end());
    reverse(q.begin(), q.end());
    sort(r.begin(), r.end());
    reverse(r.begin(), r.end());
    vector<ll> picks;
    for (int i = 0; i < x; i++)
    {
        picks.push_back(p[i]);
    }
    for (int i = 0; i < y; i++)
    {
        picks.push_back(q[i]);
    }
    sort(picks.begin(), picks.end());
    for (int i = 0; i < c && i < x + y; i++)
    {
        picks[i] = max(picks[i], r[i]);
    }
    ll ans = 0;
    for (int i = 0; i < x + y; i++)
    {
        ans += picks[i];
    }
    cout << ans << endl;
    return 0;
}

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

Measured memory_bytes: 7708
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++ )
#define dump(x) cerr << #x << " = " << (x) << endl;
int A[100010];
int cnt[100010];
int main(void){
    int N; cin >> N;
    rep(i, N) cin >> A[i];
    rep(i, N) cnt[A[i]]++;
    rep(i, 100010) {
      if (cnt[i] % 2 == 1) cnt[i] = 1;
      else if (cnt[i] % 2 == 0 && cnt[i] >= 2) cnt[i] = 2;
    }
    int cnt1 = 0;
    int cnt2 = 0;
    rep(i, 100010) if (cnt[i] == 1) cnt1++;
    rep(i, 100010) if (cnt[i] == 2) cnt2++;
    //rep(i, 20) cout << i << " " << cnt[i] << endl;
    cout << cnt1 + cnt2 - cnt2 % 2 << endl;


    return 0;
}


Measured memory_bytes: 1024
import java.util.*;
import java.io.*;
//import java.util.stream.Stream;
import static java.lang.Math.*;

public class Main {
	Scanner cin;

	void init() throws Exception {
		cin = new Scanner(new BufferedInputStream(System.in));
//		cin = new Scanner(new File("in.txt"));
//		System.setOut(new PrintStream(new File("out.txt")));
		solve();
	}

	void solve() {
		int N = cin.nextInt();
		int T = cin.nextInt();
		cin.nextLine();
		int[] t = Arrays.stream(cin.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
		int cnt = 0;
		for (int i=1;i<N;i++){
			cnt += min(t[i]-t[i-1], T);
		}
		cnt += T;
		System.out.println(cnt);
	}

	public static void main(String[] args) throws Exception {
		Main M = new Main();
		M.init();
	}

}


Measured memory_bytes: 54996
#include <bits/stdc++.h>
#include<algorithm>
 
using namespace std;
  
vector<long long> divisor(long n, long gcd) {
  vector<long long> ret;
  for(long long i = 1; i * i <= n; i++) {
    if(i > gcd) {
      break;
    }
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
 
int main() {
  long long A,B;
 
  cin >> A >> B;
 
  long long gcd = __gcd(A,B);
  
  vector<long long> a = divisor(A, gcd);
  vector<long long> b = divisor(B, gcd);
  
  vector<long long> c;
  set_intersection(a.begin(), a.end()
                     , b.begin(), b.end()
                     , inserter(c, c.end()));
 
  vector<long long> d; // 互いに素な約数
 
  d.push_back(1);
  
  for(long long i=1; i<c.size(); i++){
    if(c.at(i) !=2 && c.at(i)%2 == 0){
      continue;
    }
    bool so = true;
 
    for(long long l=0; l < d.size(); l++){
      if(d.at(l) !=1 && c.at(i)%d.at(l) == 0){
        so = false;
        break;
      }
    }
 
    if(so) {
      d.push_back(c.at(i));
    }
    
  }
  cout << d.size();
  
 }

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

struct Mod
{
    const static auto M = static_cast<int>(1e9+7);
    long long k;

    Mod() = default;
    Mod(long long k) : k(k%M) {}
};

Mod operator+(Mod a, Mod b) { return a.k + b.k; }
Mod operator*(Mod a, Mod b) { return a.k * b.k; }
Mod& operator*=(Mod& a, Mod b) { return a = a*b; }

template <typename T>
T power(T x, int k)
{
    if (k == 1) return x;
    else if (k % 2 == 0) return power(x * x, k/2);
    else return x * power(x * x, k/2);
}

Mod solve(int N, string s)
{
    auto M = static_cast<int>(s.length());

    auto ways = vector<Mod>(N+1);
    ways[0] = 1;
    for (auto i = 0; i < N; i++)
    {
        auto nways = vector<Mod>(N+1);

        nways[0] = ways[0] + ways[1];
        for (auto length = 1; length < N; length++)
            nways[length] = 2*ways[length-1] + ways[length+1];
        nways[N] = 2*ways[N-1];

        ways = nways;
    }

    auto two_inverse = power(Mod(2), Mod::M-2);
    auto result = ways[M];
    for (auto i = 0; i < M; i++)
        result *= two_inverse;
    return result;
}

int main()
{
    int N; cin >> N;
    string s; cin >> s;
    cout << solve(N, s).k << endl;
}


Measured memory_bytes: 512
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	a := ReadInts(3)
	sort.Ints(a)
	fmt.Println(a[0] * a[1] / 2)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


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

int main() {
    int n, q;
    cin >> n;
    int S[n];
    for (int i = 0; i < n; i++) cin >> S[i];
    cin >> q;
    int T, C = 0;
    for (int i = 0; i < q; i++) {
        cin >> T;
        for (int j = 0; j < n; j++) {
            if (T == S[j]) {
                C++;
                break;
            }
        }
    }
    cout << C << endl;

}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n, k, x, ans = 0;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> x;
		ans += min((x - 0) * 2, abs(x - k) * 2);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n =10**5+4
p = [False] * 2 + [True] * (n-2)
for i in range(2,n):
    if p[i]:
        for j in range(i*2,n,i):
            p[j] = False
x=int(input())
while p[x]==False:
    x+=1
print(x)    

Measured memory_bytes: 4724
#include <stdio.h>

int main(void)
{
  int n[100000], q[50000], n1, q1, i, j, k = 0, sta, left = 0;
  scanf("%d", &n1);
  for (i = 0; i < n1; i++)  {
    scanf("%d", &n[i]);
  }
  int right, mid;
  scanf("%d", &q1);
  for (i = 0; i < q1; i++)  {
    scanf("%d", &q[i]);
  }

  for (i = 0; i < q1; i++)  {
    right = n1;
    left = 0;
    while (left < right)  {
      mid = (left + right) / 2;
      if (n[mid] == q[i])  {
        k++;
        break;
      }
      else if (n[mid] > q[i])  {
        right = mid;
      }
      else  {
        left = mid + 1;
      }
    }
  }

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

  return 0;
}

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

namespace B_ABC130
{
    class MainClass
    {

        static int[] s;
        static int[] l;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(Console.ReadLine().Split().ToArray(), int.Parse);           
            l = Array.ConvertAll(Console.ReadLine().Split().ToArray(), int.Parse);
            long x = 0;
            int ans = 1;
            for(int i=0;i<s[0];i++){
                x = x+l[i];
                if(x<=s[1]){
                    ans++;
                }else{
                    break;
                }


            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13268
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iostream>
#include <limits>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#pragma comment(linker, "/STACK:36777216")

using namespace std;

#define MP make_pair
#define all(v) (v).begin(), (v).end()
#define PROBLEM_ID "A"

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef long double ld;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;

int main() {
  string s;
  cin >> s;
  vi d(s.length(), 0);
  ll res = 0;
  for (int i = s.length() - 3; i >= 0; --i) {
    if (s[i + 1] == 'B' && s[i + 2] == 'C') {
      d[i] = d[i + 2] + 1;
    }
    else if (s[i + 1] == 'A') {
      d[i] = d[i + 1];
    }
    if (s[i] == 'A') {
      res += d[i];
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 1412
import java.util.*;

import static java.lang.System.*;

public class Main {

	Scanner sc = new Scanner(in);
	
	int[] eratosthenes(int n) {
		boolean[] dp = new boolean[n+1];
		dp[0] = dp[1] = true;
		List<Integer> prime = new LinkedList<Integer>();
		for (int i = 2; i <= n; i++) {
			if (dp[i]) continue;
			prime.add(i);
			for (int j = i + i; j <= n; j += i) 
				dp[j] = true;
		}
		
		int[] ret = new int[prime.size()];
		int count = 0;
		for (int num : prime)
			ret[count++] = num;
		
		return ret;
	}
	
	void run() {
		int m, a, b;
		int[] prime = eratosthenes(100000);
		while (true) {
			m = sc.nextInt(); a = sc.nextInt(); b = sc.nextInt();
			if (m == 0 && a == 0 && b == 0) break;
			
			
			int p = 0, q = 0;
			I:for (int i = 0; i < prime.length; i++) {
				for (int j = i; j < prime.length; j++) {
					if (prime[i]*prime[j] <= m) {
						if (a*prime[j] <= b*prime[i]) {
							if (p*q < prime[i]*prime[j]) {
								p = prime[i];
								q = prime[j];
							}
						}
					} else {
						if (prime[i]*prime[i] > m) break I;
						continue I;
					}
				}
			}
			
			out.printf("%d %d\n", p, q);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}

}

Measured memory_bytes: 35804
#include <bits/stdc++.h>
#define LL long long
#define mp make_pair
#define pb push_back
#define VI vector<int>
#define pii pair<int,int>
using namespace std;
int n, m;
int S[6], C[6];
bool valid(int x){
	stringstream ss;
	ss << x;
	string num = ss.str();
	if(num.length() != n) return false;
	for(int i = 0; i < m; i++){
		if(num[S[i]-1]-'0' != C[i]) return false;
	}
	return true;
}
int main(){
	scanf("%d %d", &n, &m);
	for(int i = 0; i < m; i++){
		scanf("%d %d", &S[i], &C[i]);
	}
	for(int i = 0; i < 1000; i++){
		if(valid(i)){
			printf("%d\n", i);
			return 0;
		}
	}
	printf("-1\n");
	return 0;
}

Measured memory_bytes: 256
#include<map>
using namespace std;
#include<bits/stdc++.h>
int main()
{
    int n,i,ans=0,j;
    cin>>n;
    int a[n];
    for(i=0;i<n;i++)
    cin>>a[i];
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<n;j++)
        ans+=a[i]*a[j];
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;

typedef long long ll;

const ll INF = 1e18;
const int BIG = 1e9;
const int maxN = 200 * 1000 + 9;
const string FILENAME = "sample";

int n, q;
int s[maxN], t[maxN], x[maxN];
int d[maxN], ans[maxN];

pair<int, pair<int, int> > intervals[maxN];

void read(){
	cin >> n >> q;
	for(int i = 1; i <= n; i++){
		cin >> s[i] >> t[i] >> x[i];
		s[i] = s[i] * 2 - 1;
		t[i] = t[i] * 2 - 1;
		x[i] *= 2;
		intervals[i] = make_pair(x[i], make_pair(s[i] - x[i], t[i] - x[i]));
	}

	for(int i = 1; i <= q; i++){
		cin >> d[i];
		d[i] *= 2;
	}
}

void solv(){
	sort(intervals + 1, intervals + n + 1);
	fill_n(ans, q + 1, -2);
	//for(int i = 1; i <= q; i++){
	//	cerr << d[i] << ' ';
	//}
	//cerr << '\n';

	set<pair<int, int> > S;
	for(int i = 1; i <= q; i++){
		S.insert(make_pair(d[i], i));
	}

	for(int i = 1; i <= n; i++){
		if(S.empty())
			continue;
		set<pair<int, int> >::iterator it = S.lower_bound(make_pair(intervals[i].second.first, -1));
		while(S.size() && it != S.end() && (it->first <= intervals[i].second.second)){
			ans[it->second] = intervals[i].first;
			S.erase(it++);
		}
	}

	for(int i = 1; i <= q; i++)
		cout << (ans[i] / 2) << '\n';
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
#ifdef h4h4
	freopen((FILENAME + ".inp").c_str(), "r", stdin);
	freopen((FILENAME + ".out").c_str(), "w", stdout);
#endif

	read();
	solv();

	return 0;
}


Measured memory_bytes: 17536
object Main extends App {
  var total:Double = 0
  var n = scala.io.StdIn.readInt()
  for(i<-1 to n) {
    val xu = scala.io.StdIn.readLine()
    val xuArray = xu.split(" ")
    if(xuArray(1) == "JPY"){
      total += xuArray(0).toDouble
    } else {
      total += xuArray(0).toDouble * 380000
    }
  }
  println(total)
}


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

typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    if (s.size() < 3) {
        cout << 0 << endl;
        return 0;
    }
    vector<string> cans;
    vector<string> next;
    for (int i = 1; i < s.size(); i++) {
        if (i == 1) {
            cans.push_back("3");
            cans.push_back("5");
            cans.push_back("7");
            next.push_back("3");
            next.push_back("5");
            next.push_back("7");
            continue;
        }
        vector<string> toAdd;
        for (string ne : next) {
            toAdd.push_back(ne + "3");
            toAdd.push_back(ne + "5");
            toAdd.push_back(ne + "7");
        }
        for (string add : toAdd) cans.push_back(add);
        next = toAdd;
    }
    int t = s[0] - '0';
    vector<string> toAdd;
    if (t >= 7) {
        for (string can : next) {
            toAdd.push_back("3" + can);
            toAdd.push_back("5" + can);
            toAdd.push_back("7" + can);
        }
    } else if (t >= 5) {
        for (string can : next) {
            toAdd.push_back("3" + can);
            toAdd.push_back("5" + can);
        }
    } else if (t >= 3) {
        for (string can : next) {
            toAdd.push_back("3" + can);
        }
    }
    for (string add : toAdd) cans.push_back(add);
    int ans = 0;
    for (string can : cans) {
        if (find(can.begin(), can.end(), '3') == can.end()) continue;
        if (find(can.begin(), can.end(), '5') == can.end()) continue;
        if (find(can.begin(), can.end(), '7') == can.end()) continue;
        if (stoi(can) > stoi(s)) continue;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2172
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String temp = scanner.nextLine();

		int A = 0;
		int B = 0;

		for(int i = 0; i < temp.length(); i++) {

			int a = temp.charAt(i) - 48;

			if(a == 0) {
				A++;
			}else {
				B++;
			}

		}


		System.out.println(Math.min(A, B) * 2);


	}

}


Measured memory_bytes: 27012
/*Read the problem carefully before starting to work on it*/
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;

//ll ncr(ll n,ll r){ll ans=1;r=min(r,n-r);for (int i=1;i<=r;i++){ans*=(n-r+i);ans/=i;}return ans;}

#define pb push_back
#define eb emplace_back
#define mp(x,y) make_pair(x,y)
#define mod 1000000007

double PI=3.1415926535897932384626;

//template<typename T> T 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;}

//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;

#define fi first
#define se second

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    ll n,k;
    cin>>n>>k;
    vector<ll>arr(n);
    for(ll i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    sort(arr.begin(),arr.end());
    ll sum=0;
    for(ll i=0;i<(n-k);i++)
    {
        sum+=arr[i];
    }
    cout<<sum;
    return 0;
}


//252908XL

Measured memory_bytes: 1792
#include <stdio.h>
#include <math.h>
#include<vector>
using namespace std;
typedef long long ll;

int main(void) {
  ll i, j, k, n, m, ans = 1;
  scanf("%lld%lld", &n, &m);
  vector<ll> v;
  for(i = 1; i <= sqrt(m); ++i) if(!(m % i)) v.push_back(i);
  for(i = v.size() - 1; i >= 0; --i) v.push_back(m / v[i]);
  m /= n;
  for(i = 0; i < v.size(); ++i) if(v[i] <= m) ans = v[i];
  printf("%lld",ans);
  return 0;
}

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


int main() {
	char a[4];
	cin >> a;
	int sum = 700;
	for (int i = 0;i < 3;i++) {
		if (a[i] == 'o')
			sum += 100;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;int64_t N,P,p,i,r,v,m[1<<20];string S;main(){cin>>N>>P>>S;if(10%P)for(*m=p=1,i=N;i--;)r+=m[v=(v+(S[i]-48)*(p=(p*10)%P))%P]++;else{for(;i<N;i++)if(!((S[i]-8)%P))r+=i+1;}cout<<r;}

Measured memory_bytes: 644
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include <unordered_map>
using namespace std;


#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;

const int MOD = 1000 * 1000 * 1000 + 7;

const int MAX = 100 * 1000 + 47;
const int LEN = 25;

int gcd(int a, int b)
{
    if (!a)return b;
    return gcd(b %a, a);
}

int main()
{
    set<int> X;
    int n, d;
    int g = 0;
    cin>> n >> d;
    int mx = -1;
    FOR(i, 0, n) {
        int x;
        cin>> x;
        mx = max(mx, x);
        g = gcd(g, x);
        X.insert(x);
        
    }
    
    if (X.count(d)) {
        cout << "POSSIBLE" << endl;
    } else if (d > mx || d % g)
    {
        cout << "IMPOSSIBLE" << endl;
    }
    else cout << "POSSIBLE" << endl;
    
    return 0;
}

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

int main(){
  string s;
  int l,count;
  count=0;
  cin>>s;
  l=s.length();
  for(int i=0;i<l/2;i++){
    if(s[i]!=s[l-1-i]){
      count++;
    }
  }
  cout<<count<<"\n";
}


Measured memory_bytes: 256
#include <stdio.h>
int main() {
int a = 0, b, E, Y;
scanf("%d", &E);
scanf("%d", &Y);
if (E == 0) {
if (Y >= 1868 && Y <= 1911) {
 a = Y - 1868;
printf("M%d\n", a+1); 
} else if (Y >= 1912 && Y <= 1925) {
 a = Y - 1912;
printf("T%d\n", a+1);
} else if (Y >= 1926 && Y <= 1988) {
 a = Y - 1926;
printf("S%d\n", a+1);
} else if (Y >= 1989 && Y <= 2016) {
 a = Y - 1989;
printf("H%d\n", a+1);
}
} 	else if (E == 1) {
		b = 1867 + Y;
		printf("%d\n", b);
	} else if (E == 2) {
		b = 1911 + Y;
		printf("%d\n", b);
	} else if (E == 3) {
		b = 1925 + Y;
		printf("%d\n", b);
	} else if (E == 4) {
		b = 1988 + Y;
		printf("%d\n", b);
} return 0;
}

Measured memory_bytes: 1860
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#define nmax_def 110000
#define Cmax_def 2200
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;

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

	return 0;
}

Measured memory_bytes: 640
N, W = map(int, input().split())

w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = {0: 0}
for i in range(N):
    for cv, cw in list(dp.items()):
        if cw + w[i] > W:
            continue
        dp[cv + v[i]] = min(
            dp.get(cv + v[i], float('inf')),
            cw + w[i])
print(max(dp))

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

vector <int> from[100010];
int fa[100010], in[100010];

void dfs(int x, int last){
	fa[x] = last;
	vector <int> son;
	for (int i = 0; i < from[x].size(); i++){
		int v = from[x][i];
		if (in[v] > 1) in[v]--;
		else son.push_back(v);
	}
	for (int i = 0; i < son.size(); i++){
		dfs(son[i], x);
	}
}

int main(){
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 1; i < n + m; i++){
		int x, y;
		scanf("%d%d", &x, &y);
		from[x].push_back(y);
		in[y]++;
	}
	int R;
	for (int i = 1; i <= n; i++){
		if (!in[i]) R = i;
	}
	dfs(R, 0);
	for (int i = 1; i <= n; i++){
		printf("%d ", fa[i]);
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 19584
N = int(input())
S = input()

white = len([char for char in S if char == '.'])

left_black = 0
right_white = white
result = left_black + right_white
for char in S:
    if char == '.':
        right_white -= 1
    else:
        left_black += 1
    result = min(result, right_white + left_black)
print(result)


Measured memory_bytes: 5096
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {

	char a[10005];
	scanf("%s",a);
	if (a[0] == 'Y' && a[1] == 'A' && a[2] == 'K' && a[3] == 'I') {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	return 0;
}


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

using namespace std;


int main() {
    int N; cin >> N;
    vector<int> A(N);

    for(int i=0;i<N;i++) {
        cin >> A[i];
        A[i] -= (i+1);

    }

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

    long long ans = 0ll;
    long long b = A[N/2];
    
    for_each(A.begin(), A.end(), [&](int a) {
            ans += abs(a - b);
            });

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024