akhauriyash/Code-Regression huggingface dataset:
/*
 * ALDS1_3_D.cpp
 *
 *  Created on: Apr 26, 2018
 *      Author: 13743
 */

#include<iostream>
#include<stack>

using namespace std;

int main() {
	stack<int> s1;
	stack<pair<int, int> > s2;
	int sumR = 0;

	char c;
	for(int i=0; cin >> c; i++) {
		if(c == '\\') {
			s1.push(i);
		}
		else if(c == '/' && !s1.empty()){
			int l = s1.top(); s1.pop();
			int df = i - l;
			sumR += df;
			while(!s2.empty() && s2.top().first > l) {
				df += s2.top().second;
				s2.pop();
			}
			s2.push(make_pair(l, df));
		}
	}
	cout << sumR << endl;
	stack<int> ans;
	while(!s2.empty()) {
		ans.push(s2.top().second);
		s2.pop();
	}
	cout << ans.size();
	while(!ans.empty()) {
		cout << " " << ans.top();
		ans.pop();
	}
	cout << endl;
}

//int main() {
//	int slope[20000];
//	int n = 0;
//	int maxH = 0;
//	int nowH = 0;
//	stack<int> tops;
//	stack<int> topInds;
//	bool nextTop = true;
//	char s;
//	while(cin >> s) {
//		if(s == '_') {
//			slope[n] = 0;
//		}
//		else if(s == '/') {
//			slope[n] = 1;
//			nextTop = true;
//			nowH++;
//			while(!tops.empty() && nowH > tops.top() && maxH > tops.top()) {
//				tops.pop();
//				topInds.pop();
//			}
//		}
//		else {
//			slope[n] = -1;
//			if(nextTop) {
//				tops.push(nowH);
//				topInds.push(n);
//				nextTop = false;
//			}
//			maxH = (nowH > maxH) ? nowH : maxH;
//			nowH--;
//		}
//		n++;
//	}
//	if(nextTop) {
//		tops.push(nowH);
//		topInds.push(n);
//	}
//
//	int sumR = 0;
//	int count = 0;
//	int rains[20000];
//	int tpR = tops.top(); tops.pop();
//	int tpRInd = topInds.top(); topInds.pop();
//	while(!tops.empty()) {
//		int tpL = tops.top();
//		int depth = 0;
//		int rain = 0;
//		int slC = 0;
//		if(tpL > tpR) {
//			do {
//				tpRInd--;
//				int sl = -slope[tpRInd];
//				slC += sl*sl;
//				rain += depth;
//				depth -= sl;
//				if(sl == 1) rain--;
//			} while(depth != 0 || slC == 0);
//		}
//		else {
//			int tpLInd = topInds.top();
//			do {
//				int sl = slope[tpLInd];
//				slC += sl*sl;
//				rain += depth;
//				depth -= sl;
//				tpLInd++;
//				if(sl == 1) rain--;
//			} while(depth != 0 || slC == 0);
//		}
//		rain += slC / 2;
//		sumR += rain;
//		rains[count] = rain;
//		count++;
//		tpR = tops.top(); tops.pop();
//		tpRInd = topInds.top(); topInds.pop();
//	}
//
//	cout << sumR << endl;
//	cout << count;
//	for(int i=0; i<count; i++) {
//		cout << " " << rains[count-1-i];
//	}
//	cout << endl;
//}





Measured memory_bytes: 3220
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define EPS 10e-8
#define MAX_NM 100000
#define MOD 1000000007

using namespace std;
typedef pair<llong, llong> ipair;
llong modulo(llong left, llong right) { return (left % right + right) % right; }

llong N, M, x[MAX_NM], y[MAX_NM];
llong x_dif_f[MAX_NM], x_dif_b[MAX_NM];
llong y_dif_f[MAX_NM], y_dif_b[MAX_NM];

llong solve() {
    llong x_res = N * (N - 1) / 2.0;
    x_res = modulo(x_res, MOD);
    x_res *= x_dif_f[N - 2];
    x_res = modulo(x_res, MOD);

    for(int i = 1; i < N - 1; ++i) {
        llong cnt = N - 1 - i;
        x_res -= cnt * x_dif_f[i - 1];
        x_res = modulo(x_res, MOD);
        x_res -= cnt * x_dif_b[N - 1 - i];
        x_res = modulo(x_res, MOD);
    }

    llong y_res = M * (M - 1) / 2.0;
    y_res = modulo(y_res, MOD);
    y_res *= y_dif_f[M - 2];
    y_res = modulo(y_res, MOD);

    for(int i = 1; i < M - 1; ++i) {
        llong cnt = M - 1 - i;
        y_res -= cnt * y_dif_f[i - 1];
        y_res = modulo(y_res, MOD);
        y_res -= cnt * y_dif_b[M - 1 - i];
        y_res = modulo(y_res, MOD);
    }

    llong res = x_res * y_res;
    res = modulo(res, MOD);
    
    return res;
}

int main(int argc, char **argv) {
    cin >> N >> M;
    for(int i = 0; i < N; ++i) cin >> x[i];
    for(int i = 0; i < M; ++i) cin >> y[i];

    for(int i = 0; i < N - 1; ++i) x_dif_f[i] = x[i + 1] - x[0];
    for(int i = 0; i < M - 1; ++i) y_dif_f[i] = y[i + 1] - y[0];

    for(int i = 0; i < N - 1; ++i) x_dif_b[i] = x[N - 1] - x[i];
    for(int i = 0; i < M - 1; ++i) y_dif_b[i] = y[M - 1] - y[i];

    cout << solve() << endl;   
}

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

#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

int N, A, B, C;
vector<int> l;

int dfs(int depth, int a, int b, int c) {
  if (depth == N) {
    if (min({a, b, c}) > 0) return abs(A-a)+abs(B-b)+abs(C-c)-30;
    else return 1<<30;
  }

  int ret0 = dfs(depth+1, a, b, c);
  int ret1 = dfs(depth+1, a+l[depth], b, c)+10;
  int ret2 = dfs(depth+1, a, b+l[depth], c)+10;
  int ret3 = dfs(depth+1, a, b, c+l[depth])+10;

  return min({ret0, ret1, ret2, ret3});
}

int main()
{
  cin >> N >> A >> B >> C;
  l.assign(N, 0); rep(i, N) cin >> l[i];

  cout << dfs(0, 0, 0, 0) << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> trainsIn = new ArrayList<Integer>();
		ArrayList<Integer> trainsOut = new ArrayList<Integer>();
		
		try{
			while(true){
				int n = sc.nextInt();
				switch(n){
				case 0:
					popTrain(trainsIn, trainsOut);
					break;
				default:
					pushTrain(trainsIn, n);
					break;
				}
			}
		}catch(NoSuchElementException e){
			//½àµÈ¢
		}
		
		for(int i = 0; i < trainsOut.size(); i++){
			System.out.println(trainsOut.get(i));
		}
	}
	
	private static void pushTrain(ArrayList<Integer> trains, int n){
		trains.add(n);
	}
	
	private static void popTrain(ArrayList<Integer> trains, ArrayList<Integer> trainsOut){
		Integer firstTrain = trains.get(trains.size() - 1);
		trainsOut.add(firstTrain);
		trains.remove(trains.size() - 1);
	}
}

Measured memory_bytes: 0
def examA():
    a, b = LI()
    if (a*b)%2==0:
        ans = "Even"
    else:
        ans = "Odd"
    print(ans)


import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()


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

using namespace std;

typedef long long ll;

int main(){
  double A,B,H,M;
  cin >> A >> B >> H >> M;
  double x = 6*M - (60*H+M)/2; //ずれた度数
  if(x < 0) x *= -1;
  while(x > 360) x-= 360; 
  if(x > 180) x = 360 - x; //0<=x<=180
  cout << setprecision(20) << sqrt(A*A + B*B - 2*A*B*cos(x / 180 * 3.141592653589793238462643383279)) << endl;
}

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

using namespace std;
typedef long long int lld;
typedef multiset<lld>::iterator sit;
multiset<lld> a;
multiset<lld> b;
lld sum_a=0;
lld sum_b=0;
lld l[1000000];
lld r[1000000];
lld absol(lld x){
  if(x>0)return x;
  return -x;
}

int main(){
  int n;
  cin>>n;
  
  
  lld minimum=0;
  for(int i=0;i<n;i++){
    cin>>l[i]>>r[i];
    if(a.size()!=0){
      sum_a+=r[i]-l[i];
      sum_b-=r[i-1]-l[i-1];
      sit s=b.begin();
      lld index=0;
      if(l[i]<*s-sum_b){
	sit FIM=a.end();
	FIM--;
	if(l[i]>*FIM-sum_a){//cout<<"A"<<endl;
	  a.insert(l[i]+sum_a);
	  b.insert(l[i]+sum_b);
	}else{
	  index=*FIM-sum_a;
	  minimum+=absol(l[i]-index);
	  a.insert(l[i]+sum_a);
	  a.insert(l[i]+sum_a);
	  sit top=a.end();
	  top--;
	  lld add=*top-sum_a;
	  a.erase(top);
	  b.insert(add+sum_b);
	}
      }else{
	index=*b.begin()-sum_b;
	minimum+=absol(l[i]-index);
	b.insert(l[i]+sum_b);
	b.insert(l[i]+sum_b);
	sit top=b.begin();
	lld add=*top-sum_b;
	b.erase(top);
	a.insert(add+sum_a);
      }
    }else{
      a.insert(l[i]);
      b.insert(l[i]);
    }
    /*for(auto it:a){
      cout<<it-sum_a<<" ";
    }cout<<endl;
    for(auto it:b){
      cout<<it-sum_b<<" ";
      }cout<<endl;*/
    
    /*for(int i=0;i<changes.size();i++){
      cout<<changes[i]<<" ";
    }cout<<endl;*/
    
  }
  cout<<minimum<<endl;
    return 0;
}

Measured memory_bytes: 14464
using System;

namespace DPL_1_D
{
    class Program
    {
        public static int LowerBound(int[] arr,int arrlen,int value)
        {
            int low = 0;
            int high = arrlen;
            int mid;
            while (low < high)
            {
                mid = ((high - low) / 2) + low;
                if (arr[mid] < value)
                    low = mid + 1;
                else
                    high = mid;
            }
            return low;
        }
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = int.Parse(Console.ReadLine());
            int[] dp = new int[n];
            for (int i = 0; i < n; i++) dp[i] = int.MaxValue;
            for (int i = 0; i < n; i++)
            {
                dp[LowerBound(dp,n,a[i])] = a[i];
            }
            Console.WriteLine(LowerBound(dp,n,int.MaxValue));
        }
    }
}


Measured memory_bytes: 10252
# -*- coding: utf-8 -*-
k = int(input())
a, b = map(int, input().split())
result = False

dif = b-a
if b-a >= k:
    result = True
else:
    for i in range(a, b+1):
        if i % k == 0:
            result = True

if result:
    print("OK")
else:
    print('NG')


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

using ll = long long;
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repr(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(x, c) for (auto&& x : (c))
#define updatemax(t, v) ((t) = std::max((t), (v)))
#define updatemin(t, v) ((t) = std::min((t), (v)))
#define endl _endl
const char _endl = (cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout.precision(16), '\n');

void solve(std::vector<std::string> s) {
  rep(i, 3) cout << (char)(s[i][0] - ' ');
  cout << endl;
}

int main() {
    std::vector<std::string> s(3);
    for(int i = 0 ; i < 3 ; i++){
        std::cin >> s[i];
    }
    solve(std::move(s));
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


int main(){
	//ios_base::sync_with_stdio(0);
	int N, M, K;
	bool f = false;

	cin >> N >> M >> K;
	rep(i,N+1) rep(j,M+1){
		if( (M-j)*i + j*(N-i) == K ) f = true;
	}

	cout << (f?"Yes":"No") << endl;

	return 0;
}

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

#define NIL -1

vector< vector<int> > edge;

class Result {
public:
	vector<int> path;
	int cost;
};

Result rec(int v, vector< vector<int> > visited, int cost) {
	Result result;
	result.cost = cost;
	int maxCost = cost;
	for(int i=0; i<edge.size(); i++) {
		if(visited[v][i]) continue;
		if(edge[v][i]==NIL) continue;
		visited[v][i] = visited[i][v] = 1;
		Result r = rec(i, visited, cost+edge[v][i]);
		if(maxCost >= r.cost) continue;
		maxCost = r.cost;
		result = r;
		result.path.insert(result.path.begin(), i);
	}
	return result;
}

void solve() {
	Result result;
	int maxCost = NIL;
	vector< vector<int> > visited(edge.size(), vector<int>(edge.size(), 0));
	for(int i=0; i<edge.size(); i++) {
		Result r = rec(i, visited, 0);
		if(maxCost >= r.cost) continue;
		maxCost = r.cost;
		result = r;
		result.path.insert(result.path.begin(), i);
	}
	cout<<result.cost<<endl;
	for(vector<int>::iterator i=result.path.begin(); i!=result.path.end(); i++) {
		if(i!=result.path.begin()) cout<<" ";
		cout<<*i+1;
	}
	cout<<endl;
}

int main() {
	int ns, nl;
	while(cin>>ns>>nl, ns|nl) {
		edge.clear();
		edge.resize(ns);
		for(int i=0; i<ns; i++) edge[i].resize(ns, NIL);
		for(int i=0; i<nl; i++) {
			int s1, s2, d;
			cin>>s1>>s2>>d;
			s1--; s2--;
			edge[s1][s2] = edge[s2][s1] = d;
		}
		solve();
	}
}

Measured memory_bytes: 1228
import sys
INPUT = sys.stdin.readline
#入力関数
def SORO_INT(): return int(INPUT())
def MULT_INT_LIST(): return list(map(int, INPUT().split()))
def MULT_INT_MAP(): return map(int, INPUT().split())
def SORO_STRING(): return INPUT()
def MULT_STRING(): return INPUT().split()
 
r=SORO_INT()
print(r**2)

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 998244353; //1000000007;

template<class _T> static void get(_T& a) {
	std::cin >> a;
}
template<class _T> static void get(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void get(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}

static void A();

int main()
{
	A();
	fflush(stdout);
	return 0;
}

static void A()
{
	int N;
	get(N);

	std::string str;
	get(str);

	std::vector<int> left(N + 1, 0), right(N + 1, 0);
	for (int i = 1; i < N; i++) {
		right[i] = right[i - 1];
		left[N - 1 - i] = left[N - i];

		if (str[i - 1] == 'E') {
			right[i]++;
		}
		if (str[N - i] == 'W') {
			left[N - 1 - i]++;
		}
	}

	int ans = N;
	for (int i = 0; i < N; i++) {
		int num = 0;
		if (i) {
			num = right[i];
		}
		num += left[i];
		ans = std::min(ans, N - num - 1);
	}
	printf("%d\n", ans);
}


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

#define FOR(i,a,n) for (int i = a; i < n; ++i)
#define REP(i,n) FOR(i,0,n)
#define whole(f,x,...) ([&](decltype((x)) whole) { \
    return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
template<typename T> bool chmin(T &a, const T &b) {if (a > b) { a = b; return true; }return false;}
template<typename T> bool chmax(T &a, const T &b) {if (a < b) { a = b; return true; }return false;}

using ll = long long;

constexpr ll INF = (1e9);
constexpr ll MOD = (1e9+7);

ll fact[200004], inverse[200005];

ll pow(ll x, ll n) {
  if (n == 0) return 1;
  if (n%2 == 0) return pow(x*x%MOD, n/2)%MOD;
  return pow(x*x%MOD, n/2)*x%MOD;
}

ll comb(int n, int r) {
  return fact[n] * inverse[r] %MOD * inverse[n-r] %MOD;
}

int main() {
  int h, w, a, b; cin >> h >> w >> a >> b;
  fact[0] = 1;
  FOR(i,1,h+w) fact[i] = fact[i-1]*i%MOD;
  REP(i,h+w) inverse[i] = pow(fact[i], MOD-2)%MOD;
  ll ans = 0;
  FOR(i,b,w) {
    ans += comb(h-a-1+i,i)*comb(a-1+w-1-i, w-1-i)%MOD;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3328
import java.io.InputStream;
import java.io.IOException;
import java.util.NoSuchElementException;

public class Main {
    static int n;
    public static void main(final String[] args) {
        final MyScanner sc = new MyScanner();
        n = sc.nextInt();
        depthFirstSearch("", 'a');
    }

    public static void depthFirstSearch(final String s, final char mx) {
        if (s.length() == n) {
            System.out.printf("%s\n", s);
        } else {
            for (char c = 'a'; c <= mx; c++) {
                depthFirstSearch(s + c, ((c == mx) ? (char) (mx + 1) : mx));
            }
        }
    }
}

class MyScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int pointer = 0;
    private int bufLength = 0;

    private boolean hasNextByte() {
        if (pointer < bufLength) {
            return true;
        } else {
            pointer = 0;
            try {
                bufLength = in.read(buffer);
            } catch (final IOException e) {
                e.printStackTrace();
            }
            if (bufLength <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[pointer++];
        } else {
            return -1;
        }
    }

    private static boolean isNumberChar(final int c) {
        return '0' <= c && c <= '9';
    }

    private static boolean isPrintableChar(final int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[pointer])) {
            pointer++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        final StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long num = 0;
        boolean isNegative = false;
        int b = readByte();
        if (b == '-') {
            isNegative = true;
            b = readByte();
        }
        if (!isNumberChar(b)) {
            throw new NumberFormatException();
        }
        while (true) {
            if (isNumberChar(b)) {
                num *= 10;
                num += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return isNegative ? -num : num;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        final long temp = nextLong();
        if (temp < Integer.MIN_VALUE || Integer.MAX_VALUE < temp) {
            throw new NumberFormatException();
        }
        return (int) temp;
    }

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


Measured memory_bytes: 98428
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class A
{
	public static void Main()
	{
		string S = Console.ReadLine();
		long numW = 0;
		long ans = 0;
		for(int i = 0; i < S.Length; i++)
		{
			if(S[i] == 'W')
			{
				ans += i - numW;
				numW++;
			}
		}

		Console.WriteLine(ans);
	}
}





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



int main(){
  long long W,H,x,y;
  cin>>W>>H>>x>>y;
  
  cout<<fixed<<setprecision(12)<<W*H/2.0<<" ";
  
  if(2*x==W&&2*y==H){
    cout<<1<<endl;
  }
  else cout<<0<<endl;
}

Measured memory_bytes: 3704
// Author : Mohamed Sameh
#include <bits/stdc++.h>
typedef long long ll ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define Flush fflush(stdout);
using namespace std ;
int main()
{
    int n ;
    cin >> n ;
    set<int> st ;
    for (int i =0 ; i < n ;i++)
    {
        int x ;
        cin >> x ;
        st.insert(x);
    }
    if (SZ(st) == n )
        cout <<"YES\n";
    else
        cout <<"NO\n";

}


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

public class Hello
{
    public static void Main()
    {
        var s = Console.ReadLine().Trim();
        var n = int.Parse(Console.ReadLine().Trim());
        var a = new List<string>();
        var sL = s.Length;
        for (int i = 0; i < 5; i++)
            for (int j = 0; j < sL - i; j++)
                a.Add(s.Substring(j, i + 1));
        var b = a.Distinct().OrderBy(x => x).ToArray();
        Console.WriteLine(b[n - 1]);
    }
}



Measured memory_bytes: 13920
#include <iostream>
#include <string>
#include <stdint.h>

using namespace std;

int main()
{
  string S;

  cin >> S;

  uint64_t count = 0;
  unsigned num_B = 0;
  
  for (int ii=0; ii<S.size(); ++ii) {
    if (S[ii]=='B') {
      ++num_B;
      count += S.size() - ii - num_B;
    }
  }

  cout << count << endl;
  
  return 0;
}

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

int main() {
    int N,H,W;
    cin >> N >> H >> W;
    int ans = 0;
    int a,b;
    for(int i=0; i<N; ++i) {
        cin >> a >> b;
        if(a >= H && b >= W) ++ans;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
using namespace std;
 
int main() {
    int a,b,c;cin >> a >> b >> c;
    if(a==b && b==c && c==a){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
from math import *
n,m=map(int,input().split())
a=[]
for i in range(n):
    p=list(input().rstrip())
    a.append(p)
p=[[0 for i in range(m+1)] for j in range(n+1)]
for i in range(n):
    for j in range(m):
        if i==0 and j==0 and a[i][j]=='#':
            p[i][j]=1
        elif i==0:
            p[i][j]=p[i][j-1]+int(a[i][j]=='#' and a[i][j-1]!='#')
        elif j==0:
            p[i][j]=p[i-1][j]+int(a[i][j]=='#' and a[i-1][j]!='#')
        else:
            p[i][j]=min(p[i][j-1]+int(a[i][j]=='#' and a[i][j-1]!='#'),p[i-1][j]+int(a[i][j]=='#' and a[i-1][j]!='#'))
print(p[n-1][m-1])


Measured memory_bytes: 42352
(n, m, l) = [int(i) for i in input().split()]
a = []
b = []
for i in range(n):
    a.append([int(i) for i in input().split()])
for j in range(m):
    b.append([int(i) for i in input().split()])

for x in range(n):
    c = []
    for y in range(l):
        d = 0
        for z in range(m):
            d += a[x][z] * b[z][y]
        c.append(str(d))
    print(' '.join(c))

Measured memory_bytes: 8492
#include <iostream>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)

using namespace std;


int main()
{
  int N; cin>>N;
  int seq[N]; REP(i,N) cin>>seq[i];
  
  int swap=0;
  for(int i=0; i<N; i++)
  {
    for(int j=N-1; j>i; j--)
    {
      if(seq[j-1] > seq[j])
      {
        int tmp = seq[j];
        seq[j] = seq[j-1];
        seq[j-1] = tmp;
        swap++;
      }
    }
  }
  
  REP(i,N)
  {
    if(i) cout<<' ';
    cout<<seq[i];
  }
  cout<<endl;

  cout<<swap<<endl;
}

Measured memory_bytes: 3124
import numpy as np

D = int(input())
c = np.array(list(map(int, input().split())))
s = np.array([list(map(int, input().split())) for _ in range(D)])


def s3(c, s, last_date, di, i):
    score = s[di - 1][i]
    score += 500 * c[i - 1] * (di - last_date[i - 1])
    return score


def f3(D, c, s):
    last_date = np.zeros(26)

    t = []
    for di in range(1, D + 1):
        score_list = []
        for i in range(26):
            score_list.append(s3(c, s, last_date, di, i))

        select_index = score_list.index(max(score_list))
        t.append(select_index)
        last_date[select_index] = di

    return t


for ti in f3(D, c, s):
    print(ti + 1)

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

int main() {
  string s;
  int i;
  cin >> s;

  if(s.size()==2){
    cout << s << endl;
  } else if(s.size()==3){
    i=3;
    while(i>0){
    i--;
    cout << s.at(i);
    }
    cout << endl;
    }

}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def a_int(): return int(read())


def ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter, xor, add
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from functools import reduce

N = a_int()
# 3重ループの早期終了かな
f = [0] * (N + 1)
for x in range(1, N):
    for y in range(1, N):
        if x * x + y * y + x * y >= N:
            break
        for z in range(1, N):
            n = x * x + y * y + z * z + x * y + y * z + z * x
            if n > N:
                break
            f[n] += 1
print(*f[1:], sep='\n')


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

int main() {
    string S; cin >> S;
    int ss = S.size();
    int ans = 0;
    for (int i = 1; i < ss; i++){
        if(S[i] != S[i-1])ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3740
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int a[105];
int main( void )
{
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  for( int i=0; i<N; i++ ){
    cin >> a[i];
  }
  int ret = 1<<29;
  for( int i=-100; i<=100; i++ ){
    int d = 0;
    for( int j=0; j<N; j++ ){
      int c = i - a[j];
      d += c*c;
    }
    ret = min( ret, d );
  }
  cout << ret << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	private Scanner sc;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);
		
		String line = sc.nextLine();
		
		while (line.equals("0 0 0") == false) {
			String[] nico = line.split(" ");
			
			int max = 0;
			int total = 0;
			
			int[] length  = new int[3];
			for (int i = 0; i < length.length; i++) {
				length[i] = Integer.parseInt(nico[i]);
				total = total + length[i] * length[i];
				if (max < length[i]) max = length[i];
			}
			total = total - max * max;
			
			double r = Math.sqrt(total) / 2;

			int lines = Integer.parseInt(sc.nextLine());
			for (int i = 0; i < lines; i++) {
				int hr = Integer.parseInt(sc.nextLine());
				if (hr > r) System.out.println("OK");
				else System.out.println("NA");
			}
			
			line = sc.nextLine();
		}
	}
}

Measured memory_bytes: 26084
a, b = [int(x) for x in input().split()]
abp = a + b
abm = a - b
abt = a * b
if abp > abm:
  if abp > abt:
    print(abp)
  else:
    print(abt)
else:
  if abm > abt:
    print(abm)
  else:
    print(abt)

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <queue>

using namespace std;

int n,m;
vector<pair<pair<int,int>,int > > v[100];
int d[100];
int inf = 1000000000;

int Prev[100];

void dijkstra(int s){
  priority_queue<pair<int,int> ,vector<pair<int,int> >, greater<pair<int,int> > > que;
  fill(d,d+n,inf);
  d[s] = 0;
  que.push(make_pair(0,s));
  fill(Prev,Prev+n,-1);

  while(!que.empty()){
    pair<int,int> p = que.top();que.pop();
    int V = p.second;
    if(d[V] < p.first)continue;
    for(int i = 0;i<v[V].size();i++){
      pair<int,int> e = v[V][i].first;
      if(d[e.first] > d[V] + e.second){
	d[e.first] = d[V] + e.second;
	que.push(make_pair(d[e.first],e.first));
	Prev[e.first] = v[V][i].second;
      }
    }

  }
}
  
int main(){
  cin>>n>>m;
  for(int i = 0;i<m;i++){
    int a,b,c;
    cin>>a>>b>>c;
    a--;b--;
    v[a].push_back(make_pair(make_pair(b,c),i));
    v[b].push_back(make_pair(make_pair(a,c),i));
  }
  bool use[m];
  fill(use,use+m,false);
  for(int i = 0;i<n;i++){
    dijkstra(i);
    /*
    for(int j = 0;j<n;j++)
      cout<<Prev[j]<<endl;
    */
    for(int j = 0;j<n;j++){
      if(Prev[j] != -1)
	use[Prev[j]] = true;
    }
  }
  int ans = 0;
  for(int i = 0;i<m;i++){
    if(use[i])
      ans++;
  }
  cout<<m-ans<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define rep(i,N) for(int i=0;i<N;i++)
using namespace std;
/*
dp[i][j]
i枚目まで投げた時、j枚表である確率

--遷移--
dp[i][j] = (i-1)まで投げた時、j枚表である確率　×　i枚目が裏である確率
           ＋(i-1)まで投げた時、(j-1)枚表である確率　×　i枚目が表である確率

dp[i][j] = dp[i-1][j] * ( 1 - p[i] ) + ( 1 - dp[i-1][j-1] ) * p[i]

*/

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

    int n;
    cin >> n;
    vector<double> p(n+1);
    rep(i,n) cin >> p[i+1];                          //p[i] : i枚目が表である確率
    vector<vector<double>> dp( n+1, vector<double>(n+1) );
    dp[0][0] = 1;
    for(int i=1;i<=n;i++) for(int j=0;j<=i;j++){
        if(j>0){
            dp[i][j] = dp[i-1][j]*(1.0-p[i]) + dp[i-1][j-1]*p[i];      //下以外
        }else dp[i][j] = dp[i-1][j] * (1.0-p[i]);    //すべて裏である確率更新 
    }
    double ans = 0.0;
    rep(i,n+1){
        if(i > n/2) ans += dp[n][i];
    }

    printf("%.10lf\n",ans);

    return 0;
}


Measured memory_bytes: 70784
import math

N = int(input())

def main():
    """
    main.
    """
    serial_a = math.floor(N / 10)
    serial_b = N % 1000
    cardinal = 111
    if serial_a % cardinal == 0 or \
       serial_b % cardinal == 0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <bits/stdc++.h>
#include <vector>
using namespace std;
vector<int>a[100010];
int visit[100010]={0};
int cnt=0;
queue<int>q;
void dfs(int b,int n){
    cnt++;
    visit[b]=1;
    q.push(b);
    while(!q.empty()){
            int sz=a[q.front()].size();
        for(int i=0;i<sz;i++){
            if(!visit[a[q.front()][i]]){
                cnt++;
                q.push(a[q.front()][i]);
                visit[a[q.front()][i]]=1;
            }
        }
        q.pop();
    }
//    for(int i=0;i<n;i++)
//        cout << visit[i] << " \n"[i==n-1];
}
int main()
{
    int n,m,ans=0;
    cin >> n >> m;
    int num1,num2,num;
    for(int i=0;i<m;i++){
    cin >> num1 >> num2 >> num;
    a[num1].push_back(num2);
    a[num2].push_back(num1);
    }
    if(cnt!=n){
        for(int i=1;i<=n;i++){
            if(!visit[i]){
                dfs(i,n);
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

using pint = pair<int, int>;

int N;
vector<vector<pint>> v;

bool judge(int bit) {

    rep(i, N) {

        if ( !(bit & (1 << i) )) continue; 

        for (pint xy : v[i]) {
            int x = xy.first;
            int y = xy.second;

            if (y == 1 && !(bit & (1 << x))) return false;

            if (y == 0 && (bit & (1 << x))) return false;
        }
    }
    return true;
}

int main() {
    cin >> N;
    v.resize(N);
    rep(i, N) {
        int A; cin >> A;
        v[i].resize(A);
        rep(j, A){
            cin >> v[i][j].first >> v[i][j].second;
            --v[i][j].first;
        }
    }

    int res = 0;
    rep(bit, (1 << N)){

        if (judge(bit)) {

            int count = 0;
            rep(i, N) {
                if (bit & (1 << i)) ++count;
            }
            res = max(res, count);
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int main(void) {
    int left = -1,right = TEN(9);
    int n,m;
    cin>>n>>m;

    for(int i = 0;i < m;i++) {
        int l,r;
        cin>>l>>r;
        left = max(l,left);
        right = min(r,right);
    }

    if(left > right) {
        cout<<0<<endl;
    } else {
        cout<<right-left+1<<endl;
    }

    return 0;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int arr[200001];
int ans[200001];

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie();
	cout.tie();
	int n;
	cin >> n;
	for(int i=2;i<=n;i++){
		cin >> arr[i];
	}
	for(int i=2;i<=n;i++){
		ans[arr[i]]++;
	}
	for(int i=1;i<=n;i++){
		cout << ans[i] << '\n';
	}
}

Measured memory_bytes: 5112
def main():
    H,W = map(int,input().split())
    N = int(input())
    a = list(map(int,input().split()))
    a.reverse()
    ans = []
    i = 1
    tmp = []
    k = -1
    cnt = 1
    while a:
        num = a.pop()
        l = len(tmp)
        if num > W-l:
            tmp += [i]*(W-l)
            if i-1 == k and cnt%2 == 1:
                tmp.reverse()
                cnt += 1
            ans.append(tmp)
            num -= (W-l)
            while num >= W:
                ans.append([i]*W)
                num -= W
            tmp = [i]*num
            k = i

        else:
            tmp += [i]*num
            if len(tmp) == W:
                if i-1 == k and cnt%2==1:
                    tmp.reverse()
                    cnt += 1
                ans.append(tmp)
                tmp = []
        i += 1
    for i in range(1,H):
        if ans[i][0] == ans[i-1][-1]:
            ans[i].reverse()
    for v in ans:
        print(*v)
if __name__ == "__main__":
    main()

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

bool isPrime(int p) {
    int i;
    for (i = 2; i * i <= p; i++) {
        if (p % i == 0)
            return false;
    }
    return true;
}

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

    while (!isPrime(p))
        p++;

    cout << p << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
	int n, ans = 0;
	cin >> n;
	int x = 0, y = 0, z = 0;
	for(int i = 0; i < n; i++){
		int a;
		cin >> a;
		if(a % 4 == 0){
			x++;
		}else if(a % 2 == 0){
			y++;
		}else{
			z++;
		}
	}
	if(x == 0){
		if(z == 0){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}else if(x + 1 >= min(y, 1) + z){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <chrono>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;

ll section(ll start, ll end, ll divider) {
    if (start % divider == 0) {
        return (end / divider - start / divider + 1);
    } else {
        return (end / divider - start / divider);
    }
}

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

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

int main() {
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    ll non_ans = section(A, B, C) + section(A, B, D) - section(A, B, lcm(C, D));
    cout << (B - A + 1 - non_ans) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define reus ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int main()
{
	reus;
	int c=0,i;
	string s,k;
	cin>>s>>k;
	for(i=0;i<3;i++)
	{
		if(s[i]==k[i])
		c++;
	}
	cout<<c<<endl;
	return 0;
}

Measured memory_bytes: 256
h,n=map(int,input().split())
magi=[list(map(int,input().split())) for i in range(n)]
magi.sort(reverse=True)
infi=10**9
dp=[infi]*(2*10**4)
dp[0]=0
for a,b in magi:
  for i in range(h+1):
    if dp[i]!=infi:
      dp[i+a]=min(dp[i]+b,dp[i+a])
print(min(dp[h:]))

Measured memory_bytes: 42972
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	int x1,x2,y1,y2;

	cin>>x1>>y1>>x2>>y2;

	cout<<x2+(y1-y2)<<" "<<y2+(x2-x1)<<" "<<x1+(y1-y2)<<" "<<y1+(x2-x1)<<endl;


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

const int mod = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if(!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if(t & 1) a *= *this;
    return a;
  }
  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
mint fact(int n) {
  if(n == 1 || n == 0) return 1;
  mint res = n;
  return res * fact(n - 1);
}

int main() {
  string s;
  cin >> s;
  int n = s.size();
  mint dp[n + 1][2];
  rep(i, n + 1) rep(j, 2) dp[i][j] = 0;
  dp[0][0] = 1;
  rep(i, n) {
    if(s[i] == '1') {
      dp[i + 1][0] = dp[i][0] * 2;
      dp[i + 1][1] = dp[i][0] + dp[i][1] * 3;
    } else {
      dp[i + 1][0] = dp[i][0];
      dp[i + 1][1] = dp[i][1] * 3;
    }
  }
  cout << dp[n][0] + dp[n][1] << endl;
}

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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,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; }
typedef long long ll;

const long long INF = 1LL << 60;

typedef pair<int, int> P;

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

    map<P, int> dir;
    vector<P> xy(N);

    rep(i, N) {
        int x, y;
        cin >> x >> y;
        xy[i] = P(x, y);
    }

    rep(i, N) {
        rep(j, N) {
            if (i == j) {
                continue;
            }
            int x, y;
            x = xy[j].first - xy[i].first;
            y = xy[j].second - xy[i].second;
            dir[P(x, y)]++;
        }
    }

    P ans;
    int tmp = 0;
    for (auto itr = dir.begin(); itr != dir.end(); ++itr) {
        if (itr->second > tmp) {
            tmp = itr->second;
            ans = itr->first;
        }
    }

    cout << N - tmp << endl;
    return 0;
}

Measured memory_bytes: 384
/*Made by Shivam Solanki*/
#include<bits/stdc++.h>
#pragma GCC optimize ("Ofast")
using namespace std;
#define DEBUG(x) cerr << '>' << #x << ':' << x << endl;
#define ll long long int
#define endl '\n'
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef queue<int> qii;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
#define all(x) x.begin(),x.end()
#define rep(i,k,n) for (int i = k; i < n; ++i) 
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i) 
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;
double pi = 2 * acos(0.0); 

void solve(){
   int L,R,d;
   cin>>L>>R>>d;
   int ctr=0;
   rep(i,L,R+1){
      if(i%d==0) ctr++;
   }
   cout<<ctr;
}

int main(){ 
    // #ifndef ONLINE_JUDGE  
        // freopen("input.txt", "r", stdin); 
        // freopen("output.txt", "w", stdout); 
    // #endif 
   //  fastio;
    int t=1;
   //  cin>>t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
using namespace std;
int main(void){
    int b1,b2,b3;
    cin >> b1 >> b2 >> b3;
    
    if(b1==1 && b2==0 && b3==0 || b1==0 && b2==1 && b3==0 || b1==0 && b2==0 && b3==0 )
    cout <<"Close"<<endl;
    
    else cout<<"Open"<<endl;
    
}


Measured memory_bytes: 3100
-- {-# LANGUAGE BangPatterns #-}
-- {-# LANGUAGE ScopedTypeVariables #-}
-- {-# LANGUAGE FlexibleContexts #-}
-- {-# LANGUAGE ViewPatterns #-}
-- {-# LANGUAGE OverloadedStrings #-}

import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.Vector.Algorithms.Merge as VAM
import qualified Data.Heap as HP
import qualified Data.ByteString.Char8 as BC
import qualified Data.Map as MP
import qualified Data.Set as ST
import qualified Data.Sequence as SQ
import Data.Array
import Data.Array.Unboxed
import Data.Array.ST
import Data.Array.IO
import Data.Maybe
import Data.Ratio
import Data.Char
import Data.Bits
import Data.List
import Data.Tuple
import Data.Functor
import Data.IORef
import Data.STRef
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Debug.Trace

--------------------------------------------------------------------------
solve i n
    | i > n = 0
    | mod i 3 == 0 = solve (i+1) n
    | mod i 5 == 0 = solve (i+1) n
    | otherwise = i + solve (i+1) n

main = do
    n <- int
    print $ solve 1 n
--------------------------------------------------------------------------
    
-- Input Util
int :: IO Int
int = readLn 

double :: IO Double
double = readLn 

str :: IO String
str = getLine

strBC :: IO BC.ByteString
strBC = BC.getLine

sLineToIntL :: IO [Int]
sLineToIntL = getLine >>= return . map read . words

sLineToDoubleL :: IO [Double]
sLineToDoubleL = getLine >>= return . map read . words

sLineToIntV :: Int -> IO (VU.Vector Int)
sLineToIntV n = BC.getLine >>= return . VU.unfoldrN n (BC.readInt . BC.dropWhile isSpace)

sLineToDoubleV :: Int -> IO (VU.Vector Double)
sLineToDoubleV n = BC.getLine >>= return . VU.fromList . map (read . BC.unpack) . BC.words

mLinesToIntL :: Int -> IO [Int]
mLinesToIntL n = replicateM n readLn

mLinesToDoubleL :: Int -> IO [Double]
mLinesToDoubleL n = replicateM n readLn

mLinesToIntV :: Int -> IO (VU.Vector Int)
mLinesToIntV n = VU.replicateM n readLn

mLinesToDoubleV :: Int -> IO (VU.Vector Double)
mLinesToDoubleV n = VU.replicateM n (BC.getLine >>= return . read . BC.unpack)

mLinesToTupleL :: Int -> IO [(Int, Int)]
mLinesToTupleL n = replicateM n (getLine >>= return . (\[a,b] -> (a,b)) . map read . words)

mLinesToTupleV :: Int -> IO (VU.Vector (Int, Int))
mLinesToTupleV n = VU.replicateM n $ do
    bs <- strBC
    let
        Just (a, bs') = BC.readInt $ BC.dropWhile isSpace bs
        Just (b, _) = BC.readInt $ BC.dropWhile isSpace bs'
    return (a,b)
    
mLinesToTripleV :: Int -> IO (VU.Vector (Int, Int, Int))
mLinesToTripleV n = VU.replicateM n $ do
    bs <- strBC
    let
        Just (a, bs') = BC.readInt $ BC.dropWhile isSpace bs
        Just (b, bs'') = BC.readInt $ BC.dropWhile isSpace bs'
        Just (c, _) = BC.readInt $ BC.dropWhile isSpace bs''
    return (a,b,c)

-- others
strToChr :: String -> Char
strToChr [x] = x

chrToStr :: Char -> String
chrToStr x = [x]

m1 :: Int -> Int
m1 x = subtract 1 x

toDouble :: Int -> Double
toDouble x = fromIntegral x

toInt :: Double -> Int
toInt x = floor x

Measured memory_bytes: 17088
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

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

fn main() {
    input! {
        s: String,
    }
    let s = s.chars().collect::<Vec<_>>();
    let mut result = 0;
    for i in 1..s.len() {
        if s[i - 1] != s[i] {
            result += 1;
        }
    }
    println!("{}", result); 
}


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

using namespace std;

//int n = 0;

void init()
{
	char s[123456];
	scanf("%s", s);
	int n = strlen(s);
	if(s[0] == s[n - 1]){
		if(n % 2 == 1){
			printf("Second\n");
		}
		else {
			printf("First\n");
		}
	}
		else {
			if(n % 2 == 0){
				printf("Second\n");
			}
			else {
				printf("First\n");
			}
		}
	}
//}

int main()
{

	

	init();

	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int n;
struct edge{
	int v,w,next;
}e[405000];
int head[405000],cnt;
int ans[405000];
void add(int u,int v,int w){
	++cnt;
	e[cnt].v=v;
	e[cnt].w=w;
	e[cnt].next=head[u];
	head[u]=cnt;
}
void dfs(int u,int fa,int sum){
	ans[u]=sum;
	for(int i=head[u];i;i=e[i].next){
		int v=e[i].v;
		if(v==fa)continue;
		if(e[i].w%2)dfs(v,u,sum^1);
		else dfs(v,u,sum);
	}
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n-1;++i){
		int u,v,w;
		scanf("%d%d%d",&u,&v,&w);
		add(u,v,w);add(v,u,w);
	}
	dfs(1,-1,0);
	for(int i=1;i<=n;++i)cout<<ans[i]<<endl; 
}

Measured memory_bytes: 7552
#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
long long n,k,t,ans;
string s;
long long p25[2000010],p26[2000010];
inline long long power(long long a,long long b){
	long long ans=1;
	while(b){
		if(b%2)
			ans=ans*a%mod;
		b/=2;
		a=a*a%mod;
	}
	return ans;
}
int main(){
	p25[0]=p26[0]=1;
	cin>>k>>s;
	n=s.size();
	for(long long i=1;i<=n+k;i++){
		p25[i]=p25[i-1]*25%mod;
		p26[i]=p26[i-1]*26%mod;
	}
	t=1;
	for(long long i=n;i<=n+k;i++){
		ans=(ans+(t*p25[i-n]%mod)*p26[n+k-i])%mod;
		t=(t*i%mod)*power((i+1)-n,mod-2)%mod;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 35500
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n, k;
	cin >> n >> k;
	
	int ans = 0;
	for(int i = 0; i < n; ++i) {
		int h;
		cin >> h;
		
		if( h >= k ) ans++;
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256