akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include <string>
#include <vector>

using namespace std;

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

	int oddCnt = 0;
	vector<int> c(26, 0);

	for (int i = 0; i < s.size(); i++) {
		c[s[i] - 'a']++;
	}

	long long cnt = 0;

	for (int i = 0; i < 26; i++) {
		if (c[i] % 2 == 1) {
			oddCnt++;
			if (c[i] >= 3) {
				cnt += (c[i] - 1) / 2;
			}
		}
		else {
			cnt += c[i] / 2;
		}
	}

	if (oddCnt >= 2) {
		cout << 0 << endl;
		return 0;
	}


	long long ans = 1;
	for (long long i = cnt; i >= 1; i--) {
		ans *= i;
	}

	for (int i = 0; i < 26; i++) {
		if (c[i] >= 2) {
			long long tmp;
			if (c[i] % 2 == 1) {
				tmp = (c[i] - 1) / 2;
			}
			else {
				tmp = c[i] / 2;
			}
			for (int j = 2; j <= tmp; j++) {
				ans /= j;
			}
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 3216
//  Created by conan1024hao in 2020.
//  Copyright © 2020 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao Twitter/QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e17
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef long long int LL;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????统一类型        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    ll a,b,c;
    cin>>a>>b>>c;
    ll ans=b;
    if(b>=c){
        b-=c;
        ans+=c;
    }
    else{
        c-=b;
        ans+=b;
        ans+=mmin(c,a);
        if(c>a)ans++;
    }
    cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------








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

using namespace std;

#define F first
#define S second
#define modulo ll (1e9 + 7)

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

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}

const int N = 1e5 + 9, M = 1e6 + 9, OO = 0x3f3f3f3f;
const ll llOO = 0x3f3f3f3f3f3f3f3f;


void go(int tc){

    string s, t;    cin >> s >> t;

    int ans = 0;
    for(int i = 0;i < s.size();i++)
        ans += (s[i] != t[i]);

    cout << ans;

}




int main(){
    init();

//    freopen("in.in", "r", stdin);
//    freopen("out.out", "w", stdout);

    int t = 1, tc = 1;//  cin >> t;
    while(t--)  go(tc++);

}

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

int main() {
  string S; cin >> S;

  rep( i, 0, S.size() ) {
    if ( (i+1)%2 ) {
      if ( S[i]!='R' && S[i]!='U' && S[i]!='D' ) {
        cout << "No" << endl;
        return 0;
      }
    } else {
      if ( S[i]!='L' && S[i]!='U' && S[i]!='D' ) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

int main() {
    // input
    int n; cin >> n;
    vector<ll> a(n);
    REP (i, n) cin >> a[i];
    vector<ll> b(n);
    REP (i, n) cin >> b[i];

    // solve
    ll cnt = 0;
    REP (i, n) {
        if (a[i] > b[i]) {
            ll k = a[i] - b[i];
            b[i] += k;
            cnt += k;
        }
    }
    REP (i, n) {
        if (a[i] < b[i]) {
            ll k = (b[i] - a[i]) / 2;
            a[i] += 2 * k;
            cnt -= k;
            if (a[i] < b[i]) {
                a[i] += 2;
                b[i] += 1;
            }
        }
    }
    bool answer = (cnt <= 0);

    // output
    cout << (answer ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 384
n = int(input())
a = list(map(int, input().split()))

total = sum(a)

pre = 0
for i in range(n):
    if pre + a[i] >= total // 2:
        x = abs((total - pre * 2))
        y = abs((total - (pre + a[i])*2))
        print(min(x, y))
        break
    pre += a[i]



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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld; 
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ll> vll;




#define F first
#define S second
#define pob pop_back
#define pb push_back
#define Time()	cerr << clock() * 1000 / CLOCKS_PER_SEC << "ms\n"
#define show(x)	cerr << #x << " = " << (x) << '\n'
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define invec(v) for(auto& x : v)cin>>x;
#define Test int T;cin>>T;while(T--)
#define REP(i,j,k) for(int i=(j);(i)<(k);(i)++)
//#define phi ((1+sqrt(5))/2)
#define endl '\n'
const int MxN = 1e9+7;
const double pi = 2*acos(0.0);
int main(){
	cout.precision(15);
	FASTER;
	double r;
	cin>>r;
	cout<<2 * pi*r;
	
	
	//Test{
	
	
	
	//}
}


Measured memory_bytes: 3820
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A, B;
  cin >> N >> A >> B;
 
  if ( A >= B ) {
    cout << B << endl;
  }
  else {
    cout << A << endl;
  }
  
  if ( A + B - N >= 0) {
    cout << A + B - N << endl;
  }
  else {
    cout << 0 << endl;
  }
  
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();

        int cost = Integer.MAX_VALUE;
        int n = Math.max(x, y);
        for (int i = 0; i <= n; ++i) {
            int X = x - i;
            int Y = y - i;
            if (x - i <= 0) X = 0;
            if (y - i <= 0) Y = 0;
            int tmp = (c * 2) * i + a * X + b * Y;
            cost = Math.min(tmp, cost);
        }
        System.out.println(cost);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
  public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

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

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
    SORT(S);
    if(S[0] == S[1] && S[2] == S[3]){
        if(S[0] != S[2]){
            cout << YES << endl;
            return;
        }
    }
    cout << NO << endl;
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>

//using namespace std;

int main()
{
    int64_t nn;
    int64_t aa;
    int64_t bb;
    int64_t apb;
    int64_t ans;

    std::cin >> nn >> aa >> bb;

    apb = aa + bb;
    ans = (nn / apb) * aa;

    if(((nn % apb) - aa) >= 0){
        std::cout << (ans + aa) << std::endl;
        return 0;
    }

    ans += (nn % apb);
    std::cout << ans << std::endl;
    return 0;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);
#define H 11
#define N 110
ll d[H][H],z[N][N],h,w;
int main(){
  cin>>h>>w;
  for(int i=1;i<=h;i++)for(int j=1;j<=w;j++){
    cin>>d[i][j];
  }
  for(int i=0;i<N;i++)for(int j=0;j<N;j++){
    z[i][j]=0;
    for(int a=1;a<=h;a++)for(int b=1;b<=w;b++){
      chmax(z[i][j],d[a][b]-i*a-j*b);
    }
  }
  bool ok=1; ll cnt=0;
  for(int i=1;i<=h;i++)for(int j=1;j<=w;j++){
    ll mi=1e9;
    for(int a=0;a<N;a++)for(int b=0;b<N;b++){
      if(z[a][b]>100)continue; cnt++;
      chmin(mi,z[a][b]+a*i+b*j);
    }
    if(mi!=d[i][j])ok=0;
  }
  cnt=cnt/h/w+2*(N-1);
  if(ok==0){
    cout<<"Impossible"<<endl;
    return 0;
  }
  cout<<"Possible"<<endl;
  cout<<2*N<<" "<<cnt<<endl;
  for(int i=1;i<N;i++)cout<<i<<" "<<i+1<<" X"<<endl;
  for(int i=N+1;i<2*N;i++)cout<<i<<" "<<i+1<<" Y"<<endl;
  for(int a=0;a<N;a++)for(int b=0;b<N;b++){
    if(z[a][b]>100)continue;
    cout<<a+1<<" "<<2*N-b<<" "<<z[a][b]<<endl;
  }
  cout<<1<<" "<<2*N<<endl;
    return 0;
}



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

const int mod=1000000007,iv2=(mod+1>>1);
int n,cnt,nw,ans1,ans2,pre[200010];
struct node{int v,p;}a[200010];
struct Node{int v1,v2,l,r,laz;}t[800010];

bool cmp(node a,node b) {return a.v<b.v;}
int add(int x,int y) {return x+y>=mod?x+y-mod:x+y;}
Node operator +(Node a,Node b) {return (Node){a.v1+b.v1,add(a.v2,b.v2),a.l,b.r,1};}

void build(int i,int l,int r)
{
	t[i].l=l,t[i].r=r,t[i].laz=1,t[i].v1=t[i].v2=0;
	if (l==r) return;
	int mid=(l+r)>>1;
	build(i<<1,l,mid),build(i<<1|1,mid+1,r);
}

void pushdown(int i)
{
	if (t[i].laz==1) return;
	t[i<<1].v2=1ll*t[i<<1].v2*t[i].laz%mod,t[i<<1].laz=1ll*t[i].laz*t[i<<1].laz%mod;
	t[i<<1|1].v2=1ll*t[i<<1|1].v2*t[i].laz%mod,t[i<<1|1].laz=1ll*t[i].laz*t[i<<1|1].laz%mod;
	t[i].laz=1;
}

void add(int i,int x,int v2)
{
	if (t[i].l==t[i].r) {t[i].v1++,t[i].v2=add(t[i].v2,v2); return;}
	pushdown(i); int mid=(t[i].l+t[i].r)>>1;
	add(i<<1|(x>mid),x,v2),t[i]=t[i<<1]+t[i<<1|1];
}

Node query(int i,int l,int r)
{
	if (t[i].l==l&&t[i].r==r) return t[i];
	pushdown(i); int mid=(t[i].l+t[i].r)>>1;
	if (r<=mid) return query(i<<1,l,r);
	if (l>mid) return query(i<<1|1,l,r);
	return query(i<<1,l,mid)+query(i<<1|1,mid+1,r);
}

int main()
{
	scanf("%d",&n);
	for (int i=1; i<=n; i++) scanf("%d",&a[i].v),a[i].p=i;
	sort(a+1,a+1+n,cmp),cnt=0,nw=1,build(1,1,n),ans1=ans2=0,pre[0]=1;
	for (int i=1; i<=n; i++) pre[i]=1ll*pre[i-1]*(a[i].v-i+1)%mod;
	for (int i=n; i; i--)
	{
		Node L=query(1,1,a[i].p),R=query(1,a[i].p,n);
		ans1=(ans1+1ll*L.v2*(a[i].v-i+mod)%mod*(a[i].v-i+1+mod)%mod*pre[i-1])%mod;
		ans2=(ans2+1ll*R.v2*(a[i].v-i+mod)%mod*(a[i].v-i+1+mod)%mod*pre[i-1])%mod;
		t[1].laz=1ll*t[1].laz*(a[i].v-i+mod)%mod,t[1].v2=1ll*t[1].v2*(a[i].v-i+mod)%mod;
		cnt=add(cnt,L.v1),add(1,a[i].p,nw),nw=1ll*nw*(a[i].v-i+1+mod)%mod;
	}
	ans1=1ll*ans1*iv2%mod,ans2=1ll*ans2*iv2%mod;
	ans2=(ans2+1ll*cnt*pre[n]-ans1+mod)%mod;
	return printf("%d\n",ans2),0;
}

Measured memory_bytes: 16128
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
const long long INF = 1e18;
const double PI = 2 * asin(1);
typedef long long ll;

int main(){
  int N; cin >> N;
  vector <int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  sort(A.begin(), A.end());

  string ans = "Yes";

  if (A[N - 1] - A[0] > 1){
    ans = "No";
  }else if(A[N - 1] - A[0] == 1){
    int cnt = 0;
    for (int i = 0; i < N; i++){
      if(A[i] == A[0]) cnt++;
    }
    
    if (cnt >= A[N - 1]){
      ans = "No";
    }else if(2 * (A[N - 1] - cnt) > N - cnt){
      ans = "No";
    }

  }else{
    if (2 * A[N - 1] > N && A[0] + 1 != N){
      ans = "No";
    }    
  }
  
  cout << ans << endl;

  return 0;
}


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

using ll = long long;

typedef pair<int, int> P;
struct edge { int to, cost; };

const int MAX_V =500000;
const int INF = 1LL<<30;

int V;
vector<edge> G[MAX_V];
int d[MAX_V];

void dijkstra(int s) {
    // greater<P>を指定することでfirstが小さい順に取り出せるようにする
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d + V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        rep(i,G[v].size()) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
    int N, E, s, t, e;
    cin >> N >> E;
    if (E == 0) {
        cout << "-1\n";
        return 0;
    }
    V = (1 << N) * N;
    rep(i, E) {
        cin >> s >> t >> e;
        rep(j, 1 << N) {
            G[(1 << N) * s + (j | (1 << t)) ^ (1 << t)].push_back({(1 << N) * t + (j | (1 << t)), e});
            //G[(1 << N) * s + j].push_back({(1 << N) * t + (j | (1 << t)), e});
        }
    }
    dijkstra(0);
    int ans = d[(1 << N) - 1];
    if (ans == INF) cout << "-1\n";
    else cout << ans << "\n";
}


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

typedef long long LL;
std::map<LL, LL> M;
typedef std::map<LL, LL>::iterator it;

const int MAXN = 100010;
LL st[MAXN], ansl[MAXN]; int top;
int main() {
	int n, Q; LL t;
	std::cin >> n >> Q;
	st[++top] = n;
	while (Q --> 0) {
		std::cin >> t;
		while (top && t <= st[top]) --top;
		st[++top] = t;
	}
	M[st[top]] = 1;
	auto back = [] () { it t = M.end(); return --t; };
	for (int i = top - 1; i; --i) {
		M[st[i]]; LL at, v; it t;
		while ((t = back())->first > st[i]) {
			at = t->first, v = t->second;
			M[st[i]] += at / st[i] * v;
			M[at % st[i]] += v;
			M.erase(t);
		}
	}
	for (auto t : M) ansl[t.first] += t.second;
	for (int i = n; i; --i) ansl[i] += ansl[i + 1];
	for (int i = 1; i <= n; ++i)
		std::cout << ansl[i] << '\n';
	return 0;
}


Measured memory_bytes: 9344
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

const int INF = 1 << 29;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
int N;
vector<string> words;
vector<map<char, int>> values;
map<char, int> cnt;
int main() {
  cin >> N;
  words.resize(N);
  for (auto &val : words){
    cin >> val;
    sort(val.begin(), val.end());
  }
  for (int i = 0; i < N; i++){
    map<char, int> cnt;
    for (int j = 0; j < words[i].size(); j++){
      cnt[words[i][j]]++;
    }
    values.emplace_back(cnt);
  }
  string result = "";
  for (char i = 'a'; i <= 'z'; i++){
    int res = INF;
    for (int j = 0; j < values.size(); j++){
      res = min(res, values[j][i]);
    }
    for (int j = 0; j < res; j++){
      result += i;
    }
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999
#define rep(i,m,n) for(int i = m;i < n;i++)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl;
#define Vecpr vector<pair<lli,lli>>
#define mod 1000000007;
lli gcd(lli num1, lli num2){
  return num2 != 0 ? gcd(num2, num1 % num2) : num1;
}
lli lcm(lli num1, lli num2){
    return num1 / gcd(num1, num2) * num2;
}
int main() {
  lli A,B,C=0,D=0,E=0,F=0,G=0,H=0,N,M;
  string S,OP1,OP2,OP3;
  cin >> S;
  A=stoll(S.substr(0,1));
  B=stoll(S.substr(1,1));
  C=stoll(S.substr(2,1));
  D=stoll(S.substr(3,1));
  N=7-A;
  if(B+C+D==N)cout<< A << '+' << B <<'+' << C << '+' << D << "=7" << endl;
  else if(B+C-D==N)cout<< A << '+' << B <<'+' << C << '-' << D << "=7" << endl;
  else if(B-C-D==N)cout<< A << '+' << B <<'-' << C << '-' << D << "=7" << endl;
  else if(-B-C-D==N)cout<< A << '-' << B <<'-' << C << '-' << D << "=7" << endl;
  else if(B-C+D==N)cout<< A << '+' << B <<'-' << C << '+' << D << "=7" << endl;
  else if(-B-C+D==N)cout<< A << '-' << B <<'-' << C << '+' << D << "=7" << endl;
  else if(-B+C+D==N)cout<< A << '-' << B <<'+' << C << '+' << D << "=7" << endl;
  else if(-B+C-D==N)cout<< A << '-' << B <<'+' << C << '-' << D << "=7" << endl;
}

Measured memory_bytes: 256
import math
a,b,x=map(int,input().split())
if (a*a*b)>=2*x:
  h=x/(b*(a/2))
  print(90-math.degrees(math.atan(h/b)))
else:
  h=(((x/a)*2)/a)-b
  b-=h
  if b!=0:
    print(90-math.degrees(math.atan(a/b)))
  else:
    print(0)

Measured memory_bytes: 3060
#include <stdio.h>
int main() {
  char input;
  int itmp;
  while (scanf("%c", &input) != EOF) {
    itmp = (int) input;
    if (itmp >= 65 && itmp <= 90) itmp += 32;
    else if (itmp >= 97 && itmp <=122) itmp -= 32;
    printf("%c", (char) itmp);
  }
  return 0;
}



Measured memory_bytes: 2692
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>

using namespace std;

int main(){

    char str[30];

    while(gets(str)){

        int len = strlen(str);

        reverse(str,str+len);

        puts(str);
    }
return 0;
}

Measured memory_bytes: 1084
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <chrono> 
using namespace std::chrono;
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_mset tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define fr(i,a,b) for (int i=(a); i<(b);++i)
#define frr(i,a,b) for(int i=(a-1);i>=(b);--i)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define ppb pop_back()
#define pf push_front
#define ppf pop_front()
#define F first
#define S second
#define pii pair<int,int> 
#define rev(a) reverse(a.begin(),a.end())
#define srt(a) sort(a.begin(),a.end())
#define rsrt(a) sort(a.begin(),a.end(),greater<int>())
#define sz(a) (ll)a.size()
#define endl "\n"
#define po(a,b) (ll)(pow(a,b)+0.5)
#define double long double
#define print(a) for(auto x:a)cout<<x<<" ";cout<<endl;
const ll M=1e9+7;
const int MaxM=501;
ll dp[2000005];


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

   int n;
   cin>>n;

   ll a[n];
   fr(i,0,n)cin>>a[i];
 ll num=0;
 fr(i,0,n)num^=a[i];
fr(i,0,n)cout<<(num^a[i])<<" ";
   }



Measured memory_bytes: 5024
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>
#include <queue>

using namespace std;

int N, L;
int ans[300][300];

void func(vector<vector<pair<int, int>>>& E, int start){
    vector<vector<int>> maxF(N, vector<int>(N, -1));
    vector<int> minCnt(N, -1);

    priority_queue<pair<pair<int, int>, int>> pq;
    maxF[start][0] = L;
    pq.push(make_pair(make_pair(0, L), start));

    while(!pq.empty()){
        auto temp = pq.top();
        pq.pop();

        int tempF = temp.first.second;
        int node = temp.second;
        int tempCnt = -temp.first.first;

        if(minCnt[node] != -1){
            continue;
        }
        minCnt[node] = tempCnt;

        if(tempCnt == N - 1){
            continue;
        }

        for(auto e: E[node]){
            int nextNode = e.first;
            int cost = e.second;
            if(cost > L){
                continue;
            }

            if(cost > tempF){
                if(minCnt[nextNode] == -1 && maxF[nextNode][tempCnt + 1] < L - cost){
                    maxF[nextNode][tempCnt + 1] = L - cost;
                    pq.push(make_pair(make_pair(-(tempCnt + 1), L - cost), nextNode));
                }
            }
            else{
                int nextF = tempF - cost;
                if(minCnt[nextNode] == -1 && maxF[nextNode][tempCnt] < nextF){
                    maxF[nextNode][tempCnt] = nextF;
                    pq.push(make_pair(make_pair(-tempCnt, nextF), nextNode));
                }
            }
        }
    }

    for(int i = 0; i < N; i++){
        ans[start][i] = minCnt[i];
    }
}

int main(){

    int M;
    cin >> N >> M >> L;

    vector<vector<pair<int, int>>> E(N);
    int a, b, c;
    for(int i = 0; i < M; i++){
        cin >> a >> b >> c;
        E[a - 1].emplace_back(make_pair(b - 1, c));
        E[b - 1].emplace_back(make_pair(a - 1, c));
    }

    for(int i = 0; i < N; i++){
        func(E, i);
    }

    int Q;
    cin >> Q;
    vector<pair<int, int>> st(Q);
    int s, t;
    for(int i = 0; i < Q; i++){
        cin >> s >> t;
        st[i] = make_pair(s, t);
    }

    for(int i = 0; i < Q; i++){
        auto temp = st[i];
        cout << ans[temp.first - 1][temp.second - 1] << endl;
    }

    return 0;
}


Measured memory_bytes: 3200
from itertools import *
N,M = map(int,input().split())
S = [list(map(int,input().split())) for m in range(M)]
a = 0

for p in permutations(range(1,N+1)):
  f = True
  if p[0]==1:
    for n in range(N-1):
      if sorted([p[n],p[n+1]]) not in S:
        f = False
    if f:
      a+=1

print(a)

Measured memory_bytes: 9200
#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

int main(){
    std::ios::sync_with_stdio(false);
    int a[3];
    int i; f(i,0,3) cin >> a[i];

    sort(a, a+3);
    int sum = 0; int X;
    f(i,0,3) sum+=a[i];
    if(3*a[2]%2 == sum%2) X = a[2];
    else X = a[2]+ 1;
    
    cout << (3*X - sum)/2 << endl;
    return 0;
    
}

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

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define pb push_back
#define fr first
#define se second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

mt19937 rng (chrono::steady_clock::now().time_since_epoch().count() );

const int MOD = 1e9 + 7;
const ll INF = 1e18;
const int MX = 3e5 + 12; //check the limits, dummy

int main()
{

    ios_base::sync_with_stdio (0);
    cin.tie (0);

    ll a, b;
    cin >> a >> b;

    if (b < a) swap (a, b);

    if (a == 1 && b == 2) cout << 3 << '\n';
    else if (a == 1 && b == 3) cout << 2 << '\n';
    else if (a == 2 && b == 3) cout << 1 << '\n';

    return  0;
}


Measured memory_bytes: 256
N, M = [int(i) for i in input().rstrip().split(' ')]
num_list_1 = [1 ,3 , 5, 7, 8, 10, 12]
num_list_2 = [4, 6, 9, 11]
num_list_3 = [2]

if N in num_list_1 and M in num_list_1:
  print('Yes')
elif N in num_list_2 and M in num_list_2:
  print('Yes')
elif N ==  2 and M == 2:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

#define chmax(a, b) (a) = max(a, b)
#define chmin(a, b) (a) = min(a, b)

int64_t dpow(int64_t a, int64_t b, int64_t MOD) {
  if (b == 0) {
    return 1;
  }
  if (b % 2 == 0) {
    return dpow(a * a % MOD, b / 2, MOD);
  } else {
    return dpow(a, b - 1, MOD) * a % MOD;
  }
}

int main() {
  int64_t N, M;
  cin >> N >> M;

  vector<vector<int64_t>> stirling(N + 1 + 1, vector<int64_t>(N + 1 + 1, 0));
  stirling[0][0] = 1;
  rep(i, N + 1) rep(j, i + 1) {
    stirling[i + 1][j + 1] = stirling[i][j] + (j + 1) * stirling[i][j + 1] % M;
    stirling[i + 1][j + 1] %= M;
  }
  vector<int64_t> fact(N + 1, 1);
  rep(i, N) { fact[i + 1] = fact[i] * (i + 1) % M; }

  int64_t result = 0;
  irep(i, N) {
    int64_t comb = fact[N] * dpow(fact[i] * fact[N - i] % M, M - 2, M) % M;
    int64_t f = 0;

    int64_t p2 = dpow(2, N - i, M);
    int64_t t = 1;
    for (int j = 0; j <= i; j++) {
      f += stirling[i + 1][j + 1] * t % M;
      f %= M;

      t *= p2;
      t %= M;
    }
    f *= dpow(2, dpow(2, N - i, M - 1), M);
    f %= M;

    int64_t term = dpow(-1, i, M) * comb % M * f % M;
    result += term;
    result %= M;
  }
  result = (result + M) % M;
  cout << result << endl;

  return 0;
}

Measured memory_bytes: 74180
var i,n,j,res:longint;
    a:array[1..100000] of longint;
procedure sort(l,r:longint);
var i,j,x,y: longint;
begin
  i:=l; j:=r; x:=a[random(r-l+1)+l];
  repeat
    while a[i] < x do inc(i);
    while x < a[j] do dec(j);
    if not(i > j) then
      begin
        y:=a[i];
        a[i]:=a[j];
        a[j]:=y;
        inc(i);
        dec(j);
      end;
 until i > j;
 if l < j then sort(l,j);
 if i < r then sort(i,r);
end;
function find(l,r,x:longint):longint;
var  mid:longint;
begin
  while l <= r do
    begin
      mid:=(l+r) >> 1;
      if (a[mid] < x) then l:=mid + 1 else r:=mid -1;
    end;
  exit(l-1);
end;
begin
  readln(n);
  for i:=1 to n do read(a[i]);
  sort(1,n);
  for i:=1 to a[n] do if find(1,n,i) = n div 2 then inc(res);
  writeln(res)
end.

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

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

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second　//pairの二つ目の要素

 vector<int> r;


int main(){
    set<int> s;
    ll n,k;
    cin>>n>>k;
    int a[n+1];
    a[n]=n;
    REP(i,n){
        cin>>a[i];
        a[i]--;
    }
    r.push_back(0);
    s.insert(0);
    int no=a[0];
    while(s.count(no)==0){
        r.push_back(no);
        s.insert(no);
        no=a[no];
    }
    int pre,kri;
    REP(i,n){
        if(r[i]==no){
            pre=i;
            kri=r.size()-pre;
            break;
        }
    }
    int ans;
    if(k<=pre){
        ans=r[k]+1;
    }
    else{
        ans=r[(k-pre)%kri+pre]+1;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 13812
#include<iostream>
using namespace std;
int main(){
  int i=1,n; 
  cin>>n;
 while(i<n){
   i*=2;
   }
   if(i<=n){
   cout<<i<<endl;
   }
   else if(i>n){
   cout<<i/2<<endl;
   }
  return 0;
}

Measured memory_bytes: 768
#include<stdio.h>

#define NIL -1
#define A 101
#define N 2000

void MSTPrim();

static const int MAX=500;
static const int INFTY=(1<<21);

int key[A], M[A][A], p[A], S[A], d[A], n, sum;

int main(){
  int i, j, u, k, v, c;
  scanf("%d", &n);
  for (i=0; i<n; i++){
    for (j=0; j<n; j++){
      M[i][j]=INFTY;
    }
  }
  for (i=0; i<n; i++){
    scanf("%d %d", &u, &k);
    for (j=0; j<k; j++){
      scanf("%d %d", &v, &c);
      M[u][v]=c;
    }
  }
  sum = 0;
  MSTPrim();
  for (i=0; i<n; i++){
    printf("%d %d\n", i, (d[i]==INFTY?-1:d[i]));
  }

  return 0;
}

void MSTPrim(){
  int i, v, u;
  for(u=0;u<n;u++){
    key[u]=INFTY;
    p[u]=NIL;
    d[u]=INFTY;
  }
 
  key[0]=0;
  
  while(1){
    int minv=INFTY;
    u=NIL;
    for(i=0; i<n; i++){
      if(key[i]<minv && p[i]==NIL){
	u=i;
	minv=key[i];
      }
    }
    if(u==NIL) break;
    p[u]=1;
    d[u]=key[u];
    for(v=0;v<n;v++){
      if(p[v]!=1 && key[u]+M[u][v]<key[v]){
	key[v]=key[u]+M[u][v];
      }
    }
  }
}

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

int main(){
  long long n,k;
  string s;
  cin >> n >> s >> k;
  char a = s[k-1];
  for(long long i = 0; i < n; i++){
    if(s[i]!=a) s[i]='*';
  }
  cout << s << endl;
}

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

const int MAX_N = 5000;
int dp[MAX_N+1][MAX_N+1];

string calc_lcs(string &s, string &t){
  int M = s.length();
  int N = t.length();
  string ans = "";
  for(int i = M, j = N; 0 < i && 0 < j;){
    if(dp[i-1][j] == dp[i][j]){
      --i;
    }else if(dp[i][j-1] == dp[i][j]){
      --j;
    }else if(dp[i-1][j-1] < dp[i][j]){
      ans += s[i-1];
      --i;
      --j;
    }else{
      cout << "THERE IS A BUG!" << endl;
    }
  }
  reverse(ans.begin(), ans.end());
  return ans;
}

string solve(string s, string t){
  int M = s.length();
  int N = t.length();
  
  for(int i = 0; i < M; ++i){
    for(int j = 0; j < N; ++j){
      if(s[i] == t[j]){
      	dp[i+1][j+1] = dp[i][j] + 1;
      }else{
        dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
      }
    }
  }
  return calc_lcs(s, t);
}


int main(){
  string s, t;
  cin >> s >> t;
  cout << solve(s, t) << endl;
  return 0;
}


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

using namespace std;

int N, K;
vector<int> v;
vector<int> dp;

int solution(int sum)
{ 
  if (sum < 0)
  { 
    return 1;
  }
  int& res = dp[sum];
  if (res != -1)
  { 
    return res;
  }
  res = 0; 
  for (int i = 0; i < v.size(); ++i)
  { 
    res = 1 - solution(sum - v[i]);
    if (res) break;
  }
  return res;
}


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

  std::cin >> N >> K;
  v.resize(N);
  dp = vector<int>(K+1, -1);

  for (int i = 0; i < N; ++i)
  {
    cin >> v[i];
  }

  if (solution(K) == 1) std::cout << "First";
  else std::cout << "Second";

  return 0;
}

Measured memory_bytes: 5376
#include<stdio.h>

int main(){
    int lenO, lenE;
    char o[50], e[50], pas[100];
    scanf("%s", o);
    scanf("%s", e);

    for(lenO=0; o[lenO]!='\0'; lenO++);
    for(lenE=0; o[lenE]!='\0'; lenE++);

    for(int i=0; i<lenO+lenE; i++){
        if(i%2 == 0){
            if(o[i/2] !='\0') pas[i] = o[i/2];
            else pas[i] = e[i/2];
        }
        else pas[i] = e[i/2];
    }
    pas[lenO+lenE] = '\0';

    printf("%s",pas);
    return 0;
}

Measured memory_bytes: 128
"""
bitDP
dp[j] => jの二進数表記で1になっている桁数と同じ番号の宝箱を全て開けるのに必要な費用の最小値
"""

N,M = map(int,input().split())
dp = [float("INF")]*(2**N)
dp[0] = 0
for _ in range(M):
    a,b = map(int,input().split())
    C = list(map(int,input().split()))
    key = 0
    for c in C:
        key += 1 << (c-1)
    for j in range(2**N-1,-1,-1):
        dp[j|key] = min(dp[j|key],dp[j]+a)

if dp[-1] == float("INF"):
    print(-1)
else:
    print(dp[-1])



Measured memory_bytes: 76396
import sys
A, B, C, X, Y = map(int, input().split())
if (A + B) < 2*C:
  print(X*A+Y*B)
  sys.exit()
else:
  if X >= Y:
    C_pr = Y*2*C
    if A >= 2*C:
      pr = (X - Y)*2*C
    else:
      pr = (X - Y)*A
  else:
    C_pr = X*2*C
    if B >= 2*C:
      pr = (Y - X)*2*C
    else:
      pr = (Y - X)*B
print(C_pr + pr)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <functional>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

int n, a[100010];
vector<int> vec[100010];
bool bl = true;

ll dfs(int v, int p) {
	if ((int)vec[v].size() == 1)return a[v];
	ll cnt = 0, ma = 0;
	for (int i = 0; i < (int)vec[v].size(); i++) {
		if (vec[v][i] == p)continue;
		ll q = dfs(vec[v][i], v);
		cnt += q, ma = max(ma, q);
	}
	ll x = a[v] * 2 - cnt;
	if (x < 0 || a[v] < max(ma, x))bl = false;
	return x;
}

signed main() {
	std::random_device rnd;
	std::mt19937_64 mt(rnd());
	cin >> n;
	for (int i = 1; i <= n; i++)cin >> a[i];
	for (int i = 1; i < n; i++) {
		int u, v; cin >> u >> v;
		vec[u].push_back(v);
		vec[v].push_back(u);
	}
	if (n == 2) {
		if (a[1] != a[2])cout << "NO" << endl;
		else cout << "YES" << endl;
		return 0;
	}
	for (int i = 1; i <= n; i++)if ((int)vec[i].size() > 1) {
		ll p = dfs(i, 0);
		if (!bl || p)cout << "NO" << endl;
		else cout << "YES" << endl;
		return 0;
	}
}

Measured memory_bytes: 16108
import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = readLine >>= main'
    where
        main' [n, m] = readContents n >>= print . solve n

solve :: Int -> [[Int]] -> Int 
solve n = length . filter (== n) . map length . group . sort . concatMap tail

readLine :: IO [Int]
readLine = unfoldr (\s -> second (maybe B.empty snd . B.uncons) <$> B.readInt s) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine



Measured memory_bytes: 1020
#include <vector> 
#include <list> 
#include <map> 
#include <set> 
#include <deque> 
#include <queue> 
#include <stack> 
#include <bitset> 
#include <algorithm> 
#include <functional> 
#include <numeric> 
#include <utility> 
#include <sstream> 
#include <iostream> 
#include <iomanip> 
#include <cstdio> 
#include <cmath> 
#include <cstdlib> 
#include <cctype> 
#include <string> 
#include <cstring> 
#include <ctime> 

using namespace std;

#define _int64 long long

int main()
{
  int x,y,ans;
  scanf("%d%d",&x,&y);
  ans=x-1;
  if (y>=x) ans++;
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
struct UnionFind {vector<int> par, cnt;
    UnionFind(int NV) { par.clear(); cnt.resize(NV, 1); rep(i, 0, NV) par.push_back(i); }
    void reset() { rep(i, 0, cnt.size()) cnt[i] = 1; rep(i, 0, par.size()) par[i] = i; }
    int operator[](int x) { return par[x] == x ? x : par[x] = operator[](par[x]); }
    void operator()(int x, int y) {x = operator[](x); y = operator[](y);
        if (x != y) par[x] = y, cnt[y] += cnt[x];}};
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






typedef long long ll;
int N, A[303][303];
ll d[303][303];
#define INF INT_MAX/2
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) rep(j, 0, N) cin >> A[i][j];

    vector<pair<ll, pair<int, int>>> v;
    rep(i, 0, N) rep(j, i + 1, N) v.push_back({ -A[i][j],{ i,j } });
    sort(v.begin(), v.end());

    ll ans = 0;
    rep(i, 0, N) rep(j, i + 1, N) ans += A[i][j];
    fore(p, v) {
        ll c = -p.first;
        int a = p.second.first;
        int b = p.second.second;
        if (A[a][b] == INF) continue;

        rep(i, 0, N) if (i != a && i != b && A[a][i] != INF && A[i][b] != INF) {
            if (A[a][i] + A[i][b] == c) {
                ans -= c;
                A[a][b] = A[b][a] = INF;
                break;
            } else if (A[a][i] + A[i][b] < c) {
                printf("-1\n");
                return;
            }
        }
    }
    cout << ans << endl;
}


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

main(){
  int n;
  cin>>n;
  int a[n+1];
  for(int i=1;i<=n;i++)
    cin>>a[i];
  int dp[n+1];
  //dp[0]=0;
  dp[1]=0;
  dp[2]=abs(a[2]-a[1]);
  for(int i=3;i<=n;i++){
    dp[i]=min(abs(a[i]-a[i-1])+dp[i-1],abs(a[i]-a[i-2])+dp[i-2]);
  }
  cout<<dp[n];
  
}


Measured memory_bytes: 4332
#include<iostream>

int main()
{
	int s = 0, a;
	
	for( int i = 0; i < 4; i++ ){
	 	std::cin >> a;
		s += a;
	}
	
	std::cout << s / 60 << std::endl;
	std::cout << s % 60 << std::endl;

 	return 0;
}

Measured memory_bytes: 1164
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct node
{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer cur = nil->next;
  while(cur!=nil && cur->key != key)
  {
    cur = cur->next;
  }
  return cur;
}

void init()
{
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList()
{
  NodePointer cur = nil->next;
  int isf = 1;
  while(1)
  {
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t)
{
  if(t==nil)
  {
    return;
  }
  t->prev->next=t->next;
  t->next->prev=t->prev;
  free(t);
}

void deleteFirst()
{
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast()
{
  deleteNode(nil->prev);
}

void delete(int key)
{
  deleteNode(listSearch(key));
}


void insert(int key)
{
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;

}

int main()
{
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ )
  {
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' )
    {
      insert(key); np++; size++;
    }
    else if ( com[0] == 'd' )
    {
      if (strlen(com) > 6)
      {
	      if ( com[6] == 'F' )
        deleteFirst();
	      else if ( com[6] == 'L' )
        deleteLast();
      }
      else
      {
	      delete(key);
        nd++;
      }
      size--;
    }
  }
  printList();
  return 0;
}



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

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 5e5 + 10;

vector<int> g[N];
bool viss[N];
int vis[N];

// Normal DFS
void dfs(int curr, int par)
{
  for(auto x: g[curr])
    if(x != par)
      dfs(x, curr);
}

// DFS with visiting status
void dfs1(int curr, int par)
{
  viss[curr] = 1;
  for(auto x: g[curr])
    if(!viss[x])
      dfs1(x, curr);
}

// DFS with strongly connected component
void dfs2(int curr, int par, int num)
{
  vis[curr] = num;
  for(auto x: g[curr])
    if(vis[x] == 0)
      dfs2(x, curr, num);
}

// XOR from 0 to n
ll fxor(ll n)
{
  if(n < 0) return 0;
  if(n % 4 == 3) return 0;
  else if(n % 4 == 0) return n;
  else if(n % 4 == 1) return n^(n-1);
  else if(n%4 == 2) return n^(n-1)^(n-2);
}

// Power in logn with mod 1000000007
llt ppow(llt x, llt y)
{
  llt res = 1;
  while(y > 0){
    if(y&1)
      res = (res * x)%M;
    y = y >> 1;
    x = (x * x)%M;
  }
  return res;
}

// Factorial with dp
llt factdp[N];
llt fact(llt x)
{
  if(x == 0) return 1;
  if(x == 1) return 1;
  if(factdp[x] != -1) return factdp[x];
  return factdp[x] = (x*fact(x-1))%M;
}

// String return to base b
string ansConv ="";
void convert10tob(llt N, int b)
{
     if (N == 0)
        return;
     int x = N % b;
     N /= b;
     if (x < 0)
        N += 1;
     convert10tob(N, b);
     ansConv += to_string(x);
     return;
}

// Convert string to num wiht base b
llt convertstrtob(string a, int b)
{
  llt aa = 0;
  llt mul = 1;
  for(int i=a.length()-1; i>=0; i--)
  {
    int curr = a[i] - '0';
    aa += (curr * mul);
    mul *= b;
  }
  return aa;
}

// Union Find algo with array
// Find()
int findpar(int curr, int arr[])
{
  while(arr[curr] != curr) curr = arr[curr];
  return curr;
}
// Union()
void Union(int b, int spa, int arr[])
{
  while(arr[b] != b)
  {
    int c = arr[b];
    arr[b] = spa;
    b = c;
  }
  arr[b] = spa;
}

// Main Code


int main()
{
  int n, m;
  cin>>n>>m;
  rep(i, 0, m+2)
    cout<<'#';
  cout<<endl;
  rep(i, 0, n)
  {
    cout<<'#';
    rep(j, 0, m)
    {
      char x;
      cin>>x;
      cout<<x;
    }
    cout<<'#'<<endl;
  }
  rep(i, 0, m+2)
    cout<<'#';
  cout<<endl;
  return 0;
}


Measured memory_bytes: 12160
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

constexpr int P = 1000000007;

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

    int n, k;
    cin >> n >> k;

    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    vector<int> b(a);
    sort(b.begin(), b.end());

    ll r = 0;
    ll k2 = (ll)k * (k - 1) / 2 % P;
    for (int i = 0; i < n; i++) {
        int t = 0;
        for (int j = i + 1; j < n; j++) {
            if (a[i] > a[j]) t++;
        }
        r += (ll)t * k;
        auto s = lower_bound(b.begin(), b.end(), a[i]) - b.begin();
        r += (ll)s * k2;
        r %= P;
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
from numpy import*
n,m=map(int,input().split())
l=[]
for i in range(m):
    *a,=map(int,input().split())
    l.append(a[1:])
*p,=map(int,input().split())

ans=0
for t in range(2**n):
    tmp=array([t>>s&1 for s in range(n)])
    if p==[sum(tmp[array(i)-1])%2for i in l]:
        ans+=1
print(ans)

Measured memory_bytes: 12448
#include<bits/stdc++.h>
using namespace std;
int main()
{
  vector <int> a;
  for(int i =0 ; i<5; ++i)
  {
    int temp;
    cin>>temp;
    a.push_back(temp);
  }
  int ans = 0;
  for(int i =0; i<5; ++i)
    if(a[i] == 0)
    {
      ans = ++i;
      break;
    }
  cout<<ans<<endl;
}
  

Measured memory_bytes: 3540
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define ff first
#define ss second
#define vll vector<ll>
#define pii pair<ll,ll>
#define sz(v) (v).size()
#define srt(v) sort(v.begin(),v.end())
#define ull unsigned long long
#define tell(a) cout<<a<<" "
#define el cout<<endl
#define rev(v) reverse(v.begin(),v.end())
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ld long double
#define mem(a,b) memset(a,b,sizeof(a) )
#define M 1000000007

ll power(ll x, ll y, ll p){ll res = 1;x = x % p;while (y > 0){   if (y & 1)res = (res*x) % p;y = y>>1;
x = (x*x) % p;}return res;}



ll a[10000001];
int main()
{
	IOS;
	int n;
	cin>>n;
  for(int i=2;i<=10000000;i++)
	a[i]=2;
	a[1]=a[0]=1;
	for(int i=2;i*i<=n;i++)
	{
			for(int j=i*i;j<=n;j+=i)
			{
				if(j==i*i)
				a[j]++;
				else
				a[j]+=2;
			}
	}
	for(int i=2;i<=n;i++)
	{
		a[i]=a[i]*i;
		a[i]+=a[i-1];
	}
	cout<<a[n]<<endl;
	
}



Measured memory_bytes: 81680
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int x,a,b;
   while(cin>>x>>a>>b)
   {
       if(abs(x-a)<abs(x-b))
       {
           cout<<"A"<<endl;
       }
       else
       {
           cout<<"B"<<endl;
       }
   }


   return 0;
}


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

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(){
  ll n,T;
  cin>>n>>T;
  ll mn = 100000;
  rep(i,0,n){
    ll a,b;
    cin>>a>>b;
    if(b<=T){
      mn = min(mn,a);
    }
  }
  if(mn==100000){
    cout << "TLE" << endl;
  }
  else{
    cout << mn << endl;
  }
  return 0;
}

Measured memory_bytes: 256