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

using ull = unsigned long long;
using ll = long long;

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define pb push_back
#define fill(x, y) memset(x, y, sizeof(x))
#define even(x) x % 2 == 0
#define odd(x) x % 2 != 0
#define all(x) x.begin(), x.end()
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define IN1(x) ll x; cin >> x;

// these functions return the position of result of Binary Search.
#define LB(s, t, x) (int) (lower_bound(s, t, x) - s)
#define UB(s, t, x) (int) (upper_bound(s, t, x) - s)

ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1) ans = 1ll * ans * a % mo; a = 1ll * a * a % mo; } while (b >>= 1); return ans; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll temp = gcd(a, b); return temp ? (a / temp * b) : 0; }
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dx8[] = { 1, -1, 0, 0, 1, 1, -1, -1 }, dy8[] = { 0, 0, -1, 1, -1, 1, -1, 1 };

template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts>
auto make_v(size_t a, size_t b, Ts... ts) { return vector<decltype(make_v<T>(b, ts...))>(a, make_v<T>(b, ts...)); }
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); }
// auto dp = make_v<int>(4, h, w);
// fill_v(dp, 0);

const ll INF_LL = (1ll << 60);
const int INF_INT = (int)1e9;
const ll MOD_CONST = (ll)(1e9 + 7);

template <typename T>
vector<T> pows(int n) {
    vector<T> ret;
    T x = 1;
    while (ret.size() < n) {
        ret.push_back(x);
        x *= 10;
    }
    return ret;
}

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 (b < a) { a = b; return 1; } return 0; }

inline tuple<ll, ll> rotate45(tuple<ll, ll> point) { ll x = get<0>(point), y = get<1>(point); return tuple<ll, ll>(x + y, x - y); }
inline bool rangeCheck2D(int nx, int ny, int Width, int Height) { return nx >= 0 and nx < Width and ny >= 0 and ny < Height; }

template <typename T>
void out(T o) { cout << o << endl; }
template <typename T>
void out(vector<T> &out) { REP(i, (int)out.size()) { cout << out[i]; if (i == (int)out.size() - 1) cout << endl; else cout << " "; } }



int main(void)
{
    cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(20);

    IN1(N);

	string before; cin >> before;
	set<string> dd; dd.insert(before);
	REP(i, N-1) {
		string c; cin >> c;
		if (dd.find(c) != dd.end()) {
			out("No");
			return 0;
		}
		if (before[before.size()-1] != c[0]) {
			out("No");
			return 0;
		}
		before = c;
		dd.insert(c);
	}
	out("Yes");

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
static const int MAX_N = 100000;

int N, M;
vector<int> G[MAX_N];
int indegree[MAX_N];
int memo[MAX_N];

vector<int> TopologicalSort(){
	vector<int> va;
	queue<int> qa;
	for(int i = 0; i < N; i++){
		if(indegree[i] == 0) qa.push(i);
	}
	while(!qa.empty()){
		int u = qa.front(); qa.pop();
		va.push_back(u);
		for(int i = 0; i < G[u].size(); i++){
			int v = G[u][i];
			indegree[v]--;
			if(indegree[v] == 0) qa.push(v);
		}
	}
	return va;
}

int main(){
	scanf("%d %d", &N, &M);
	for(int i = 0; i < M; i++){
		int u, v;
		scanf("%d %d", &u, &v);
		u--; v--;
		G[u].push_back(v);
		indegree[v]++;
	}
	vector<int> va = TopologicalSort();
	for(int i = 0; i < N; i++){
		for(int j = 0; j < G[va[i]].size(); j++){
			memo[G[va[i]][j]] = max(memo[G[va[i]][j]], memo[va[i]] + 1);
		}
	}
	int res = 0;
	for(int i = 0; i < N; i++) res = max(res, memo[i]);
	printf("%d\n", res);
	return 0;
}

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

string o, e;

int main() {
  int i;
  cin >> o >> e;
  for(i = 0; i < min(o.size(), e.size()); ++i) {
    cout << o[i] << e[i];
  }
  if(o.size() > e.size()) cout << o[o.size() - 1];
  if(e.size() > o.size()) cout << e[e.size() - 1];
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define REP(i, n) for(int i = 0;i < (n);++i)
#define RREP(i, n) for(int i = (n)-1; i >= 0; --i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.1415926
#define coutdb cout<<fixed<<setprecision(15)

const int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;

// typedef int_fast64_t ll;
#define int int_fast64_t

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

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

  int N; cin >> N;
  INTV L(N);
  REP(i, N) cin >> L[i];
  sort(ALL(L));
  int ans = 0;
  REP(i, N) for(int j = i+1; j<N; j++){
    int a = L[i]+L[j];
    auto itr = lower_bound(ALL(L), a);
    ans += itr-1-(L.begin()+j);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
#include <cassert>
#include <functional>

using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<ll, ll> P;
inline ll min(ll x, ll y) { return x < y ? x : y; }
inline ll max(ll x, ll y) { return x > y ? x : y; }

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#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 all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

int main() {
	ll N;
	cin >> N;
	ll ans = 1;
	for (ll i = 1; i <= N; i++) {
		ans *= i;
		ans %= 1000000007;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <functional>


int descending_compare(const void *a, const void *b) {
	if (*(int*)a > *(int*)b) {
		return -1;
	}
	else if (*(int*)a == *(int*)b) {
		return 0;
	}
	else {
		return 1;
	}
}

int ascending_compare(const void *a, const void *b) {
	if (*(int*)a < *(int*)b) {
		return -1;
	}
	else if (*(int*)a == *(int*)b) {
		return 0;
	}
	else {
		return 1;
	}
}

//greatest common divisor
unsigned long  gcd(unsigned long x, unsigned long y) {
	if (y == 0) {
		return x;
	}
	else if (x > y) {
		return gcd(y, x % y);
	}
	else {
		return gcd(x, y % x);
	}
}



long long factorial(int x) {
	long long rtn = 1;
	int i;
	for (i = x; i > 1; i--) {
		rtn = (rtn*i);
	}
	return rtn;
}

/*
int struct_ascending_compare(const void *p, const void *q) {
return ((struct_name*)p)->member_name - ((struct_name*)q)->member_name;
}*/

long long a[100005];
long long b[100005];

int main(void) {
	int n;
    long long cnt = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++){
        scanf("%lld %lld", &a[i], &b[i]);
    }
    for (int i = n - 1; i >= 0; i--){
        a[i] += cnt;
        if (a[i] % b[i] != 0) cnt += b[i] - a[i] % b[i];
    }
    printf("%lld\n", cnt);
}


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

int main(){
    int N,M;
    cin>>N>>M;
    int a[M],b[M];
    for(int i=0;i<M;i++) cin>>a[i]>>b[i];

    map<int,int> mp;
    for(int i=0;i<M;i++){
        mp[a[i]]++;
        mp[b[i]]++;
    }

    for(int i=1;i<=N;i++){
        cout<<mp[i]<<endl;
    }
}

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

#define mp make_pair
typedef long long ll;
typedef pair<int,int>pii;
typedef pair<ll,ll>pll;
const int N = 1e5;
vector<int>graph[N+100];
int vis[N+100];
void dfs(int u)
{
	vis[u] = 1;
	for(auto it:graph[u])
	{
		if(!vis[it]){
			dfs(it);
		}
	}
}
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		graph[x].push_back(y);
		graph[y].push_back(x);
	}
	memset(vis,0,sizeof vis);
	int ans = 0;
	for(int i=1;i<=n;i++){
		if(!vis[i]){
			dfs(i);
			ans++;
		}
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 9216
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    private static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(final String[] args) throws IOException {
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(System.out, true);

        int x = in.nextInt();
        int happiness = (x / 500) * 1000;
        x = x % 500;
        happiness += x - (x % 5);
        out.println(happiness);
    }
}


Measured memory_bytes: 21332
S = input()
N = len(S)
ans = [1] * N

#処理
for i in range(N - 2):
	if S[i] == "R" and S[i + 1] == "R":
		ans[i + 2] += ans[i]
		ans[i] = 0

for i in range(N - 2):
	if S[-1 - i] == "L" and S[-2 - i] == "L":
		ans[-3 - i] += ans[-1 - i]
		ans[-1 - i] = 0

ans = list(map(str, ans))
print(" ".join(ans))

Measured memory_bytes: 10356
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
	int n, m, k;
	cin >> n >> m >> k;
	// map<int, int> mp;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= m; j++) {
			int p = m * i  + n * j - 2 * i * j;
			// cout << p << endl;
			if (k == p) {
				cout << "Yes" << endl;
				return;
			}
		}
	}
	// if (mp[k]) cout << "Yes" << endl;
	// else cout << "No" << endl;
	cout << "No" << endl;
}

int main() {
	solve();
	return 0;
}

Measured memory_bytes: 3580
/*
auth - @sportykush
*/

#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; 
// using namespace __gnu_pbds;

typedef long long int ll;
typedef long double ld;

//#define mp make_pair
#define bug(v)                    cerr<<#v<<" = "<<(v)<<endl;
#define bug2(v1,v2)               cerr<<#v1<<" = "<<(v1)<< ' ' << #v2<<" = "<<(v2)<<endl;
#define ERASE(x)                  x.erase(unique(x.begin(),x.end()),x.end())
#define pb                        emplace_back
#define vii                       vector<int>
#define vll                       vector<ll>
#define vpll                      vector< pair <ll,ll> >
#define pll                       pair <ll,ll>
#define pii                       pair <int,int>
#define pq                        priority_queue< int >
#define khtm                      "\n"
#define F                         first
#define S                         second
#define fr(i,a,n)                 for(i=a;i<n;i++)
#define mem(arr,l)                memset(arr,l,sizeof arr)
#define ALL(x)                    x.begin(), x.end()
#define frr(i,a,n)                for(i=n-1;i>=a;i--)
#define fast                      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define testcase                  ll T; cin>>T; while(T--)


const double pi = 3.14159265359;
const int MAX = 1e6 +2;
const ll inf =  1e18;
const int N = 1010;
//const ll mod = 998244353 ;
const ll mod = 1000000007;
inline ll add(ll a,ll b){a+=b;if(a>=mod)a-=mod;return a;}
inline ll mul(ll a,ll b){return (((a+mod)%mod)*(b+mod)%mod)%mod;}
inline ll power(ll a,ll b){ll rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline ll modInverse(ll n, ll p){ return power(n, p-2)%p; }

/*
important builtin functions
__gcd(value1, value2)
__builtin_ffs(x)
  Number of leading zeroes: __builtin_clz(x)
  Number of trailing zeroes : __builtin_ctz(x)
  Number of set bits: __builtin_popcount(x)
*/
 
void stArt()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
}
void eNd()
{
	#ifndef ONLINE_JUDGE
  	cout<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s";
  	#endif
}

//////////////////// start /////////////////////////////////
 

ll i,j,k,l,m,r,n;
ll a[MAX],b[MAX];

// void dfs1(ll v, ll par)
// {
// 	c[v] = a[v];
// 	for(auto u:adj[v]){
// 		if(u==par)
// 			continue;
// 		dfs1(u,v);
// 		c[v] += c[u];
// 	}
// 	//bug2(c[v],v)
// }

// void dfs2(ll v, ll par, ll bef)
// {
// 	ll g,bx;
// 	g = (c[v]+b[v])/2;
// 	bx = c[v] - g;
// 	if(abs(b[v])>c[v] || g<0 || bx<0 || (c[v]+b[v])%2!=0 || g>bef)
// 		ans=1;
// 	for(auto u:adj[v]){
// 		if(u==par)
// 			continue;
// 		dfs2(u,v,g);
// 	}
// }



int main()
{
 
stArt();
fast
//cout << setprecision(15) << fixed;

cin >> n;
cout << (n>=30 ?"Yes":"No");

 eNd();
  return 0;
 
}

Measured memory_bytes: 3648
arr = []
brr = []
orr = []
while true
  a, op, b = gets.split.map(&:to_s)
  a = a.to_i
  b = b.to_i
  break if op == "?"
  arr.push(a)
  brr.push(b)
  orr.push(op)
end
roop_num = 0
arr.zip(brr) do |a, b|
  op = orr[roop_num]
  case op
  when "+" then
    puts a + b
  when "-" then 
    puts a - b
  when "/" then
    puts a / b
  when "*" then
    puts a * b
  end
  roop_num = roop_num + 1
end



Measured memory_bytes: 6876
L, R = map(int, input().split())
# print(L, R)

if R - L <= 2019:
    ans = 2019**2
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            a = (i * j) % 2019
            if a < ans:
                ans = a
    print(ans)
    exit()

print(0)


Measured memory_bytes: 41964
#include 	<ext/pb_ds/assoc_container.hpp> 
#include 	<ext/pb_ds/tree_policy.hpp> 
#include 	<iostream>
#include 	<queue>
#include 	<tuple>
#include 	<vector>
#include	<bits/stdc++.h>
#include	<algorithm>
#include 	<cmath>
#include 	<map>
#include 	<string>
#include 	<iomanip> 
#include 	<ctype.h>
#define 	ll  long long int
#define		read(a) long long int a; cin>>a;
#define 	readstr(s) string s; cin>>s;
#define 	readc(c) char c; cin>>c;
#define 	readarr(a,l) long long int a[l]={0}; for(ll i=0;i<l;i++) cin>>a[i];
#define 	loop(i,a,b) for(ll i=a;i<b;i++)
#define 	rloop(i,a,b) for(ll i=a;i>b;i--)
#define 	loopchar() for(char c='a';c<='z';c++)
#define 	printarr(a, n) fori (i, 1, n) cout << a[i] << " "; cout << endl;
#define		printv(v) for (int i: v) cout << i << " "; cout << endl;
#define 	loopitr(vec) for(auto itr=vec.begin();itr!=vec.end();itr++)
#define 	ff first
#define 	ss second
#define 	readmtrx(i,j,a,b) ll arr[a][b]={0};for(ll i=0;i<a;i++)for(ll j=0;j<b;j++) cin>>arr[i][j];
#define 	all(a) a.begin(), a.end()
#define 	yes cout <<"YES"<<endl;
#define 	no cout <<"NO"<<endl;
#define 	sc(x) cout << (#x) << " is " << (x) << endl;
#define 	fast ios_base::sync_with_stdio(false);cin.tie(0);
#define 	pb(p) push_back(p)
#define 	mp make_pair
#define 	fsort(vec) sort(vec.begin(),vec.end())
#define 	rsort(vec) sort(vec.begin(),vec.end(),compare)
#define 	Endl endl
#define 	ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define 	roundoff std::cout << std::setprecision(15)
#define 	inf 9223372036854775807
#define 	infn -9223372036854775807
#define 	pi 3.14159265358979323846
const 		int mod = 1e9+7; 
#define 	intsize ll size = trunc(log10(num)) + 1
#define 	REVERSE(vec) reverse(vec.begin(),vec.end())
using 		namespace __gnu_pbds; 
using 		namespace std;

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

//code start from here 

int main() {
	fast;
	read(a)
	cout<<a*(a-1)/2<<endl;
	return 0;
}

//ends here

Measured memory_bytes: 256
/*Template by hemnath_d(Enlightened by chamow)*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define vec vector<ll>
#define pll pair<ll,ll>
#define fastread ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define fx first
#define sx second
#define inf 100000000000000
#define minf -100000000000000
#define maxi 100005

int main()
{
    fastread;
    ll n,x;
    cin>>n>>x;
    vec arr(n);
    for(ll i=0;i<n;i++)
    	cin>>arr[i];
    sort(arr.begin(),arr.end());
    ll ans=0;
    for(ll i=0;i<n;i++)
    {
    	if(i==n-1&&x==arr[i])
    		ans++;
    	else if(i!=n-1&&arr[i]<=x)
    	{
    		x-=arr[i];
    		ans++;
    	}
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
    int n;
    while(cin >> n, n){
        int x[n], y[n];
        
        static bool exist[5001][5001] = {};

        for(int i = 0; i < n; i++){
            cin >> x[i] >> y[i];
            exist[x[i]][y[i]] = true;
        }

        int ans = 0;
        for(int i = 0; i < n-1; i++){
            for(int j = 0; j < n; j++){
                int ax = x[i], ay = y[i], bx = x[j], by = y[j];
                int cx = ax - (by-ay), cy = ay + (bx-ax);
                int dx = cx + (bx-ax), dy = cy + (by-ay);
                if(0 <= cx && cx < 5001 && 0 <= cy && cy < 5001 && 
                   0 <= dx && dx < 5001 && 0 <= dy && dy < 5001 && 
                   exist[cx][cy] && exist[dx][dy]){
                       ans = max(ans, (bx-ax)*(bx-ax) + (by-ay)*(by-ay));
                }
            }
        }

        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 22708
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iostream>
#include <unordered_map>
#define maxn 200005
#define mod 1000000007
using namespace std;
typedef long long LL;
int n,m=2;
LL a[maxn],cnt=0,maxx=-1;
bool chk(LL x){
	LL sum=0,tot=1;
	for(int i=1;i<=n;i++){
	  if(sum+a[i]<=x) sum+=a[i];
	  else{
	  	tot++;
	  	sum=a[i];
	   }
	}
   return tot<=m;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {scanf("%lld",&a[i]);maxx=max(maxx,a[i]);cnt+=a[i];}
    LL l=maxx,r=cnt,ans;
    while(l<r-1)
    {
   	  LL mid=(l+r)/2;
   	  if(chk(mid))r=mid;
   	  else l=mid;
    }
    if(chk(l)) ans=l;
    else ans=r;
    printf("%lld",2*ans-cnt);
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define answer cout << ans << endl;
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
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; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;

signed _main(){
  double L; cin >> L;
  double e=L/3;
  /*
  double ans=0;
  for(int a=1;a<=1000;a++){
    for(int b=1;b<=1000;b++){
      int c=L-a-b;
      chmax(ans,a*b*c);
    }
  }*/
  cout << fixed << setprecision(6) << e*e*e << endl;
  return 0;
}


Measured memory_bytes: 256
while 1:
	N,M = map(int,raw_input().split())
	if N == 0: break
	T = [[0]*1261 for i in range(N)]
	r = input()
	tnms = sorted([map(int,raw_input().split()) for i in range(r)], key = lambda x:x[1])
	for i in range(0,r,2):
		t1,n,m,s = tnms[i]
		t2,n,m,s = tnms[i+1]
		T[n-1][t1:t2] = [m for j in range(t1,t2)]
	for i in range(input()):
		ts,te,m = map(int,raw_input().split())
		print sum(1 if any(T[n][t] == m for n in range(N)) else 0 for t in range(ts,te))
	

Measured memory_bytes: 20908
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<cstdlib>

using namespace std;


int main() {
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	if (abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
typedef long long ll;
typedef pair<int,pair<int,int>> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010;
int dx[5]={0,1,0,-1,0};
int dy[5]={1,0,-1,0,0};
int c[100010];
vector<int> v[100010];
int main(){
    int n,m;cin>>n>>m;
    int a[100010];
    for(int i=0;i<n;i++){
        cin>>a[i];
        c[a[i]%m]++;
        v[a[i]%m].push_back(a[i]);
    }
    int ans=0;
    ans+=c[0]/2;
    for(int i=1;i<=m/2;i++){
        if(m%2==0&&i==m/2){
            ans+=c[i]/2;
        }else{
            ans+=min(c[i],c[m-i]);
            int s=abs(c[i]-c[m-i]);
            int cc=0;
            if(c[i]>c[m-i]){
                sort(all(v[i]));
                for(int j=1;j<v[i].size();j++){
                    if(v[i][j]==v[i][j-1]){
                        cc++;
                        j++;
                    }
                }
            }else{
                sort(all(v[m-i]));
                for(int j=1;j<v[m-i].size();j++){
                    if(v[m-i][j]==v[m-i][j-1]){
                        cc++;
                        j++;
                    }
                }
            }
            while(s>=2&&cc--){
                ans++;
                s-=2;
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
// C - Vacation

using namespace std;

int dp[100005][3];
int val[3];

int main() {
    int N,i,j,k;

    scanf("%d",&N);
    for (i = 1;i <= N;i++) {
        scanf("%d%d%d",&val[0],&val[1],&val[2]);
        for (j = 0;j < 3;j++) {
            for (k = 0;k < 3;k++) {
                if (j != k)
                    dp[i][j] = max(dp[i][j],dp[i - 1][k] + val[j]);
            }
        }
    }

    printf("%d\n",max(dp[N][0],max(dp[N][1],dp[N][2])));

    return 0;
}


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

typedef struct _card {
    char mark;
    int value;
}card;

void bubblesort(card *cards, int n) {
    for(int i=0; i<n; i++) {
        for(int j=n-1; i<j; j--) {
            if(cards[j].value<cards[j-1].value) {
                swap(cards[j], cards[j-1]);
            }
        }
    }
}

void selectionsort(card *cards, int n) {
    int minj;
    for(int i=0; i<n; i++) {
        minj = i;
        for(int j=i; j<n; j++) {
            if(cards[j].value<cards[minj].value) {
                minj = j;
            }
        }
        swap(cards[i], cards[minj]);
    }
}

int s_ns(char checkmark[13][4], int *countcard, card *cards) {
    int count = 0;
    for(int i=0; i<13; i++) {
        for(int j=0; j<countcard[i]; j++) {
            if(cards[count].mark!=checkmark[i][j]) {
                return 0;
            }
            count++;
        }
    }
    return 1;
}

int main() {
    int n = 0;
    char element[3];
    char numelement[2];
    cin >> n;

    card cards[n];
    card cards2[n];
    for(int i=0; i<n; i++) {
        cin >> element;
        cards[i].mark = element[0];
        cards2[i].mark = element[0];
        numelement[0] = element[1];
        numelement[1] = element[2];
        cards[i].value = atoi(numelement);
        cards2[i].value = atoi(numelement);
    }
    //カードの数の値ごとにマークがどの順番で出てきたかを記録しておく（トランプが前提なのでマーク４つとして２次元配列を作る）
    char checkmark[13][4];
    //何枚同じ数字のカードが出たかも配列に入れておく
    int countcard[13];
    for(int i=0; i<13; i++) {
        countcard[i] = 0;
    }
    for(int i=0; i<n; i++) {
        checkmark[cards[i].value-1][countcard[cards[i].value-1]] = cards[i].mark;
        countcard[cards[i].value-1] += 1;
    }

    bubblesort(cards, n);
    for(int i=0; i<n; i++) {
        if(i!=n-1) {
            printf("%c%d ", cards[i].mark, cards[i].value);
        }
        else {
            printf("%c%d", cards[i].mark, cards[i].value);
        }
    }
    printf("\n");
    if(s_ns(checkmark, countcard, cards)==1) {
        printf("Stable\n");
    }
    else {
        printf("Not stable\n");
    }

    selectionsort(cards2, n);
    for(int i=0; i<n; i++) {
        if(i!=n-1) {
            printf("%c%d ", cards2[i].mark, cards2[i].value);
        }
        else {
            printf("%c%d", cards2[i].mark, cards2[i].value);
        }
    }
    printf("\n");
    if(s_ns(checkmark, countcard, cards2)==1) {
        printf("Stable\n");
    }
    else {
        printf("Not stable\n");
    }
}


Measured memory_bytes: 3200
//BISMILLAHIR RAHMANIR RAHEEM
//ALLAH IS WATCHING ME
// Allah amader korona virus theke rokkha korun.Amin.

//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp> //order_of_key return number of elements less than x, find_by_order return index (pointer use kora lgbe)

using namespace std;
using namespace __gnu_pbds;

#define ull    unsigned long long
#define ll    long long
#define ios    ios::sync_with_stdio(0);cin.tie(0);
#define ses   "\n"
#define all(x) (x).begin(), (x).end()
//#define INF   ((int)2e18)
#define ii pair<ll, ll>

string digit="0123456789";
string small="abcdefghijklmnopqrstuvwxyz";
string capital="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; // 8-direction.......
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[]= {1,-1,0,0}; // 4-direction...........
int dy4[]= {0,0,1,-1};

const int N=1e6+5;
const ll M=1e18;

typedef tree< ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;

struct Edge
{
    int u, vv;
    bool operator<(Edge const& other)
    {
        return vv > other.vv;
    }
}; // eta joss jinis.krsukal er jnno and sort 1 out of 3 or more er jnno better

/////////////////////////////////////////////////////////////////////////////
bool subsequence(string s, string t,ll i , ll point){
  for(ll k = i ; k<s.size();k++){
            if(s[k]==t[point])point++;
            if(point==t.size())return 1;
  }
  if(point<t.size())return 0;
}
////////////////////////////////////////////////////////////////////////////
//main function is here.........
int main()
{
       //ios
   ll n;
   cin>>n;
   ll arr[n];
   map<ll,ll> mp;
   for(ll i=0;i<n;i++){
                cin>>arr[i];
                mp[arr[i]]++;
   }
   ll ans=0;
   for(auto i: mp){
                ll valu= i.second;
                valu--;
                ans+=(valu*(valu+1))/2;
   }
   for(ll i=0;i<n;i++){
        ll now  = mp[arr[i]];
        now--;
        ll valu = ans - (now*(now+1))/2;
        if(now==0)cout<<ans<<ses;
        else{
              now--;
               cout<<valu +  (now*(now+1))/2<<ses;
        }
   }

}


/*



*/



//Alhamdulillah


Measured memory_bytes: 11008
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const int MOD = 1e9+7;
using ll = long long;
using vi = vector<int>;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(x) x.begin(), x.end();
int main() {
  int a;
  string b;
  cin >> a >> b;
  for(int i=0;i<b.size();i++){
    b.at(i) += a;
    while(b.at(i)>'Z')b.at(i) -=26;
  }
  cout << b;
}

Measured memory_bytes: 3612
# include <iostream>
# include <stdint.h>
# include <stdio.h>
# include <math.h>
using namespace std;


int main(){
	int n ;
	cin >>n;
	int y = n-1;
	int x[y];
	for(int i = 0;i <n ;i++ ){
		cin >>x[i];
	}
	for(int j =0;j<n-1;j++){
		int z = n-j -1;
		cout <<x[z]<<" ";
	}
	cout <<x[0] <<"\n";

return 0;
}



Measured memory_bytes: 3088
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
using ll = long long;
int MOD = 1e9 + 7;
using namespace std;
struct UnionFind
{
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N)
    { //最初は全てが根であるとして初期化
        for (int i = 0; i < N; i++)
            par[i] = i;
    }

    int root(int x)
    { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x)
            return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y)
    {                     // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry)
            return;   //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y)
    { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
int main()
{
    ll a, b, k;
    cin >> a >> b >> k;
    bool h = true;
    for (int i = 0; i < k;i++){
        if(h){
            b += a / 2;
            a /= 2;
            h = false;
        }else{
            a += b / 2;
            b /= 2;
            h = true;
        }
    }
    cout << a << " " << b << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#define N 100001
using namespace std;
typedef long long ll;
ll s[N];
bool vis[N];
ll n,m;
ll sum=0;
main(){
	register int i,j;
	cin>>n>>m;
	for(i=1;i<=n;i++)
	s[i]=1;
	vis[1]=true;
	for(i=1;i<=m;i++){
		ll x,y;
		cin>>x>>y;
		if(vis[x]==true){
			vis[y]=true;
			if(s[x]==1)vis[x]=false;
		}
		s[x]--;
		s[y]++;
	}
	for(i=1;i<=n;i++)
	if(vis[i]==true)sum++;
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int al = 26;
		int a = 'A';
		Scanner sc = new Scanner(System.in);
		int n = Integer.valueOf(sc.nextLine());
		String line = sc.nextLine();
		for (char c : line.toCharArray()) {
			System.out.print((char) (((c-a + n) % al) + a));
		}
		System.out.println();
	}
}


Measured memory_bytes: 24140
//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
#define  all(v)            v.begin(), v.end()
#define  sz(x)             (int)x.size()
#define  debug(x)         cout << '>' << #x << ':' << x << endl;
#define  rep(i,n)         for(int i = 0; i < n; i++)
#define  reps(i,n)        for(int i = 1; i<=n ; i++)
#define  make_unique(v)   sort(all(v));v.erase(unique(all(v)), v.end());
#define  rot(v)           rotate(v.begin(), v.begin() + k, v.end());
#define  rmv(v,a)         v.erase(remove(v.begin(),v.end(), a), v.end());
#define  max(x,y)         ((x>y)?x:y)
#define  min(x,y)         ((x<y)?x:y)
#define  pb               push_back
#define  eb               emplace_back
#define  mp               make_pair
#define  endl             '\n'
#define  fi               first
#define  se               second
#define  ajs(a)           (a<0)?(-1*a):a
using namespace std;
typedef long long          ll;
// use count() instead of find() in sets.
const ll MOD = 1e9 + 7;
const double PI  = acos(-1.0);
const double EPS = (1e-10);
const int dx4[4] = {0, 1, 0, -1};
const int dy4[4] = { -1, 0, 1, 0};
const int dx8[8] = { -1, -1, -1, 0, 1, 1, 1, 0};
const int dy8[8] = { -1, 0, 1, 1, 1, 0, -1, -1};
bool cmp(int X, int Y) {return X > Y;}
int dcp(double A, double B){return fabs(A-B)<=EPS ? 0 : A<B ? -1:1;}


ll gcd(ll a, ll b) {return !b ? a : gcd(b, a % b);}
ll lcm(ll a, ll b) {return (a / gcd(a, b)) * b;}
ll modpow(ll a, ll b, ll m ){a %= m; ll res = 1; while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a, ll m = MOD) {return modpow(a, m - 2, m);}




int main()
{ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll n;cin>>n;
ll c = 2*n;
ll a[c];
rep(i,c){cin>>a[i];}

sort(a,a+c);
ll sum = 0;
for(ll i = 0; i < 2*n ; i = i+2){
    sum+=a[i];
}
cout<<sum;
}





Measured memory_bytes: 3572
n, m = [int(x) for x in input().split()]
a = {i : 0 for i in range(1, m+1)}

for _ in range(n):
  k, *likes = [int(x) for x in input().split()]
  for l in likes:
    a[l] += 1

result = len(list(filter(lambda x : x == n, a.values())))
print(result)

Measured memory_bytes: 9084
import bisect
n = int(input())
a = list(map(int, input().split()))

ai = []
d = {}
for i, item in enumerate(a):
    ai.append(i + item)
    aj = i - item
    if aj in d:
        d[aj].append(i)
    else:
        d[aj] = [i]
ans = 0
for i, aii in enumerate(ai):
    if aii in d:
        index = bisect.bisect_right(d[aii], i)
        ans += len(d[aii]) - index


print(ans)

Measured memory_bytes: 66888
#include <stdio.h>

int main(void){
  double x1,y1,x2,y2,xq,yq;
  double xr,yr;
  double a,b;
  while(scanf("%lf,%lf,%lf,%lf,%lf,%lf",&x1,&y1,&x2,&y2,&xq,&yq)!=EOF){
    if(y1==y2){
      xr=xq; yr=2*y1-yq;
    }else if(x1==x2){
      xr=2*x1-xq; yr=yq;
    }else{
      a=(y2-y1)/(x2-x1);
      b=y1-a*x1;
      yr=(2*a*xq+(a*a-1)*yq+2*b)/(a*a+1);
      xr=a*yq-a*yr+xq;
    }
    printf("%.6f %.6f\n",xr,yr);
  }
  return 0;
}

Measured memory_bytes: 652
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h> //STL include
typedef long long ll;// long long int
const ll INF = 10000000000;//INFinity
using namespace std;//namespace

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}//transform
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//#define int long long // yabai

#define dump(x)  cout << #x << " = " << (x) << endl;// debug cout

#define FOR(i,a,b) for(int i=(a);i<(b);++i)// for macro
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

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

#define pb(a) push_back(a)//push_back
#define mp make_pair// make_pair


int main(){

    int h,w;
    cin>>h>>w;
    vector<vector<int>> c(10);
    for(auto&cc:c){cc.resize(10);for(auto&ccc:cc)cin>>ccc;}
    vector<vector<int>> a(h);
    for(auto&aa:a){aa.resize(w);for(auto&aaa:aa)cin>>aaa;}
    
    REP(k,10)REP(i,10)REP(j,10)c[i][j]=min(c[i][j],c[i][k]+c[k][j]);

    vector<int> a_inp(10,0); // 1-9
    for(auto&aa:a)for(auto&aaa:aa)if(aaa!=-1&&aaa!=1)a_inp[aaa]++;
    int sum=0;
    REP(i,10)sum += c[i][1]*a_inp[i];
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main()
{
	scanf("%d%d",&a,&b);
	a--;b--;
	puts("100 100");
	for (int i=1;i<=50;i++)
	{
		for (int j=1;j<=100;j++)
	  	  if (i%2==0&&j%2==0&&a>0) printf("."),a--;
		  else printf("#"); 
	   puts("");
	}
	for (int i=1;i<=50;i++)
	{
	  for (int j=1;j<=100;j++)
	  	 if (i%2==0&&j%2==0&&b>0) printf("#"),b--;
		 else printf("."); 
	  puts("");
	}
	return 0;
}

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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	ll n,m; cin>>n>>m;
	if(n>m) swap(n,m);
	if(n==1&&m==1) {
		cout<<1<<"\n";
		return 0;
	}
	if(n==1) {
		cout<<m-2<<"\n";
		return 0;
	}
	cout<<(n-2)*(m-2)<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int x , y;
	cin >> x >> y;
	for (int i = y - x + 1 ; i < y + x ; i++)
	{
		if (i < -1000000 || i > 1000000)
		{
			continue;
		}
		cout << i << " ";
	}
}

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

int main()
{
	ios::sync_with_stdio(false);
	
	int h,w;
	cin>>h>>w;
	string s[100]={};
	
	for(int i=0;i<h;i++)
	{
		string p;
		cin>>p;
		s[i]=p;
	}
	
	string q[200]={};
	
	for(int i=0;i<h;i++)
	{
		q[2*i]=s[i];
		q[2*i+1]=s[i];
	}
	
	for(int i=0;i<2*h;i++)
		cout<<q[i]<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  
  long long n;
  cin >> n;
  
  int cnt = 0;
  while(n > 1) {
    if(n % 3 == 0) n /= 3;
    else n = n / 3 + 1;
    cnt ++;
  }
  
  cout << cnt << endl;
  
  return 0;
}

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


int main(){
    int N;
    cin >> N;
    int a[N];
    for(int i = 0; i < N; i++) {
        cin >> a[i];
    }
    sort(a, a+N);
    
    for (int i = 0; i < N - 1; i++){
        if(a[i] == a[i+1]) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;
using P = pair<ll, ll>;

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 ll mod = 1000000007;
const int INF = 1<<29;

int main(){
  string S; cin >> S;
  if (S[2] == S[3] && S[4] == S[5]) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
 
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <climits>
using Graph = vector<vector<int>>;
const double PI = 3.14159265358979323846;
 
 
 
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
 
 
//約数をベクトル形式で返す
vector<int> vect_yakusuu(int n) {
	vector<int> ret;
	for (int i = 1; i*i <= n; i++) {
		if (n%i == 0) {
			ret.push_back(i);
			if (i*i != n) ret.push_back(n / i);
		}
	}
	sort(begin(ret), end(ret));
	return ret;
}
 
 
 
int main() {

	int N,K,A[200020];

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

	for (int i=0;i<N-K;i++){
		if (A[i]<A[K+i]){
			cout << "Yes" << endl;
		}
		else{
			cout << "No" << endl;
		}
	}
 
	return 0;
 
 
}

Measured memory_bytes: 4420
import os
import sys

import numpy as np
from scipy.sparse.csgraph import floyd_warshall

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N, M, L = list(map(int, sys.stdin.readline().split()))
ABC = [list(map(int, sys.stdin.readline().split())) for _ in range(M)]
Q = int(sys.stdin.readline())
S, T = list(zip(*[map(int, sys.stdin.readline().split()) for _ in range(Q)]))

D = np.full((N, N), 0)
for a, b, c in ABC:
    D[a - 1][b - 1] = c
    D[b - 1][a - 1] = c

floyd_warshall(D, directed=False, overwrite=True)
counts = floyd_warshall(D <= L, directed=False, unweighted=True)
S = np.array(S, dtype=int) - 1
T = np.array(T, dtype=int) - 1

ans = counts[S, T] - 1
ans[ans == np.inf] = -1
print(*ans.astype(int), sep='\n')


Measured memory_bytes: 68076
object Main {
  def main(args: Array[String]): Unit = {
    val Seq(n, m): Seq[Int] = io.StdIn.readLine().split(' ').map(_.toInt)

    val edges: collection.mutable.IndexedSeq[collection.mutable.ArrayBuffer[(Int, Long)]] =
      collection.mutable.IndexedSeq.fill(n)(collection.mutable.ArrayBuffer.empty)

    for(_ <- 0 until m) {
      val Seq(a, b, c): Seq[Int] = io.StdIn.readLine().split(' ').map(_.toInt)
      edges(a - 1) += b - 1 -> -c.toLong
    }

    val dist: collection.mutable.IndexedSeq[Long] = collection.mutable.IndexedSeq.fill(n)(Long.MaxValue)
    dist(0) = 0

    def solve(): Boolean = {
      val isInf: collection.mutable.IndexedSeq[Boolean] = collection.mutable.IndexedSeq.fill(n)(false)
      for(i <- 0 until n) {
        for(v <- 0 until n) {
          for(j <- 0 until edges(v).length) {
            val edge = edges(v)(j)
            if(dist(v) != Long.MaxValue && dist(edge._1) > dist(v) + edge._2) {
              dist(edge._1) = dist(v) + edge._2
              if (i == n - 1){
                isInf(edge._1) = true
              }
            }
          }
        }
      }

      return isInf(n - 1)
    }

    val isInf = solve()
    if(isInf)println("inf")
    else println(-dist(n - 1))
  }
}

Measured memory_bytes: 47816
#include <iostream>
using namespace std;
#define rep(i, n) for(int i=0;i<(n);i++)

int n, m;
char s[1000000];
int c;
int a[1000000];

int main() {
	
	while(cin>>n,n) {
		cin>>m;
		cin>>s;
		c=0;
		rep(i, m) {
			if(s[i]!='I')continue;
			a[c]=0;
			while(i<m-1) {
				if(s[i+1]!='O'||s[i+2]!='I')break;
				a[c]++;
				i+=2;
			}
			c++;
		}
		int r=0;
		rep(i, c) {
			if(n>a[i])continue;
			r+=a[i]-n+1;
		}
		cout<<r<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 4020
# python3 (3.4.3)
import sys
input = sys.stdin.readline

# main
N,T = map(int,input().split())
A = list(map(int,input().split()))

lowest = 10**9+1
profit = 0
ans = 0

for a in A:
    lowest = min(lowest, a)
    if a - lowest == profit:
        ans += 1
    elif a - lowest > profit:
        profit = a - lowest
        ans = 1

print(ans)



Measured memory_bytes: 14752
import Data.List (intercalate)

draw :: Int -> Int -> IO ()
draw h w = drawEachLine 1
  where drawEachLine n
          | n <= h    = drawLine n w >> drawEachLine (n + 1)
          | otherwise = putStrLn ""  >> return ()
        drawLine n w = putStrLn $ intercalate "" [selectChar (i+n) | i <- [1..w]]
        selectChar n
          | n `mod` 2 == 0 = "#"
          | otherwise      = "."

main :: IO ()
main = do
    line <- getLine
    let [h, w] = map (\n -> read n :: Int) $ words line
    if h == 0 && w == 0 then
        return ()
    else do
        draw h w
        main



Measured memory_bytes: 4088
import random

N,K = map(int,input().split())
H_input = [int(input()) for i in range(N)]

def quick_sort(array):
    low_array = []
    high_array = []
    len_array = len(array)
    if len_array <= 1:
        return array
    pivot = random.choice(array)
    pivot_count = 0
    for i in range(len_array):
        if pivot > array[i]:
            low_array.append(array[i])
        elif pivot < array[i]:
            high_array.append(array[i])
        else:
            pivot_count += 1
    low_array = quick_sort(low_array)
    high_array = quick_sort(high_array)
    return low_array + [pivot]*pivot_count + high_array

H = quick_sort(H_input)

min = []
for i in range(N-K+1):
    min.append(H[i+K-1]-H[i])

print(quick_sort(min)[0])


Measured memory_bytes: 15264
#include <iostream>
#include <algorithm>
#include <string>
#include <functional> 
#include <vector>
#include <numeric>
#include <stack>
#include <queue>
#include <utility>
//#include <cmath>
#include <cstdlib>

using namespace std;

int main(){

    int n;
    cin >> n;

    vector<int> a(n+1);
    for(int i=0;i<n;i++) cin >> a[i];
    a[n] = 1000000005;
    sort(a.begin(),a.end());
    
    int cnt = 1;
    int ans = 0;
    for(int i=0;i<n;i++){
        if(a[i+1] == a[i]) cnt++;
        else {
          	ans += cnt%2;
            cnt = 1;
        }

    }

    cout << ans;


    return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define ins insert

#define debug(a) cerr<<(a)<<endl
#define dbrep(a,n) rep(_i,n) cerr<<(a[_i])<<" "; cerr<<endl
#define dbrep2(a,n,m) rep(_i,n){rep(_j,m) cerr<<(a[_i][_j])<<" "; cerr<<endl;}

using namespace std;

template<class A, class B>
ostream &operator<<(ostream &os, const pair<A,B> &p){return os<<"("<<p.fi<<","<<p.se<<")";}
template<class A, class B>
istream &operator>>(istream &is, pair<A,B> &p){return is>>p.fi>>p.se;}

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N; cin>>N;
    ll X,M; cin>>X>>M;
    set<int> S;
    vll vec;
    S.ins(X);
    vec.pb(X);
    while(true){
        X = X*X % M;
        if (S.count(X)){
            break;
        }
        S.ins(X);
        vec.pb(X);
    }
    int V = vec.size();
    int idx=0;
    ll ans=0;
    while(vec[idx]!=X && N>0){
        ans+=vec[idx];
        N--; idx++;
    }
    ll sum=0;
    FOR(i,idx,V-1){
        sum+=vec[i];
    }
    int C = (V-idx);
    ll t = N/C;
    N%=C;
    ans += t*sum;
    FOR(i,idx,idx+N-1){
        ans+=vec[i];
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5984
#include <bits/stdc++.h>
using namespace std;
int main()
{

string s1,s2,s3;
cin>>s1;
if(s1=="Sunny")
{
    cout<<"Cloudy"<<endl;
}
else if(s1=="Cloudy")
{
    cout<<"Rainy"<<endl;
}
else if(s1=="Rainy")
{
    cout<<"Sunny"<<endl;
}

}


Measured memory_bytes: 256