akhauriyash/Code-Regression huggingface dataset:
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           ll                          long long
#define                           double                      long double
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100009;

 main()

{
    fast
//    int a;
//    double B;
//    cin>>a>>B;
//    int b=B;
//    B=B*100.00;
//    int x=B;
//    int dg1,dg2;
//    dg1=x%10;
//    x=x/10;
//    dg2=x%10;
//    int nb=dg1+(10*dg2);
//    cout<<nb<<" # "<<endl;
//    int ses=(a*b*100LL)+(a*nb);
//    ses=ses/100;
//    cout<<ses<<endl;
     double a,b,ses;
    cin>>a>>b;
    ses=a*b;
    int x=ses;
    cout<<x<<endl;
    return 0;

}





































Measured memory_bytes: 3800
def solve():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    INF = 10 ** 9
    dp = [INF] * N
    dp[0] = 0
    for i in range(1, N):
        for j in range(1, K + 1):
            if i - j >= 0:
                dp[i] = min(dp[i], dp[i - j] + abs(A[i] - A[i - j]))
    print(dp[N - 1])

solve()


Measured memory_bytes: 84788
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i, a, j) for(int i = a; i < j; i++)
#define all(i) i.begin(), i.end()
using namespace std;
struct dat_st { int h, w, num; };
bool compare(const dat_st &t0, const dat_st &t1)
{
	if (t0.num == t1.num)
	{
		return t0.h < t1.h;
	}
	return t0.num < t1.num;
}
int dia(int x, int y)
{
	return x * x + y * y;
}
int main()
{
	vector<dat_st> cul(0);
	rep(h, 1, 151) rep(w, 1, 151)
	{
		if (h < w && h != w) { cul.push_back({ h, w, dia(h, w) }); }
	}
	sort(all(cul), compare);
	int h, w; while (cin >> h >> w, h, w)
	{
		auto p = upper_bound(all(cul), dat_st{ h,w,dia(h,w) }, compare);
		cout << p->h << " " << p->w << endl;
	}
	return 0;
}

Measured memory_bytes: 3192
# -*- coding: utf-8 -*-

s = list(input())
s = list(map(int,s))

ans = 100000

for i in range(2,len(s)):
    fetch = s[i-2] * 100 + s[i-1]*10 + s[i]
    ans = min(ans,abs( fetch - 753))

print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
#define MAX 200005
#define MOD 1000000007
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define si set<int>
#define mp map<ll,ll>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll dp[105][100005];
int main()
{ 
	fast 
	ll n,w,w1[MAX],v[MAX];
	cin>>n>>w;
	ll i,j;
	for(i=0;i<n;i++)
	{
		cin>>w1[i]>>v[i];
	}
	for(j=0;j<w1[0];j++)
	{
		dp[0][j]=0;
	}
	for(j=w1[0];j<=w;j++)
	{
		dp[0][j]=v[0];
	}
	for(i=1;i<n;i++)
	{
		for(j=0;j<=w;j++)
		{
			if(j<w1[i])
			{
				dp[i][j]=dp[i-1][j];
			}
			else
			{
				dp[i][j]=max(dp[i-1][j],(v[i]+dp[i-1][j-w1[i]]));
			}
		}
	}
	cout<<dp[n-1][w];


}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_a() {
	ll n, m;
	ll x, y;
	ll a, b, c, d;
	ll h;
	ll k;
	//string s, t;
	ll l_ans = 0;
	string s_ans = "NG";

	cin >> a >> b >> h;

	l_ans = (a + b) * h / 2;

	cout << l_ans << "\n";

	return;
}


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

	solve_abc_a();

	return 0;
}

Measured memory_bytes: 3620
#include <iostream>

using namespace std;

int main() {
  int N, T;
  cin >> N >> T;
  int MAX = 1 << 20;
  int min_cost = MAX;
  for (int i = 0; i < N; i++) {
    int c, t;
    cin >> c >> t;
    if (t <= T) {
      min_cost = min(c, min_cost);
    }
  }
  if (min_cost == MAX) {
    cout << "TLE" << endl;
  } else{
    cout << min_cost << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))

using namespace std;


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


ll m = 1000000007;

const int MOD = 1000000007;

ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}



long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}


vector<int>alpha1[26];
vector<int>alpha2[26];
int main() {
	string S, T;
	cin >> S >> T;
	int N = S.length();
	REP(i, N) {
		int num = S[i] - 'a';
		alpha1[num].pb(i);
	}
	REP(i, N) {
		int num = T[i] - 'a';
		alpha2[num].pb(i);
	}
	REP(i, 26) {
		int l = alpha1[i].size();
		if (l <= 1)continue;
		char c = T[alpha1[i][0]];
		FOR(j, 1, l) {
			if (T[alpha1[i][j]] != T[alpha1[i][0]]) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	REP(i, 26) {
		int l = alpha2[i].size();
		if (l <= 1)continue;
		char c = S[alpha2[i][0]];
		FOR(j, 1, l) {
			if (S[alpha2[i][j]] != S[alpha2[i][0]]) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 2824
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,mod=1000000007;
const double pi=3.1415926535897932,eps=1e-6;
int n,a[105];
vector<int> ans;
int main()
{
    scanf("%d",&n);
    rep(i,1,n) scanf("%d",a+i);
    rep(i,1,n){
        bool flg=0;
        per(j,n-i+1,1)
        if(a[j] == j){
            ans.pb(j);
            rep(k,j,n-i) a[k] = a[k+1];
            flg=1;
            break;
        }
        if(!flg) {
            puts("-1");
            return 0;
        }
    }
    per(i,(int)ans.size()-1,0) printf("%d\n",ans[i]);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

int main(){
    int n,l;
    cin >> n >> l;
  vector<string> s(n);
  for (int i =0; i<n;i++){
    cin >> s[i];
  }
  sort(s.begin(),s.end());
  string ans;
  ans="";
  for (int i=0;i < n;i++){
    ans+=s[i];
  }
  cout << ans << endl;
    
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace B_001_60
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            new Logic_A().Start();
        }

        public class Logic_A
        {
            public void Start()
            {
                var str = Console.ReadLine().Split(' ');
                var a = str[0];
                var b = str[1];
                var c = str[2];

                if (a.Last() == b.First() && b.Last() == c.First())
                {
                    Console.WriteLine("YES");
                }
                else
                {
                    Console.WriteLine("NO");
                }
            }
        }
    }
}

Measured memory_bytes: 13268
class Card:
    def __init__(self, args=None, mark=None, no=None):
        if args != None:
            self.mark = args[0]
            self.no = int(args[1])
        else:
            self.mark = mark
            self.no = no


n = int(input())

cards = []
for i in range(0, n):
    cards.append(Card(args=list(input().split(' '))))

nothings = []
marks = ['S', 'H', 'C', 'D']

for mark in marks:
    for i in range(1, 14):
        for card in cards:
            if card.mark == mark and card.no == i:
                break
        else:
            nothings.append(Card(mark=mark, no=i))

for card in nothings:
    print("{} {}".format(card.mark, card.no))



Measured memory_bytes: 5604
# 各たけを、A,B,C,使わないの4パターンに振り分ける
# LA = [l2,l4,l7]みたいになったら、あとは
# コストは（合成＋調整で）(len(LA)-1)*10 + abs(sum(LA)-A)
# A = 90, L! = [40,30,21] -> 20 + 1
import copy as cp
inf = 10**9
def cost(li, length):
    if len(li)==0:
        return inf
    return (len(li)-1)*10 + abs(sum(li)-length)

def search_cost(ln,assignment,length):
#     from IPython.core.debugger import Pdb; Pdb().set_trace()
    if len(ln)==0:
        costA = cost(assignment["A"], length[0])
        costB = cost(assignment["B"], length[1])
        costC = cost(assignment["C"], length[2])
        return costA + costB + costC
    val = ln[-1]
    candidate = []
    for take in assignment.keys():
        nextdic = cp.deepcopy(assignment)
        nextdic[take].append(val)
        cand = search_cost(ln[:-1],nextdic,length)
        candidate.append(cand)
    return min(candidate)
  
  
# 実行
N, A, B, C =map(int,input().split())
length = [A,B,C]
ln = []
assignment = {"A":[],"B":[],"C":[],"D":[]}

for i in range(N):
    a = int(input())
    ln.append(a)
   
print(search_cost(ln,assignment,length))



Measured memory_bytes: 3700
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ARounding solver = new ARounding();
        solver.solve(1, in, out);
        out.close();
    }

    static class ARounding {
        public void solve(int testNumber, FastReader s, PrintWriter out) {
            int x = s.nextInt();
            int a = s.nextInt();
            if (x < a) {
                out.println(0);
            } else {
                out.println(10);
            }
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 21460
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cstdio>
#define LL long long
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int n;
int main(){
	cin>>n;
	cout<<(n-2)*180<<endl;
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

struct edge {
	ll to;
	ll cost;
};

ll ans = 0;

//require 0-indexed
vector<vector<edge>> prim(vector<vector<edge>>& g) {
	vector<vector<edge>> ret(g.size());
	set<int> X, Y;
	//cost from to
	priority_queue<pair<ll, pair<int, int>>, vector<pair<ll, pair<int, int>>>, greater<>> q;

	X.insert(0);
	for (int i = 1; i < g.size(); i++)Y.insert(i);
	for (int i = 0; i < g[0].size(); i++)q.push({ g[0][i].cost,{0,g[0][i].to} });
	
	while (X.size() != g.size()) {
		auto top = q.top(); q.pop();
		if (X.count(top.second.first) == 1 && Y.count(top.second.second) == 1) {
			X.insert(top.second.second);
			Y.erase(top.second.second);
			ret[top.second.first].push_back({ top.second.second,top.first });
			ret[top.second.second].push_back({ top.second.first,top.first });
			for (int i = 0; i < g[top.second.second].size(); i++) {
				q.push({ g[top.second.second][i].cost,{top.second.second,g[top.second.second][i].to} });
			}
			ans += top.first;
		}
	}
	return ret;
}

int main() {
	int V, E;
	cin >> V >> E;
	vector<vector<edge>> g(V);
	for (int i = 0; i < E; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		g[a].push_back({ b,c });
		g[b].push_back({ a,c });
	}
	prim(g);
	cout << ans << endl;
}


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

int main(){
    string s; cin>>s;
    int n=s.length();

    string ans="No";
    for(int i=0;i<n-1;i++){
        if(s[i]=='A' and s[i+1]=='C') ans="Yes";
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import numpy as np

def spaceinput():
    return list(map(int,input().split(" ")))


N,K=spaceinput()

res=0

for i in range(1,N+1):
    if K>i:
        tmp=np.ceil(np.log2(K/i))
        res+=(0.5**tmp)/N
    else:
        res+=1/N

    


print(res)


Measured memory_bytes: 22480
#include <bits/stdc++.h>
// #include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
// using namespace atcoder;

vector<pair<ll, ll> > prime_factorize(ll N) {
    vector<pair<ll, ll> > res;
    for (ll a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        ll ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

ll mpow(ll x, ll n, ll mod){
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % mod;
        x = x*x % mod;
        n = n >> 1;
    }
    return ans;
}

// nCa
ll combination(ll n, ll a, ll mod) {
    ll X = 1;
    for (ll i = n - a + 1; i <= n; i++) {
        X = (X * i) % mod;
    }
    ll Y = 1;
    for (ll i = 1; i <= a; i++) {
        Y = (Y * i) % mod;
    }

    ll iY = mpow(Y, mod - 2, mod);
    return X * iY % mod;
}


void Main()
{
    ll n, m;
    cin >> n >> m;

    auto primes = prime_factorize(m);
    ll mod = 7LL + 1e9;
    ll res = 1;
    for (auto pr: primes) {
        ll p = pr.second;
        res *= combination(p + n - 1, p, mod);
        res %= mod;
    }
    put(res);
}
signed main(){ Main();return 0;}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
int main() {
  int N,i,c;
  c=0;
  long sum;
  sum=0;
  cin>>N;
  int A[N];
  int B[i];
  for(i=0;i<N;i++){
  cin>>A[i];
    if(A[i]<0) c++;
  B[i]=abs(A[i]);
  }
  sort(B,B+N);
  if(c%2==0){
  for(i=0;i<N;i++){
  sum=sum+B[i];
  }
  }else{
    for(i=1;i<N;i++){
  sum=sum+B[i];
  }
   sum=sum-B[0];
  }
  
cout<<sum<<endl;
}

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

#define int long long
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
constexpr int DX[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
int sign(int x) { return (x > 0) - (x < 0); }
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int cdiv(int a, int b) { return (a - 1 + b) / b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T> T sq(T x) { return x * x; }
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const deque<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const set<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

signed main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max({a * c, a * d, b * c, b * d}) << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <queue>
#include <iomanip>
#include <map>
#include <algorithm>

using namespace std;

using ll = long long;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

// Warshall-Floyd
int d[10][10];

void warshall_floyd() { // N: length of vertices
    for (int k = 0; k <= 9; k++)
        for (int i = 0; i <= 9; i++)
            for (int j = 0; j <= 9; j++) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
}


int main() {
    int H, W;
    cin >> H >> W;
    for (int i = 0; i <= 9; i++) {
        for (int k = 0; k <= 9; k++) {
            cin >> d[i][k];
        }
    }

    warshall_floyd();

    int A[H][W];
    ll cost = 0;
    for (int i = 0; i < H; i++) {
        for (int k = 0; k < W; k++) {
            cin >> A[i][k];
            if (A[i][k] == -1 || A[i][k] == 1) continue;

            cost += d[A[i][k]][1];
        }
    }

    cout << cost << endl;

    return 0;
}

Measured memory_bytes: 1016
#include "bits/stdc++.h"
using namespace std;
int main(){
	string S;
	cin >> S;
	for(int x = 0; x<S.size(); x++){
		if(x%2==0){
			if(!(S[x]=='R' || S[x] == 'U' || S[x] == 'D')){
				cout << "No";
				return 0;
			}
		}else{
			if(!(S[x] == 'L' || S[x] == 'U' || S[x] == 'D')){
				cout << "No";
				return 0;
			}
		}
	}
	cout << "Yes";
}



Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

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 ll mod=1e9+7;

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n+1);
    vector<ll> b(n);
    rep(i,n+1){
        cin >> a[i];
    }
    rep(i,n){
        cin >> b[i];
    }
    ll ans=0;
    rep(i,n){
        if(b[i]<=a[i]){
            ans+=b[i];
            a[i]-=b[i];
        }
        else if(a[i]<b[i] && b[i]<=a[i]+a[i+1]){
            ans+=b[i];
            a[i+1]-=b[i]-a[i];
        }
        else{
            ans+=a[i]+a[i+1];
            a[i+1]=0;
            a[i]=0;
            
        }
    }
    cout << ans << endl;
    return 0;
} 

Measured memory_bytes: 1792
n,k=map(int,input().split())
if(n>k):
    if(n%k==0):
        print(0)
    else:
        print(min((n%k),(n//k+1)*k-n))
elif(n==k):
    print(0)
elif(n==0):
    print(0)
else:
    if(k%n==0):
        print(n)
    else:
        if(k-n)<=n:
            print(k-n)
        else:
            print(n)



Measured memory_bytes: 38384
#include <cstdio>
using ll = long long;

const int mod = 1e9 + 7;
int n, ans, p2[60], cnt[60];
ll a;

int main(){
    p2[0] = 1;
    for(int i = 1; i < 60; i++) p2[i] = p2[i - 1] * 2 % mod;

    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        scanf("%lld", &a);
        for(int k = 0; k < 60; k++){
            int v = (a >> k) & 1;
            if(v) ans += p2[k] * 1ll * (i - 1 - cnt[k]) % mod, cnt[k]++;
            else ans += p2[k] * 1ll * cnt[k] % mod;
            ans %= mod;
        }
    }
    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
string s,t;

int main(){
    cin >> s >> t;
    int n = s.length();
    int ans = 0;
    for(int i=0; i<n; i++){
        if(s[i]!=t[i]){
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3868
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
 
#define REP(i,b,n) for(int i=b;i<n;++i)
#define REPR(i,b,n) for(int i=n-1;i>=b;--i)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))
#define EACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define BIT(n, b) ((n>>b) & 1)

using namespace std;

static const double PI = acos(-1.0);
static const double EPS = 1e-9;
typedef pair<int, int> pii;
typedef pair<pii, int> stt;
typedef long long ll;


enum{RIGHT, UP, LEFT, DOWN};

int h, w;
int field[32][32];
int vtx[32][32][4];
int cost[4];
int dx[] = {1, 0, -1, 0};
int dy[] = {0, -1, 0, 1};
int rev[] = {0, -1, 2, 1};


bool border(int lo, int mid, int hi){
	return lo <= mid && mid <= hi;
}


int solve(){

	queue<stt> qu;
	qu.push(make_pair( make_pair(1,1), (int)(RIGHT)));
	vtx[1][1][RIGHT] = 0;
	
	stt now;
	int x, y, dir, nx, ny, ndir, pay;
	
	while(!qu.empty()){
		
		now = qu.front();
		x = now.first.first, y = now.first.second, dir = now.second;
		qu.pop();
		
		for(int i=0; i<4; ++i){
			
			if(i==field[y][x])
				pay = 0;
			else
				pay = cost[i];
			
			ndir = (4+dir+rev[i])%4;
			nx = x+dx[ndir];
			ny = y+dy[ndir];
			
			if(border(1, nx, w) && border(1, ny, h) && vtx[ny][nx][ndir] > vtx[y][x][dir] + pay){
				vtx[ny][nx][ndir] = vtx[y][x][dir] + pay;
				qu.push(make_pair( make_pair(nx,ny), ndir));
			}
		}
	}
		
	int res = INT_MAX;
	
	for(int i=0; i<4; ++i)
		res = min(res, vtx[h][w][i]);
	
	return res;
}


int main(){
	
	while(cin >> w >> h, (w||h)){
		
		for(int y=1; y<=h; ++y){
			for(int x=1; x<=w; ++x){
			
				cin >> field[y][x];
				
				for(int k=0; k<4; ++k)
					vtx[y][x][k] = INT_MAX;
			}
		}
		
		for(int i=0; i<4; ++i)
			cin>> cost[i];
		
		cout << solve() << endl;
	}
	
	return 0;
}

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

int N;
long long ans;

int calc(int n,vector<vector<int>> num){
  if(n==N-1){
    return ans;
  }
  if(ans<num[n][1]){
    ans=num[n][1];
  }if(ans%num[n][2]!=0){
    ans+=num[n][2]-ans%num[n][2];
  }ans+=num[n][0];
  return calc(n+1,num);
}

int main(){
  cin>>N;
  vector<vector<int>> num(N-1,vector<int>(3));
  for(int i=0;i<N-1;i++){
    cin>>num[i][0]>>num[i][1]>>num[i][2];
  }
  for(int i=0;i<N;i++){
    ans=0;
    cout<<calc(i,num)<<endl;
  }
}

Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007

int main()
{  
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll n;
    cin>>n;
    ll a[n],dp[n][n];
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=n-1;i>=0;i--)
    {
        for(int j=i;j<n;j++)
        {
            if(i == j)dp[i][j]=a[i];
            else if(i+1 == j)dp[i][j]=abs(a[i]-a[i+1]);
            else dp[i][j]=max(a[i]+min(dp[i+2][j]-a[i+1],dp[i+1][j-1]-a[j]),a[j]+min(dp[i][j-2]-a[j-1],dp[i+1][j-1]-a[i]));
        }
    }
    cout<<dp[0][n-1]<<"\n";
    return 0;
}

Measured memory_bytes: 70144
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);

int main() {
	int n;
	
	while(cin >> n, n) {
		string s;
		cin >> s;

		string tmp;
		REP(i, n) {
			tmp.clear();

			char c = s[0];
			int count = 1;
			FOR(j, 1, s.size()-1) {
				if(c == s[j]) {
					count++;
				} else {
					tmp += toString<int>(count);
					tmp += c;
					c = s[j];
					count = 1;
				}
			}
			tmp += toString<int>(count);
			tmp += c;

			s = tmp;
		}

		cout << s << endl;
	}

	return 0;
}

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

int N;
string S, T;
int main() {
    cin >> N >> S >> T;

    rep(i, N) {
        cout << S[i] << T[i];
    }

    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<int,int> Paint;
int main(){
  int n;cin>>n;
  vector<Paint> arr;
  for(int i = 0; n > i; i++){
    int a,b;cin>>a>>b;
    arr.push_back(make_pair(b,a));
  }
  sort(arr.begin(),arr.end());
  int nw = 0;
  for(int i = 0; n > i; i++){
    nw += arr[i].second;
    if(nw > arr[i].first){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}
    

Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define ll long long
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
using namespace std;
const int tINF = (int)INT_MAX;
const long long lINF = (long long)LLONG_MAX;
int fact(int num){
    int res = 1;
    for(int i = 2; i <= num; ++i)
        res *= i;
    return res;
}
int findNum(vector <int> &pr){
    vector <int> cr = pr;
    sort(all(cr));
    bool f = 1;
    int cnt = 0;
    do{
        ++cnt;
        if(cr == pr)
            break;
    }while(next_permutation(all(cr)));
    return cnt;
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef DEBUG
			assert(freopen("inp", "r", stdin));
			assert(freopen("out", "w",stdout));
	#else
			#define cerr if(false)cerr
	#endif
    int n;
    cin >> n;
    vector <int> pr(n),qr(n);
    for(auto &i : pr)
        cin >> i;
    for(auto &i : qr)
        cin >> i;
    int a = findNum(pr);
    int b = findNum(qr);
    cout << abs(a - b) << '\n';
   cerr << "Time execute: " << (double)clock() / (double)CLOCKS_PER_SEC 
    << " sec" << endl;
}

Measured memory_bytes: 256
l=input()
n=len(l)
Mod=10**9+7
ans=0
count=1
for i in range(n):
    if l[i]=='1':
        ans=(ans+count*pow(3,n-1-i,Mod))%Mod
        count=(count*2)%Mod
ans=ans+count
print(ans%Mod)
    


Measured memory_bytes: 39536
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    int n, m;cin >> n >> m;
    
    vector<tuple<int,int,int>> t(m);
    vector<pair<int,int>> p(m);

    rep(i,m){
        cin >> get<0>(t[i]) >> get<1>(t[i]);
        get<2>(t[i])  = i;
    }

    sort(all(t));

    int tmp = 1;
    int town = get<0>(t[0]);
    rep(i,m){
        if(town != get<0>(t[i])){
            tmp = 1;
            town = get<0>(t[i]);
        }
        
        get<1>(t[i]) = tmp;
        tmp++;
    }

    rep(i,m){
        p[get<2>(t[i])].first = get<0>(t[i]);
        p[get<2>(t[i])].second = get<1>(t[i]);
    }

    rep(i,m){
        cout << setw(6) << setfill('0') << p[i].first;
        cout << setw(6) << setfill('0') << p[i].second << endl;
    }
}

    

Measured memory_bytes: 3456
from collections import Counter

n=int(input())

mod=10**9+7

def factorization(n):
    p=2
    fcr=[]
    while p*p<=n:
        while n%p==0:
            fcr.append(p)
            n//=p
        p+=1
    if n>1:
        fcr.append(n)
    return fcr

ha=[]
for i in range(1,n+1):
  l=factorization(i)
  ha+=l

c=Counter(ha)

ans=1
for v in c.values():
  ans*=v+1
  ans%=mod

print(ans)

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

#define x first
#define y second
#define pb push_back
#define mp make_pair

#define all(a) (a).begin(), (a).end()

#define ll long long

int n, p, v;
ll m, a[100000];

bool ok(int x) {
    ll y = m*(v-1);
    int z = 0;
    vector<ll> b;
    for (int i = 0; i < n; i++) {
        if (i == x) continue;
        if (a[i] > a[x]+m) {
            y -= m;
            z++;
            if (z > p-1) return 0;
        } else {
            ll w = min(m, a[x]+m-a[i]);
            y -= w;
            if (a[x]+m > a[i]) b.pb(m-w);
        }
    }
    sort(all(b));
    for (int i=0; i<p-1-z && i<b.size(); i++) {
        y -= b[(int)b.size()-i-1];
    }
    return y <= 0;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m >> v >> p;
    for (int i=0; i<n; i++) cin >> a[i];
    sort(a, a+n);
    int lo = 0, hi = n + 1;
    while (hi-lo > 1) {
        int mi = (lo+hi)/2;
        if (ok(n - mi)) lo = mi;
        else hi = mi;
    }
    cout << lo;
    return 0;
}


Measured memory_bytes: 2916
n, m = (int(i) for i in input().split())
city2city = [0] * n
for i in range(m):
    a,b = (int(i) for i in input().split())
    city2city[a-1] += 1
    city2city[b-1] += 1

for c in city2city:
    print(c)


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

#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

int main(void) {
		int n;
		cin >> n;
		switch (n) {
		case 25:
			cout << "Christmas" << endl;
			break;
		case 24:
			cout << "Christmas Eve" << endl;
			break;
		case 23:
			cout << "Christmas Eve Eve" << endl;
			break;
		case 22:
			cout << "Christmas Eve Eve Eve" << endl;
			break;
		}
		return 0;

}



Measured memory_bytes: 256
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(1, n-1):
    if (p[i-1] < p[i] and p[i] < p[i+1]) or (p[i-1] > p[i] and p[i] > p[i+1]):
        cnt += 1
print(cnt)


Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        string a = sc.Next();
        string b = sc.Next();
        string c = sc.Next();

        string answer = a[0].ToString() + b[1].ToString() + c[2].ToString();

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
int main(){
  int x, y;
  cin >> x >> y;
  if(x==2){
    cout << "No" << endl;
  }
  
  else if(x==4||x==6||x==9||x==11){
    if(y==4||y==6||y==9||y==11){
      cout << "Yes" << endl;
    }
    
    else{
      cout << "No" << endl;
    }
  }
    
  else{
    if(y==2||y==4||y==6||y==9||y==11){
      cout << "No" << endl;
    }
    else{
      cout << "Yes" << endl;
    }
  }
  }


Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;


class Program
{


    static void Main(string[] args)
    {

        char[] cs = new char[] { ' ', ',' };
        //int val = int.Parse(Console.ReadLine());
        //int[] vals = parseAry(Console.ReadLine().Split(cs));
        //string str = Console.ReadLine();
        //string[] strs = Console.ReadLine().Split(cs);

        //string res="";
        //int res = 0; ;
        //int t = int.Parse(Console.ReadLine());
        //string str = Console.ReadLine();
        ///int[] vals = parseAry(Console.ReadLine().Split(cs));
        //int n = int.Parse(Console.ReadLine());
		
        int[] vals = parseAry(Console.ReadLine().Split(cs));
		int n=vals[0];
        int res =0;
		int[] s = new int[vals[1]+1];
		for ( int i = 0; i < n; i++ ) {

			int[] v = parseAry(Console.ReadLine().Split(cs));
			for ( int k = 1; k < v.Length; k++ ) {
				s[v[k]]++;
			}
		}

		for ( int k = 0; k < s.Length; k++ ) {
			if ( s[k] == n ) { res++; }
		}

        Console.WriteLine(res);

        return;
    }

    //　String[]  ----->  int[]
    static int[] parseAry(string[] str)
    {
        int[] nums = new int[str.Length];
        for (int i = 0; i < str.Length; i++) { nums[i] = int.Parse(str[i]); }
        return nums;
    }
    //　String[]  ----->  long[]
    static long[] parseAryL(string[] str)
    {
        long[] nums = new long[str.Length];
        for (int i = 0; i < str.Length; i++) { nums[i] = long.Parse(str[i]); }
        return nums;
    }

    //文字列を1文字ずつString[]に入れる
    static string[] strAry(String str)
    {
        string[] re = new string[str.Length];
        for (int i = 0; i < str.Length; i++) { re[i] = str[i].ToString(); }
        return re;
    }

}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main()
{
    fast;
    string s;
    cin>>s;
    int n = s.size()-1;
    if(s[n]=='s')
        cout<<s<<"es"<<endl;
    else
        cout<<s<<"s"<<endl;
    return 0;
}


Measured memory_bytes: 3660
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>
#include<bitset>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll n, m, k, a, b, c, d, ans[100000] = {};
vector<vector<ll>> suggestion;
bool visited[100000] = {};
vector<vector<ll>> neighbor, block;
const ll INF = (ll)1e6;

ll dfs(ll cur, ll start) {
	ll sum = 1;
	visited[cur] = true;
	suggestion[start].push_back(cur);
	rep(i, sz(neighbor[cur])) {
		if (!visited[neighbor[cur][i]])sum += dfs(neighbor[cur][i], start);
	}
	return sum;
}

int main() {
	cin >> n >> m >> k;
	neighbor.resize(n);
	block.resize(n);
	suggestion.resize(n);
	rep(i, n)suggestion[i].push_back(INF);
	rep(i, m) {
		cin >> a >> b;
		neighbor[a - 1].push_back(b - 1);
		neighbor[b - 1].push_back(a - 1);
	}
	rep(i, k) {
		cin >> c >> d;
		block[c - 1].push_back(d - 1);
		block[d - 1].push_back(c - 1);
	}
	rep(i, n) {
		if (!visited[i]) {
			ll box = dfs(i, i);
			stable_sort(suggestion[i].begin(),suggestion[i].end());
			rep(j, sz(suggestion[i]) - 1) {
				rep(k, sz(block[suggestion[i][j]])) {
					if (suggestion[i][LBI(suggestion[i], block[suggestion[i][j]][k])] == block[suggestion[i][j]][k])ans[suggestion[i][j]]--;
				}
				ans[suggestion[i][j]] += sz(suggestion[i]) - sz(neighbor[suggestion[i][j]]) - 2;
			}
		}
	}
	rep(i, n)cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 21052
from itertools import combinations_with_replacement as comb
N,M,Q = map(int,input().split())
abcd = [list(map(int,input().split())) for i in range(Q)]
ans = 0
for lista in comb([j for j in range(1,M+1)],N):
    lista=list(lista)
    ansi = 0
    for a,b,c,d in abcd:
        if lista[b-1]-lista[a-1]==c:
            ansi+=d
    ans = max(ans,ansi)
print(ans)

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



int main(){
    int n, m;
    cin >> n >> m;
    int ans=0;
    ans += n*(n-1)/2;
    ans += m*(m-1)/2;
    cout << ans << endl;

   

}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)n; i++)
#define REPR(i, n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define FORR(i, m, n) for(int i=(int)m-1; i>=(int)n; i--)
#define ASC(v) sort(v.begin(), v.end());
#define DESC(v) sort(v.begin(), v.end(), greater<int>());
#define REVERSE(v) reverse(v.begin(), v.end());
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
typedef long long ll;
struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;

int main() {
	ll N, R;
	cin >> N >> R;
	ll res = R;

	if (N<10) res += 100 * (10-N);

	cout << res << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <utility>
#include <numeric>
#include <iomanip>

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

using namespace std;

int main() {
    string s; cin >> s;
    int ans = 0;
    int len = s.length();

        for (int i = 0; i < len/2; i++)
        {
            if (s[i] != s[len-1-i])
            {
                //cout << i << " " << len-1-i << endl;
                ans++;
            }
            
        }

    cout << ans << endl;
}

/*

long int gcd(long int a, long int b)
{
    if (a < b) {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    
    return b ? gcd(b, a % b) : a;
}

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

*/

Measured memory_bytes: 256
import numpy as np
import sys

n,m = map(int, sys.stdin.readline().split())
a = np.array([list(input()) for _ in range(n)])
b = np.array([list(input()) for _ in range(m)])

flag = False

for i in range(n-m+1):
    for j in range(n-m+1):
        if (a[i:i+m,j:j+m] == b).all():
            flag = True
            break

print("Yes" if flag else "No")

Measured memory_bytes: 12408
# coding: utf-8

II = lambda: int(input())
MI = lambda: map(int, input().split())
MIL = lambda: list(MI())


def main():
    N = II()
    H = MIL()

    ans = 0
    prev = 0
    mode = True
    H.append(0)
    for h in H:
        if mode:
            if prev <= h:
                prev = h
            else:
                ans += prev
                mode = False
                prev = h
        else:
            if prev >= h:
                prev = h
            else:
                ans -= prev
                mode = True
                prev = h
    return ans


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 3064
using System;
using System.IO;

class Program
{
    static void Main(string[] args) {
        var scan = new Scanner();
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(Solve(scan));
        Console.Out.Flush();
    }
    static object Solve(Scanner scan) {
        int N = scan.NextInt(), D = scan.NextInt();
        var count = 0;
        for (int i = 0; i < N; i++) {
            var X = scan.NextLong();
            var Y = scan.NextLong();
            if (Math.Sqrt(X * X + Y * Y) <= D) count++;
        }
        return count;
    }
}

class Scanner
{
    string[] s;
    int i;
    public Scanner() {
        s = new string[0];
        i = 0;
    }
    public string Next() {
        if (i < s.Length) return s[i++];
        string str = Console.ReadLine();
        while (str == "") str = Console.ReadLine();
        s = str.Split(' ', StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return Next();
        i = 0;
        return s[i++];
    }
    public int NextInt() => int.Parse(Next());
    public long NextLong() => long.Parse(Next());
}

Measured memory_bytes: 46000
#include <iostream>
#include <string>

using namespace std;

void solve()
{
	string S;
	cin >> S;
	for (int i = 0; i < S.size() - 8; ++i)
	{
		cout << S[i];
	}
	cout << endl;
}

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

Measured memory_bytes: 256