akhauriyash/Code-Regression huggingface dataset:
using System;

class sample
{
	static void Main()
	{
		string[] input =Console.ReadLine().Split(' ');

		int[] inputnum = new int[2];
		string input0 ="";
		string input1 ="";


		inputnum[0]=Convert.ToInt32(input[0]);
		inputnum[1]=Convert.ToInt32(input[1]);

		for(int i=0;i<inputnum[0];i++)
		{
			input1+=input[1];
		}

		for(int i=0;i<inputnum[1];i++)
		{
			input0+=input[0];
		}

		if(input0.CompareTo(input1)<=0)
		{
			Console.WriteLine(input0);
		}

		else
		{
			Console.WriteLine(input1);
		}


	}
}



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

int n, d[15], s[15], v[15], w[1<<15], pre[15][1<<15];
double dp[15][1<<15];  // dp[現在地][すでに訪れたものの集合]

double t(int l, int S){
    return double(l)/(double(2000)/(70+w[S]*20));
}

double rec(int now, int S){
    if(dp[now][S] != -1) return dp[now][S];
    if(S == (1<<n)-1) return 0;

    double res = DBL_MAX;
    for(int i=0;i<n;i++){
        if((S>>i)&1) continue;
        double tmp = rec(i, S^(1<<i)) + t(abs(d[i]-d[now]), S);
        if(tmp < res){
            res = tmp;
            pre[now][S] = i;
        }
    }
    return dp[now][S] = res;
}

int main() {
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> s[i] >> d[i] >> v[i];
    }
    for(int i=0;i<(1<<n);i++){
        for(int j=0;j<n;j++){
            if((i>>j)&1){
                w[i] += v[j];
            }
        }
    }
    for(int i=0;i<n;i++) fill(dp[i], dp[i]+(1<<n), -1);
    int id = 0;
    double tmin = DBL_MAX;
    for(int i=0;i<n;i++){
        if(rec(i, 1<<i) < tmin){
            tmin = rec(i, 1<<i);
            id = i;
        }
    }
    cout << s[id];
    for(int S=1<<id; S<(1<<n)-1; S ^= 1<<id){
        id = pre[id][S];
        cout << " " << s[id];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 8720
#include<stdio.h>
int main(void){
    int a[10],b=0,c=0,d=0;

    int i=0;

    for(i=0; i<10; i++)
    {
        scanf("%d",&a[i]);
    }
    for(b=0;b<10;b++){
        for(c=b+1;c<10;c++){
        if(a[b]<a[c]){
            d=a[b];
            a[b]=a[c];
            a[c]=d;
        }
        }
    }
    printf("%d\n%d\n%d\n",a[0],a[1],a[2]);
    return 0;
}

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

int main() {
  long long n;
  cin >> n;
  vector<long long> Lucas(n+1);
  Lucas[0] =2 ;
  Lucas[1] =1 ;
  if(n == 1) {
    cout  << 1;
  }
  else{
    for(int i = 2; i < n+1; i++){
      Lucas[i] = Lucas[i-1] + Lucas[i-2];
    }
    cout << Lucas[n];
  }
}

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

typedef long long ll;
const long long LINF = 1LL << 60;
const long long LMINF = 1LL << 63;
const int INF = 1 << 30;

#define REP(i,n) for(int i = 0;i < n;++i)
#define REPS(i,x) for(int i = 1;i <= (int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i >= 0;i--)
#define RREPS(i,x) for(int i=((int)(x));i > 0;i--)
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << x << "\n"

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;}



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

    ll cnt = 0;
    REPS(i,n){
        cnt += floor((n - 1) / i); 
    }

    cout << cnt << endl;
    
    return 0;
}

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

int main(){
    int N, K, count;
    count = 0;
    cin >> N >> K;
    vector<int> h(N);
    for (int i = 0; i < N; i++){
        cin >> h[i];
        if (h[i] >= K) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 640
/*
 * Author : Sadi
 * Thu 09/07/2020
 * 21:53:16.66
 */
#include <iostream>
#include <cstdio>
#include <cmath>
#include <climits>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE

    int n, k, q;
    cin >> n >> k >> q;
    vector<int> v(q + 1);
    unordered_map<int, int> umap;
    for(int i = 1; i <= q; ++i) {
        cin >> v[i];
        umap[v[i]]++;
    }    
    for(int i = 1; i <= n; ++i) {
        int not_answered = q - umap[i];
        if(k - not_answered <= 0) {
            cout << "No" << endl;
        }
        else {
            cout << "Yes" << endl;
        }
    }
    return 0;
}


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

int main(){
    int N,X,T;
    cin >> N >> X >> T;
    int a = N/X;
    if(N%X==0){
        cout << T*a << endl;
    }
    else{
        cout << T*(a+1) <<endl;
    }
}

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

T = [["S", "S"], ["S", "W"], ["W", "S"], ["W", "W"]]

for t in T:
  for i in range(1, N-1):
    if (t[i] == "S" and S[i] == "o") or (t[i] == "W" and S[i] == "x"):
        t.append(t[i-1])
    else:
        t.append("S" if t[i-1] == "W" else "W")
  #print(t)
  
  flag = 1
  if (t[0] == "S" and S[0] == "o") or (t[0] == "W" and S[0] == "x"):
    if t[-1] != t[1]: flag = 0
  else:
    if t[-1] == t[1]: flag = 0
  if (t[-1] == "S" and S[-1] == "o") or (t[-1] == "W" and S[-1] == "x"):
    if t[-2] != t[0]: flag = 0
  else:
    if t[-2] == t[0]: flag = 0
  if flag:
    print("".join(t))
    exit()
print(-1)

Measured memory_bytes: 62276
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
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);}

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll r,g,b,n;
	cin>>r>>g>>b>>n;
	ll ans=0;
	rep(i,5000)rep(j,5000){
		ll p=n-r*i-g*j;
		if(p>=0 and p%b==0)ans++;
	}
	puta(ans);
	return 0;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
import numpy as np
def main():
    n=int(input())
    A=np.array([int(_) for _ in input().split()])
    while A.size>1:
        min_A=np.min(A)
        A=np.fmod(A,min_A)
        A=A[A>0]
        A=np.append(A,min_A)
    print(A[0])
    

if __name__=='__main__':
    main()

Measured memory_bytes: 23116
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define int long long
#define pb push_back
#define fi first
#define se second
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define IO ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pii pair<int,int>
#define sz(x) (int)x.size()
const int mod = 1e9 + 7;
const int mod1 = 998244353;
typedef long double f80;

#ifndef LOCAL
#pragma GCC optimize ("O2")
#define endl '\n'
#endif

template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}

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

string to_string(string s) {
  return '"' + s + '"';
}

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

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

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

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

const int N = 4005;
int ncr[N][N];
int solve(int f,int c,int n){
	int ans = 0;
	int pt = 1;
	fr(m, 0, c){
		ans += (((ncr[c][m] * ncr[n + f - 1][m + f - 1]) % mod1) * pt) % mod1;
		pt = (pt << 1) % mod1;
		ans %= mod1;
	}
	return ans;
}
void solve(){
	int n, k;
	cin >> k >> n;
	ncr[0][0] = 1;
	fr(i, 1, N - 1){
		ncr[i][0] = 1;
		fr(j, 1, i){
			ncr[i][j] = (ncr[i - 1][j] + ncr[i - 1][j - 1]) % mod1;
		}
	}
	fr(x, 2, 2 * k){
		int free = 0, cons = 0;
		fr(i, 1, k){
			if(x - i >= 1 && x - i <= k){
				cons++;
			}
			else{
				free++;
			}
		}
		debug(x, cons, free);
		int ans = solve(free, cons / 2, n);
		debug(x, ans);
		if(cons & 1){
			ans += solve(free, cons / 2, n - 1);
		}
		ans %= mod1;
		cout << ans << endl;
	}
}
signed main(){
    IO;
    #ifdef LOCAL
        freopen("inp.txt","r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    cout << setprecision(10) << fixed;
    int t = 1;
    // cin >> t;
    fr(tt, 1, t){
        solve();
    }
    return 0;
}

Measured memory_bytes: 123904
#pragma GCC optimize("trapv")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<ll>;
using pi = pair<ll, ll>;
const int maxn = 3555;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	string a, b;
	cin>>n >> a>>b;
	for(int i = 0; i < n; i++)
		cout << a[i] << b[i];
}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
"""
n = I()
s = SR(n)
for i in range(n):
    for j in range(len(s[i])):
        while s[i][j] in s[i][:j]:
            s[i][j] = "0"+s[i][j]
ans = set(s[0])
for i in range(1,n):
    ans &= set(s[i])
ans = sorted(list(ans))
if len(ans) == 0:print()
else:
    for i in range(len(ans)):
        ans[i] = ans[i][-1]
    ans.sort()
    for i in range(len(ans)-1):
        print(ans[i],end = "")
    print(ans[-1])
"""

#D
n,m = LI()
ln = [n-1]
lm = [m-1]
a = n-1
b = m-1
while a > 2:
    a -= 2
    ln.append(ln[-1]+a)
while b > 2:
    b -= 2
    lm.append(lm[-1]+b)
la = len(ln)
lb = len(lm)
for i in range(la):
    if i or a == 2:
        ln.append(ln[la-i-1])
for i in range(lb):
    if i or b == 2:
        lm.append(lm[lb-i-1])
x,y = LIR(2)
lx = 0
ly = 0
for i in range(n-1):
    lx += ln[i]*(x[i+1]-x[i])%mod
    lx %= mod
for i in range(m-1):
    ly += lm[i]*(y[i+1]-y[i])%mod
    ly %= mod
ans = lx*ly%mod
print(ans)
#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Measured memory_bytes: 25436
#include<stdio.h>
#include<iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<long,long>
#define vi          vector<long>
#define vii         vector<pii>
#define mi          map<long,long>
#define mii         map<pii,long>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define fIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

ll sub(ll a, ll b){return (a-b+hell)%hell;}
ll add(ll a, ll b){return (a+b)%hell;}
ll mul(ll a, ll b){return (a*b)%hell;}



int main()
{
fIO;


/*#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif*/


long long n,sum=0,t=1,m=0;
//cin >> t;
while(t--){
cin>>n>>m;
cout<<(n*500>=m?"Yes":"No");



}
	
}

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

#define all(v) (v).begin(),(v).end()

using namespace std ;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;




int main()
{
  int a, b ;
  cin >> a >> b ;
  
  if(a%b==0){
    cout << 0 << endl ;
  }
  else{
    cout << 1 << endl ;
  }
    return 0 ;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int num[]={0,2,5,5,4,5,6,3,7,6};
bool ok[10];

bool large(string& s,string& t){
    if(s.size()!=t.size()){
        return s.size()>t.size();
    }
    return s>t;
}

string dp[10101];

string rec(int n){
    if(dp[n]!="")return dp[n];
    if(n==0)return "";
    string ret="";
    rep(i,10){
        if(ok[i]&&n-num[i]>=0){
            char c='0'+i;
            string res=c+rec(n-num[i]);
            if(res.back()=='-')continue;
            if(large(res,ret))ret=res;
        }
    }
    if(ret=="")ret="-";
    return dp[n]=ret;
}

int main(){
    int n;
    cin>>n;
    int m;
    cin>>m;
    rep(i,m){
        int x;
        cin>>x;
        ok[x]=1;
    }
    cout<<rec(n)<<endl;
    
    return 0;
}

Measured memory_bytes: 26624
let () = Scanf.scanf "%d %d" @@ fun x y ->
  Printf.printf "%d\n" @@
  ( if x = 1 then 300000
    else if x = 2 then 200000
    else if x = 3 then 100000
    else 0 ) +
  ( if y = 1 then 300000
    else if y = 2 then 200000
    else if y = 3 then 100000
    else 0 ) +
  ( if x = 1 && y = 1 then 400000
    else 0 )



Measured memory_bytes: 2432
#include <iostream>
#include <sstream>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
using namespace std;
int main(){
	int n,m;
	while(1){
		cin >> n >> m;
		if(n+m==0) break;
		bool a[n];
		for(int i=0;i<n;i++) a[i] = false;
		int b = 0;
		for(int i=0;i<n-1;i++){
			int c = 0;
			for(int j=0;;j++){
				int d = (b+j)%n;
				if(a[d]) continue;
				c++;
				if(c==m){
					a[d] = true;
					b = d;
					break;
				}
			}
		}
		for(int i=0;i<n;i++) if(not a[i]) cout << i+1 << endl;
	}
}

Measured memory_bytes: 1160
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
//ITP1_11-A
 
namespace ConsoleApplication24
{
    class Dice
    {
        string[] D;
 
        public Dice(string[] DArray)
        {
            D = DArray;
        }
 
        public string DiceRoll(string roll)
        {
            for (int i = 0; i < roll.Length; ++i)
            {
                string D0 = D[0];
                string D1 = D[1];
                string D2 = D[2];
                string D3 = D[3];
                string D4 = D[4];
                string D5 = D[5];
 
                switch (roll[i])
                {
                    case 'E':
                        D[0] = D3;
                        D[2] = D0;
                        D[3] = D5;
                        D[5] = D2;
 
                        break;
 
                    case 'N':
                        D[0] = D1;
                        D[1] = D5;
                        D[4] = D0;
                        D[5] = D4;
 
                        break;
 
                    case 'S':
                        D[0] = D4;
                        D[1] = D0;
                        D[4] = D5;
                        D[5] = D1;
                        break;
 
                    case 'W':
                        D[0] = D2;
                        D[2] = D5;
                        D[3] = D0;
                        D[5] = D3;
                        break;
                }
            }
            return D[0];
        }
    }
 
 
    class Program
    {
        static void Main()
        {
            string[] DiceArray = Console.ReadLine().Split(' ');
            string str = Console.ReadLine();
 
            Dice DClass = new Dice(DiceArray);
 
            string top = DClass.DiceRoll(str);
 
            Console.WriteLine(top);
        }
    }
}

Measured memory_bytes: 13472
#include<bits/stdc++.h>
using namespace std;
int main(){
  int k,s;
  cin>>k>>s;
  int ans=0;
  int z;
  for(int i=0;i<=k;i++){
    for(int j=0;j<=k;j++){
      z=s-i-j;
      if(z<0 || z>k){
	continue;
      }
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(int (i) = 1; (i) < (n); ++(i))
#define rrep1(i,n) for(int (i) = (n) - 1; (i) >= 1; --(i))
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i))
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;
#define all(x) (x).begin(),(x).end()

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

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

int main()
{
    ll n;
    cin >> n;
    vector<ll> d(n);
    rep0(i, n)cin >> d[i];
    sort(d.begin(), d.end());
    cout << d[n / 2] - d[n / 2 - 1] << endl;
    return 0;
}


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

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b;
            while (true)
            {
                string[] array = Console.ReadLine().Split(' ');
                a = int.Parse(array[0]);
                b = int.Parse(array[1]);
                if (a == 0 && b == 0)
                {
                    break;
                }
                for (int i = 0; i < a; i++)
                {
                    List<char> charList = new List<char>();
                    if (i % 2 == 0)
                    {
                        for (int j = 0; j < b; j++)
                        {
                            charList.Add('#');
                            charList.Add('.');
                        }
                    }
                    else
                    {
                        for (int j = 0; j < b; j++)
                        {
                            charList.Add('.');
                            charList.Add('#');
                        }
                    }
                    for (int k = 0; k < b; k++)
                    {
                        Console.Write(charList[k]);
                    }
                    Console.WriteLine();
                }
                Console.WriteLine();
            }
        }
    }
}

Measured memory_bytes: 8904
#include<bits/stdc++.h>
using namespace std;
int minn=0x7fffffff;
string s;
int main()
{   
    cin>>s;
    int l=s.size();
    for(int i=1;i<=l-2;i++)
    {
        minn=min(minn,abs(753-((int(s[i-1]-'0')*100)+(int(s[i]-'0')*10)+int(s[i+1]-'0'))));
    }
    cout<<minn<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ld long double
#define pii pair<int,int>
int const M=2e5+10,M2=300+10,inf=1e9+10,mod=1e9+7;
int a[M];
map<string,int>cnt[M];
int32_t main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	string x;
	cin>>x;
	string y="";
	for(int i=0;i<n;i++)
	{
		y+=x[i];
	}
	for(int i=0;i<(1<<n);i++)
	{
		string tmp="";
		int t=0;
		for(int j=0;j<n;j++)
		{
			if((i & (1<<j)))tmp+=y[j],t++;
		}
		for(int j=n-1;j>=0;j--)
		{
			if(!(i & (1<<j)))tmp+=y[j];
		}
		cnt[t][tmp]++;
	//	cout<<tmp<<endl;
	}
	reverse(x.begin(),x.end());
	y="";
	for(int i=0;i<n;i++)
	{
		y+=x[i];
	}
	int ans=0;
//	reverse(x.begin(),x.end());
	for(int i=0;i<(1<<n);i++)
	{
		string tmp="";
		int t=0;
		for(int j=0;j<n;j++)
		{
			if((i & (1<<j)))tmp+=y[j],t++;
		}
		for(int j=n-1;j>=0;j--)
		{
			if(!(i & (1<<j)))tmp+=y[j];
		}
		ans+=cnt[t][tmp];
	//	cout<<tmp<<"*******"<<endl;
	}
	cout<<ans;
}

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

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

    ll total = 0;
    ll lastX = X[0];
    loop(i, 1, N) {
        ll d = X[i] - lastX;
        total += min(A * d, B);
        lastX = X[i];
    }
    cout << total << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main()
{
  int N;
  int A;
  int B;
  int sum_A,sum_B;
  int num;
  int sum,sum_min=1000;
  scanf("%d",&N);
  for(int n4=0;n4<=5;n4++){
  for(int n3=0;n3<=9;n3++){
  for(int n2=0;n2<=9;n2++){
  for(int n1=0;n1<=9;n1++){
  for(int n0=0;n0<=9;n0++){
    A=10000*n4+1000*n3+100*n2+10*n1+1*n0;
    B=N-A;
    if (A>0 && B>0){
    sum_B=0;
    num = B;
    while(num>0){
      sum_B=sum_B+num%10;
      num = num/10;
    }
   sum_A=n4+n3+n2+n1+n0;
   sum=sum_A+sum_B;
   if (sum<sum_min){
     sum_min = sum;
   }
   }
  }
  }
  }
  }
  }

  printf("%d",sum_min);
  return 0;
}

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

using namespace std;
 
using ll = long long;
using ull = unsigned long long;
using ldouble = long double;
 
const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s) cout << fixed << setprecision(10) << s << endl;

string res;
ll sum = 0;

int main()
{
    ll a, b;
    cin >> a >> b;

    if (a == 1)
    {
        a = 14;
    }

    if (b == 1)
    {
        b = 14;
    }

    if (a > b)
    {
        println("Alice");
    }
    else if (a < b)
    {
        println("Bob");
    }
    else
    {
        
        println("Draw");
    }
    
}


Measured memory_bytes: 3632
#include<cstdio>

long double sqrt(double);

int main(void){
long double d;
double x1,y1,x2,y2,D;
scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
D=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
sqrt(D);
d=sqrt(D);
printf("% 8.8Lf\n",d);
return 0;
}

long double sqrt(double a){
int i;
long double b=3;
for(i=0;i<256;i++){
b=(b/2)+(a/(2*b));

}
return b;
}

Measured memory_bytes: 2696
#include <bits/stdc++.h>
#include <regex>
#ifdef _DEBUG
#include "debug.h"
#endif
#define int ll
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define mkpr make_pair
#define mktp make_tuple
#define tv(tp, i) get<(i)>(tp)
#define CLEAR(obj) obj = decltype(obj)()
#define var auto
#define OUT(type) type &
#define IN(type) const type &
#define self (*this)
#define in :
#define True true
#define False false
using namespace std; using str = string; using cstr = const str;
using ll = long long; using ull = unsigned long long; using cint = const int; using cll = const ll;
using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>;
using vb = vector<bool>; using vvb = vector<vb>; using vd = vector<double>; using vvd = vector<vd>;
using vc = vector<char>; using vvc = vector<vc>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using pdd = pair<double, double>; using psl = pair<string, ll>;
using tiii = tuple<int, int, int>; using tlll = tuple<ll, ll, ll>;
static const int MGN = 10; static const int ARYSZ_MAX = (int)1e7;
static const ll LINF = LLONG_MAX/2;
#ifdef int
static const int INF = LINF;
#else
static const int INF = INT_MAX/2;
#endif
static double EPS = 1e-9;
static inline bool DBLEQ(double a, double b) {return abs(a - b) < EPS;}
static inline void EPR(str msg) {cerr << msg << endl;}
static inline void AST(bool exp, str msg) {if(!exp){EPR(msg);} assert(exp);}
static inline void TAST(bool exp, str msg) {if(!exp){EPR(msg);} while(!exp){}}


int32_t main(int32_t argc, char* argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef IMPORT_SAMPLE
    vs args(argv, argv+argc);
    string sample = make_sample(args, "sample-1");
    ifstream ifs(sample); cin.rdbuf(ifs.rdbuf());
#endif


    string S; cin >> S;

    string ans = "No";
    REP(i,3) {
        if (S[i] == '7') {
            ans = "Yes";
            break;
        }
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 3656
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("-1"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
#define bn(x) ((1<<x)-1)
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;

bool q(int x, int y) {
  cout<<'?'<<" "<<x<<" "<<y<<endl;
  char c;
  cin>>c;
  return c == 'Y';
}

int f(vi s) {
  int m = sz(s);
  if (m == 1) return s[0];
  vi t;
  rep(i,m/2) {
    if (q(s[i*2],s[i*2+1])) t.pb(s[i*2+1]);
  }
  if ((m&1) && !(sz(t)&1)) t.pb(s.back());
  return f(t);
}

int main() {
  int a,b;
  scanf("%d%d",&a,&b);
  if (a <= b) {
    cout<<"Impossible"<<endl;
    return 0;
  }
  int n = a+b;
  vi s;
  rep(i,n) s.pb(i);
  int x = f(s);
  string ans(n,'0');
  ans[x] = '1';
  rep(i,n) if (i != x) {
    if (q(x,i)) ans[i] = '1';
  }
  cout<<'!'<<" "<<ans<<endl;
  return 0;
}






















Measured memory_bytes: 848
#include <bits/stdc++.h>
#define MAX_N 200001
#define mod 1000000007
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define FOR(i, a, b) for(ll i=a; i<b; i++)
#define REP(i, n) for(ll i=0; i<n; i++)
#define REV(i, n) for(ll i=n-1; i>=0; i--)
#define ALL(v) v.begin(), v.end()
#define pb push_back
const ll INF = 9e18;
ll n;
map<ll, ll> L, R;

signed main(){
    cin >> n;
    REP(i, n){
        ll a; cin >> a;
        ll l = i + a;
        ll r = i - a;
        if(L.count(l) != 1) L.insert(P(l, 1));
        else L[l]++;

        if(R.count(r) != 1) R.insert(P(r, 1));
        else R[r]++;
    }

    ll ret = 0;
    // ll check = 0;
    for(const auto& [key, value]: L){
        auto iterR = R.find(key);
        // check += value;
        // if(iterR != R.end()) cout << key << " " << value << " " << iterR->first << " "<< iterR->second << endl;
        if(iterR != R.end()) ret += value * iterR->second;
    }
    cout << ret << endl;

    return 0;
}

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


int main() {
  int a;
  cin >> a;
  cout << a+a*a+a*a*a << endl;
  
  return 0;
}

Measured memory_bytes: 3628
S = input().rstrip().split(' ')
o = 0
A = int(S[0])
B = int(S[1])
l = 0
while l < 2:
  if A>=B:
    o +=A
    A-= 1
    l +=1
  else:
    o += B
    B -= 1
    l +=1
print(o)
  
  
  

Measured memory_bytes: 3060
import fractions

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

values = list(map(int, input().split()))
a = values[0]
b = values[1]
c = values[2]
d = values[3]

# 最小公倍数
c_d_gcd = lcm(c, d)

divable_c = b // c - (a - 1) // c
divable_d = b // d - (a - 1) // d
divable_gcd = b // c_d_gcd - (a - 1) // c_d_gcd

result = (b - a + 1) - divable_c - divable_d + divable_gcd

print(result)

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

long long x , k , d ;

void input ( ) {
    cin >> x >> k >> d ;
}

void solve ( ) {
    if ( x == 0 ) {
        if ( ( k % 2 ) == 0 ) { cout << "0\n" ; }
        else { cout << d << "\n" ; }
        return ;
    }
    if ( x < 0 ) {
        long long cnt = ( -x ) / d ;
        if ( cnt >= k ) {
            cout << - ( x + k * d ) << "\n" ;
            return ;
        }
        else {
            if ( ( k % 2 ) == ( cnt % 2 ) ) {
                cout << - ( x + cnt * d ) << "\n" ;
            }
            else {
                cout << llabs ( x + ( cnt + 1 ) * d ) << "\n" ;
            }
        }
    }
    else {
        long long cnt = x / d ;
        if ( cnt >= k ) {
            cout << x - k * d << "\n" ;
            return ;
        }
        else {
            if ( ( k % 2 ) == ( cnt % 2 ) ) {
                cout << x - cnt * d << "\n" ;
            }
            else {
                cout << llabs ( x - ( cnt + 1 ) * d ) << "\n" ;
            }
        }
    }
}


int main ( ) {
    ios_base :: sync_with_stdio ( false ) ;
    cin.tie ( NULL ) ;
    input ( ) ;
    solve ( ) ;
    return 0 ;
}


Measured memory_bytes: 3664
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, M = MAP()

# (鍵の購入コスト, 開けられる宝箱)
keys = [None] * M
for i in range(M):
    c, _ = MAP()
    # どの宝箱を開けられるのかをbitで持っておく
    s = 0
    for a in [a-1 for a in LIST()]:
        s += 1 << a
    keys[i] = (c, s)

# dp[i][j] := i個目の鍵まで見て、集合jの宝箱を開けるための最小コスト
dp = list2d(2, 1<<N, INF)
dp[0][0] = 0
for i in range(M):
    # 今回の鍵で開けられる宝箱の集合s
    s = keys[i][1]
    c = keys[i][0]
    cur = i % 2
    nxt = (i+1) % 2
    # 今回の鍵を買わない遷移
    dp[nxt] = dp[cur][:]
    for j in range(1<<N):
        if dp[cur][j] != INF:
            m = j | s
            # 買う遷移：遷移元の開けられる宝箱の集合j | 今回の鍵で開けられる宝箱の集合s
            dp[nxt][m] = min(dp[nxt][m], dp[cur][j]+c)
ans = dp[M%2][-1]

if ans != INF:
    print(ans)
else:
    print(-1)


Measured memory_bytes: 3316
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func line() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	input := strings.Split(line(), " ")
	n_, _ := strconv.Atoi(input[0])
	k_, _ := strconv.Atoi(input[1])
	n := float64(n_)
	k := float64(k_)

	result := 0.0
	for i := 1; i <= n_; i++ {
		times := math.Log2(k / float64(i))
		var tmp float64
		if times < 0.0 || int(k) == i {
			tmp = 1.0 / n
		} else {
			tmp = 1.0 / n * math.Pow(0.5, float64(math.Ceil(times)))
		}
		result += tmp
		//fmt.Printf("%d %f %f\n", i, tmp, result)
	}

	fmt.Println(result)
}


Measured memory_bytes: 640
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] line = scanner.nextLine().split(" ");
        int numVertices = Integer.parseInt(line[0]);
        int numEdges = Integer.parseInt(line[1]);

        Map<Integer, List<Integer>> graph = new HashMap<>();
        for (int i = 0; i < numEdges; i++) {
            line = scanner.nextLine().split(" ");
            int from = Integer.parseInt(line[0]);
            int to = Integer.parseInt(line[1]);
            graph.putIfAbsent(from, new ArrayList<>());
            graph.get(from).add(to);
        }

        int[] max = new int[numVertices + 1];
        boolean[] visited = new boolean[numVertices + 1];
        for (int i = 1; i <= numVertices; i++) {
            if (!visited[i]) {
                dfs(graph, i, 0, max, visited);
            }
        }

        int ans = 0;
        for(int num : max) {
            ans = Math.max(ans, num);
        }
        System.out.println(ans);
    }

    private static void dfs(Map<Integer, List<Integer>> graph, int start, int count, int[] max, boolean[] visited) {
        visited[start] = true;
        max[start] = 0;
        if (graph.containsKey(start)) {
            for (int child : graph.get(start)) {
              if(!visited[child]) {
                dfs(graph, child, count, max, visited);
              }
                max[start] = Math.max(max[start], 1 + max[child]);
            }
        }
    }
}


Measured memory_bytes: 87080
#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

typedef unsigned long long ULL;
typedef long long ll;
const ULL base = 233;
const int N = 100005;

int n;
int f[201000];
ll val1[200100],val2[201000];
int find(int x){return f[x]==x?x:(f[x]=find(f[x]));}

int main(){
    cin>>n;
    FOR(i,1,2*N)f[i]=i;
    FOR(i,1,n){
        int x,y;
        scanf("%d%d",&x,&y);
        f[find(x)]= find(y+N);
    }
    FOR(i,1,N)val1[find(i)]++;
    FOR(i,N+1,2*N)val2[find(i)]++;
    ll ans=0;
    FOR(i,1,2*N){
        ans+=val1[i]*val2[i];
    }
    printf("%lld\n",ans-n);
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e5)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

template <typename T> 
ostream& operator<<(ostream& os, const vector<T>& v) 
{ 
    for (int i = 0; i < (int)v.size(); ++i) { 
        os << v[i]; 
        if (i != (int)v.size() - 1) 
            os << " "; 
    } 
    return os; 
} 

int main()
{
    ll N;
    cin >> N;
    print(N * N * N);
    return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, a, b;
  cin >> n >> a >> b;
  
  cout << min(a, b) << " " << max(0, a + b - n) << '\n';
}

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


int main()
{
    std::ios_base::sync_with_stdio(0);	
    cin.tie(0);
    cout.tie(0);
    
    ll n;
    cin>>n;
    
    map <ll,ll> mp;
    
    for(ll i=0;i<n;i++)
    {
		ll x;
		cin>>x;
		
		mp[x]++;
	}
	
	if(mp.size()==n)
	{
		cout<<"YES";
	}
	else
	{
		cout<<"NO";
	}
    
}


Measured memory_bytes: 12800
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int n ; int[] lst ;
        double sum, a ;
        while(true){
            
            n = sc.nextInt();
            if(n==0)break;
            
            sum = 0 ; a = 0 ;
            
            lst = new int[n];
            for(int i=0;i<n;i++){
                lst[i]=sc.nextInt();
                sum+=lst[i];
            }
            
            sum = sum / n;
            
            for(int i : lst){
                a += (i-sum)*(i-sum);
            }
            
            System.out.println(Math.sqrt(a/n));
        }
    }
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define pb push_back

using namespace std;

typedef long long ll;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

void solve() {

}

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if( a != c ) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<cstring>
#define ll long long
using namespace std;

const ll mod=1e9+7;

ll ksm(ll b,ll p)
{
	ll ans=1;
	while(p>0)
    {
        if(p%2==1)
            ans=(ans*b)%mod;
        b=(b*b)%mod;
        p/=2;
    }
    return ans;
}

ll f[500010],anss;

int main()
{
	int n,k;
	cin>>n>>k;
	for(ll i=k;i>=1;i--)
	{
		ll cnt=k/i;
		f[i]=ksm(cnt,n);
		for(ll j=2*i;j<=k;j+=i)
		{
			f[i]=(f[i]+mod-f[j])%mod;
		}
	}
	for(ll i=1;i<=k;i++)
	{
		anss+=f[i]*i;
		anss%=mod;
	}
	cout<<anss;
}

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

int main() {
    string s;
    cin >> s;
    int year = stoi(s.substr(0, 4));
    int month = stoi(s.substr(5, 2));
    int date = stoi(s.substr(8, 2));
    if (year < 2019) cout << "Heisei" << endl;
    else if (month < 5) cout << "Heisei" << endl;
    else cout << "TBD" << endl;
}


Measured memory_bytes: 256
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from  collections import defaultdict
from collections import Counter
import bisect
def main():
    N = I()
    A = LI()
    A.sort(reverse=True)
    ans = A[0]
    cnt = 1
    i = 1
    while cnt < N - 1:
        ans += A[i] * 2
        cnt += 2
        i += 1
    if cnt > N - 1:
        ans -= A[i - 1]
    print(ans)
if __name__ == "__main__":
    main()



Measured memory_bytes: 102508
from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
import math
from fractions import gcd
import sys
#input = sys.stdin.readline


#N=int(input())

#A=list(map(int,input().split()))
#XY=[list(map(int,input().split())) for i in range(N)]

H,Y=map(int,input().split())
if H==1 or Y==1:
    print(1)
else:
    print(H*Y//2+H*Y%2)


Measured memory_bytes: 65260
N = int(input())
A = list(map(int, input().split()))


ans = 0
num_minus = 0
min_num = 1e+9
for i in range(N):
    ans += abs(A[i])
    min_num = min(min_num, abs(A[i]))
    if A[i] < 0: num_minus += 1

if num_minus%2 == 0: print(ans)
else: print(ans - 2*min_num)

Measured memory_bytes: 14412
#include <stdio.h>

int main(void)
{
	int W = 0,H = 0,N = 0;
	int x[100] = {0},y[100] = {0},a[100] = {0},ans[100][100] = {0},ANS = 0;
	int i = 0,j = 0, l = 0;
	scanf("%d%d%d",&W,&H,&N);
	for(i = 0;i < N;i++)
		scanf("%d%d%d",&x[i],&y[i],&a[i]);
	
	for(i = 0;i < N;i++){
		if(a[i] == 1){
			for(j = 0;j < x[i];j++){
				for(l = 0;l < H;l++)
					ans[j][l] = 1;
			}
		}else if(a[i] == 2){
			for(j = x[i];j < W;j++){
				for(l = 0;l < H;l++)
					ans[j][l] = 1;
			}
		}else if(a[i] == 3){
			for(j = 0;j < y[i];j++){
				for(l = 0;l < W;l++)
					ans[l][j] = 1;
			}
		}else if(a[i] == 4){
			for(j = y[i];j < H;j++){
				for(l = 0;l < W;l++)
					ans[l][j] = 1;
			}
		}
	}
	
	for(i = 0;i < W;i++){
		for(j = 0;j < H;j++){
			if(ans[i][j] == 0)
				ANS++;
		}
	}
	
	printf("%d\n",ANS);
	
	return 0;
}

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

int main() {
	stack<int>S1;
	stack<pair<int, int> >S2;
	char ch;
	int sum = 0;
	for (int i = 0; cin >> ch; i++) {
		if (ch == '\\')S1.push(i);
		else if (ch == '/'&&S1.size() > 0) {
			int j = S1.top(); S1.pop();
			sum += i - j;
			int a = i - j;
			while (S2.size() > 0 && S2.top().first > j) {
				a += S2.top().second; S2.pop();
			}
			S2.push(make_pair(j, a));
		}
	}

	vector<int>ans;
	while (S2.size() > 0) { ans.push_back(S2.top().second); S2.pop(); }
	reverse(ans.begin(), ans.end());
	cout << sum << endl;
	cout << ans.size();
	for (int i = 0; i < ans.size(); i++) {
		cout << " ";
		cout << ans[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 3172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
	
    int N, K; cin >> N >> K;
    vi p(N); rep(i,N) cin >> p[i];

    vl imos(N+1,0);
    rep(i,N) imos[i+1] = imos[i] + p[i];

    ll ma = 0;
    rep(i,N-K+1) {
        ll tmp = imos[i+K] - imos[i];
        chmax(ma,tmp);
    }
    ld ans = (ld) (ma + K) / 2.0;
    cout << ans << endl; 
    

}

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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int l, r, d;
  cin >> l >> r >> d;
  int res = 0;
  for (int i = l; i <= r; ++i) {
    res += i % d == 0;
  }
  cout << res << '\n';
}


Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(int, char**)
{
	string s;
	cin >> s;
	auto len = s.length();
	vector<long long> nums;
	size_t from;
	long long total = 0;
	for (auto i = 0; i < (1 << len - 1); ++i)
	{
		nums.clear();
		from = 0;
		for (auto j = 0; j < len; ++j)
		{
			if ((i >> j) & 1)
			{
				nums.push_back(stoll(s.substr(from, j - from + 1)));
				from = j + 1;
			}
		}
		nums.push_back(stoll(s.substr(from, len)));
		for (const auto& n : nums)
		{
			total += n;
		}
	}
	cout << total << endl;
	return 0;
}


Measured memory_bytes: 256