akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DEBUG 0
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) if(DEBUG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DEBUG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
using pii = pair<int, int>; using vi = vector<int>;
static const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
static const int MOD = (int)(1e9 + 7);

//素集合データ構造
//Union-Find木
struct UnionFind {
	vector<int> p; //parent
	int s; //size 集合の数
	UnionFind(int n) :p(n, -1), s(n) {}
	bool unite(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (size(x) < size(y)) swap(x, y);
		p[x] += p[y]; p[y] = x; s--;
		return true;
	}
	bool same(int x, int y) { return root(x) == root(y); }
	int root(int x) { return p[x] < 0 ? x : p[x] = root(p[x]); }
	//集合の要素数
	int size(int x) { return -p[root(x)]; }
};

signed main() {
	int N, M; cin >> N >> M;
	UnionFind UF(N);
	vector<vector<int>> L(M);
	rep(i, 0, N) {
		int K; cin >> K;
		rep(j, 0, K) {
			int LL; cin >> LL; LL--;
			L[LL].emplace_back(i);
		}
	}
	rep(k, 0, L.size()) {
		rep(l, 1, L[k].size()) {
			UF.unite(L[k][l], L[k][l - 1]);
		}
	}
	cout << (UF.size(0) == N ? "YES" : "NO") << endl;
	return 0;
}

Measured memory_bytes: 4608
N = int(input())
A = list(map(int, input().split()))
r = 0

for i in range(N-1):
  flag = False
  for j in range(N-2, i-1, -1):
    if A[j] > A[j+1]:
      t = A[j]
      A[j] = A[j+1]
      A[j+1] = t
      flag = True
      r += 1

print(" ".join(map(str, A)))
print(r)


Measured memory_bytes: 5596
#include<cstdio>
#include<cmath>

#define ll long long
using namespace std;
ll n;
ll a[100010];
int main()
{
	scanf("%lld", &n);
	for (int i = 1; i <= n; i++)
		scanf("%lld", &a[i]);
	ll dap = 0;
	for (int i = 0; i <= n; i++)
		dap += (abs(a[i] - a[i + 1]));
	for (int i = 1; i <= n; i++)
	{
		ll ch = dap;
		ch -= (abs(a[i] - a[i + 1]));
		ch -= (abs(a[i - 1] - a[i]));
		ch += (abs(a[i + 1] - a[i - 1]));
		printf("%lld\n", ch);
	}
}


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

int main() {
  int H,W;
  cin >> H >> W;
  vector<string> pic(H);
  for(int i = 0; i < W+2; i++)
  cout << "#";
  cout << endl;
  for(int i = 0; i < H; i++){
    cout << "#";
    cin >> pic[i];
    cout << pic[i] << "#" << endl;
  }
  for(int i = 0; i < W+2; i++)
  cout << "#";
  cout << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int i, j, h, w;
        while(true) {
            int testdai2;
            int ansh = 999, answ = 999;
            int ansmenseki = 9999999;
            h=sc.nextInt();
            w=sc.nextInt();

            if(h == 0 && w == 0)break;

            int dia1 = (h * h) + (w * w);



            for( i = 1; i < 150; i++) {
                for( j=i+1 ; j < 150; j++) {
                    testdai2 = (i * i)+(j * j);

                    if(dia1 <= testdai2) {
                        if(dia1 == testdai2 && h >= i)continue;
                        if(testdai2 < ansmenseki) {
                        ansh = i;
                        answ = j;
                        ansmenseki = testdai2;
                        }
                    }
                }
            }
            System.out.println(ansh + " " + answ);
        }
        sc.close();
    }
}


Measured memory_bytes: 27580
//https://qiita.com/tanakh/
#[allow(unused_macros)]
macro_rules! input {
	(source = $s:expr, $($r:tt)*) => {
		let mut iter = $s.split_whitespace();
		let mut next = || { iter.next().unwrap() }; 
		input_inner!{next, $($r)*}
	};
	($($r:tt)*) => {

		let stdin = std::io::stdin();
		let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); 
		let mut next = move || -> String{
			bytes
				.by_ref()
				.map(|r|r.unwrap() as char) 
				.skip_while(|c|c.is_whitespace()) 
				.take_while(|c|!c.is_whitespace()) 
				.collect()
			};
	input_inner!{next, $($r)*} 
	};
}

#[allow(unused_macros)]
macro_rules! input_inner { 
	($next:expr) => {}; 
	($next:expr, ) => {};

	($next:expr, $var:ident : $t:tt $($r:tt)*) => { 
		let $var = read_value!($next, $t); 
		input_inner!{$next $($r)*}
	}; 
}
#[allow(unused_macros)]
macro_rules! read_value { 
	($next:expr, ( $($t:tt),* )) => {
		( $(read_value!($next, $t)),* ) 
	};
	
	($next:expr, [ $t:tt ; $len:expr ]) => {
		(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
	};

	($next:expr, chars) => {
		read_value!($next, String).chars().collect::<Vec<char>>()
	};
	
	($next:expr, bytes) => {
		read_value!($next, String).into_bytes()
	};
	
	($next:expr, usize1) => { 
		read_value!($next, usize) - 1
	};

	($next:expr, $t:ty) => {
		$next().parse::<$t>().expect("Parse error")
	};
}

fn main(){
    input!{
        n : usize,
        d : i64,
        x : i64,
        a : [i64; n],
    }
    let mut count : i64 = 0;
    let mut ans : i64 = 0;
    for i in 0..n {
        count = (d - 1) /  a[i] + 1;
        ans = count + ans
    }
    println!("{}",ans + x);
}

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

#define dbg(a)  cerr << __LINE__ << ": " << #a << " = " << a << '\n'

template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }

typedef long long ll;

int main(){
  ios::sync_with_stdio(0), cin.tie(0);
  
  int h, w; cin >> h >> w;
  vector<string> s(h);  cin >> s;
  vector<string> ans(2*h);
  for (int i = 0; i < 2*h; ++i){
    for (int j = 0; j < w; ++j){
      ans[i] += s[i/2][j];
    }
  }
  for (int i = 0; i < 2*h; ++i){
    cout << ans[i] << "\n";
  }
  return 0;
}

Measured memory_bytes: 3700
import scala.io.StdIn._
import scala.annotation.tailrec

object Main {
    def main(args: Array[String]): Unit = { 
        digit(readLine().split(" ").map(_.toDouble))
    }   

    @tailrec
    def digit(n: Seq[Double]): Unit = {
       val d: Double = n(1) * n(3) - n(0) * n(4)
       val x: Double = zero((n(1) * n(5) - n(4) * n(2)) / d)
       val y: Double = zero((n(2) * n(3) - n(0) * n(5)) / d)
       println(f"$x%.3f $y%.3f")
       val next: String = readLine()
       if(next == null) Unit else digit(next.split(" ").map(_.toDouble))
    }

    def zero(n: Double): Double = if(Math.abs(n) == 0) 0 else n
}

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    bool check = true;
    int length = S.length();
    int count = 0;
    for (int i = 0; i < length - 1; ++i) {
        if (S.length() <= 1) break;
        if ((S[i] == '0' && S[i + 1] == '1') || (S[i] == '1' && S[i + 1] == '0')) {
            // cout << i << endl;
            // cout << S << endl;
            S.erase(S.begin() + i, S.begin() + i + 2);
            // cout << S << endl << endl;
            i -= 2;
            count += 2;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <cstring>
#include <sstream>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vii> vvii;

#define fastIO ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define forw(i,l,r) for(int i=(l);i<(r);i++)
#define forb(i,r,l) for(int i=(r);i>(l);i--)
#define sqr(x) (x)*(x)
#define log2i(x) 32 - __builtin_clz((x)) - 1
#define log2l(x) 64 - __builtin_clzll((x)) - 1
#define inf1 int(1e9+7)
#define inf2 0x3f3f3f3f
#define infll ll(1e18+7)
#define Pi acos(-1.0)
#define mu(x,y) trunc(exp(log((x))*(y)))
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()

const int N = 1e5+7;
int n,k;
int dp[N], h[N];

int vet(int vt) {
    if(dp[vt]!=-1) return dp[vt];
    int ans=INT_MAX;
    forw(i,1,k+1) {
        if(vt+i<=n) ans=min(ans,vet(vt+i)+abs(h[vt-1]-h[vt+i-1]));
    }
    return dp[vt]=ans;
}

int main() {
    fastIO;
    //freopen("test.inp","r",stdin);
    //freopen(".out","w",stdout);

    cin >> n >> k;
    forw(i,0,n) {
        cin >> h[i];
        dp[i+1]=-1;
    }
    dp[n]=0;
    cout << vet(1);
    return 0;
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define Max_size 100000
using namespace std;
int main () {
    int n, a[Max_size], sum = 0;
    cin >> n;
    a[0] = 0;
    a[n + 1] = 0;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        sum += abs(a[i - 1] - a[i]);
    }
    sum += abs(a[n] - a[n + 1]);
    for (int i = 1 ; i <= n ; i++){
        cout << sum - abs(a[i - 1] - a[i]) - abs(a[i] - a[i + 1]) + abs(a[i - 1] - a[i + 1]) << endl;
    }
    return 0;
}

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

using namespace std;

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

#define ALL(obj)	(obj).begin(),(obj).end()

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;

#define INF 		2000000007
#define MINF		-2000000007
#define MAX 		100005

const int MOD = 1e9+7;
// テンプレ終了
//====================================================================//


// agc071
int main(){
	int N;cin>>N;
	string s1,s2;cin>>s1>>s2;

	vector<int> p;
	REP(i,N){
		if(s1[i]==s2[i])
			p.push_back(0);
		else{
			p.push_back(1);
			i++;
		}
	}

	//for(int itr : p)cout << itr << " ";
	//cout << endl;

	ll ans = (p[0] ? 6 : 3);
	REPS(i,1,p.size()){
		if(p[i]==1){//横
			if(p[i-1]==1) ans = (ans * 3) %MOD;
			else ans = (ans * 2) %MOD;
		}else{// 縦
			if(p[i-1]==1)continue;
			else ans = (ans * 2) %MOD;
		}
	}

	cout << ans << endl;

	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int N,l,r,ans = 0;
int main(){
    cin >> N;
    rep(i,N) cin >> l >> r, ans += r-l+1;
    pr(ans);
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int x = sc.nextInt();

        int[] xA = new int[n+1];
        for (int i = 0; i < n; i++) {
            xA[i] = sc.nextInt();
        }
        xA[n] = x;
        Arrays.sort(xA);

        int[] diffA = new int[n];
        for (int i = 0; i < n; i++) {
            diffA[i] = xA[i+1] - xA[i];
        }

        Arrays.sort(diffA);
        ans(diffA);
        System.out.println(diffA[0]);
    }

    public static int[] ans(int[] a) {
        for (int i = 1; i < a.length; i++) {
            if (a[i] % a[0] != 0) {
                a[0] = Euclid(a[i], a[0]);
                ans(a);
            }
        }
        return  a;
    }

    public static int Euclid(int a, int b) {
        if (a % b != 0) {
            b = Euclid(b, a%b);
        }
        return b;
    }
}


Measured memory_bytes: 49980
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main() {
    int n, m; cin >> n >> m;
    vector<vector<bool>> g(n ,vector<bool> (m,false));

    rep(i,m){
        int k; cin >> k;
        rep(j,k){
            int s; cin >> s; s--;
            g[s][i] = true;
        }
    }
    vector<int> p(m); rep(i,m) cin >> p[i];

    ll ans = 0;
    for(int bit = 0; bit < (1<<n); bit++){
        vector<int> a(m,0);
        rep(i,n){
            if(bit & (1 << i)){
                rep(j,m){
                    if(g[i][j]) a[j]^=1;
                }
            }
        }

        bool jud = true;
        rep(i,m){
            if(p[i] != a[i]) jud = false;
        }
        if(jud) ans++;

    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C;
  cin >> A >> B;
  C = A / 500;
  A = A - (500 * C);
  if (A > B) 
    cout << "No" << endl;
  else 
  	cout << "Yes" << endl;
 
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())

if x%50 > 0:
    print(0)
    exit()
    
ans = 0
for a_c in range(a+1):
    for b_c in range(b+1):
        amount = 500 * a_c + 100 * b_c
        if 0 <= x - amount <= 50 * c:
            ans += 1

print(ans)

Measured memory_bytes: 9056
# import math
# import statistics
# a=input()
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#     c.append(i)
e1,e2 = map(str,input().split())
# f = list(map(int,input().split()))
#g = [input() for _ in range(a)]
# h = []
# for i in range(e1):
#     h.append(list(map(int,input().split())))
c=[]
count=0
ans=0
for i in range(int(e1),int(e2)+1):
    count=0
    for k in range(len(str(i))//2):
        if str(i)[k]==str(i)[-(k+1)]:
            count+=1
            if len(str(i))//2 == count:
                ans+=1

print(ans)

Measured memory_bytes: 9196
#include <stdio.h>

int A[1000000],n;

int binarysearch(int key){
  int left = 0;
  int right = n;
  int mid;
  while(left < right){
    mid = (left + right) / 2;
      if(key == A[mid])
	return 1;
    if(key > A[mid])
      left = mid + 1;
    else if(key < A[mid])
      right = mid;
  }
  return 0;
}

int main(){
  int i,q,k,sum = 0;

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

  scanf("%d",&q);
  for(i = 0;i < q;i++){
    scanf("%d",&k);
    if( binarysearch(k))
      sum++;
  }
  printf("%d\n",sum);

  return 0;
}

      



Measured memory_bytes: 2188
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <math.h>
using namespace std;

int main() {
    string s;
    cin>>s;
    int n=700;
    if(s[0]=='o') n+=100;
    if(s[1]=='o') n+=100;
    if(s[2]=='o') n+=100;
    
    cout<<n<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ld long double
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define mp map<ll, ll>
#define um unordered_map<ll, ll>
#define st set<ll> 
#define us unordered_set<ll>
#define vt vector<ll>
#define pll pair<ll, ll>
#define fl(i, x, y) for(ll i=x;i<y;++i)
#define flr(i, x, y) for(ll i=x;i>=y;--i)
 
int main() 
{
    int n, k;
    cin>>n>>k;
    string s;
    cin>>s;
    vt t, c;
    int x = 1;
    fl(i, 0, n)
    {
        if (i == n - 1 || s[i] != s[i + 1])
        {
            t.push_back(!(s[i] - '0'));
            c.push_back(x);
            x = 0;
        }
        x++;
    }
    int ans = 0;
    int m = t.size(), sum = 0, j = 0;
    fl(i, 0, m){
        sum += c[i];
        k -= t[i];
        while (k < 0){
            sum -= c[j];
            k += t[j];
            j++;
        }
        ans = max(ans, sum);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 2164
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 #define int long long

#define all(X) (X).begin(), (X).end()
#define reset(X) memset(X, 0, sizeof(X))
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define endl '\n'
#define fi first
#define se second


using namespace __gnu_pbds;
using namespace std;
const int mod=1e9+7;
 // const int mod=998244353;
 // const int mod=1e9+9;
const int INF=4e18+10;
// const int INF=4e18+10;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define read(n) int n; cin>>n;
#define readv(x, n) vector<int> x(n); for(auto &i:x) cin>>i;


typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

template<typename T1,typename T2>
void set_min(T1& a, T2 b)
{
    a=min(a, (T1)b);
}


int multiply(int a, int b, int in_mod){return (a*b)%in_mod;}
int mult_identity(int a){return 1;}


auto power(auto a, int b, int in_mod)
{
    auto prod=mult_identity(a);
    auto mult=a%in_mod;
    while(b!=0)
    {
        if(b%2)
        {
            prod=multiply(prod,mult, in_mod);

        }
        mult=multiply(mult, mult,in_mod);
        b/=2;
    }
    return prod;
}
int mod_inv(int q, int in_mod)
{

    return power(q, in_mod-2,in_mod);
}

void precomp()
{
}



void solve()
{
    int n;
    cin>>n;
    cout<< (n+999)/1000 * 1000 -n<<endl; 
}


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen("INPUT.txt", "r", stdin);
        freopen("OUTPUT.txt", "w", stdout);
    }
#endif
    auto clk = clock();
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    // -------------------------------------Code starts here---------------------------------------------------------------------
    precomp();
    int t = 1;
    // cin>>t;

    for (int test = 1; test <= t; test++)
    {
        // cout<<"Case #"<<test<<": ";
        // cout<<endl;
        solve();

        // cout<<endl;
    }

    // -------------------------------------Code ends here------------------------------------------------------------------

    clk = clock() - clk;
    // cerr << fixed << setprecision(6) << "Time: " << ((long double)clk) / CLOCKS_PER_SEC << "\n";
    return 0;
}


Measured memory_bytes: 3628
// In God We Trust


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

# define INF 1 << 31 - 1
# define pb push_back
# define fi first
# define se second

# define int long long

signed main(){
  int t1, t2;
  cin >> t1 >> t2;
  int a1, a2;
  cin >> a1 >> a2;
  int b1, b2;
  cin >> b1 >> b2;
  int a, b;
  a = t1 * abs(a1 - b1);
  b = t2 * abs(a2 - b2);
  if (a > b or (a1 > b1 and a2 > b2) or (b1 > a1 and b2 > a2))
    cout << 0;
  else if (a == b)
    cout << "infinity";
  else{
    int c = b - a;
    if (a % c == 0)
      cout << a / c * 2;
    else
      cout << 1 + a / c * 2; 
  }

  cout << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
//using namespace __gnu_pbds;
using namespace std;
typedef long long  L;

#define max_(x, y) (((x) > (y)) ? (x) : (y))
#define min_(x, y) (((x) < (y)) ? (x) : (y))
#define ___ ios_base::sync_with_stdio(false);cin.tie(NULL);
#define Mx 2000001
#define inf 1e15
const L MOD = 1e9+7;
const double pi = 2 * acos (0.0);

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/


//typedef tree<L,null_type,less<L>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

L a1,a2,a3,b1,b2,b3,c,c2,c3,d,d1,d2,d3,d4,d5,e1,e2,e3,f,h,k,l,m,n,m1,m2,n1,n2,o,p,p1,p2,p3,p4,
q,q1,q2,q3,q4,r,s,t,u,v,x,y,z,sum,mx=-inf,mn=inf,flg,flg1,flg2,id,id1,id2,id3,id4,lim,from,to;

char str1[Mx],str2[Mx];
int main()
{
    scanf("%s%s",str1,str2);
    n=strlen(str1);
    c=0;
    for(int i=0;i<n;i++){
        if(str1[i]!=str2[i])c++;
    }
    printf("%lld\n",c);
    return 0;
}

/// empty() lld I64d push_back() top() pop() insert() upper_bound() lower_bound() memset() max() min() scanf continue


Measured memory_bytes: 4208
#include <stdio.h>
#include <ctype.h>  // moji shori no library

int main(void)
{
  char ch;
  while(1)
    {
      // input
      scanf("%c",&ch);
      //evaluate convert output
      if(isupper(ch)!=0)
        {
          ch = tolower(ch);
          printf("%c",ch);
        }
      else if(islower(ch)!=0)
        {
          ch = toupper(ch);
          printf("%c",ch);
        }
      else
        {
          printf("%c",ch);
        }
      if (ch == '\n')break;
    }
  return 0;
}

Measured memory_bytes: 524
import java.util.*;
import java.io.*;
public class Main{
    static int N;
    static double dp[][], p[], ans=0.0;
    public static void main(String[] args) throws IOException{
        N = readInt();
        dp = new double[N+1][N+1];
        p = new double[N+1];
        for (int i = 1; i<=N; i++) p[i] = readDouble();
        dp[1][1] = p[1];
        dp[1][0] = 1.0 - p[1];
        for (int i = 2; i<=N; i++){
            dp[i][0] = dp[i-1][0]*(1.0-p[i]);
            for (int j = 1; j<=i; j++){
                dp[i][j] = dp[i-1][j-1]*p[i] + dp[i-1][j]*(1.0-p[i]);
            }
        }
        for (int i = N/2 + 1; i<=N; i++) ans+=dp[N][i];
        System.out.println(ans);
    }
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                    st = new StringTokenizer(br.readLine().trim());
            return st.nextToken();
    }
    static long readLong() throws IOException {
            return Long.parseLong(next());
    }

    static float readFloat() throws IOException {
            return Float.parseFloat(next());
    }

    static boolean readBool() throws IOException {
            return Boolean.parseBoolean(next());
    }

    static short readShort() throws IOException {
            return Short.parseShort(next());
    }

    static byte readByte() throws IOException {
            return Byte.parseByte(next());
    }

    static int readInt() throws IOException {
            return Integer.parseInt(next());
    }

    static double readDouble() throws IOException {
            return Double.parseDouble(next());
    }

    static char readChar() throws IOException {
            return next().charAt(0);
    }

    static String readLine() throws IOException {
            return br.readLine().trim();
    }

    static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

    static void print(Object o) {
            pr.print(o);
    }
}

Measured memory_bytes: 128976
n, k = map(int, input().split())
s = []
for i in range(n):#h:高さ
    s.append([int(m) for m in input().split()])
s.sort(key=lambda x:(x[0]))
count = 0
recli = []
if k == 2:
    for i in range(n):
        for j in range(i + 1, n):
            larx = max(s[i][0], s[j][0])
            smax = min(s[i][0], s[j][0])
            lary = max(s[i][1], s[j][1])
            smay = min(s[i][1], s[j][1])
            rec = (larx - smax) * (lary - smay)
            for l in range(n):
                if smax <= s[l][0] <= larx and smay <= s[l][1] <= lary:
                    count += 1
            if count >= k:
                recli.append(rec)
            count = 0

elif k == 3:
    for i in range(n):
        for j in range(i + 1, n):
            for p in range(j + 1, n):
                larx = max(s[i][0], s[j][0], s[p][0])
                smax = min(s[i][0], s[j][0], s[p][0])
                lary = max(s[i][1], s[j][1], s[p][1])
                smay = min(s[i][1], s[j][1], s[p][1])
                rec = (larx - smax) * (lary - smay)
                for l in range(n):
                    if smax <= s[l][0] <= larx and smay <= s[l][1] <= lary:
                        count += 1
                if count >= k:
                    recli.append(rec)
                count = 0
else:
    for i in range(n):
        for j in range(i + 1, n):
            for p in range(j + 1, n):
                for q in range(p + 1, n):
                    larx = max(s[i][0], s[j][0], s[p][0], s[q][0])
                    smax = min(s[i][0], s[j][0], s[p][0], s[q][0])
                    lary = max(s[i][1], s[j][1], s[p][1], s[q][1])
                    smay = min(s[i][1], s[j][1], s[p][1], s[q][1])
                    rec = (larx - smax) * (lary - smay)
                    if q - i + 1 >= k:
                        if (recli == []) or (recli != [] and rec < min(recli)):
                            for l in range(i, q + 1):
                                if smax <= s[l][0] <= larx and smay <= s[l][1] <= lary:
                                    count += 1
                            if count >= k:
                                recli.append(rec)
                            count = 0

print(min(recli))

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

struct a{
	ll v;
	ll s;
	bool operator <(const a& rhs) const{
		return v < rhs.v;
	}
};

int main(){
	ll n,m;
	cin >> n >> m;
	vector <a> arr(n);
	for (int z=0;z<n;z++){
		cin >> arr[z].v >> arr[z].s;
	}
	sort(arr.begin(),arr.end());
	ll count = 0;
	for (int z=0;z<n;z++){
		count += arr[z].v*min(arr[z].s,m);
		m -= arr[z].s;
		if (m <= 0) break;
	}
	cout << count << endl;
	cin >> n;
}


Measured memory_bytes: 1792
/*
 * Author:  xioumu
 * Created Time:  2012/7/17 12:57:52
 * File Name: b.cpp
 * solve: b.cpp
 */
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<string>
#include<map>
#include<set>
using namespace std;
const double esp = 1e-8;
const int maxn = 1000007;
typedef long long ll;
int n;
int a;
int v[maxn];
int next(int x){
    int h[7];
    int ma = 0, mi = 0;
    for(int i = 0; i < n; i++){
        h[i] = x % 10;
        x /= 10;
    }
    sort(h, h + n);
    for(int i = 0; i < n; i++)
        mi = mi * 10 + h[i];
    reverse(h, h + n);
    for(int i = 0; i < n; i++)
        ma = ma *10 + h[i];
    //printf("%d %d %d\n", ma, mi, ma - mi);
    return ma - mi;
}
int main(){
    while(scanf("%d%d", &a, &n) != EOF && (a || n)){
        memset(v, -1, sizeof(v));
        v[a] = 0;        
        int res = -1, b;
        do{
            b = next(a);
            if(v[b] == -1) v[b] = v[a] + 1;
            else {
                res = v[a] + 1;
                break;
            }
            a = b;
        }while(1);
        printf("%d %d %d\n", v[b], b, res - v[b]);
    }
    return 0;
}

Measured memory_bytes: 4668
def isOK(p0, p1):
    for i in range(p0, p1 + 1):
        if i % paramK == 0:
            return True
    return False

paramK = int(input())
params1 = list(map(lambda x: int(x), input().split(' ')))

if isOK(params1[0], params1[1]):
    print('OK')
else:
    print('NG')

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

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

    int res = 0;
    for (int i = 1; i <= n; i++)
    {
        int tmp = i;
        int cnt = 0;
        while (tmp > 0) {
            tmp /= 10;
            cnt++;
        }
        if (cnt % 2 == 1) {
            res++;
        }
    }
    cout << res << "\n";
    
}

Measured memory_bytes: 256
import heapq
N=int(input())
v=list(map(int,input().split()))
heapq.heapify(v)
for x in range(N-1):
  t1=heapq.heappop(v)
  t2=heapq.heappop(v)
  heapq.heappush(v,(t1+t2)/2)
print(heapq.heappop(v))

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

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

#define vt          vector
#define sz(x)       (int)(x).size()
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

void solve(int tc) {
    int n, x, t;
    cin >> n >> x >> t;
    cout << (n + x - 1) / x * t;
}

signed main() {
    ios::sync_with_stdio(0), cin.tie(0);

    int tcs = 1;
    for (int tc = 1; tc <= tcs; tc++) solve(tc);
}


Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>

using namespace std;

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

	set<int> s;

	for (int i = 0; i < n; i++) {
		int t;
		cin >> t;
		s.insert(t);
	}

	cout << s.size() << endl;
	return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
 
#define loop(n, i) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;

using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    while (n--) {
        int h, w; cin >> h >> w;
        vector<string> B(h);
        loop (h, i) cin >> B[i];

        unordered_set<char> alphs;
        loop (h, i) loop (w, j) {
            char c = B[i][j];
            if (c != '.') alphs.insert(c);
        }
        vector<char> perm(all(alphs));
        sort(all(perm));
        int safe = 0;
        do {
            map<char, int> layer = {{ '.', 0 }};
            loop (perm.size(), i) layer[perm[i]] = i+1;

            for (char c : perm) {
                int l = 100, r = 0, t = 100, b = 0;
                loop (h, i) loop (w, j) if (B[i][j] == c) {
                    l = min(j, l);
                    r = max(j, r);
                    t = min(i, t);
                    b = max(i, b);
                }
                for (int i = t; i <= b; i++) {
                    for (int j = l; j <= r; j++) {
                        if (layer[B[i][j]] < layer[c]) goto NG;
                    }
                }
            }
            safe = 1;
            break;
NG:
            continue;
        } while (next_permutation(all(perm)));
        if (safe) cout << "SAFE" << endl;
        else cout << "SUSPICIOUS" << endl;
    }
    return 0;
}

Measured memory_bytes: 3168
/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.07.13 02:11:35
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    while (true) {
        int w, h;
        cin >> w >> h;
        if (w == 0) {
            break;
        }
        vector<string> s(h),t(h);
        pair<int,int> s_goal,t_goal,s_start,t_start;
        for (int i = 0; i < h; i++) {
            cin >> s[i] >> t[i];
            for (int j = 0; j < w; j++) {
                if (s[i][j] == '%') s_goal = {i,j};
                if (t[i][j] == '%') t_goal = {i,j};
                if (s[i][j] == 'L') s_start = {i,j};
                if (t[i][j] == 'R') t_start = {i,j};
            }
        }
        vector<vector<vector<vector<int>>>> dist(h,vector<vector<vector<int>>>(w,vector<vector<int>>(h,vector<int>(w,-1))));
        queue<tuple<int,int,int,int>> que;
        que.push(make_tuple(s_start.first,s_start.second,t_start.first,t_start.second));
        const int dx[] = {0,1,0,-1}, dy[] = {1,0,-1,0};
        bool ok = false;
        while(!que.empty()) {
            auto p = que.front(); que.pop();
            int sx = get<0>(p);
            int sy = get<1>(p);
            int tx = get<2>(p);
            int ty = get<3>(p);
            if (sx == s_goal.first && sy == s_goal.second && tx == t_goal.first && ty == t_goal.second) {
                ok = true;
                puts("Yes");
                break;
            }
            else if ((sx == s_goal.first && sy == s_goal.second) || (tx == t_goal.first && ty == t_goal.second)) {
                continue;
            }
            for (int i = 0; i < 4; i++) {
                int x1 = sx + dx[i];
                int y1 = sy + dy[i];
                int x2 = tx + dx[i];
                int y2 = ty - dy[i];
                if (x1 >= 0 && x1 < h && y1 >= 0 && y1 < w && s[x1][y1] != '#') {
                }
                else {
                    x1 = sx, y1 = sy;
                }
                if (x2 >= 0 && x2 < h && y2 >= 0 && y2 < w && t[x2][y2] != '#') {
                }
                else {
                    x2 = tx, y2 = ty;
                }
                if (dist[x1][y1][x2][y2] == -1) {
                    que.push(make_tuple(x1,y1,x2,y2));
                    dist[x1][y1][x2][y2] = 0;
                }
            }
        }
        if (!ok) {
            puts("No");
        }
    }
    return 0;
}



Measured memory_bytes: 31852
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
using namespace std;

int main()
{
    fastio;
    int64_t H;
    cin >> H;

    int64_t mon_num = 1;
    int64_t attack_count = 0;

    while (H > 0)
    {
        attack_count += mon_num;
        H /= 2;
        mon_num *= 2;
    }

    cout << attack_count << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;

mat dp(201,vec(201,-1));

ll rec(ll w,ll b) {
  if(dp[w][b]!=-1) return dp[w][b];
  set<ll> grundy;
  if(w>0) grundy.insert(rec(w-1,b));
  for(ll i=1;i<=w;i++) {
    if(b-i>-1) {
      grundy.insert(rec(w,b-i));
    }
  }
  if(b>0) {
    grundy.insert(rec(w+1,b-1));
  }
  ll res=0;
  while(grundy.count(res)) res++;
  return dp[w][b]=res;
}

int main() {
  ll n;
  cin >> n;
  ll grundy=0;
  for(ll i=0;i<n;i++) {
    ll w,b;
    cin >> w >> b;
    grundy^=rec(w,b);
  }
  if(grundy==0) {
    cout << 1 << endl;
  }
  else {
    cout << 0 << endl;
  }
}


Measured memory_bytes: 3504
#include <bits/stdc++.h>
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(ll i=0,i##_len=(n);i<i##_len;i++)
#define rep2(i,a,b) for(ll i=(a),i##_len=(b);i<=i##_len;i++)
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define pb push_back
using namespace std;
using ll = long long;

template<class T> bool chmax(T&a,const T&b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T&a,const T&b){if(a>b){a=b;return true;}return false;}
template<class T> void show(vector<T>v){rep(i,v.size()-1){cout<<v.at(i)<<" ";}cout<<v.at(v.size()-1)<<endl;}
template<class T> T abs(T x){return max(x,-x);}
template<class T> T gcd_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=gcd(r,v.at(i));return r;}
template<class T> T lcm(T m,T n) {return m*n/gcd(m,n);}
template<class T> T lcm_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=lcm<T>(r,v.at(i));return r;}
template<class T> T factorial(T n){if(n==0)return 1;T r=1;for(T i=2;i<=n;i++)r*=i;return r;}
template<class T> T nCr(T n,T k){return factorial<T>(n)/(factorial<T>(k)*factorial<T>(n-k));}
vector<string> split(const string&s,char d){vector<string>r;stringstream ss(s);string k;while(getline(ss,k,d))if(!k.empty())r.pb(k);return r;}

// Template ends here

int main() {
    int a, b; cin >> a >> b;
    cout << ceil((b - 1.0) / (a - 1.0)) << endl;
    return 0;
}

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

using namespace std;

#define int long long
#define ar array
#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)

template<class T>
bool umin(T &a, const T &b) {
    return b < a ? a = b, 1 : 0;
}

template<class T>
bool umax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

template<class A>
void read(vt<A> &v);

template<class A, size_t S>
void read(ar<A, S> &a);

template<class T>
void read(T &x) {
    cin >> x;
}

void read(double &d) {
    string t;
    read(t);
    d = stod(t);
}

void read(long double &d) {
    string t;
    read(t);
    d = stold(t);
}

template<class H, class... T>
void read(H &h, T &... t) {
    read(h);
    read(t...);
}

template<class A>
void read(vt<A> &x) {
    EACH(a, x)read(a);
}

template<class A, size_t S>
void read(array<A, S> &x) {
    EACH(a, x)read(a);
}

string to_string(char c) {
    return string(1, c);
}

string to_string(bool b) {
    return b ? "true" : "false";
}

string to_string(const char *s) {
    return string(s);
}

string to_string(string s) {
    return s;
}

string to_string(vt<bool> v) {
    string res;
    FOR(sz(v))res += char('0' + v[i]);
    return res;
}

template<size_t S>
string to_string(bitset<S> b) {
    string res;
    FOR(S)res += char('0' + b[i]);
    return res;
}

template<class T>
string to_string(T v) {
    bool f = 1;
    string res;
    EACH(x, v) {
        if (!f)
            res += ' ';
        f = 0;
        res += to_string(x);
    }
    return res;
}

template<class A>
void write(A x) {
    cout << to_string(x);
}

template<class H, class... T>
void write(const H &h, const T &... t) {
    write(h);
    write(t...);
}

void print() {
    write("\n");
}

template<class H, class... T>
void print(const H &h, const T &... t) {
    write(h);
    if (sizeof...(t))
        write(' ');
    print(t...);
}

template<class T, class U>
void vti(vt<T> &v, U x, size_t n) {
    v = vt<T>(n, x);
}

template<class T, class U>
void vti(vt<T> &v, U x, size_t n, size_t m...) {
    v = vt<T>(n);
    EACH(a, v)vti(a, x, m);
}

void solve() {
    int n;
    read(n);
    
    int ans = 0;
    while (n) {
        ans++;
        n /= 2;
    }
    print(1 << (ans - 1));
}

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int tt = 1;
    //read(tt);
    FOR(tt) {
        //write("Case #", i + 1, ": ");
        solve();
        
    }
    
}



Measured memory_bytes: 3728
i = j = 0
n = ''
m = ''
 
 
line = input()
 
while line[i] != ' ':
    n = n + line[i]
    i += 1
     
while i < len(line):
    m = m + line[i]
    i += 1
     
n = int(n)
m = int(m)
 
d = n // m
r = n % m
f = n / m
 
print(d,end=' ')
print(r,end=' ')
print("{0:.5f}".format(f))

Measured memory_bytes: 7684
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip>

using namespace std;

template <class T> using V = vector<T>;

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 long long INF = 1LL << 60;

using ll = long long;
using db = long double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
using graph = V<V<int>>;
using pq = priority_queue<ll>;



#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define pb(a) push_back(a);




ll Sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}



const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}


#define comuse Comuse()

ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll perm(int n,int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] % MOD) % MOD;
}


ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}


vll div(ll n){
  vll ret;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ret.push_back(i);
      if(i*i!=n){
        ret.push_back(n/i);
      }
    }
  }
  SORT(ret);
  return (ret);
}


ll modpow(ll a,ll n,ll mod){
  ll ans=1;
  while(n>0){
    if(n&1){
      ans=ans*a%mod;
    }

    a=a*a%mod;
    
    n>>=1;
  }

  return ans;
}

void Solve();


const int MAX_N = 131072;
//segment tree 
int NN;
int seg[MAX_N*2-1];
void seguse(){
  for(int i=0;i<2*NN-1;i++){
    seg[i]=INT_MAX;
  }
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(20)<<fixed;
  Solve();
}




/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
//segtreeの葉の先頭の添え字はn-1
void Solve(){
  //vll segtree(524287);
  //ll N=262144;
  ll n,m;
    cin>>n>>m;
  auto A=div(m);
  ll s=A.sz;
  FOR(i,0,s){
    if(A[i]>=n){
      cout<<m/A[i]<<"\n";
      return;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define lout cout
#else
stringstream devnull;
#define lout devnull
#endif
template <class C>
inline void vcin(C &a);
template <class C>
inline void vcout(const C a, const string separate = "\n");

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  vcin(a);

  sort(a.begin(), a.end());
  int ap = 0, bp = 0;
  while (not a.empty())
  {
    ap += a.back();
    a.pop_back();
    if (a.empty())
      break;
    bp += a.back();
    a.pop_back();
  }

  cout << ap - bp << endl;

  return 0;
}

template <class C>
inline void vcin(C &c)
{
  for (auto &a : c)
  {
    cin >> a;
  }
}
template <class C>
inline void vcout(const C c, const string separate)
{
  for (auto it = c.begin(); it != c.end(); it++)
  {
    if (it != c.begin())
      cout << separate;
    cout << *it;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int max_n;
int a;

ll dfs(ll p, ll q, int x, int n, int b) {
	if(p == 0) return 1;
	if(n == max_n) {
		if(q % p == 0 && q / p >= b && (q / p) * x <= a) return 1;
		else return 0;
	}
	ll res = 0;
	int pos = b;
	while(pos * x <= a) {
		if(pos * p >= q)
		res += dfs(p * pos - q, pos * q, x * pos, n + 1, pos);
		++pos;
	}
	return res;
}

int main(void) {
	while(true) {
		int p, q;
		cin>>p>>q>>a>>max_n;
		if(p == 0 && q == 0 && a == 0 && max_n == 0) break;
		cout<<dfs(p, q, 1, 1, 1)<<endl;
	}
}

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

int main() {
  int x;
  cin >> x;
  if (x >= 30){
      cout << "Yes" << endl;
      }
  else{
      cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3532
#include<bits/stdc++.h>
#define pb push_back
#define gc getchar 
using namespace std;
const int N=5e4+10,mod=998244353,g=3;
typedef long long ll;
typedef double db;

int n,m,ans,f[N],h[N],t[N],frc[N],nv[N],ivg;

char cp;
template<class T>inline void rd(T &x)
{
	cp=gc();x=0;int f=0;
	for(;!isdigit(cp);cp=gc()) if(cp=='-') f=1;
	for(;isdigit(cp);cp=gc()) x=x*10+(cp^48);
	if(f) x=-x;
}

inline int fp(int x,int y)
{
	int re=1;
	for(;y;y>>=1,x=(ll)x*x%mod)
	  if(y&1) re=(ll)re*x%mod;
	return re;
}

inline int ad(int x,int y){x+=y;return x>=mod?x-mod:x;}
inline int dc(int x,int y){x-=y;return x<0?x+mod:x;} 
inline int C(int n,int m)
{
	if(m>n) return 0;
	return (ll)frc[n]*nv[m]%mod*(ll)nv[n-m]%mod;
}

namespace poly{
   int rv[N],L,len;
   
   inline void ntt(int *e,int pr)
   {
   	   int i,j,k,ix,iy,pd,ori,G=pr?g:ivg;
   	   for(i=1;i<len;++i) if(i<rv[i]) swap(e[i],e[rv[i]]);
   	   for(i=1;i<len;i<<=1){
   	      ori=fp(G,(mod-1)/(i<<1));
   	      for(j=0;j<len;j+=(i<<1)){
   	      	for(pd=1,k=0;k<i;++k,pd=(ll)pd*ori%mod){
   	      		ix=e[j+k];iy=(ll)pd*e[j+i+k]%mod;
   	      		e[j+k]=ad(ix,iy);e[i+j+k]=dc(ix,iy);
			}
		  }
	   }
	   if(pr) return;
	   G=fp(len,mod-2);
	   for(i=0;i<len;++i) e[i]=(ll)e[i]*G%mod;
   }
   
   void mul(int *f,int *g,int n,int m)
   {
   	   int i;
   	   for(L=0,len=1;len<=n+m;len<<=1) L++;
	   for(i=1;i<len;++i) rv[i]=(rv[i>>1]>>1)|((i&1)<<(L-1));
	   for(i=n+1;i<len;++i) f[i]=0;
   	   for(i=m+1;i<len;++i) g[i]=0;
   	   ntt(f,1);ntt(g,1);
   	   for(i=0;i<len;++i) f[i]=(ll)f[i]*g[i]%mod;
	   ntt(f,0); 
   }
}
using namespace poly;

int main(){
	int i,j,x,y;ivg=fp(g,mod-2);
	rd(n);rd(m);
	f[0]=frc[0]=nv[0]=frc[1]=nv[1]=1;
    for(i=2;i<n+3;++i)
	  frc[i]=(ll)frc[i-1]*i%mod,
	  nv[i]=(ll)(mod-mod/i)*nv[mod%i]%mod;
	for(i=2;i<n+3;++i) nv[i]=(ll)nv[i-1]*nv[i]%mod;
	for(i=1;i<=n;++i) h[i]=nv[i+2];
	for(L=0,len=1;len<=(n<<1);len<<=1) L++;
	for(i=1;i<len;++i) rv[i]=((rv[i>>1]>>1)|((i&1)<<(L-1)));
	ntt(h,1);
	for(j=1;j<=m;++j){
		for(i=0;i<=n;++i) t[i]=(ll)nv[i]*f[i]%mod;
		for(i=n+1;i<len;++i) t[i]=0;
		ntt(t,1);
		for(i=0;i<len;++i) t[i]=(ll)h[i]*t[i]%mod;
		ntt(t,0);
		for(i=0;i<=n;++i)
		 f[i]=ad((ll)(1+C(i+1,2))*f[i]%mod,(ll)t[i]*frc[i+2]%mod);
	}
	for(i=0;i<=n;++i) ans=ad(ans,(ll)C(n,i)*f[i]%mod);
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 512
function Main(input){
  input = input.split("\n");
  inputStr = input[0].split(" ");
  const N = Number.parseInt(inputStr[0]);
  inputStr = input[1].split(" ");
  var D = inputStr.map(inputStr => Number.parseInt(inputStr));
  //計算処理
  var ans = 0;
  for(var i=0 ; i<N-1 ; i++){
    for(var j=i+1 ; j<N ; j++ ){
      ans += D[i] * D[j];
    }
  }
  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
#include <bits/stdc++.h>
using namespace std;
int main()
{   int a,b,c;
    int result=0;
    cin>>a>>b>>c;
    for (int i=1;i<=a;++i)
        {int sum=0;
        int temp=i;
        while(temp>0)
            {
                sum=sum+(temp%10);
                temp=temp/10;
                
                
            }
            
        if (sum>=b&&sum<=c)
            {
                result=result+i;
                
            }
        }
        cout<<result;
    return 0;
}


Measured memory_bytes: 764
/* ex4_2: Colon
    Jun_JPN */

#include <stdio.h>
#include <math.h>

int main(void){

    long double s_hand, l_hand, hour, min, rad, length;

    scanf("%Lf %Lf %Lf %Lf", &s_hand, &l_hand, &hour, &min);

    /* 長針と短針のなす角radを計算
        0時方向ベクトルと長針がなす偏角theta1は(min/60)*2*M_PI
        0時方向ベクトルと短針がなす偏角theta2は(hour/12)*2*M_PI + (min/60)*(1/12)*2*M_PI
        よって，rad = theta1-theta2である */
    rad = (60*hour - 11*min)/360 * M_PI;    //負の数をとっても良い

    /* 余弦定理で求める長さlengthを計算
        なす角の大きさが0，M_PIラジアンのときも余弦定理の式は成り立つ
        rad<0でも余弦定理の式は成り立つ */

    length = sqrt(l_hand*l_hand + s_hand*s_hand - 2*l_hand*s_hand*cos(rad));

    printf("%.20Lf\n", length);

    return 0;
}

Measured memory_bytes: 2584
N = gets.to_i
P = gets.split.map(&:to_i)
Q = gets.split.map(&:to_i)

per = (1..N).to_a.permutation(N)
pp = 0
qq = 0
per.each_with_index do |ary, i|
  pp = i if P == ary
  qq = i if Q == ary
end

puts (pp - qq).abs

Measured memory_bytes: 4220