akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int main() {
	int a;
	bool b00l = true;
	while (cin >> a){
		if (!b00l)cout << endl;
		int b[5] = { 0 };
		if (a < 10){
			b[4] = a;
		}
		else if (a < 100){
			b[4] = a % 10;
			a -= b[4];
			a /= 10;
			b[3] = a;
		}
		else if (a < 1000){
			b[4] = a % 10;
			a -= b[4];
			a /= 10;
			b[3] = a % 10;
			a -= b[3];
			a /= 10;
			b[2] = a;
		}
		else if (a < 10000){
			b[4] = a % 10;
			a -= b[4];
			a /= 10;
			b[3] = a % 10;
			a -= b[3];
			a /= 10;
			b[2] = a % 10;
			a -= b[2];
			a /= 10;
			b[1] = a;
		}
		else{
			b[4] = a % 10;
			a -= b[4];
			a /= 10;
			b[3] = a % 10;
			a -= b[3];
			a /= 10;
			b[2] = a % 10;
			a -= b[2];
			a /= 10;
			b[1] = a % 10;
			a -= b[1];
			a /= 10;
			b[0] = a;
		}
		for (int i = 0; i < 5; i++){
			if (b[i] < 5)cout << '*';
			else cout << ' ';
		}
		cout << endl;
		for (int i = 0; i < 5; i++) {
			if (b[i] < 5)cout << ' ';
			else cout << '*';
		}
		cout << endl;
		for (int i = 0; i < 5; i++) {
			cout << '=';
		}
		cout << endl;
		for (int i = 0; i < 5; i++) {
			if (b[i] % 5 == 0)cout << ' ';
			else cout << '*';
		}
		cout << endl;
		for (int i = 0; i < 5; i++) {
			if (b[i] % 5 == 1)cout << ' ';
			else cout << '*';
		}
		cout << endl;
		for (int i = 0; i < 5; i++) {
			if (b[i] % 5 == 2)cout << ' ';
			else cout << '*';
		}
		cout << endl;
		for (int i = 0; i < 5; i++) {
			if (b[i] % 5 == 3)cout << ' ';
			else cout << '*';
		}
		cout << endl;
		for (int i = 0; i < 5; i++) {
			if (b[i] % 5 == 4)cout << ' ';
			else cout << '*';
		}
		cout << endl;
		b00l = false;
	}

}

Measured memory_bytes: 3048
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

void solve()
{
	int N;
	cin >> N;
	map<int, int> Map;
	for (int i = 0; i < N; ++i)
	{
		int D;
		cin >> D;
		Map[D]++;
	}
	int M;
	cin >> M;
	vector<int> T(M);
	for (int i = 0; i < M; ++i)
	{
		cin >> T[i];
	}
	for (int i = 0; i < M; ++i)
	{
		if (Map[T[i]] == 0)
		{
			cout << "NO" << endl;
			return;
		}
		else
		{
			Map[T[i]]--;
		}
	}
	cout << "YES" << endl;
}

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

Measured memory_bytes: 10368
import java.util.PriorityQueue;
import java.util.Scanner;

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

		PriorityQueue pq = new PriorityQueue();
		for (int i = 0; i < N; i++) {
			int temp = sc.nextInt();
			pq.add(-temp);
		}
		sc.close();

		for (int i = 1; i <= M; i++) {
			int max = -(int) pq.poll();
//			System.out.println(max + "->" + max / 2);
			pq.add(-max / 2);
		}

		long sum = 0;
		while (!pq.isEmpty()) {
//			System.out.println(pq.peek());
			sum += -(int) pq.poll();
		}
		System.out.println(sum);

	}
}


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

int N, K;
string S;

int count(int n){
	for(int i = 0; i < N; ++i){
		
	}
}

int main(){
	cin >> S;
	int size = (int)(S.length());
	int count_a = 0;
//	if(size % 2 == 0){
		for(int i = 0; i < size; ++i){
			if(i % 2 == 0){
				if(S[i] != '0') count_a++;
			}else{
				if(S[i] != '1') count_a++;
			}
		}
		cout << min(count_a, size - count_a) << endl;
//	}

}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<pair<int,int>> T(N);
  
  for(int i = 0; i < N;i++){
    int a , b;
    cin >> a >> b;
    T.at(i) = make_pair(b,a);
  }
  sort(T.begin(),T.end());
  int time = 0;
  for(int k = 0;k < N;k++){
    time += T.at(k).second;
    if(time > T.at(k).first){
      cout << "No"<< endl;
    break;
    }
    if(k == N - 1 && time <= T.at(k).first){
      cout << "Yes" << endl;
    }
  }
}
    
      

Measured memory_bytes: 1920
#include <cstdio>
#include <utility>
#include <cctype>
#include <string>
#include <algorithm>
using namespace std;

#define _gp(l) const auto gcu{getchar##l}; const auto pcu{putchar##l}
#ifdef __linux
_gp(_unlocked);
#else
_gp();
#endif
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
#define _OP(t) inline operator t()
struct _in {
#ifdef _GLIBCXX_STRING
	_OP(string){string s;for(char c;c=gcu(),c!=' '&&c!='\n';)s+=c;return s;}
#endif
	_OP(char){char c=gcu();gcu();return c;}
	_OP(double){double d; scanf("%lf",&d); gcu();return d;}
	_T _OP(T){T n{},m{1},c;if((c=gcu())=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
} in;
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
_T _SCAN(T &o) {int c{gcu()};return c==EOF?false:ungetc(c,stdin),o=in,true;}
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);} _OUT(const char *s){while(*s)pcu(*s++);} _OUT(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_OUT(string s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b;T m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _OUT(vector<T> v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
_HT _OUT(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _OUTL(T&&... t){out(move(t)...);outl();}
struct range{
	int e,b=0,s=1; range(int _b,int _e,int _s):e(_e),b(_b),s(_s){} range(int _b,int _e): e(_e), b(_b){} range(int _e):e(_e){}
	struct it { int v, s; it (int _v, int _s) : v(_v), s(_s) {} operator int()const{return v;} operator int&(){return v;} int operator*()const{return v;}
		it& operator++(){v+=s;return *this;} }; it begin() {return {b, s};} it end() {return {e, s};}};

int main() {
	for (int n(in); n; n--) {
		string k = move(in), s = move(in);
		for (auto i {rbegin(k)}; i != rend(k); i++)
			switch(*i) {
			case 'C':
				s = s.substr(1, s.size()) + s.front();
				break;
			case 'J':
				s = s.back() + s.substr(0, s.size() - 1);
				break;
			case 'E':
				for (int j: range(s.size() / 2))
					swap(s[j], s[j + (s.size() + 1) / 2]);
				break;
			case 'P':
				for (char &j: s)
					if (isdigit(j))
						j = (j - '0' + 9) % 10 + '0';
				break;
			case 'M':
				for (char &j: s)
					if (isdigit(j))
						j = (j - '0' + 1) % 10 + '0';
				break;
			case 'A':
				reverse(begin(s), end(s));
				break;
			}
		outl(s);
	}
}


Measured memory_bytes: 2548
import java.util.*;

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

        int[] abc = new int[3];
        abc[0] = sc.nextInt();
        abc[1] = sc.nextInt();
        abc[2] = sc.nextInt();
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;

        for(int i = 0;i < 3;i++){
            if(max < abc[i])    max = abc[i];
            if(min > abc[i])    min = abc[i];
        }
        System.out.println(min+" "+max);
    }
}


Measured memory_bytes: 26300
#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};

vector<pii> v;

int solve(int n, int x) {
	int res = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			int k = x - (i + j);
			if (i == k || j == k) continue;
			if (k < j) continue;
			if (k > 0 && k <= n) res++;
		}
	}
	return res;
}

int main() {
	bool flag = 1;
	while (flag) {
		int n, x;
		cin >> n >> x;
		if (n == 0 && x == 0) flag = 0;
		else cout << solve(n, x) << endl;
	}
	return 0;
}


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

int main(){
  int N,M;
  cin >> N >> M;
  vector<string> A(N),B(M);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  for(int i=0;i<M;i++){
    cin >> B.at(i);
  }
  for(int i=0;i<N-M+1;i++){
    for(int j=0;j<N-M+1;j++){
      bool flag=true;
      for(int k=0;k<M;k++){
        if(A.at(i+k).substr(j,M)!=B.at(k)){
          flag=false;
          break;
        }
      }
      if(flag){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


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

int main()
{
	int n, A, B, a, b;
	while (cin >> n, n) {
		A = B = 0;
		for (int i = 0; i < n; i++) {
			cin >> a >> b;
			if (a > b)
				A += a + b;
			else if (a == b) {
				A += a;
				B += b;
			}
			else {
				B += a + b;
			}
		}
		cout << A << " " << B << endl;
	}
	return 0;
}

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

#define int long long 
#define ll long long 
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define ff first
#define ss second
#define vi vector<ll>
#define mod 1000000007
#define MOD 1000000007
#define full(a) a.begin(),a.end()
#define inf INT_MAX
#define minf INT_MIN
#define dd double
#define fori(x,n) for(ll i=x;i<n;i++)


int32_t main() 
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
 
        ll n;
        cin>>n;

        if(n%1000==0)cout<<0;
        else {
            cout<<1000*(n/1000+1)-n;
        }
        cout<<"\n";

 



    return 0;  
}
    

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <utility>

typedef long long ll;
typedef unsigned long long ull;

#define vi std::vector<int>
#define vl std::vector<ll>
#define floop(n) for(int i = 0; i < n; ++i)
#define print(x) std::cout << x << std::endl;

const ll INF = 1e18;

int main()
{
    int x;
    std::cin >> x;

    if(x == 0)
    {
        print(1);
    }

    else
    {
        print(0);
    }
    return 0;
}

Measured memory_bytes: 3616
from fractions import gcd

yes = "POSSIBLE"
no = "IMPOSSIBLE"

N, K = map(int, raw_input().split())
A = map(int, raw_input().split())

if N == 1:
    print yes if A[0] == K else no
    exit()

if K > max(A):
    print no
    exit()

g = reduce(gcd, A)
if g == 1:
    print yes
elif K % g == 0:
    print yes
else:
    print no


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

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;



    int a[210000];
    int main(){
        int n;
        std::cin >> n;
        rep(i, n) scanf("%d", a+i);
        sort(a, a+n);
        for (int i = 0; i < n-1; ++i)
            {
                if (a[i] == a[i+1])
                {
                    /* code */printf("NO\n");
                    return 0;
                }
            }
        printf("YES\n");
        
        
    }


Measured memory_bytes: 1024
N = int(input())
cmin = 1000
for i in range(1,N):
    a = str(i)
    cnt = 0
    for j in range(len(a)):
        cnt += int(a[j])
    b = str(N-i)
    for j in range(len(b)):
        cnt += int(b[j])
    cmin = min(cmin,cnt)
print(cmin)

Measured memory_bytes: 73444
#include<bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

string s[10];
string dp[1 << 10][10];
int main() {
	int n;
	string inf; rep(i, 100)inf += 'z';
	while (scanf("%d", &n), n) {
		rep(i, n)cin >> s[i];
		rep(i, 1 << n)rep(j, n)dp[i][j] = inf;
		rep(i, n)dp[1 << i][i] = s[i];
		rep(i, 1 << n) {
			rep(j, n) {
				if (!(i >> j & 1))continue;
				if (dp[i][j] == inf)continue;
				rep(k, n) {
					if (i >> k & 1)continue;
					string t = dp[i | 1 << k][k];
					string p = dp[i][j];
					int d = s[k].size();
					while ((int)(p + s[k].substr(d)).find(s[k]) == -1)d--;
					p += s[k].substr(d);
					if (t.size() > p.size())dp[i | 1 << k][k] = p;
					else if (t.size() == p.size())dp[i | 1 << k][k] = min(dp[i | 1 << k][k], p);
				}
			}
		}
		string ans = inf;
		rep(i, n) {
			string t = dp[(1 << n) - 1][i];
			if (ans.size() > t.size())ans = t;
			else if (ans.size() == t.size())ans = min(ans, t);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  string s, t;
  cin >> s >> t;
  ll ss=s.size(), ts=t.size();
  
  vl S, T;
  rep(i, ss) S.push_back((ll)s[i]);
  rep(i, ts) T.push_back((ll)t[i]);
  sort(all(S));
  sort(all(T), greater<ll>());
  
  rep(i, min(ss, ts)) {
    if(S[i]<T[i]) {cout << "Yes" << newl; return 0;}
    if(S[i]>T[i]) {cout << "No" << newl; return 0;}
  }
  cout << (ss<ts ? "Yes" : "No") << newl;
  return 0;
}

Measured memory_bytes: 3580
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <stdio.h>

using namespace std;

//typedefリスト
typedef long long int llint;
typedef vector<int> vint;
typedef vector< vector<int> > vvint;
typedef vector<string> vstr;


int main(void) {
	llint N, mi, ma;
	mi = 0;
	cin >> N;
	vint a(N);
	vint c(9);
	for (int i = 0; i < 9; i++)c[i] = 0;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		if (a[i] < 400)c[0] = 1;
		else if (a[i] < 800)c[1] = 1;
		else if (a[i] < 1200)c[2] = 1;
		else if (a[i] < 1600)c[3] = 1;
		else if (a[i] < 2000)c[4] = 1;
		else if (a[i] < 2400)c[5] = 1;
		else if (a[i] < 2800)c[6] = 1;
		else if (a[i] < 3200)c[7] = 1;
		else c[8]++;
	}
	for (int i = 0; i < 8; i++) mi += c[i];
	if (mi == 0) {
		mi = 1;
		ma = c[8];
	}
	else ma = mi + c[8];
	cout << mi << " " << ma << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define SORT(v,n) sort(v,v+n)
#define rep(i,n) FOR(i,0,n)
#define EPS (1e-7)
#define INF (1e9)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef priority_queue<int> PQI;
typedef priority_queue<int,vector<int>,greater<int> > PQSI;
typedef priority_queue<ll> PQL;
typedef priority_queue<ll,vector<ll>,greater<ll> > PQSL;

const int MOD = 1000000007;
struct mint { int n; mint(int n_ = 0) : n(n_) {} };
mint operator-(mint a) { return -a.n + MOD * (a.n != 0); }
mint operator+(mint a, mint b) { int x = a.n + b.n; return x - (x >= MOD) * MOD; }
mint operator-(mint a, mint b) { int x = a.n - b.n; return x + (x < 0) * MOD; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }
istream &operator>>(istream &i, mint &a) { return i >> a.n; }
ostream &operator<<(ostream &o, mint a) { return o << a.n; }

vector<mint> F_{1, 1}, R_{1, 1}, I_{0, 1};
void check_fact(int n) {
  for (int i = I_.size(); i <= n; i++) {
    I_.push_back(I_[MOD % i] * (MOD - MOD / i));
    F_.push_back(F_[i - 1] * i);
    R_.push_back(R_[i - 1] * I_[i]);
  }
}

mint I(int n) { check_fact(abs(n)); return n >= 0 ? I_[n] : -I_[n]; }
mint F(int n) { check_fact(n); return n < 0 ? 0 : F_[n]; }
mint R(int n) { check_fact(n); return n < 0 ? 0 : R_[n]; }
mint C(int n, int r) { return F(n) * R(n - r) * R(r); }
mint P(int n, int r) { return F(n) * R(n - r); }
mint H(int n, int r) { return n == 0 ? (r == 0) : C(n + r - 1, r); }

template<typename T>
T gcd(T x, T y){
    if (y == 0) return x;
    else return gcd(y, x % y);
}

template<typename T>
T lcm(T x, T y){
    return (x / gcd(x, y)) * y;
}

template<typename T>
T ceil(T x, T y){
    return (x + (y - 1)) / y;
}

ll W1,H1,x,y;
int main(void){
    cin >> W1 >> H1 >> x >> y;
    cout << W1*H1/2.0 << " ";
    if(abs(x-W1/2.0) < EPS and abs(y-H1/2.0) < EPS) cout << 1 << endl;
    else cout << 0 << endl;

    return 0;
}




Measured memory_bytes: 256
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-04-03 21:59:56
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

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

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n; cin >> n;
  int ct= 0, cx = 0, cy = 0;

  for (int i = 0; i < n; ++i) {
    int t, x, y; cin >> t >> x >> y;
    int res = t - ct;
    int diff = abs(x - cx) + abs(y - cy);
    if (((diff & 1) != (res & 1)) || res < diff) {
      cout << "No" << endl; return 0;
    }
    cx = x, cy = y, ct = t;
  }

  cout << "Yes" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<iterator>
#include<queue>
#include<algorithm>
#include<functional>

typedef long long ll;
typedef std::map<char, int> string_type;
typedef std::unordered_map<int, int> type_occurences;
typedef std::set<int> type_set_int;
using t_map_rate_n = std::map<int, int>;
using vint = std::vector<int>;


struct abc_178_c {
	const ll mod_by = 7 + 1e9;
	ll run(const int N) {
		// ll ll_10_n, ll_9_n, ll_8_n;
		int N2 = N;
		// std::cerr << mod_by << std::endl;
		// ll_10_n = 10;
		// ll_9_n = 9;
		// ll_8_n = 8;

		if(N == 1) {
			return 0;
		}
		if(N == 2) {
			return 2;
		}

		std::vector<ll> nums, pows;
		pows.push_back(10);
		pows.push_back(9);
		pows.push_back(8);

		nums.push_back(1);
		nums.push_back(1);
		nums.push_back(1);

		while(N2 > 0) {
			if(N2 % 2 == 1) {
				for(int i = 0; i < pows.size(); ++i) {
					nums[i] = (nums[i]*pows[i])%mod_by;
				}
			}
			N2 /= 2;

			// for next
			for(int i = 0; i < pows.size(); ++i) {
				pows[i] = (pows[i]*pows[i])%mod_by;
			}
		}

		ll ans = (nums[0] + nums[2] - 2*nums[1] + mod_by + mod_by) % mod_by;

		return ans;
	}
};

int main(void) {
	abc_178_c solver;
	int N;

	std::cin >> N;

	std::cout << solver.run(N) << std::endl;

	return 0;
}


Measured memory_bytes: 3572
H, W, K = map(lambda x: int(x), input().split())
 
matrix = []
for i in range(H):
	row = input()
	dots = []
	for j in range(W):
		dots.append(row[j])
	matrix.append(dots)


ans = 0
for a in range(1<<H):
    for b in range(1<<W):
        cnt=0 
        for c in range(H):
            if a&(1<<c): 
                for d in range(W):
                 if b&(1<<d): 
                    cnt+=matrix[c][d]=='#'
        ans+=cnt==K
 
print(ans)

Measured memory_bytes: 9152
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string s;
int n,cnt,sum;
int main() {
	string s;
	cin>>n;
	cin>>s;
	for(int i=0; i<n; i++) {
		if(s[i]=='W') cnt++;
	}
	for(int i=n-cnt; i<n; i++) {
		if(s[i]=='R') sum++;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3752
def comb(n, k, mod):

    m = 1
    for i in range(n, n - k, -1):
        m = m * i % mod

    n = 1
    for i in range(1, k + 1):
        n = n * i % mod

    return (m * pow(n, mod - 2, mod) % mod)


def main():

    mod = 1000000007
    n, a, b = map(int, input().split())

    ans = pow(2, n, mod) - 1 - comb(n, a, mod) - comb(n, b, mod)
    ans = ans % mod
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 39152
/***************************************************

@author: vichitr
Compiled On: 19th Mar 2020

*****************************************************/
#include<bits/stdc++.h>
#define MAX 9223372036854775807
#define endl "\n"
#define ll long long
#define int long long
#define double long double
#define pb push_back
#define pf pop_front
#define mp make_pair
#define ip pair<int, int>
#define F first
#define S second

#define loop(i,n) for(int i=0;i<n;i++)
#define loops(i,s,n) for(int i=s;i<=n;i++)
#define fast ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
using namespace std;

const ll MOD = 1e9+7;
const ll SZ = 107;
const ll N = 2e5+7;
// const ll M = 2e5+7;

ll pwr(ll x, ll y)
{
    ll r = 1LL;
    while(y)
    {
        if(y&1)
            r = (r * x) % MOD;
        y >>= 1;
        x = (x * x) % MOD;
    }
    return r;
}

int inv(int x)
{
    return pwr(x, MOD-2ll);
}

// int fact[N];

// int nCr(int x, int y){
//     int ans= fact[x];
//     ans *= inv(fact[y]);
//     ans %= MOD;
//     ans *= inv(fact[x-y]);
//     ans %= MOD;
//     return ans;
// }

// bool prim(int n){
//     for(int i=2;i*i<=n;i++){
//         if(n%i==0)
//             return 0;
//     }
//     return 1;
// }
bool ispal(string s){
    int n = s.size();
    for(int i=0;i<n/2;i++)
        if(s[i]!=s[n-1-i])
            return 0;
    return 1;
}

void solve()
{ 
    string s; cin>>s;
    int n = s.size();
    string s1 = s.substr(0, n/2);
    string s2 = s.substr(n/2+1, n/2);
    if(ispal(s) and ispal(s1) and ispal(s2))
        cout<<"Yes";
    else cout<<"No";
}

signed main()
{
    fast;
// #ifndef ONLINE_JUDGE
//     freopen("in.txt", "r", stdin);
//     freopen("out.txt", "w", stdout);
// #endif
    int t=1;
    // cin >>t;

    // fact[0] =1;
    // for(int i=1;i<N;i++){
    //     fact[i] = fact[i-1]*i;
    //     fact[i] %= MOD;
    // }
    // int i  =1;
    while(t--){
        // int n = i++;
        solve();
        
    }
    return 0;
}

/*****************************

1
10 3
1 5 1
3 6 1
6 9 1


**************************/

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <string>
#define ll long long
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vvvl vector<vector<vector<ll> > >
#define vd vector<double>
#define vvd vector<vector<double> >
#define vvvd vector<vector<vector<double> > >
#define mod 1000000007
using namespace std;


int main(void){
    ll n; cin>>n;
    vector<string> s(n);
    for(int i=0;i<n;++i){
        //string s;
        cin>>s[i];
        //for(int j=0;j<s.length();++j) vs[i].push_back(s[i]);
        sort(s[i].begin(),s[i].end());
    }
    sort(s.begin(),s.end());
    vl count(1,0);
    string tmp = s[0];
    for(int i=0;i<n;++i){
        if(s[i] == tmp){
            count[count.size()-1]++;
        }else{
            count.push_back(1);
            tmp = s[i];
        }
    }
    ll ans = 0;
    for(int i=0;i<count.size();++i) if(count[i] > 1) ans += (count[i]*(count[i]-1))/2;
    cout<<ans<<endl;
}


Measured memory_bytes: 8444
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define fi first
#define se second
#define mp make_pair
int main() {

ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll n;
cin>>n;
map<ll,ll>m;
for(ll i=0;i<n;i++)
{ll x;
  cin>>x;
  m[x]=i+1;
}
for(auto it=m.begin();it!=m.end();it++)
{
  cout<<it->second<<" ";
}
cout<<endl;
	return 0;
}


Measured memory_bytes: 7040
import java.util.*;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int z = sc.nextInt();
        int k = sc.nextInt();
        Long[] a = new Long[x];
        for(int i = 0;i < x;i++){
            a[i] = sc.nextLong();
        }
        Long[] b = new Long[y];
        for(int i = 0;i < y;i++){
            b[i] = sc.nextLong();
        }
        Long[] c = new Long[z];
        for(int i = 0;i < z;i++){
            c[i] = sc.nextLong();
        }

        Arrays.sort(a, Comparator.reverseOrder());
        Arrays.sort(b, Comparator.reverseOrder());
        Arrays.sort(c, Comparator.reverseOrder());

        int ai = 0;
        int bi = 0;
        int ci = 0;

        Map<String, Long> values = new HashMap<>();
        values.put(ai + "_"+ bi + "_"+ ci, a[ai]+b[bi]+c[ci]);
        Map<String, Boolean> visited = new HashMap<>();
        visited.put(ai + "_"+ bi + "_"+ ci, true);
        for(int i = 0;i < k;i++){
            long max = 0;
            String maxKey = "";
            for(String key : values.keySet()){
                long v  = values.get(key);
                if(max < v){
                    max = v;
                    maxKey = key;
                }
            }

            values.remove(maxKey);
            System.out.println(max);
            ai = Integer.parseInt(maxKey.split("_")[0]);
            bi = Integer.parseInt(maxKey.split("_")[1]);
            ci = Integer.parseInt(maxKey.split("_")[2]);
            if(ai < x-1 && !visited.containsKey((ai+1) + "_"+ bi + "_"+ ci)){
                visited.put((ai+1) + "_"+ bi + "_"+ ci, true);
                values.put((ai+1) + "_"+ bi + "_"+ ci, a[ai+1]+b[bi]+c[ci]);
            }
            if(bi < y-1 && !visited.containsKey(ai + "_"+ (bi+1) + "_"+ ci)){
                visited.put(ai + "_"+ (bi+1) + "_"+ ci, true);
                values.put(ai + "_"+ (bi+1) + "_"+ ci, a[ai]+b[bi+1]+c[ci]);
            }
            if(ci < z-1 && !visited.containsKey(ai + "_"+ bi + "_"+ (ci+1))){
                visited.put(ai + "_"+ bi + "_"+ (ci+1), true);
                values.put(ai + "_"+ bi + "_"+ (ci+1), a[ai]+b[bi]+c[ci+1]);
            }
        }
    }
}


Measured memory_bytes: 64548
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;

int main(){
    int l,r;cin>>l>>r;
    int m=2019;
    for(int i=l;i<r&&i<2019+l;i++){
        for(int j=i+1;j<=r&&j<2020+i;j++){
            m=min(m,((i%2019)*(j%2019))%2019);
          if(m==0) break;
        }
    }
    cout<<m<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int maxLength = 0;

        int curLength = 0;
        for (int i = 0; i < s.length(); i += 1) {
            char si = s.charAt(i);
            if (si == 'A' || si == 'C' || si == 'G' || si == 'T') {
                curLength += 1;
                if (maxLength < curLength) {
                    maxLength = curLength;
                }
            } else {
                curLength = 0;
            }
        }

        System.out.println(maxLength);
    }

}


Measured memory_bytes: 21844
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        String[] a = line.split("");
        line = br.readLine();
        String[] b = line.split("");
        String r = "";
        for(int i = 0; i < b.length; i++) {
            r = r + a[i] + b[i];
        }
        if(a.length != b.length) {
            r = r + a[a.length - 1];
        }
        System.out.println(r);
    }
}

Measured memory_bytes: 22868
#include "bits/stdc++.h"
using namespace std;

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

const int INF = 1000000007;

/*ll factorial(int n){
	if(n == 1) return 1 % INF;
	else return n*factorial(n - 1) % INF;
}*/

ll factorial(ll n){
	ll res = 1;
	for(int i=1;i<=n;i++){
		res = (res*i) % INF;
	}

	return res;
}


int main(){
	ll n,m; cin>>n>>m;
	ll dog=0,monkey=0;

	dog = factorial(n) % INF;
	monkey = factorial(m) % INF;
	ll ans = (dog * monkey) % INF;

	if(abs(n-m) >= 2) cout<< 0 <<endl;
	else if(n == m) cout<< ans*2%INF <<endl;
	else cout<< ans <<endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <algorithm>
using namespace std;

using ll = long long;

#define MOD 1000000007

#define FOR(i, m, n) for (ll i = m; i <= n; i++)
#define FORR(i, m, n) for (ll i = m; i >= n; i--)

ll gcd(ll a, ll b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

int main() {
    ll X;
    cin >> X;
    cout << X / 500 * 1000 + X % 500 / 5 * 5 << endl;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
from collections import deque, Counter
import math
import pprint
from functools import reduce
import numpy as np
# stdin = open("sample.txt")

MOD = 1000000007
INF = float('inf')
alpha = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]

def keta(kazu): # 入力されたintを桁ごとに分解，リストで出力
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

def gcd(*numbers): # 最小公倍数
    return reduce(math.gcd, numbers)

def combination(m,n): # mCn
    
    if n > m:
        return 'すまん'
    return math.factorial(m) // (math.factorial(m-n) * math.factorial(n))

def pow_k(x,n):  # (x**n)の計算の高速化
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2
    return K * x

def fact(n): # nの素因数分解の結果を辞書で出力 fuct(24) → {2: 3, 3: 1}
    arr = {}
    temp = n
    for i in range(2,int(n**0.5)+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt
    if temp != 1:
        arr[temp] = 1
    if arr == {}:
        arr[n] = 1
    return arr

def main():
    d = int(stdin.readline().rstrip())
    c = list(map(int,[int(x) for x in stdin.readline().rstrip().split()]))
    table = []
    last = [0]*26
    score = 0
    for _ in range(d):
        table.append(list(map(int,[int(x) for x in stdin.readline().rstrip().split()])))
    for D in range(d):
        go = int(stdin.readline().rstrip()) - 1
        for i in range(26):
            if i == go:
                score += table[D][i]
                last[i] = D+1
                # print(table[D][i])
            else:
                score -= c[i]*(D+1-last[i])
                # print(c[i]*(D+1-last[i]))
        print(score)
main()

Measured memory_bytes: 27188
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <iostream>
#include <numeric>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
int INF = 1e9;


int main(){
	int n,k;cin >> n >> k;
	int ans = k;
	rep(i,n-1){
		ans *= k-1;
	}
	cout << ans << endl;

} 


Measured memory_bytes: 3580
//https://atcoder.jp/contests/arc080/tasks/arc080_b
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}}star;
#define DEBUG if(0)
#endif
#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}
class reverse_range {private:struct I {int x;int operator*() {return x-1;}bool operator!=(I& lhs) {return x>lhs.x;}void operator++() {--x;}};I i, n;public:reverse_range(int n) :i({ 0 }), n({ n }){}reverse_range(int i, int n) :i({ i }), n({ n }){}I& begin() {return n;}I& end() {return i;}};
class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }reverse_range operator!(){return reverse_range(*i,*n);}};


int b[100][100];
int a[11234];
int main(){
    int R,C,N;
    cin>>R>>C>>N;
    for(int i:range(N)){
        cin>>a[i];
    }
    int id=0;
    for(int i:range(R)){
        if(i%2==0){
            for(int j:range(C)){
                if(a[id]==0)id++;
                a[id]--;
                b[i][j]=id+1;
            }
        }
        else{
            for(int j:!range(C)){
                if(a[id]==0)id++;
                a[id]--;
                b[i][j]=id+1;
            }
        }
    }
    for(int i:range(R)){
        for(int j:range(C)){
            cout<<b[i][j]<<" ";
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 384
import numpy as np
from numba import njit, int64
import sys

read = sys.stdin.buffer.read


@njit((int64[:], ), cache=True)
def solve(inp):
    INF = 10 ** 18

    n = inp[0]
    x = inp[1::3]
    y = inp[2::3]
    p = inp[3::3]

    ver = np.empty((1 << n, n), np.int64)
    ver[0] = np.abs(x) * p

    for i in range(n):
        bt = 1 << i
        ver[bt:2 * bt] = np.minimum(ver[:bt], np.abs(x - x[i]) * p)

    hor = np.empty((1 << n, n), np.int64)
    hor[0] = np.abs(y) * p

    for i in range(n):
        bt = 1 << i
        hor[bt:2 * bt] = np.minimum(hor[:bt], np.abs(y - y[i]) * p)

    ans = [INF] * (n + 1)
    for i in range(pow(3, n)):
        vi = 0
        hi = 0
        cnt = 0
        pow2 = 1
        pow3 = i
        while pow3:
            pow3, r = divmod(pow3, 3)
            if r == 1:
                vi += pow2
                cnt += 1
            elif r == 2:
                hi += pow2
                cnt += 1

            pow2 *= 2

        score = np.minimum(ver[vi], hor[hi]).sum()
        ans[cnt] = min(ans[cnt], score)

    return ans


inp = np.array(read().split(), np.int64)
ans = solve(inp)
print(*ans, sep="\n")


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

using namespace std;

int main()
{
    int A, B, area;

    cin >> A >> B;

    if((A >= 2 && A <= 100) && (B >= 2 && B <= 100))
    {
        area = (A - 1) * (B - 1);
        printf("%d", area);
    }
    else
    {
        printf("Invalid Input");
    }

    return 0;
}


Measured memory_bytes: 256
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))

X_Y = []
for i in range(N):
    X_Y.append(V[i] - C[i])
X_Y_pos = [x for x in X_Y if x > 0]
print(sum(X_Y_pos))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

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

    ll ans=h*w;

    if(h%3==0){
        cout<<0<<endl;
        return 0;
    }
    ans=w;

    if(w%3==0){
        cout<<0<<endl;
        return 0;
    }
    ans=min(ans,h);

    ll tmp=h*w;
    rep(x,w+1){
        ll s1=h*x;
        ll s2=(w-x)*(h/2);
        ll s3=(w-x)*(h-h/2);
        tmp=min(tmp,max({s1,s2,s3})-min({s1,s2,s3}));
    }
    ans=min(ans,tmp);

    tmp=h*w;
    rep(x,h+1){
        ll s1=w*x;
        ll s2=(h-x)*(w/2);
        ll s3=(h-x)*(w-w/2);
        tmp=min(tmp,max({s1,s2,s3})-min({s1,s2,s3}));
    }
    ans=min(ans,tmp);

    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 1LL << 60;

long power(long a, long b) {
    return b ? power(a*a%MOD, b/2) * (b%2?a:1)%MOD:1;
}

long perm(int N, int K) {
    long x = 1;
    for(int i = 1; i <= K; i++) x = x * (N-i+1) % MOD;
    return x % MOD;
}

long comb(int N,int K) {
    long x = 1, y = 1;
    for(int i = 1; i <= K; i++) {
        x = x * (N-i+1) % MOD;
        y = y * i % MOD;
    }
    return x * power(y, MOD-2) % MOD;
}

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

void dfs(const vector<vector<int> > &G, int v, vector<int> &seen) {
    seen[v] = true;

    for(int next_v : G[v]) {
        if(seen[next_v]) continue;
        dfs(G, next_v, seen);
    }
}

void yes() { cout << "Yes" << endl;}
void no() { cout << "No" << endl;}



int main() {
  int n, m, a, b;
  cin >> n >> m;
  const int inf = 1000000;
  vector<int> to[100005];
  vector<int> dist(n+1, inf);
  vector<int> pre(n+1, -1);
    
  for(int i = 0; i < m; i++) {
    cin >> a >> b;
    a--; b--;
    to[a].push_back(b); to[b].push_back(a);
  }
  
  queue<int> q;
  dist[0] = 0;
  q.push(0);
  
  while(!q.empty()) {
    int v = q.front(); q.pop();
    for (int u : to[v]) {
      if (dist[u] != inf) continue;
      dist[u] = dist[v] + 1;
      pre[u] = v;
      q.push(u);
    }
  }
  cout << "Yes" << endl;
  for (int i = 0; i < n; i++) {
    if (i == 0) continue;
    cout << ++pre[i] << endl;
  }
}

Measured memory_bytes: 10592
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<utility>
#include<sstream>
#include<cctype>
#include<cmath>
#include<algorithm>
using namespace std;

#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define rev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define repp(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define clr(a) memset((a), 0 ,sizeof(a))


typedef pair<int,int> P;
typedef vector<pair<int,int> > pii;
typedef map<string,int> mi;


int main(){
	int a,cnt=0,cnt2=0;
	for(int i=0;i<3;i++){
		cin >> a;
		if(a==5) cnt++;
		else if(a==7) cnt2++;
	}
	cout << (cnt==2&&cnt2==1?"YES":"NO") << endl;
	return 0;
}

Measured memory_bytes: 764
def input_n
  gets.to_i               # 単一整数
end

def input_s
  gets.chomp              # 文字列。chompを付けないと改行文字がついてくる
end

def input_a
  gets.split.map(&:to_i)  # スペースで区切られた複数の整数
end

def input_o(num)
  num.times.map { gets.to_i }  # 縦に並んだ複数の整数。たまにある
end

def output_f(num)
  puts sprintf("%.12f", num)
end

n, m, x = input_a
c = []
n.times do
  c.push(input_a)
end

# bit全探索
min = 10 ** 8
[0, 1].repeated_permutation(n) do |bits|
  # repeated_permutationで長さn(本の冊数)のbit列を作成(ex. n=3, [0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1], ..., [1, 1, 1])
  # bit=1のとき購入とし、bit配列の値をindex付きで順次取り出し
  # アルゴリズムの個数m分の理解度を格納する配列performanceを用意
  cost = 0
  performances = Array.new(m, 0)
  # bitが立っている本を購入した場合の費用と習熟度を足していく
  bits.each_with_index do |buy, i|
    if buy == 1
      cost += c[i][0]
      c[i][1..m].each_with_index do |performance, j|
        performances[j] += performance
      end
    else
    end
  end
  # 習熟度がxを超えているか
  ok = 1
  performances.each do |performance|
    if performance < x
      ok = 0
    end
  end
  if ok == 1
    if min > cost
      min = cost
    end
  end
end
if min == 10 ** 8
  puts -1
else
  puts min
end

Measured memory_bytes: 14324
#include<iostream>
#include<utility>

using namespace std;

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

struct dice{
    int top, bottom;
    int brfl[4];
};

int n;
int f;
int t;
int top[200][200];
int c[200][200];

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

dice d;

void roll(int i){
    swap(d.brfl[i], d.top);
    swap(d.top, d.brfl[(i+2)%4]);
    swap(d.brfl[(i+2)%4], d.bottom);
}

int tf[7][7];
int output[6];

int main(){
    tf[1][2] = 3; tf[1][3] = 5; tf[1][4] = 2; tf[1][5] = 4;
    tf[2][3] = 1; tf[2][4] = 6; tf[2][6] = 3; tf[2][1] = 4;
    tf[3][5] = 1; tf[3][6] = 5; tf[3][1] = 2; tf[3][2] = 6;
    tf[4][5] = 6; tf[4][6] = 2; tf[4][1] = 5; tf[4][2] = 1;
    tf[5][6] = 4; tf[5][1] = 3; tf[5][3] = 6; tf[5][4] = 1;
    tf[6][2] = 4; tf[6][3] = 2; tf[6][4] = 5; tf[6][5] = 3;

    while(1){
        cin >> n;
        if(n==0) break;

        REP(i, 200){
            REP(j, 200){
                top[i][j] = 0;
                c[i][j] = 0;
            }
        }
        REP(i, 6) output[i] = 0;

        REP(i, n){
            cin >> t >> f;
            d.top = t; d.bottom = 7-t, d.brfl[2] = f; d.brfl[0] = 7-f;
            d.brfl[1] = tf[t][f]; d.brfl[3] = 7-tf[t][f];

            int x = 100, y = 100;
            while(1){
                bool flag = false;
                int nx, ny, nj;
                int max_num = 0;
                REP(j, 4){
                    if(d.brfl[j]>=4 && c[x][y]>c[x+dx[j]][y+dy[j]]){
                        if(d.brfl[j]>max_num){
                            max_num = d.brfl[j];
                            nx = x+dx[j]; ny = y+dy[j]; nj = j;
                            flag = true;
                        }
                    }
                }
                if(!flag) break;
                roll(nj);
                x = nx; y = ny;
            }
            top[x][y] = d.top;
            c[x][y] += 1;
        }

        REP(i, 200){
            REP(j, 200){
                if(top[i][j]>0){
                    output[top[i][j]-1]+=1;
                }
            }
        }

        REP(i, 6){
            cout << output[i];
            if(i!=5){
                cout << " ";
            } else {
                cout << endl;
            }
        }
    }
}

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

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

    vector<int> v(n);
    for(int i=0; i<n; i++) cin >> v[i];
    int count = 0;
    bool tall;

    for(int i=0; i<v.size(); i++) {
        for(int j=0; j<=i; j++) {
            if(v[i]<v[j]) {
                tall = false;
                break;
            }
            else tall = true;
        }
        if(tall) count++;
    }
    cout << count << endl;
}



Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  if (S.at(0) == S.at(1) && S.at(1) == S.at(2)) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}

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

using namespace std;

int main(){
	string str;
	getline(cin,str);
	for(int i=0;i<str.size();i++){
		if(str[i] == 'a' &&str[i+1] == 'p' && str[i+2]== 'p' && str[i+3] == 'l' && str[i+4] == 'e'){
			str[i] = 'p';
			str[i+1] = 'e';
			str[i+2] = 'a';
			str[i+3] = 'c';
			str[i+4] = 'h';
		}else if(str[i] == 'p' &&str[i+1] == 'e' && str[i+2]== 'a' && str[i+3] == 'c' && str[i+4] == 'h'){
			str[i] = 'a';
			str[i+1] = 'p';
			str[i+2] = 'p';
			str[i+3] = 'l';
			str[i+4] = 'e';
		}
	}
	cout << str << endl;
}

/*	string str;
	getline(cin,str);
	for(int i=0;i<str.size();i++){
		if(str.find("apple") != string::npos){
			str.replace(str.find("apple"),5,"peach");
		}
		if(str.find("peach") != string::npos){
			str.replace(str.find("peach"),5,"apple");
		}
	}
	cout << str << endl;
}*/

Measured memory_bytes: 1172
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

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

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}


int main() {
    ll n;
    cin >> n;
    vector<vector<ll>> z(n);
    map<pair<ll,ll>,ll> mp;
    vector<pair<ll, ll>> p(n-1);
    for (int i = 0; i < n - 1; i++) {
        ll a, b;
        cin >> a >> b;
        z[a - 1].push_back(b - 1);
        z[b - 1].push_back(a - 1);
        p[i] = make_pair(a - 1, b - 1);
    }
    ll anso = 0;
    for (int i = 0; i < n - 1; i++) {
            ll g = z[i].size();
            anso = max(anso, g);
    }
    cout << anso << endl;
    queue<ll> q;
    vector<int> fl(n);
    fl[0] = 9999999;
    q.push(0);
    
    while (!q.empty()) {
        ll k = 1;
        for (int i = 0; i < z[q.front()].size(); i++) {
            if (k == fl[q.front()])k++;
            if (fl[z[q.front()][i]] == 0) {
                fl[z[q.front()][i]] = k;
                ll ak = q.front();
                ll bk = z[q.front()][i];
                mp[make_pair(min(ak, bk), max(ak, bk))] = k;
                q.push(z[q.front()][i]);
                k++;
            }
            
        }
        q.pop();
    }
    for (int i = 0; i < n - 1; i++) {
        cout << mp[p[i]] << endl;
    }
}

Measured memory_bytes: 14720