akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REP1(i, n) for (int i = 1; i < n + 1; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
typedef long long ll;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;
    if (w >= v)
    {
        cout << "NO" << endl;
    }
    else
    {
        if (abs(b - a) <= t * (v - w))
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
}


Measured memory_bytes: 3648
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

signed main(void)
{
	ll n;
	cin >> n;
	ll sum = 1;
	FOR(i, 1, n+1) sum *= i;
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b,c,t;
    cin>>a>>b>>c;
    t=c-b-a;
    //cout<<t<<endl;
    //cout<<(t*t)<<endl;cout<<(4*a*b)<<endl;
    if(t>0 && (t*t)>(4*a*b))
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char a[102];
	cin>>a;
	for(int i=0;i<strlen(a);i++)
		if(a[i]=='C')
			for(int j=i+1;j<strlen(a);j++)
				if(a[j]=='F')
				{
					cout<<"Yes"<<endl;
					return 0;
				}
	cout<<"No"<<endl; 
	return 0;
} 

Measured memory_bytes: 256
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];


int main()
{
    ll n,k,i,j,cc=0;
    cin>>n>>k;
    ll arr[n];for(i=0;i<n;i++)cin>>arr[i];sort(arr,arr+n,greater<ll>());
    k--;
    for(i=0;i<n;i++){
        if(i>k)cc+=arr[i];
    }
    cout<<cc<<endl;
return 0;
}


Measured memory_bytes: 6528
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from collections import defaultdict

"""
・最小カット
・頂点でカットする場合には、v_in, v_outに分ける
・v_in, v_outの間に容量1の辺
・sourceから、ヤギ_outに容量無限大の辺
・外周_outから、sinkに容量無限大の辺
"""

H,W = map(int,readline().split())
S = b''.join(read().split())

INF = 10**12

source = -1
sink = -2
graph = defaultdict(dict)
for i in range(H*W):
    h,w = divmod(i,W)
    if S[i] == ord('.'):
        graph[i+i][i+i+1] = 1
        graph[i+i+1][i+i] = 0
    else:
        graph[source][i+i+1] = INF
        graph[i+i+1][source] = 0
    for dh,dw in ((1,0),(-1,0),(0,1),(0,-1)):
        h1 = h + dh; w1 = w + dw
        if 0 <= h1 < H and 0 <= w1 < W:
            j = h1 * W + w1
            graph[i+i+1][j+j] = 1
            graph[j+j][i+i+1] = 0
        else:
            # 画面外
            graph[i+i+1][sink] = INF
            graph[sink][i+i+1] = 0

class Dinic():
    def __init__(self,graph,V,source,sink):
        self.graph = graph
        self.sink = sink
        self.source = source
        self.V = V
        self.compress()
        
    def compress(self):
        self.N = len(self.V)
        v_to_i = {x:i for i,x in enumerate(self.V)}
        self.sink = v_to_i[self.sink]
        self.source = v_to_i[self.source]
        g = [dict() for _ in range(self.N)]
        for v,e in self.graph.items():
            vn = v_to_i[v]
            g[vn] = {v_to_i[w]:c for w,c in e.items()}
        self.graph = g
        
    def bfs(self):
        level = [0]*self.N
        q = [self.source]
        level[self.source] = 1
        d = 1
        while q:
            if level[self.sink]:
                break
            qq = []
            d += 1
            for v in q:
                for w,cap in self.graph[v].items():
                    if cap == 0:
                        continue
                    if level[w]:
                        continue
                    level[w] = d
                    qq.append(w)
            q = qq
        self.level = level
        
    def dfs(self,v,f):
        if v == self.sink:
            return f
        for w,cap in self.itr[v]:
            if cap == 0 or self.level[w] != self.level[v] + 1:
                continue
            d = self.dfs(w,min(f,cap))
            if d:
                self.graph[v][w] -= d
                self.graph[w][v] += d
                return d
        return 0
    
    def max_flow(self):
        INF = 10**18
        flow = 0
        while True:
            self.bfs()
            if self.level[self.sink] == 0:
                break
            self.itr = [iter(e.items()) for e in self.graph]
            while True:
                f = self.dfs(self.source,INF)
                if f == 0:
                    break
                flow += f
        return flow

f = Dinic(graph,set(graph),source,sink).max_flow()

answer = f if f < INF else -1
print(answer)

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

#define MOD 998244353
LL powmod(LL a, LL n){
	if(n == 0) return 1;
	if(n % 2) return (a*powmod(a,n-1)) % MOD;
	LL c = powmod(a, n/2);
	return (c*c) % MOD;
}
LL inv(LL a){
	return powmod(a, MOD-2);
}
LL fact[1100000];
LL invfact[1100000];
LL p2[1100000];
LL ncr(LL n, LL r){
	if(r < 0 || n < 0) return 0;
	if(n < r) return 0;
	LL a = fact[n];
	a = (a * invfact[r]) % MOD;
	a = (a * invfact[n-r]) % MOD;
	return a;
}
LL finalans = 0;
LL solve2(LL a, LL b, LL c){
	if(b == 0){
		if(a == 0 && c == 0){
			return 1;
		}
		return 0;
	}
	if(a == 0) return ncr(b-1+c,b-1);
	if(c == 0) return ncr(b-1+a,b-1);
	return ncr(a-1+b+c-1+1,b-1);
}

void solve(string a, string b, string c, string d){
	LL na = 0;
	LL nb = 0;
	for(int i = 0; i < a.size(); i++) na += a[i] - '0';
	for(int i = 0; i < b.size(); i++) nb += b[i] - '0';
	LL lc = 0;
	LL rc = 0;
	LL ld = 0;
	LL rd = 0;
	LL l2 = 0;
	LL r2 = 0;
	for(int i = 0; i < c.size(); i++) rc += c[i] - '0';
	for(int i = 0; i < d.size(); i++) rd += d[i] - '0';
	for(int i = 0; i < c.size(); i++){
		if(c[i] == '1' && d[i] == '1'){
			r2++;
		}
	}


	LL lsols = 0;
	LL ans = 0;
	for(int i = 0; i < c.size(); i++){
		rc -= (c[i] - '0');
		rd -= (d[i] - '0');
		if(c[i] == '1' && d[i] == '1'){
			r2--;
		}
		if(c[i] == '0' && d[i] == '0') continue;
		LL rsol = solve2(rc, nb, rd);
		rsol *= inv(p2[r2]);
		rsol %= MOD;

		LL lsol = solve2(lc, na, ld);
		lsol *= inv(p2[l2]);
		lsol %= MOD;
		lsols = (lsols + lsol) % MOD;

		ans += rsol * lsols;
		ans %= MOD;

		lc += (c[i] - '0');
		ld += (d[i] - '0');
		if(c[i] == '1' && d[i] == '1'){
			l2++;
		}		
	}
	ans *= p2[l2];
	ans %= MOD;
	//cout << ans << endl;
	finalans += ans;
	finalans %= MOD;
}
int main(){
	fact[0] = 1;
	invfact[0] = 1;
	p2[0] = 1;
	for(LL i = 1; i < 1100000; i++){
		fact[i] = (i*fact[i-1]) % MOD;
		invfact[i] = inv(fact[i]);
		p2[i] = (2*p2[i-1]) % MOD;
	}

	LL n, m;
	cin >> n >> m;
	string a, b, c, d;
	cin >> a >> b >> c >> d;
	int n0 = 0;
	for(int i = 0; i < a.size(); i++) n0 += a[i] - '0';
	for(int i = 0; i < b.size(); i++) n0 += b[i] - '0';
	for(int i = 0; i < c.size(); i++) n0 += c[i] - '0';
	for(int i = 0; i < d.size(); i++) n0 += d[i] - '0';
	if(n0 == 0){
		cout << 1 << endl;
		return 0;
	}
	solve(a,b,c,d);
	solve(c,d,a,b);
	cout << finalans << endl;
}


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

#define vd vector<double>
 
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define vc vector<char>
#define vcc vector< vector<char> >
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
int dx[4] = { -1,0, 1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
// #define mp make_pair
//#define endl '\n'
 
int main() {
    int n, m;
    cin >> n >> m;
    int l_max = 0, r_min = n;
    int ans;
    rep(i, m){
        int l, r;
        cin >> l >> r;
        chmax(l_max, l);
        chmin(r_min, r);
    }
    if(l_max <= r_min) ans = r_min - l_max + 1;
    else ans = 0;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    string s;
    cin >> s;

    int ans = 0;
    int cnt = 0;
    REP(i, s.size()) {
        if (s[i] == 'R') {
            cnt++;
            ans = max(ans, cnt);
        } else {
            cnt = 0;
        }
    }

    print(ans);
}


Measured memory_bytes: 3672
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type
fill_v(U& u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type
fill_v(U& u, const V... v) { for (auto& e : u) fill_v<T>(e, v...); }
template<class T> bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T & a, const T & b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int H, W, N;
	cin >> H >> W >> N;
	int y, x;
	cin >> y >> x;
	y--; x--;
	string S, T;
	cin >> S >> T;
	int R = W, L = -1, U = -1, D = H;
	REPR(i, N) {
		//青木君のターン(盤上から駒を出したくない)
		if (T[i] == 'R') {
			L = max(-1,L-1);
		}else if (T[i] == 'L') {
			R = min(W, R + 1);
		}
		else if (T[i] == 'U') {
			D = min(H,D+1);
		}
		else {
			U = max(-1,U-1);
		}
		//高橋君のターン(盤上から駒を出したい)
		if (S[i] == 'R') {
			R--;
		}
		else if (S[i] == 'L') {
			L++;
		}
		else if (S[i] == 'U') {
			U++;
		}else{
			D--;
		}

		bool ng = false;
		if (R - 1 <= L)ng = true;
		if (U + 1 >= D)ng = true;
		if (ng) {
			cout << "NO" << endl; return 0;
		}
	}
	if (R <= x || L >= x) {
		cout << "NO" << endl; return 0;
	}
	if (U >= y || D <= y) {
		cout << "NO" << endl; return 0;
	}
	cout << "YES" << endl;
	return 0;
}


Measured memory_bytes: 920
#include<bits/stdc++.h>
using namespace std;
int n,k,mod;
int C[305][305];
int f[305][305];
int s[305][305];

int main(){
	cin>>n>>k>>mod;
	C[0][0]=1;
	for(int i=1;i<=n;i++){
		C[i][0]=1;
		for(int j=1;j<=i;j++) C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
	}
	for(int j=0;j<=k;j++) f[1][j]=1,s[1][j]=k-j+1; 
	for(int i=2;i<=n+1;i++){
		for(int j=0;j<=k;j++){
			for(int u=1;u<i;u++) (f[i][j]+=1ll*C[i-2][u-1]*f[i-u][j]%mod*s[u][j+1]%mod)%=mod; 
		}
		for(int j=k;j>=0;j--) s[i][j]=(s[i][j+1]+f[i][j])%mod;
	}
	printf("%d\n",f[n+1][0]);

	return 0;
}

Measured memory_bytes: 1280
/********************************************************************
 * Ejercicio: Grid 1                                                *
 * Url: https://atcoder.jp/contests/dp/tasks/dp_h                   *
 * Lenguaje: c++                                                    *
 * Autor: Sebastian Vega                                            *
 * Fecha: 28-08-2020                                                *
 *******************************************************************/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define forn(i, a, b) for (int i = a; i < b; ++i)
#define SZ(x) int(x.size())
#define pb push_back
#define F first
#define S second
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}

const int H = 1000, W = 1000, MOD = 1e9 + 7;
int h, w;
ll dp[H][W];
char g[H][W];

int main() {
#ifdef LOCAL
  freopen("in.txt", "r", stdin);
// freopen("main.txt", "w", stdout);
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
  ios::sync_with_stdio(0);
  cin.tie(0);
#define endl '\n'
#define dbg(...) 18
#endif
  cin >> h >> w;
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++) cin >> g[i][j];
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (g[i][j] == '#')
        dp[i][j] = 0;
      else if (!i && !j)
        dp[i][j] = 1;
      else if (!i)
        dp[i][j] = dp[i][j - 1];
      else if (!j)
        dp[i][j] = dp[i - 1][j];
      else
        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % MOD;
    }
  }
  cout << dp[h - 1][w - 1] << endl;
  return 0;
}

Measured memory_bytes: 12372
//
//  main.cpp

#include <iostream>
using namespace std;


int main(){	
	int N,M;
	int targets[101];
	int point[101];
	int matrix[101][101];
	
	for(int i=0;i<101;i++){
		for(int j=0;j<101;j++){
			matrix[i][j] = 0;
		}
		targets[i] = 0;
		point[i] = 0;
	}
	
	cin >> N >> M;
	for(int i=0;i<M;i++){
		cin >> targets[i];
	}
	for(int j=0;j<M;j++){
		for(int i=0;i<N;i++){
			cin >> matrix[i][j];
		}
	}
	
	for(int j=0;j<M;j++){
		int target = targets[j];
		int count = 0;
		for(int i=0;i<N;i++){
			if(matrix[i][j] == target){
				point[i]++;
			}else{
				count++;
			}
		}
		point[target-1] += count;
	}
	for(int i=0;i<N;i++){
		cout << point[i] << endl;
	}
	
	return 0;
}

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

int main(){
	int a,b,i;
	cin >> a;
	cin >> b;
	if(a >= b){
		for(i = 0; i < a; i++){
			cout << b;
		}
	}
	else if(a < b){
		for(i = 0; i < b; i++){
			cout << a;
		}
	}
	return 0;
}


Measured memory_bytes: 256
import itertools


N, M, X = list(map(int, input().split()))
CA = [list(map(int, input().split())) for i in range(N)]
# print(N, M, X)
# print(CA)

def can_reach(M, CA, X):
    understandig_list = [0] * M
    for CAi in CA:
        for j in range(1, len(CAi)):
            understandig_list[j - 1] += CAi[j] 

    can = all([understandig >= X for understandig in understandig_list])

    return can


if not can_reach(M, CA, X):
    print('-1')
    exit(0)

min_amount = 10 ** 5 * 12 + 1
for i in range(1, N + 1):
    combinations = itertools.combinations(range(N), i)

    for combination in combinations:
        understanding_list = [0] * M
        amount = 0
        for i in combination:
            for j in range(1, len(CA[i])):
                understanding_list[j - 1] += CA[i][j]
            amount += CA[i][0]

        # print(understanding_list)
        is_reached = all([understanding >= X for understanding in understanding_list])
        if not is_reached: continue

        min_amount = min(amount, min_amount)

print(min_amount)


Measured memory_bytes: 9268
use std::io;

/// 一行を読み込んで、空白で区切ったベクタにして返す
#[allow(dead_code)]
fn read<T>() -> Vec<T>
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim()
        .split_whitespace()
        .map(|s| s.parse().unwrap())
        .collect()
}

/// n行を読み込んで、数字を空白で区切って二次元のベクタにして返す
#[allow(dead_code)]
fn read_table<T>(n: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    let mut ret: Vec<Vec<T>> = Vec::new();
    for _ in 0..n {
        ret.push(read::<T>());
    }
    ret
}

/// n行を読み込んで、1文字ずつを二次元のベクタにして返す
#[allow(dead_code)]
fn read_char_table(n: usize) -> Vec<Vec<char>> {
    let mut ret: Vec<Vec<char>> = Vec::new();
    for _ in 0..n {
        let mut buf = String::new();
        io::stdin().read_line(&mut buf).unwrap();
        let chr = buf.trim().chars().collect();
        ret.push(chr);
    }
    ret
}

/// n行を読み込んで、一次元のベクタにして返す
#[allow(dead_code)]
fn read_array<T>(n: usize) -> Vec<T>
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    let mut array = Vec::new();

    for _ in 0..n {
        let mut buf = String::new();
        io::stdin().read_line(&mut buf).unwrap();
        array.push(buf.trim().parse().unwrap());
    }
    array
}

fn main() {
    // 数値
    let an = read::<isize>();

    let mut max = an[0];
    let mut min = an[0];

    for ai in an {
        if max < ai {
            max = ai;
        }

        if min > ai {
            min = ai;
        }
    }

    let ans = max - min;
    println!("{}", ans);
}


Measured memory_bytes: 4352
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

class DKThK {
public:
    void solve(istream& in, ostream& out) {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        int n,nw=0,w=0;
        in>>n;
        vector<int> x(n);
        vector<pair<int,int>> v(n);
        fr(i,n){
            in>>x[i];
            v[i]=make_pair(x[i]-1,i+1);
        }
        sort(v.begin(),v.end());
        queue<int> f,s;
        fr(i,n) fr(_,v[i].second-1) f.push(v[i].second);
        vector<int> ans(n*n,-1);
        int a,c;
        fr(i,n*n){
            if(w<n&&v[w].first==i){
                ans[i]=v[w].second;
                fr(_,n-v[w].second) s.push(v[w].second);
                ++w;
            }
            else if(!f.empty()){
                ans[i]=f.front();f.pop();
            }
            else{
                if(s.empty()){
                    out<<"No"<<endl;
                    return;
                }
                ans[i]=s.front();s.pop();
            }
        }
        vector<int> d(n+1);
        fr(i,n*n){
            ++d.at(ans[i]);
            if(d[ans[i]]==ans[i]&&x[ans[i]-1]!=i+1){
                out<<"No"<<endl;
                return;
            }
        }
        out<<"Yes"<<endl;
        for(auto i:ans) out<<i<<" ";
        out<<endl;
    }
};

int main() {
    DKThK solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 2944
#include <iostream>
#include <string>
 
using namespace std;
 
int main(int argc, char** argv) {
  int n, m;
  cin >> n >> m;
  
  bool answered[n];
  int w[n];
  for (int i = 0; i < n; ++i) {
    answered[i] = false;
    w[n] = 0;
  }
  int ac = 0;
  int wa = 0;
  for (int i = 0; i < m; ++i) {
    int ni;
    string s;
    cin >> ni;
    cin >> s;
    if (answered[ni])
      continue;
    if (s == "AC") {
      ++ac;
      answered[ni] = true;
      wa += w[ni];
    } else if (s == "WA") {
      ++w[ni];
    }
  }
  cout << ac << " " << wa << endl;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;// при желании можно поменять
ll a[300000];
ll s0,s1,s2,s3,s4;
int main(){
    //ios_base::sync_with_stdio(false);
    //cout<<fixed<<setprecision(20);
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        ll a;
        cin>>a;
        ll x0,x1,x2,x3,x4;
        x0=s0+a;
        ll delt=0;
        if(a==0)delt=2;
        if(a%2==1)delt=1;
        x1=min(x0,s1+delt);
        ll c=0;
        if(a%2==0)c=1;
        x2=min(x1,s2+c);
        x3=min(x2,s3+delt);
        x4=min(x3,s4+a);
        s0=x0;
        s1=x1;
        s2=x2;
        s3=x3;
        s4=x4;
    }
    cout<<s4;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 18 20:30:45 2020

@author: naoki
"""
import sys
N, Y = map(int, input().split())

for k in range(N+1):
    for j in range(N+1):
        if k+j > N:
            continue
        elif 10000*k + 5000*j + 1000*(N-k-j) == Y:
            print(k, j, N-k-j)
            sys.exit()
            
print(-1,-1,-1)

Measured memory_bytes: 3060
#include <stdio.h>

int main(void)
{
        int S;
        int s,m,h;

        scanf("%d",&S);

        h = S/3600;
        m = (S%3600) / 60;
        s = (S%3600) % 60;

        printf("%d:%d:%d\n",h ,m ,s);

        return 0;
}

Measured memory_bytes: 592
n=int(input())
a=list(map(int,input().split()))
b=[a[0]]
for i in range(1,n):
    b.append(b[-1]+a[i])
s=sum(a)
ans=10**20
for i in range(n-1):
    ans=min(ans,abs(s-2*b[i]))
print(ans)


Measured memory_bytes: 93936
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline bool Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+" ";
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e17;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin >> a >> b;
    a += b;
    if (a%2) PRINT(a/2+1);
    else PRINT(a/2);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;



int main() {
//    cout << fixed << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    int n, m, k;
    cin >> n >> m >> k;
    string a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    int ans[n][m], part = 1;
    memset(ans, -1, sizeof ans);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (ans[i][j] != -1 || a[i][j] == '.') continue;
            ans[i][j] = part;
            int c = j - 1;
            while (c >= 0 && ans[i][c] == -1 && a[i][c] == '.') ans[i][c--] = part;
            c = j + 1;
            while (c < m && ans[i][c] == -1 && a[i][c] == '.') ans[i][c++] = part;
            part++;
        }
    }


    for (int i = 1; i < n; i++) {
        if (count(a[i].begin(), a[i].end(), '#') == 0) {
            for (int j = 0; j < m; j++) ans[i][j] = ans[i - 1][j];
        }
    }

    for (int i = n - 2; i >= 0; i--) {
        if (count(a[i].begin(), a[i].end(), '#') == 0) {
            for (int j = 0; j < m; j++) ans[i][j] = ans[i + 1][j];
        }
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cout << ans[i][j] << ' ';
        }
        cout << '\n';
    }


}

//5 1 1
//.
//.
//.
//.
//#

Measured memory_bytes: 1280
# WIP
A, B, C = map(int, input().split())

combi = [A, B, C]
set_abc = set(combi)

len_set_abc = len(set_abc)
max_set = max(set_abc)
min_set = min(set_abc)
if len_set_abc == 1:
    print(0)
elif len_set_abc == 2:
    max_freq = combi.count(max_set)
    diff = max_set - min_set
    if max_freq == 2 and diff % 2:
        print((diff + 1) // 2 + 1)
    elif max_freq == 2:
        print(diff // 2)
    else:
        print(diff)
else:
    other = [c for c in combi if c != max_set]
    max_other = max(other)
    min_other = min(other)
    
    n_operation = max_set - max_other
    max_other += n_operation
    min_other += n_operation

    diff = max_set - min_other

    if diff % 2:
        n_add = (max_set - min_other) // 2 + 2
    else:
        n_add = (max_set - min_other) // 2
    n_operation += n_add

    print(n_operation)


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

typedef long long ll;

ll X, Y;
/*
a+b=X  2a+4b=Y
b = (Y-2X) / 2
*/
int main() {
  cin >> X >> Y;
  ll b2 = Y - 2 * X;
  ll b = b2 / 2;
  cout << (b2 % 2 == 0 && 0 <= b && b <= X ? "Yes" : "No") << endl;
  return 0;
}


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

inline int read(){
    char ch=getchar();
    int x=0,f=1;
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
    return x*f;
}

int n, m;
int sum=0;

int main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    //freopen(".in","r",stdin);
	//freopen(".out","w",stdout); 
	
	cin >> n >> m;
	
	for(int i=1; i<=n; i++){
		sum+=n-i;
	}
	
	for(int i=1; i<=m; i++){
		sum+=m-i;
	}
	
	cout << sum;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<set>
#include<iomanip>
#include<utility>
#include<deque>
#include<vector>
#include<locale>
#include<sstream>
#define f(i,a,b) for(int i=a;i<=b;i++)
typedef long long ll;
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	cout<<(a+b+1)/2<<endl;
	return 0;
}


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

int main(){
  int n,p,num;
  string s;
  vector<tuple<string,int,int>> rests;
  scanf("%d",&n);
  rep(i,n){
    cin >> s >> p;
    rests.push_back(make_tuple(s,p*(-1),i+1));
  }
  sort(rests.begin(),rests.end());
  rep(i,n){
    tie(ignore,ignore,num) = rests.at(i);
    printf("%d\n", num);
  }
  return 0;
}
  


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	ans := 0
	for i := 0; i < 2; i++ {
		if a < b {
			ans += b
			b--
		} else {
			ans += a
			a--
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

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

    i64 A, B, C, X, Y;
    read(A, B, C, X, Y);

    i64 ans = LINF;
    reps(ab, 0, 2 * max(X, Y)) {
        if (ab & 1) continue;
        i64 cost = C * ab;
        cost += max<i64>(0, X - (ab / 2)) * A;
        cost += max<i64>(0, Y - (ab / 2)) * B;
        chmin(ans, cost);
    }

    print(ans);

    return 0;
}


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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;

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

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

struct union_find {
	vector<int> v;
	union_find(int n) : v(n, -1) {}
	int find(int x) { return v[x] < 0 ? x : v[x] = find(v[x]); }
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y) return;
		if (-v[x] < -v[y]) swap(x, y);
		v[x] += v[y]; v[y] = x;
	}
	bool root(int x) { return v[x] < 0; }
	bool same(int x, int y) { return find(x) == find(y); }
	int size(int x) { return -v[find(x)]; }
};


int main() {
	int N, Q; cin >> N >> Q;
	union_find uf(N);
	while (Q--) {
		int t, x, y; scanf("%d%d%d", &t, &x, &y);
		if (t == 0) uf.unite(x, y);
		if (t == 1) printf("%d\n", (int)uf.same(x, y));
	}
}

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  if ((A * 100 + B * 10 + C) % 4 == 0) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int compare_int(const void *a, const void *b)
{
  return *(int*)a-*(int*)b;
}

int main()
{
  int n,i,j,k;
  int l[101];
  int ans=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&l[i]);
  }
  qsort(l,n,sizeof(int),compare_int);
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
      for(k=j+1;k<n;k++){
        if( (l[i]==l[j]) || (l[j]==l[k]) || (l[k]==l[i]) ) continue;
        if( l[i]+l[j]>l[k] ) ans++;
      }
    }
  }
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 1732
n = int(input())
ans = 0
train = [tuple(map(int, input().split())) for _ in range(n - 1)]
for i in range(n - 1):
    total = train[i][0] + train[i][1]
    for j in range(i + 1, n - 1):
        diff = total - train[j][1]
        if diff <= 0:
            total = train[j][1]
        elif diff % train[j][2] != 0:
            total += train[j][2] - diff % train[j][2]
        total += train[j][0]
    print(total)
print(0)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;

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

    int N; cin >> N;
    if(N==1){
        cout << "Hello World" << endl;
    }else{
        int A, B; cin >> A >> B;
        cout << A+B << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
a, b, c = map(int, input().split())

for i in range(10 ** 9):
    if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
        print(i)
        exit()
    if a == b == c:
        print(-1)
        exit()
    a, b, c = (b + c) // 2, (c + a) // 2, (a + b) // 2

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

using namespace std;
using ll = long long;

#define REP2(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; ++i)
#define REP3(i, l, r) for (int i = (l), i##_len = (int)(r); i < i##_len; ++i)
#define GET_MACRO_REP(_1, _2, _3, NAME, ...) NAME
#define REP(...) GET_MACRO_REP(__VA_ARGS__, REP3, REP2) (__VA_ARGS__)
#define RREP2(i, n) for (int i = (n - 1); i >= 0; --i)
#define RREP3(i, l, r) for (int i = (r - 1), i##_len = (l); i >= i##_len; --i)
#define GET_MACRO_RREP(_1, _2, _3, NAME, ...) NAME
#define RREP(...) GET_MACRO_REP(__VA_ARGS__, RREP3, RREP2) (__VA_ARGS__)
#define IN(type, n) type n; cin >> n
#define INALL(type, v) REP(i, v.size()) { IN(type, _tmp); v.at(i) = _tmp; }
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

#ifdef _DEBUG
#define DEBUG(x) cout << #x << ": " << x << endl
#else
#define DEBUG(x)
#endif

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

bool check_visit_all(vector<bool> &visit) {
  REP(i, visit.size()) {
    if (!visit.at(i)) return false;
  }

  return true;
}

int solve(vector<vector<int> > &path, int node, vector<bool> visit) {
  visit.at(node) = true;
  if (check_visit_all(ref(visit))) return 1;
  int ans = 0;
  REP(i, path.at(node).size()) {
    int next = path.at(node).at(i);
    if (visit.at(next)) continue;
    ans += solve(ref(path), next, visit);
  }

  return ans;
}

int main() {
  IN(int, N);
  IN(int, M);
  vector<vector<int> > path(N, vector<int>());
  REP(i, M) {
    IN(int, a);
    IN(int, b);
    path.at(--a).push_back(--b);
    path.at(b).push_back(a);
  }

  vector<bool> visit(N, false);
  int ans = solve(ref(path), 0, visit);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<math.h>
#include<map>
#include<stdio.h>
#include<queue>
#include<algorithm>
#include<functional>
using namespace std;
#define MP make_pair
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,a) for(int i=0;i<(a);++i)
typedef pair<int, int> P;
typedef pair<pair<P, P>, P>PP;
typedef long long LL;
#define INF LL(1e18)
#define N 100000
int n, judge;
int flag1[N], flag2[N];
vector<int> edge[N];

int bfs(int s, int flag[])
{
	queue<int> que;
	que.push(s);
	while(!(que.empty()))
	{
		int now = que.front();
		que.pop();
		REP(i, edge[now].size())
		{
			int to = edge[now][i];
			if(!flag[to] && to != s)
			{
				flag[to] = flag[now] + 1;
				que.push(to);
			}
		}
	}
}
int main()
{
	cin >> n;
	REP(i, n - 1)
	{
		int a, b;
		cin >> a >> b;
		--a; --b;
		edge[b].push_back(a);
		edge[a].push_back(b);
	}
	bfs(0, flag1);
	bfs(n - 1, flag2);
	REP(i, n)
	{
		if(flag1[i] <= flag2[i])
		{
			judge++;
		}
	}

	if(judge > n / 2)
	{
		cout << "Fennec" << endl;
	}
	else
	{	
		cout << "Snuke" << endl;
	}
	return 0;
}

Measured memory_bytes: 6656
var
  s:array[0..100] of string;
  n,l,i,j:longint;
begin
  readln(n,l);
  for i:=1 to n do readln(s[i]);
  for i:=1 to n-1 do
   for j:=i+1 to n do
    if s[i]>s[j] then begin s[0]:=s[i];s[i]:=s[j];s[j]:=s[0]; end;
  for i:=1 to n do write(s[i]);
end.

//真的不用换行吗？

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


int min(int a,int b)
{
    return a<b?a:b;
}
int max(int a,int b)
{
    return a>b?a:b;
}


int main(void){
    char s[100000];
    cin >> s;
    int rez=strlen(s);
    for (int i=1; i<strlen(s); i++)
    {
        if (s[i]!=s[i-1])
                 {
                    rez=min(rez,max(i,strlen(s)-i));
                 }
    }
    cout << rez;
    return 0;
}


Measured memory_bytes: 384
package main

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

func main() {
	s := IOInitialize()
	n := 3
	numMap := scanNums(s, n)
	as := make([]int, 3)
	bs := make([]int, 3)
	for a1 := -200; a1 <= 200; a1++ {
		as[0] = a1
		for j := 0; j < n; j++ {
			bs[j] = numMap[0][j] - as[0]
		}
		isCorrect := true
		for i := 1; i < n; i++ {
			a := numMap[i][0] - bs[0]
			for j := 1; j < n; j++ {
				isCorrect = numMap[i][j] == a+bs[j]
				if !isCorrect {
					break
				}
			}
			if !isCorrect {
				break
			}
		}
		if isCorrect {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}

func IOInitialize() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	return s
}

func Int(s *bufio.Scanner) int {
	if !s.Scan() {
		panic("scan error")
	}

	value, err := strconv.Atoi(s.Text())
	if err != nil {
		panic("text to int error")
	}
	return value
}

func scanNums(s *bufio.Scanner, len int) (numMap map[int]map[int]int) {
	numMap = map[int]map[int]int{}
	for i := 0; i < len; i++ {
		numMap[i] = map[int]int{}
		for j := 0; j < len; j++ {
			num := Int(s)
			numMap[i][j] = num
		}
	}
	return
}


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




int main()
{	
	ll n,k,q;
	cin>>n>>k>>q;
	ll a[q],b[n+1]={0};

  for(ll i=0;i<q;i++)
  {
    	cin>>a[i];
    	b[a[i]]++;
    	
  }
  for(ll i=1;i<n+1;i++)if(k-q+b[i]>0)cout<<"Yes\n";else cout<<"No\n";
	
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define Cout(s) cout << s << endl;
using ll = long long;
using P = pair<int, int>;

const ll INF = 1ll << 60;
ll MOD = 1e9 + 7;

int main()
{

    int a, b, c;
    cin >> a >> b >> c;
    int aa = a * 10 + b + c;
    int bb = a + b * 10 + c;
    int cc = a + b + c * 10;

    cout << max(aa, max(bb, cc)) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void solve()
{
	string x,y;
	cin>>x>>y;
	int m,n;
	m = x.length();
	n = y.length();
    vector<vector<int> > lcs(n+1,vector<int>(m+1,0));
	for (int i = 1; i < n+1; ++i)
	{
		for (int j = 1; j < m+1; ++j)
		{
			if (x[j-1]==y[i-1])
			   lcs[i][j] = lcs[i-1][j-1]+1;
			else
				lcs[i][j]= max(lcs[i][j-1],lcs[i-1][j]);
			
		}

    }
    
    
    int i=n,j = m;
    stack<char> sq;
    
    while(i!=0&&j!=0)
    {
    	if(x[j-1] == y[i-1])
    		{
    		sq.push(x[j-1]);
    		i--;
    		j--;
    		}
    	else
    	{
    		if(lcs[i][j-1]>=lcs[i-1][j])
    			j--;
    		else 
    			i--;
    	}
    }
    
    while(sq.size()!=0)
    {
    	cout<<sq.top();
    	sq.pop();
    }
}
int main()
{  


    solve();
    return 0;

 }

Measured memory_bytes: 35712
#include <stdio.h>
int main()
{
int n,i,num,min=1000000,max=-1000000;
long long sum=0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&num);
    sum+=num;
    if(min>num)
    min=num;
    if(max<num)
    max=num;
    }
  printf("%d %d %lld\n",min,max,sum);

  return 0;
}


Measured memory_bytes: 600
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i_, s_, t_) for (ll i_ = (s_); i_ <= (t_); ++i_)
#define re(i_, s_, t_) for (ll i_ = (s_); i_ < (t_); ++i_)
#define per(i_, s_, t_) for (ll i_ = (s_); i_ >= (t_); --i_)
typedef long long ll;
const ll P = 998244353, N = 1e6 + 5;
ll fac[N];
ll ans;
ll qpow(ll x, ll t = P - 2) {
	ll res = 1;
	for (; t; t >>= 1, x = 1LL * x * x % P)
		if (t & 1)
			res = 1LL * res * x % P;
	return res;
}
ll C(ll m, ll n) { return 1LL * fac[m] * qpow(fac[m - n]) % P * qpow(fac[n]) % P; }
int main() {
	ll n, m;
	scanf("%lld%lld", &n, &m);
	if (n > m)
		swap(n, m);
	fac[0] = fac[1] = 1;
	rep (i, 2, n + m)
		fac[i] = 1ll * fac[i - 1] * i % P;
	rep (i, 1, n)
		ans = (ans + C(n + m - 2 * i, n - i) * C(2 * i, i) % P) % P;
	ans = ans * fac[n] % P * fac[m] % P * qpow(fac[n + m]) % P * qpow(2) % P;
	printf("%lld\n", (m + ans) % P);
	return 0;
}

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

int main(){
    LL p = 41;
    LL n = p*p+p+1;
    LL k = p+1;
    cout << n << " " << k << endl;
    vector<int> x, y, z;
    for(int b = 0; b < p; b++){
        for(int c = 0; c < p; c++){
            x.push_back(1);
            y.push_back(b);
            z.push_back(c);
        }
        x.push_back(0);
        y.push_back(1);
        z.push_back(b);
    }
    x.push_back(0);
    y.push_back(0);
    z.push_back(1);
    for(int j = 0; j < n; j++){
        for(int k = 0; k < n; k++){
            if((x[j] * x[k] + y[j] * y[k] + z[j] * z[k]) % p == 0){
                cout << k+1 << " ";
            }
        }
        cout << endl;
    }
}


Measured memory_bytes: 640
import sys
input = sys.stdin.buffer.readline
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getlist():
    return list(map(int, input().split()))
import math
import heapq
from collections import defaultdict, Counter, deque
MOD = 10**9 + 7
INF = 10**15


def main():
    n = getN()
    # n, m = getlist()
    nums = getlist()
    for num in nums:
        if num % 2 == 0 and num % 3 != 0 and num % 5 != 0:
            print("DENIED")
            return

    print("APPROVED")

if __name__ == '__main__':
    main()

"""
9999
3

2916
"""

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


int main(){
	int k;
	cin>>k;
	int x=k%10;
	if(x==1||x==3||x==7||x==9){
		int y=1;
		long long rem=7%k;
		for(int n=1;n<=1e6;n++){
			if(rem==0)
			{cout<<n;y=0;break;}
			else rem= (((rem*10)%k)+(7%k))%k;
		}
		if(y)
			cout<<-1;
	}
	else
		cout<<-1;
	return 0;
}

Measured memory_bytes: 3624
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static final int max = 1000000;

	public static void main(String[] args) {
		boolean numList[] = new boolean[max + 1];
		Arrays.fill(numList, true);

		for (int t = 2; t < max; t++) {
			if (numList[t]) {
				for (int i = t * 2; i < max; i += t) {
					numList[i] = false;
				}
			}
		}
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			long inputNum = sc.nextLong();
			int count = 0;

			for (int i = 2; i <= inputNum; i++) {
				if (numList[i]) {
					count++;
				}
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 27552
N = int(input())

lst = []
for i in range(N):
    lst += [list(map(int, input().split()))]

lst.sort()
ans = N
for i in range(N):
    for j in range(N):
        count = N
        if i == j:
            pass
        else:
            p = lst[i][0]-lst[j][0]
            q = lst[i][1]-lst[j][1]
            for k in range(N):
                if [lst[k][0]-p, lst[k][1]-q] in lst:
                    count -= 1
                ans = min(count, ans)

print (ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#pragma GCC optimize(2)
#define ll long long
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,n,a) for(int i=n;i>=a;i--)
#define endl '\n'
#define eps 0.000000001
#define pb push_back
#define mem(a,b) memset(a,b,sizeof(a))
#define IO ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const int INF=0x3f3f3f3f;
const ll inf=0x3f3f3f3f3f3f3f3f;
const int mod=1e9+7;
const int maxn=2e5+5;
int n;ll a[maxn],pre[maxn];
int main(){
	int n;cin>>n;
	pre[0]=pre[1]=0;
	rep(i,1,n) cin>>a[i],pre[i+1]=(pre[i]+a[i])%mod;
	ll sum=0;
	rep(i,1,n){
		ll cur=(pre[i]*a[i])%mod;
		sum=(sum+cur)%mod;
	}
	cout<<sum<<endl;
}


Measured memory_bytes: 6712
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n;
  while (cin >> n && n) {
    int mx = -1;
    int mn = 1001;
    int sum = 0;
    REP(i, n) {
      int s;
      cin >> s;
      sum += s;
      if (mx < s) mx = s;
      if (s < mn) mn = s;
    }
    int ans = (sum - (mx + mn)) / (n - 2);
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3016
#include<iostream>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  int64_t A, B, C, K; std::cin >> A >> B >> C >> K;
  if(A >= K) fin(K);
  if(A+B >= K) fin(A);
  K -= A+B;
  fin(A - K);
  return 0;
}


Measured memory_bytes: 3632
tpoint = 0
hpoint = 0
num = int(input())
for i in range(num):
    taro,hanako = map(str,input().split())
    A = sorted(list([taro,hanako]))
    if taro == hanako:
        tpoint +=1
        hpoint +=1
    else:
        if A[0]==taro:
            tpoint += 3
        elif A[0]==hanako:
            hpoint +=3
print(str(hpoint)+' '+str(tpoint))


Measured memory_bytes: 5596