akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cstring>
#include<string>
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define SZ(a) (int)((a).size())
using namespace std;
typedef long long ll;
typedef double db;
typedef pair <int, int> Pii;
typedef pair <ll, int> Pli;
typedef unsigned long long ull;
const double eps = 1e-8;
const ll infll = 0x7fffffffffffffff;
const int mod = (int)(1e9) + 7;
const int inf = 0x7fffffff;
const int maxn = (int)(2e5) + 7;
const int maxm = 300;

int N, M, X, C[20], A[20][20], t[20], res = inf;
bool check(int p) {
	int now = 0;
	memset(t, 0, sizeof(t));
	for (int i = 0; i < N; i++) {
		if (p & (1 << i)) {
			now += C[i + 1];
			for (int j = 1; j <= M; j++) 
				t[j] += A[i + 1][j];
		}
	}
	for (int i = 1; i <= M; i++) if (t[i] < X) return false;
	res = min(res, now);
	return true;
}

int main() {
	
	// freopen("in.in", "r", stdin);
	scanf("%d%d%d", &N, &M, &X);
	for (int i = 1; i <= N; i++) {
		scanf("%d", &C[i]);
		for (int j = 1; j <= M; j++) scanf("%d", &A[i][j]);
	}
	int flg = 0;
	for (int p = 1; p < (1 << N); p++) 
		if (check(p)) flg = 1;
	if (!flg) puts("-1");
	else printf("%d\n", res);

	return 0;
}		


Measured memory_bytes: 3232
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define pdi pair<db,int>
#define mp make_pair
#define pb push_back
#define enter putchar('\n')
#define space putchar(' ')
#define MAXN 100005
#define eps 1e-8
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;char c = getchar();T f = 1;
    while(c < '0' || c > '9') {
    	if(c == '-') f = -1;
    	c = getchar();
    }
    while(c >= '0' && c <= '9') {
    	res = res * 10 + c - '0';
    	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
    	out(x / 10);
    }
    putchar('0' + x % 10);
}
int N,M,id[MAXN],conn;
int64 a[MAXN];
int fa[MAXN];
bool vis[MAXN];
int que[MAXN],ql,qr;
bool flag = 0;
bool cmp(int s,int t) {
    return a[s] < a[t];
}
int getfa(int x) {
    return fa[x] == x ? x : fa[x] = getfa(fa[x]);
}
void Solve() {
    read(N);read(M);
    for(int i = 1 ; i <= N ; ++i) {read(a[i]);id[i] = i;}
    sort(id + 1,id + N + 1,cmp);
    for(int i = 1 ; i <= N ; ++i) fa[i] = i;
    int x,y;
    conn = N;
    for(int i = 1 ; i <= M ; ++i) {
        read(x);read(y);
        ++x;++y;
        conn--;
        fa[getfa(x)] = getfa(y);
    }
    if(conn == 1) {puts("0");return;}
    ql = 1,qr = 0;
    int64 ans = 0;
    for(int i = 1 ; i <= N ; ++i) {
        int u = id[i];
        if(flag) {
            if(getfa(u) == getfa(que[ql])) que[++qr] = u;
            else {
                ans += a[que[ql]] + a[u];
                --conn;
                fa[getfa(u)] = getfa(que[ql]);
                ql++;
                if(qr == ql) flag = 0;
            }
        }
        else {
            if(vis[getfa(u)]) {
                if(ql == qr) {flag = 1;que[++qr] = u;}
                else if(getfa(que[ql]) == getfa(u)) {
                    ans += a[que[ql]] + a[que[ql + 1]];
                    --conn;
                    fa[getfa(que[ql + 1])] = getfa(que[ql]);
                    ql += 2;
                    que[++qr] = u;
                }
                else {
                    ans += a[u] + a[que[ql]];
                    --conn;
                    fa[getfa(que[ql])] = getfa(u);
                    ql++;
                }

            }
            else {
                que[++qr] = u;vis[getfa(u)] = 1;
            }
        }
        if(conn == 1) break;
        if(conn == 2 && qr - ql + 1 >= 2 && !flag) {
            ans += a[que[ql]] + a[que[ql + 1]];
            --conn;
            break;
        }
    }
    if(conn != 1) {puts("Impossible");}
    else {out(ans);enter;}
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  int n,m;
  cin>>n>>m;
  int a[n];ll sum=0;
  for(int i=0;i<n;i++){cin>>a[i];sum+=a[i];}
  //sort(a,a+n);
  double req=(double)(sum)/(double)(4*m);
  int ct=0;
  for(int i=0;i<n;i++)
  {
  	if(a[i]>=req)ct++;
  }
  if(ct<m)cout<<"No";
  else cout<<"Yes";
  
  
  
}

Measured memory_bytes: 256
O = input()
E = input()

flg = 0
res = str()

l = [""] * 100
#print(l)
if len(O) != len(E):
    E += " "
    flg = 1

for i in range(len(O)):
    #print(i)
    l[i*2] = O[i]
    l[i*2+1] = E[i]
else:
    for j in range(len(l)):
        res += l[j]
    if flg == 1:
        res = res[0:len(res)-1]

print(res)
#print(len(res))


Measured memory_bytes: 3064
#include <stdio.h>
int main(void){
    int H,W;
    int i, j;
    
    while(1){
    scanf("%d %d",&H,&W);
    if( H == 0 && W == 0) break;
    
    for ( i = 0; i < H; i++ ){
        for ( j = 0; j < W; j++ ){
        printf("#");
    }
    printf("\n");
    }
    printf("\n");
}
 return 0;
}


Measured memory_bytes: 2044
/***** TheAnshul *****/

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll int,ll int>
#define msi         map<string,ll int>
#define mis         map<ll int, string>
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define mpi         map<pair<ll int,ll int>,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define vii         vector<pair<ll int, ll int>>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;
#define N  100005
ll n,k;
ll dp[N];
void solve()
{
	cin>>n>>k;
	ll a[n];
	rep(i,0,n)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	dp[0]=0;
	rep(i,1,k+1)
	{
		bool f=1;
		rep(j,0,n)
		{
			if(i-a[j]<0)
				break;
			f&=dp[i-a[j]];
			if(!f)
				break;
		}
		dp[i]=!f;
	}
	if(dp[k])
		cout<<"First";
	else
		cout<<"Second";
	return;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		solve();
	}
	time
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
  
using namespace std;
using namespace __gnu_pbds;
 
#define ll long long
#define uint unsigned int
#define ull  unsigned long long
#define pb push_back
#define mk make_pair
#define ins insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define X first
#define Y second
#define umap unordered_map
#define speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define setvalue(d,s,e,n) for(int qwe = s; qwe < e; ++qwe) d[qwe] = n
#define mset multiset
#define pqueue priority_queue
   
template<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
        
const int  N = 2e5 + 314;
const int INF = 1e9;
const double PI = acos(-1);
const int MOD = 1e9 + 7;
const double eps = 1e-9;
const long long LINF = 1e18 + 3141;
 
void solve(){
    ll n, d;
    cin >> n >> d;
    d = d * d;
    int ans = 0;
    for(int i = 1; i <= n; ++i) {
        ll p, q;
        cin >> p >> q;
        if(p * p + q * q <= d)
            ++ans;
    }
    cout << ans << '\n';
}
 
int main(){
    speed();
    int t = 1;
    // cin >> t;
    while(t--)solve();
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
int main(void){
    int a,b;
    std::cin >> a >> b;
    if(a % 2 == 1 && b % 2 == 1){
        std::cout << "Yes" << std::endl;
    }
    else{
        std::cout << "No" << std::endl;
    }
}


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

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

template <class T>
inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

const int iINF = 1e9;
const long long llINF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

int main() {
    string S;
    cin >> S;
    deque<char> d;
    REP(i, S.size()) { d.push_back(S[i]); }
    int Q;
    cin >> Q;
    bool is_rev = false;
    REP(i, Q) {
        int t;
        cin >> t;
        if (t == 1) {
            is_rev = !is_rev;
        } else if (t == 2) {
            int f;
            char c;
            cin >> f >> c;
            if (f == 1) {
                if (!is_rev) {
                    d.push_front(c);
                } else {
                    d.push_back(c);
                }
            } else {
                if (!is_rev) {
                    d.push_back(c);
                } else {
                    d.push_front(c);
                }
            }
        }
    }

    if (is_rev) {
        REP(i, d.size()) {
            cout << d[d.size() - i - 1];
        }
    } else {
        REP(i, d.size()) {
            cout << d[i];
        }
    }
    cout << endl;
    return 0;
}

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

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int N, T, A;
	cin >> N >> T >> A;
	vector<int> H(N);
	for (int i = 0; i < N; i++) {
		cin >> H.at(i);
	}
	int ans = 0;
	double tmp = abs(T - H.at(0)*0.006 - A);
	for (int i = 1; i < N; i++) {
		double tmpp;
		tmpp = abs(T - H.at(i)*0.006 - A);
		if ( tmpp < tmp ) {
			tmp = tmpp;
			ans = i;
		}
	}
	cout << ans+1 << endl;
}


Measured memory_bytes: 256
def main():
    D = int(input())
    c = list(map(int, input().split()))
    s = [list(map(int, input().split())) for _ in range(D)]
    t = [int(input()) for _ in range(D)]

    d = [0] * 26

    ans = 0
    days = 0
    for tt in t:
        for i in range(26):
            d[i] += 1
        d[tt-1] = 0
        ans += s[days][tt-1]
        for i in range(26):
            ans -= d[i] * c[i]
        print(ans)
        days += 1


if __name__ == "__main__":
    main()


Measured memory_bytes: 9400
#include <iostream>
#include <vector>

using namespace std;

template <typename T>
class FenwickTree {
  private:
    vector<T> ft;
    T zero;

    inline T LSOne(T n) {
      return n & -n;
    }
  public:
    FenwickTree(int n, T z) {
      zero = z;
      ft.assign(n + 1, z);
    }

    int rsq(int b) {
      int sum = 0;
      for (; b; b -= LSOne(b)) sum += ft[b];
      return sum;
    }

    int rsq(int a, int b) {
      return rsq(b) - (a == 1 ? zero : rsq(a - 1));
    }

    void adjust(int k, T v) {
      for (; k < (int)ft.size(); k += LSOne(k)) ft[k] += v;
    }
};

int main(void) {
  int n, q;
  cin >> n >> q;

  auto ft = FenwickTree<int>(n, 0);
  for (int i = 0 ; i < q; i++) {
    int q, x, y;
    cin >> q >> x >> y;

    if (q == 0) {
      ft.adjust(x, y);
    } else {
      cout << ft.rsq(x, y) << endl;
    }
  }
}



Measured memory_bytes: 3116
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<limits.h>
#include<utility>
#include<vector>
//#include<bits/stdc++.h>
#include<tuple>
#include<queue>
#include<map>
#include<algorithm>
//#include <bits/stdc++.h>


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

bool _predicate(int a,const int& element) {
	return (element == a); // This will cause all elements to be deleted that are larger than 3
}
struct UnionFind {
	vector<ll> par;
	UnionFind(int n): par(n) {
		rep(i, n) {
			par[i] = i;
		}
	}
	int root(int n) {
		if (par[n] == n)return n;
		return par[n] = root(par[n]);
	}
	void unite(int x, int y) {
		ll rx = root(x), ry = root(y);
		if (rx == ry)return;
		par[rx] = ry;
	}
	bool same(int x, int y) {
		int rx = root(x), ry = root(y);
		return rx == ry;
	}
};
int main() {
	int n, m;
	cin >> n >> m;
	UnionFind uf(n);
	rep(i, m) {
		ll a, b;
		cin >> a >> b;
		a--; b--;
		uf.unite(a, b);
	}
	rep(i, n) {
		uf.root(i);
	}
	vector<ll>  ans(n);
	ll max = 0;
	rep(i, n) {
		ans[uf.par[i]]++;
		ll x = ans[uf.par[i]];
		if (x > max)max = x;
	}
	cout << max << endl;
}

Measured memory_bytes: 11988
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A - F
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

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

  if (a + b == 15) putchar('+');
  else if (a * b == 15) putchar('*');
  else putchar('x');
  putchar('\n');
  
  return 0;
}


Measured memory_bytes: 256
n = int(input())
s = [int(input()) for _ in range(n)]

s.sort()

point = sum(s)

if point%10 == 0:
    for i in s:
        if i%10 != 0:
            point -= i
            break

if point%10 == 0:
    print(0)
else:
    print(point)

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

using namespace std;

#define ll long long

//#define TEST

signed main(){
    int n,w;
    cin >> n >> w;
    int* weight = new int[n];
    int* value = new int[n];
    for (int i = 0;i < n;++i)
        cin >> weight[i] >> value[i];

    int w1 = weight[0];
    vector<int> items1; // 重さw1のitemのvalue
    vector<int> items2; // 重さw1+1のitemのvalue
    vector<int> items3; // 重さw1+2のitemのvalue
    vector<int> items4; // 重さw1+3のitemのvalue
    for (int i = 0;i < n;++i){
        if (weight[i] == w1)
            items1.push_back(value[i]);
        else if (weight[i] == w1 + 1)
            items2.push_back(value[i]);
        else if (weight[i] == w1 + 2)
            items3.push_back(value[i]);
        else if (weight[i] == w1 + 3)
            items4.push_back(value[i]);
    }
#ifdef TEST
    cout << "--------items1--------" << endl;
    for (auto wi : items1)
        cout << wi << " ";
    cout << endl;
#endif

    sort(items1.begin(),items1.end());
#ifdef TEST
    cout << "----items1(sorted)----" << endl;
    for (auto wi : items1)
        cout << wi << " ";
    cout << endl;
#endif
    sort(items2.begin(),items2.end());
    sort(items3.begin(),items3.end());
    sort(items4.begin(),items4.end());

    vector<ll> m1{0}; // m1[i] : 重さw1の中からi個取るときの最大値
    vector<ll> m2{0}; // m2[i] : 重さw1+1の中からi個取るときの最大値
    vector<ll> m3{0}; // m3[i] : 重さw1+2の中からi個取るときの最大値
    vector<ll> m4{0}; // m4[i] : 重さw1+3の中からi個取るときの最大値

    for (int i = items1.size() - 1;i >= 0;--i){
        auto last = m1.end() - 1;
        m1.push_back(*last + items1[i]);
    }
#ifdef TEST
    cout << "----------m1----------" << endl;
    for (auto wi : m1)
        cout << wi << " ";
    cout << endl;
#endif
    for (int i = items2.size() - 1;i >= 0;--i){
        auto last = m2.end() - 1;
        m2.push_back(*last + items2[i]);
    }
    for (int i = items3.size() - 1;i >= 0;--i){
        auto last = m3.end() - 1;
        m3.push_back(*last + items3[i]);
    }
    for (int i = items4.size() - 1;i >= 0;--i){
        auto last = m4.end() - 1;
        m4.push_back(*last + items4[i]);
    }


    ll ans = 0;
    for (int i = 0;i < m1.size();++i){
        for (int j = 0;j < m2.size();++j){
            for (int k = 0;k < m3.size();++k){
                for (int l = 0;l < m4.size();++l){
                    ll wei = 0;
                    wei += (ll)w1 * i;
                    wei += ((ll)w1 + 1) * j;
                    wei += ((ll)w1 + 2) * k;
                    wei += ((ll)w1 + 3) * l;
                    if (wei <= w)
                        ans = max(ans,m1[i] + m2[j] + m3[k] + m4[l]);
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n;

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  cin >> n;
  vi v2,v1;
  for(int i=1;i<=n;i++){
    int x,y;
    cin >> x >> y;
    v1.pb(x+y);
    v2.pb(x-y);
  }
  sort(all(v1));
  sort(all(v2));
  cout << max(v1.back()-v1[0],v2.back()-v2[0]) << endl;


return 0;
}
///....


Measured memory_bytes: 6700
#######################################
import numpy as np
import math
import copy
import re
import sys
#sys.exit(0)

inf = float("inf")
prime = 1

def check_print(check_flag, text, end="\n"):
  if check_flag:
    print(text, end=end)

def c2i(x):
    if str.isdecimal(x):
        return int(x)
    else:
        return x

def cout(*args):
  arglist = []
  for arg in args:
    if hasattr(arg, "__iter__"):
      arglist.extend(arg)
    else:
      arglist.append(arg)
      
  arglist = list(map(str, arglist))
  print(" ".join(arglist))
  
def count2(num):
  count=0
  while num%2==0:
    num/=2
    count+=1
  return count

def ketasum(num):
  nums = [int(s) for s in str(num)]
  return sum(nums)

#math
def gcd(a, b): #最大公約数
  while b:
    a, b = b, a % b
  return a

def lcm(a, b): #最小公倍数
  return a * b // gcd (a, b)

def gcd3(lis): #最大公約数(3over)
  ans = lis[0]
  for li in lis:
    ans = gcd(ans,li)

def lcm3(lis): #最小公倍数(3over)
  ans = lis[0]
  for li in lis:
    ans = lcm(ans,li)

def divisor(n): #nの約数を全て求める
  i = 1
  table = []
  while i * i <= n:
    if n%i == 0:
      table.append(i)
      table.append(n//i)
    i += 1
  table = list(set(table))
  return table

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

def is_prime(n):
  for i in range(2, n + 1):
    if i * i > n:
      break
    if n % i == 0:
      return False
  return n != 1

#input stock
"""
n = int(input())

#list
a = map(int, input().split())
a,b = map(int, input().split())

d=[]
for i in range(n):
  d[i]=int(input())

#2dim-list
a = [list(map(int, input().split())) for i in range(n)]

s = input()
ss =  [int(si) for si in s]
"""

#processing stock
"""
a = sorted(a)
a = sorted(a, reverse=True)

"""

#regex
"""
pattern = ""
result = re.search(pattern, s)

result = re.fullmatch(pattern, s)

result = re.finditer(pattern, s)
for res in result:
    print res.group()   # 1回目: ca      2回目: ca   
    print res.start()   # 1回目: 0       2回目: 6      
    print res.end()     # 1回目: 2       2回目: 8      
    print res.span()    # 1回目: (0, 2)  2回目: (6, 8)
"""

def strnum(st):
  st = list(st)
  for i in range(len(st)):
    tmp = st[i] + str(st[i:].count(st[i]))
    st[i] = str(tmp)
  return st

def strsort(st):
  st = list(st)
  st = sorted(st)
  return "".join(st)

def kai(num):
  if num==1:
    return 1
  else:
  	return num * kai(num-1)

def choose(num):
  return int(num*(num-1)/2)
  
import collections
#######################################
n = int(input())
s = [""]*n
for i in range(n):
  s[i] = strsort(input())

#s = sorted(s)
c = collections.Counter(s)
count=0
for v in c.values():
  count += choose(v)

print(count)

Measured memory_bytes: 28552
// atcoder/abc045/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int a, b, h;
  while (cin >> a >> b >> h) {
    cout << (a + b) * h / 2 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
N, M, K = gets.split.map{|i|i.to_i}
F = Array.new(N){[]}
group_id = Array.new(N){|i|i}
groups = Array.new(N){|i|[i]}
M.times{
	a, b = gets.split.map{|i|i.to_i - 1}
	F[a] << b
	F[b] << a
	#warn "a:%d b:%d" % [a, b]
	next if group_id[a] == group_id[b]
	ga = groups[group_id[a]]
	gb = groups[group_id[b]]
	if ga.size < gb.size
		groups[group_id[a]] = nil
		ga.each{|i|
			group_id[i] = group_id[b]
			gb << i
		}
	else
		groups[group_id[b]] = nil
		gb.each{|i|
			group_id[i] = group_id[a]
			ga << i
		}
	end
}
#warn F.inspect
#warn group_id.inspect
#warn groups.inspect
result = Array.new(N){|i|
	groups[group_id[i]].size - 1 - F[i].size
}
#warn result.inspect
K.times{
	c, d = gets.split.map{|i|i.to_i - 1}
	if group_id[c] == group_id[d]
		result[c] -= 1
		result[d] -= 1
	end
}
puts result * " "


Measured memory_bytes: 29180
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int INF = pow(2,29);
const int MOD = 1000000007;

int main() {
  int N, K; cin >> N >> K;
  string S; cin >> S;
  S[K-1] += 0x20;
  cout << S << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long INF=1LL<<60;
//set<int>::iterator it;

int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	bool a[4]={false};
	string s;
	cin>>s;
	int i;
	for(i=0;i<s.length();i++){
		if(s[i]=='S')a[0]=true;
		else if(s[i]=='E')a[1]=true;
		else if(s[i]=='N')a[2]=true;
		else if(s[i]=='W')a[3]=true;
	}
//	cout<<a[0]<<a[2]<<a[1]<<a[3]<<endl;
	if(a[0]==a[2]&&a[1]==a[3])cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	
	
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (ll i = 0; i < n; i++)
#define IREP(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(a, b) for (ll i = a; i < b + 1; i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template <class T>inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}

int main()
{
    string s;
    cin >> s;
    int now = 0;
    int ans = 0;
    REP(i, s.size())
    {
        if (s[i] == 'g')
        {
            if (now != 0)
            {
                now--;
                ans++;
            }
            else
            {
                now++;
            }
        }
        else
        {
            if (now != 0)
            {
                now--;
            }
            else
            {
                now++;
                ans--;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
from bisect import bisect_left
from itertools import product
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
#文字列を一文字ずつ数字に変換、'5678'を[5,6,7,8]とできる
def LSI(): return list(map(int, list(sys.stdin.readline().rstrip())))
def LSI2(N): return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)]
#文字列として取得
def ST(): return sys.stdin.readline().rstrip()
def LST(): return sys.stdin.readline().rstrip().split()
def LST2(N): return [sys.stdin.readline().rstrip().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6+10)

def comb(n,r,mod): #nが大きく、rが小さい時に活用
    ans = 1
    for i in range(r):
        ans *= n-i
        ans %= mod
    d = math.factorial(r)
    d %= mod
    d = pow(d,mod-2,mod)
    ans *= d
    ans %= mod
    return ans

N,A,B = MI()
ans = pow(2,N,MOD)-1
ans -= comb(N,A,MOD)
ans -= comb(N,B,MOD)
print(ans%MOD)


Measured memory_bytes: 93272
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
#include <cmath>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =1001001001;

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




/*10億7。　　　100000007
2*2行列 H*W
vector<vector<int>> vec(H,vector<int>(W));
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>vec[i][j];
  }
}

文字列→数列
string S;int A=atoi(S.c_str());
数列→文字列
int A;string S=to_string(A);
数字判定　isdigit(a)
pair宣言　pair<int,int> p(5,7);
ソート　sort(vec.begin(),vec.end());
キュー　queue<int> q;
   q.push(7);　//７が入る
   cout << q.front() << endl;  // 先頭の値を出力
   q.pop();  // 先頭の値を削除
   q.empty();
*/
//座標　corrdinateト深さヲ保持スルタメノ構造体
struct Coor{
  ll y;
  ll x;
  ll depth;
};
 ll N,M;  
 ll sy,sx,gy,gx;
 ll y,x,depth;//キューから取り出した座標
vector<string> vec;
queue<Coor> q;
vector<ll> y_vec={0,0,-1,+1};//technique
vector<ll> x_vec={-1,+1,0,0};

int BFS(){
  while(!q.empty()){
    Coor now=q.front();q.pop();//キューの先頭を取り出す
    y=now.y,x=now.x,depth=now.depth;
    
    //停止条件
    if(y==gy&&x==gx){return depth;}
    
    //上下左右４方向を探索、進むことができればキューに格納
    for(int i=0;i<4;i++){
      Coor next={y+y_vec[i],x+x_vec[i],depth+1};
      if(0<=next.y&&next.y<=N-1&&0<=next.x&&next.x<=M-1&&vec[next.y][next.x]=='.'){
        vec[next.y][next.x]='x';//同じ場所を探索しないようにする
        q.push(next);
      }
    }
  }
  return 0;
}
                   
  


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

string A,B,C;
  cin>>A>>B>>C;
  cout<<A[0]<<B[1]<<C[2]<<endl;
 

  
  
}



Measured memory_bytes: 256
L = [int(input()) for i in range(5)]
l = [n % 10 if not (n % 10 == 0) else 100 for n in L]
i = l.index(min(l))
I = 10 - (L[i] % 10) + L[i] if not(L[i] % 10 == 0) else L[i]
SUM = sum([n + 10 - (n % 10) if not (n % 10 == 0) else n for n in L])
# print(i, I, SUM)
ans = SUM - I + L[i]
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<double,ll> P;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;

const int mod = 1000000007;
//const int mod = 998244353;
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;}

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

mint dp[110][100010];
int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll>a(n);
    rep(i,n)cin>>a[i];
    rep(i,110)rep(j,100010)dp[i][j]=0;
    dp[0][0]=1;
    rep(i,k+1){
        dp[0][i+1]+=dp[0][i];
    }
    for(int i=1;i<=n;i++){
        rep(j,k+1){
            if(j-a[i-1]-1<0)dp[i][j]+=dp[i-1][j];
            else dp[i][j]+=dp[i-1][j]-dp[i-1][j-a[i-1]-1];
            dp[i][j+1]+=dp[i][j];
        }
    }
    cout << dp[n][k]-dp[n][k-1] << endl;
    return 0;
}


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

int main() {
    int n;
    cin >> n;
   
    vector<int> S(n);
    rep(i, n) cin >> S[i];

    int q;
    cin >> q;

    int ans = 0;
    rep(i, q) {
        int qi;
        cin >> qi;

        int num_i = lower_bound(S.begin(), S.end(), qi+1) - lower_bound(S.begin(), S.end(), qi);
        if (num_i > 0) ans++;
    }

    cout << ans << endl;

    return 0;
}




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

#define MAX 3

int cnt[4];

int main() {
	for( int i = 0; i < MAX; i++ ) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		cnt[a]++;
		cnt[b]++;
	}

	int cnt1 = 0;
	int cnt2 = 0;
	for( int i = 0; i < 4; i++ ) {
		if( cnt[i] == 2 ) {
			cnt2++;
		}
		else if( cnt[i] == 1 ) {
			cnt1++;
		}
	}

	if( cnt2 == 2 && cnt1 == 2 ) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

/* UnionFind */

struct UnionFind{
  vector<int> data;
  UnionFind(int s):data(s, -1) {}

  int root(int x){
    if(data[x] < 0) return x;
    return data[x] = root(data[x]);
  }

  bool set(int x,int y){
    x = root(x); y = root(y);
    if(x == y) return false;
    data[x] += data[y];
    data[y] = x;
    return true;
  }

  bool check(int x, int y){
    return root(x) == root(y);
  }

  int size(int x){
    return -data[root(x)];
  }
};



int main(){
  int n, m;
  int a[SIZE], b[SIZE];

  scanf("%d%d", &n, &m);

  for(int i=0;i<m;i++){
    scanf("%d%d", a+i, b+i);
    a[i]--; b[i]--;
  }

  ll ans[SIZE];
  UnionFind uf(n);

  ans[m-1] = (ll)n * (n-1) / 2;
  for(int i=m-1;i>=1;i--){
    if(uf.check(a[i], b[i])) {
      ans[i-1] = ans[i];
    } else {
      int p = uf.size(a[i]);
      int q = uf.size(b[i]);
      ans[i-1] = ans[i] - (ll)p * q;
      uf.set(a[i], b[i]);
    }
  }

  for(int i=0;i<m;i++){
    printf("%lld\n", ans[i]);
  }

  return 0;
}


Measured memory_bytes: 4480
N, M = map(int, input().split())
INF = 10**10
graph = [[INF for _ in range(N)] for _ in range(N)]

C = []
for i in range(M):
    a, b, c = map(int, input().split())
    graph[a-1][b-1] = c
    graph[b-1][a-1] = c
    C.append([a-1, b-1, c])

cnt = 0
for k in range(N):
    for i in range(N):
        for j in range(N):
            if(i == j):
                graph[i][j] = 0
                continue    
            graph[i][j] = min(graph[i][j], graph[i][k]+graph[k][j])

ans = M
for u, v, w in C:
    Flg = False
    for i in range(N):
        if(graph[i][v] + w == graph[i][u]):
            Flg = True
    if Flg:
        ans -= 1
print(ans)

Measured memory_bytes: 3444
n=int(input())
ans=0
nmcc=0
i=1
d=[]
while i*i<=n:
  if n%i==0:
    d.append(i)
    if i*i!=n:
      d.append(n//i)
  i+=1
for i in d:
  if i==1:
    continue
  tmp=n
  while tmp%i==0:
    tmp//=i
  tmp%=i
  if tmp==1:
    ans+=1

i=1
while i*i<=(n-1):
  if (n-1)%i==0:
    nmcc+=1
    if i*i!=n-1:
      nmcc+=1
  i+=1
nmcc-=1
print(ans+nmcc)
  

Measured memory_bytes: 3188
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();
        int l = sc.nextInt();
        
        int a[][] = new int[n][m];
        int b[][] = new int[m][l];
        int i,j,k;
        long c;
        
        for(i=0; i<n; i++){
            for(j=0; j<m; j++){
                a[i][j] = sc.nextInt();
            }
        }
        
        for(j=0; j<m; j++){
            for(k=0; k<l; k++){
                b[j][k] = sc.nextInt();
            }
        }
        
        for(i=0; i<n; i++){
            for(k=0; k<l; k++){
                c = 0;
                for(j=0; j<m; j++){
                    c += ( a[i][j] * b[j][k] );
                }
                if(k!=0) System.out.print(" ");
                System.out.print(c);
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 54572
#include <bits/stdc++.h>
using namespace std;
int main()
{
    //   #ifndef ONLINE_JUDGE
    //        freopen("input.txt", "r", stdin);
    //        freopen("output.txt", "w", stdout);
    //    #endif
       int n;
       cin>>n;
       int a[n+1],b[n+1],c[n+1];
       int i;
       for(i=1;i<=n;i++)
       {
           cin>>a[i]>>b[i]>>c[i];
       }
       vector<vector<int>> dp(n+1,vector<int>(4,0));
       int j;
       for(i=1;i<=n;i++)
       {
           if(i==1)
           {
               dp[i][1]=a[i];
               dp[i][2]=b[i];
               dp[i][3]=c[i];
           }
           else 
           {
               dp[i][1]=a[i]+max(dp[i-1][2],dp[i-1][3]);
               dp[i][2]=b[i]+max(dp[i-1][1],dp[i-1][3]);
               dp[i][3]=c[i]+max(dp[i-1][1],dp[i-1][2]);
           }
       }
       int ans=0;
       for(i=1;i<=3;i++)
       {
           ans=max(ans,dp[n][i]);
       }
       cout<<ans<<"\n";
}

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

ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

ll LCM(ll a,ll b){
    return a / GCD(a,b) * b;
}

const int MOD = 1000000007;

int main() {
    int N;
    cin >> N;
    int H[N];
    for (int i = 0; i < N; i++) {
      cin >> H[i];
    }
    for (int i = 1; i < N; i++) {
      if (H[i - 1] > H[i]) {
        cout << "No\n";
        return 0;
      } else {
        if (H[i] != H[i - 1]) {
          H[i] = H[i] - 1;
        }
      }
    }
    cout << "Yes\n";
    return 0;
    
    
}



Measured memory_bytes: 640
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static long MOD = 1_000_000_007;

	public static void main(String[] args) {
		int N = sc.nextInt();
		ArrayList<ArrayList<Integer>> g = new ArrayList<>();
		for (int i = 0; i < N; i++) {
			g.add(new ArrayList<>());
		}
		for (int i = 0; i < N - 1; i++) {
			int X = sc.nextInt() - 1;
			int Y = sc.nextInt() - 1;
			g.get(X).add(Y);
			g.get(Y).add(X);
		}
		int[] parent = new int[N];
		Arrays.fill(parent, -1);
		parent[0] = 0;
		int[] order = new int[N];
		for (int i = 0, pos = 1; i < N; i++) {
			int cur = order[i];
			for (int child : g.get(cur)) {
				if (parent[child] != -1) continue;
				order[pos++] = child;
				parent[child] = cur;
			}
		}
		parent[0] = -1;
		long[] white = new long[N];
		long[] black = new long[N];
		for (int i = N - 1; i >= 0; i--) {
			int cur = order[i];
			white[cur] = black[cur] = 1;
			for (int child : g.get(cur)) {
				if (child == parent[cur]) continue;
				white[cur] *= white[child] + black[child];
				white[cur] %= MOD;
				black[cur] *= white[child];
				black[cur] %= MOD;
			}
		}
		System.out.println((white[0] + black[0]) % MOD);
	}
}

Measured memory_bytes: 106560
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <map>
#include <math.h>
 
using namespace std;
 
typedef signed long long ll;
 
int main(void)
{
    long long count = 0;
    int N = 0;
    cin >> N;
 
    vector<int> A(N, 0);
    vector<int> B(N, 0);
    vector<int> C(N, 0);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    for (int i = 0; i < N; i++)
    {
        cin >> B[i];
    }
    sort(B.begin(), B.end());
    for (int i = 0; i < N; i++)
    {
        cin >> C[i];
    }
    sort(C.begin(), C.end());
 
    long long ab = 0;
    long long bc = 0;
    for (int j = 0; j < N; j++, ab = 0, bc = 0)
    {
        auto it_A = lower_bound(A.begin(), A.end(), B[j]);
        ab = distance(A.begin(), it_A);
        auto it_C = upper_bound(C.begin(), C.end(), B[j]);
        bc = N - distance(C.begin(), it_C);
 		
        count = count + (ab * bc);
    }
 
    cout << count << endl;
 
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
typedef long long ll;
const int mod = 1e9 + 7;
int main() {

    int a, b , c;
    cin >> a >> b >> c;

    if(a+b+c >= 22){
        cout << "bust" << endl;
    }
    else{
        cout << "win" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int
main ()
{
  int W, H, x, y, r, a, b, c, d;
  cin >> W >> H >> x >> y >> r;
 a = x + r;
  b = y + r;
c= x-r;
d=y-r;
  if (c < 0 ||a > W|| d < 0 || b > H)
    {
      cout << "No" << endl;
    }
  else
    {
      cout << "Yes" << endl;
    }


  return 0;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define vc(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
  int a,m,b,n,k;
  cin>>a>>m>>b>>n>>k;
  int min = 0;
  min += (b-a)*60;
  min += n;
  min -= m;
  min -= k;
  cout << min << endl;

  return 0;
}

Measured memory_bytes: 3636
# coding: utf-8

import numpy as np

N, M, C = map(int, input().split())
B = np.array(list(map(int, input().split())))

ans = 0

for __ in range(N):
    A = np.array(list(map(int, input().split())))
    tmp = A * B
    
    if np.sum(tmp) + C > 0:
        ans += 1

print(ans)


Measured memory_bytes: 12488
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Here your code !
    Scanner scan = new Scanner(System.in);
    
    int[] m = new int[10];
    for (int i =0 ; i<10 ;i++)
        m[i] = scan.nextInt();
        
    Arrays.sort(m);
    for( int i=9;i>=7;i--)
    System.out.println(m[i]);
    
    }
}

Measured memory_bytes: 26120
#include <math.h>

#include <algorithm>
#include <bitset>
#include <iostream>
#include <queue>
#include <sstream>
#include <vector>

using namespace std;

const int INF = 10000000;
typedef pair<int, int> P;

int main() {
  int H, W, N;
  cin >> H >> W;
  vector<vector<char>> field(H, vector<char>(W));
  vector<vector<int>> d(H, vector<int>(W));
  int white_num = 0;
  queue<P> que;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> field[i][j];
      d[i][j] = INF;
      if (field[i][j] == '#') {
        que.push(P(i, j));
        d[i][j] = 0;
      }
    }
  }
  int dx[4] = {1, -1, 0, 0};
  int dy[4] = {0, 0, 1, -1};

  int ans = 0;
  while (que.size()) {
    P p = que.front();
    que.pop();
    for (int i = 0; i < 4; i++) {
      int nx = p.first + dx[i];
      int ny = p.second + dy[i];
      if (0 <= nx && nx < H && 0 <= ny && ny < W && field[nx][ny] != '#' &&
          d[nx][ny] == INF) {
        que.push(P(nx, ny));
        d[nx][ny] = d[p.first][p.second] + 1;
        ans = max(ans, d[nx][ny]);
      }
    }
  }

  cout << ans << endl;

  return 0;
}


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

int x,y,z;

int main() {
	cin >> x >> y;
	for (int i = 0; i <= x; i++) {
		int tmp = y-i;
		if (tmp >= 0) {
			z += max(0, min(tmp+1, x-(tmp-x)+1));
		}
	}
	cout << z << "\n";
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
using namespace std;
int m, n, w[200009], t[200009], sw[200009], st[200009], c[16], b[16], dp[1 << 15];
int main() {
	cin >> m >> n;
	for (int i = 0; i < m; i++) cin >> w[i] >> t[i];
	for (int i = 0; i < m; i++) {
		sw[i + 1] = sw[i] + w[i];
		st[i + 1] = st[i] + t[i];
	}
	sw[m + 1] = st[m + 1] = 999999999;
	for (int i = 0; i < n; i++) cin >> c[i] >> b[i];
	for (int i = 1; i < 1 << n; i++) {
		for (int j = 0; j < n; j++) {
			if (!(i & (1 << j))) continue;
			int val = dp[i - (1 << j)];
			int ptr1 = lower_bound(sw, sw + m + 1, c[j] + sw[val] + 1) - sw - 1;
			int ptr2 = lower_bound(st, st + m + 1, b[j] + st[val] + 1) - st - 1;
			dp[i] = max(dp[i], min(ptr1, ptr2));
		}
	}
	cout << dp[(1 << n) - 1] << endl;
	return 0;
}

Measured memory_bytes: 6224
import java.util.Scanner;
 
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 temp = x;
      	x = y;
      	y = temp;
      	temp = x;
      	x = z;
      	z = temp;
      	System.out.println(x + " " + y + " " + z);
    }
}

Measured memory_bytes: 39288
import java.util.Scanner;

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

		long tmp = 0;
		long max = 0;
		long now = 0;
		long result = 0;
		for(int i=0;i < N;i++) {
			now = sc.nextLong();
			if(now > max) {
				max = now;
			}

			if(now < max) {
				result = result + (max - now);
			}
		}

		sc.close();
		System.out.println(result);

	}

}

Measured memory_bytes: 48392
#include <algorithm>
#include <cstdio>
#include <bitset>
#include <functional>
#include <tuple>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < int(n); ++(i))
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
using ll = long long;
using namespace std;
template <class T> inline void setmax(T & a, T const & b) { a = max(a, b); }

constexpr int max_v = 100000;
int main() {
    // input
    int v, e; scanf("%d%d", &v, &e);
    vector<vector<int> > g(v);
    repeat (i, e) {
        int a, b; scanf("%d%d", &a, &b); -- a; -- b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    // solve
    bool is_impossible = false;
    vector<pair<int, int> > component_size; {
        vector<char> color(v);
        function<bool (int, char, int &, int &)> go = [&](int i, char c, int & red_count, int & black_count) {
            if (color[i]) return color[i] == c;
            color[i] = c;
            (c == 'R' ? red_count : black_count) += 1;
            char d = c ^ 'R' ^ 'B';
            for (int j : g[i]) {
                if (not go(j, d, red_count, black_count)) {
                    return false;
                }
            }
            return true;
        };
        repeat (i, v) if (not color[i]) {
            int red_count = 0;
            int black_count = 0;
            if (go(i, 'R', red_count, black_count)) {
                component_size.emplace_back(red_count, black_count);
            } else {
                is_impossible = true;
                break;
            }
        }
    }
    ll result = -1;
    if (not is_impossible) {
        bitset<max_v+1> dp = {};
        dp[0] = true;
        for (auto it : component_size) {
            int a, b; tie(a, b) = it;
            dp = (dp << a) | (dp << b);
        }
        repeat (a, v+1) if (dp[a]) {
            ll b = v - a;
            setmax(result, a * b - e);
        }
    }
    // output
    printf("%lld\n", result);
    return 0;
}

Measured memory_bytes: 8772