akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using vi=vector<int>;
using pii=pair<int, int>;

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

int x,y,z;

signed main()
{
	cin>>x>>y>>z;
	swap(x,y);
	swap(x,z);
	printf("%lld %lld %lld\n",x,y,z);
}




Measured memory_bytes: 764
S = list(input())

center = len(S) // 2
if len(S) % 2 == 0:
    head, tail = S[:center], S[center:]
else:
    head, tail = S[:center], S[center + 1:]

c = 0
for t, z in zip(head, tail[::-1]):
    if t != z:
        c += 1
print(c)


Measured memory_bytes: 3060
from itertools import product

C = [0 for _ in range(3)]
for i in range(3):
    C[i] = list(map(int, input().split()))

x = [0] * 3
y = [0] * 3
for i in range(3):
    y[i] = C[0][i] - x[0]
    x[i] = C[i][0] - y[0]

ans = 'Yes'
for i, j in product(range(3), range(3)):
    if(x[i] + y[j] != C[i][j]):
        ans = 'No'
        break
print(ans)


Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

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

    List<Integer> list1 = new ArrayList<>();
    List<Integer> list2 = new ArrayList<>();
    long sum = 0;

    if(m == 1){
        System.out.println(0);

        System.exit(0);
    }
    
    for(int i = 0 ; i < m ; i++){
        list1.add(sc.nextInt());
    }

    Collections.sort(list1);

    for(int i = 0 ; i < m - 1 ; i++){
        list2.add(list1.get(i+1)-list1.get(i));
    }

    Collections.sort(list2);

    for(int i = 0 ; i < m - n ; i++){
        sum += list2.get(i);
    }

    System.out.println(sum);


    


    








    

    
    

    


    
    


    


    
    


    
	}
}

Measured memory_bytes: 61496
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
constexpr int MOD = 1000000007;
constexpr int INF = 2000000000;
using namespace std;

int main() {
	int n;
	string s, t;
	cin >> n >> s >> t;
	int ans = INF;
	for (int i = 0; i <= n; i++) {
		bool f = true;
		for (int j = i; j<n; j++) {
			if (s[j] != t[j - i])f = false;
		}
		if (f)ans = min(ans, i * 2 + (n - i));
	}
	cout << ans << endl;
}

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

int main() {
  
  int a,b,c;
  cin >> a >> b >> c;
  
  if ( a == b ){
    cout << c << endl;
  }else if ( a == c ){
    cout << b << endl;
  }else{
    cout << a << endl;
  }
  
  
}



Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    char MOJI[1200]={};
    int i=0;
    
    while(1){
        scanf("%c", &MOJI[i]);
        if (MOJI[i]==0){
            break;
        }
        else if (MOJI[i]>='a' && MOJI[i]<='z'){
            MOJI[i]=MOJI[i]-32;
        }
        else if(MOJI[i]>='A' && MOJI[i]<='Z'){
            MOJI[i]=MOJI[i]+32;
        }
        printf("%c", MOJI[i]);
        i++;
    }
    return 0;
}


Measured memory_bytes: 2048
// AOJ 2938 Tanuki and Fox
// 2018.3.12 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()  // 非負整数の入力
{
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

int main()
{
	int N, a, b, x;

	N = in() - 2;
	a = (gc() == 'T'), gc(), b = (gc() == 'T'), gc();
	x = 1; if (a && !b) x = 0;
	while (N--) {
		a = (gc() == 'T'), gc();
		if (x && !a) x = 0; else x = 1;
	}
	puts(x ? "T" : "F");
	return 0;
}


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

counter = 0
begin_b = []
end_a = []
begin_b_and_end_a = []
for i in range(n):
    counter += s[i].count('AB')
    if s[i][0] == 'B':
        begin_b.append(i)
    if s[i][-1] == 'A':
        end_a.append(i)
    if s[i][0] == 'B' and s[i][-1] == 'A':
        begin_b_and_end_a.append(i)

if len(begin_b) == len(begin_b_and_end_a) and len(begin_b_and_end_a) == len(end_a) and len(end_a) > 0:
    print(counter + min(len(begin_b), len(end_a)) - 1)
else:
    print(counter + min(len(begin_b), len(end_a)))


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

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (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[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
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; }
template<typename T1, typename T2> bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> bool chmin(T1 &a, const T2 &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &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;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int r;
signed main() {
    cin >> r;
    cout << r * r << endl;

}


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

#define FOR(i,a,b) for(int i=(int)a; i<(int)b; ++i)
#define REP(i, n) FOR(i,0,n)
template<class T> void CHMAX(T & a, T b) { a = (a >= b ? a : b); }
constexpr int INFINT = (1 << 30) - 1;
constexpr double EPS = 1e-8;
constexpr double PI = 3.141592653589793238462643383279;
using ld = long double;

struct Point {
	ld x, y;
};

int main() {

	int n;
	while (std::cin >> n, n) {
		std::vector<int> x(n), y(n), l(n);
		REP(i, n) std::cin >> x[i] >> y[i] >> l[i];
			
		auto check = [n,x,y,l](ld h) -> bool {
			std::vector<ld> r(n);
			REP(i, n) {
				if (l[i] + EPS < h) return false;
				r[i] = std::sqrt(l[i] * l[i] - h * h);
			}

			// 円iに点pが入るか判定
			auto isInCircle = [&](int i, Point p) {
				ld d = std::hypot(p.x - x[i], p.y - y[i]);
				return d <= r[i] + EPS;
			};

			// 円の包含関係・接触チェック
			std::vector<bool> valid(n, true);
			REP(i, n) REP(j, n) if (i != j) {
				ld d = std::hypot(x[i] - x[j], y[i] - y[j]);
				// 包含関係
				if (d + r[i] <= r[j] + EPS) valid[j] = false;
				// 接触
				if (d + EPS > r[i] + r[j]) return false;
			}
			{
				int cnt = 0;
				REP(i, n) cnt += valid[i];
				if (cnt <= 1) return true;
			}

			// 交点列挙
			std::vector<Point> points;
			REP(i, n) FOR(j, i + 1, n) if (valid[i] && valid[j]) {
				ld theta = std::atan2(y[j] - y[i], x[j] - x[i]);
				for (ld ok : {theta, theta + PI * 2}) {
					ld ng = theta + PI;
					REP(_, 50) {
						ld me = (ok + ng) / 2;
						Point p{ x[i] + r[i] * std::cos(me), y[i] + r[i] * std::sin(me) };
						if (isInCircle(j, p)) ok = me;
						else ng = me;
					}
					points.emplace_back(Point{ x[i] + r[i] * std::cos(ok), y[i] + r[i] * std::sin(ok) });
				}
			}

			// 各交点がn-重複部分に含まれるか判定
			for (const auto& p : points) {
				bool f = true;
				REP(i, n) {
					if (isInCircle(i, p)) continue;
					f = false;
					break;
				}
				if (f) return true;
			}
			return false;
		};

		ld ok = 1., ng = 301;
		REP(_, 50) {
			ld me = (ok + ng) / 2;
			if (check(me)) ok = me;
			else ng = me;
		}
		std::cout << std::fixed << std::setprecision(10) << ok << std::endl;
	}

	return 0;
}


Measured memory_bytes: 3732
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, M;
int B[510][510];
int K;
int X1[250010], Y1[250010], X2[250010], Y2[250010];

void solve() {
	cin >> N >> M;
	for(int i = 0; i < N; i++) {
		for(int j = 0; j < M; j++) {
			cin >> B[i][j];
		}
	}
	for(int i = 0; i < N; i++) {
		int sum = 0;
		for(int j = 0; j < M; j++) {
			sum += B[i][j];
		}
		if(sum % 2 == 1) {
			for(int j = 0; j < M; j++) {
				if(B[i][j] % 2 == 1 && i != N - 1) {
					X1[K] = i;
					Y1[K] = j;
					X2[K] = i + 1;
					Y2[K] = j;
					B[i][j]--;
					B[i + 1][j]++;
					K++;
					break;
				}
			}
		}
		for(int j = 0; j < M; j++) {
			if(B[i][j] % 2 == 1 && j != M - 1) {
				X1[K] = i;
				Y1[K] = j;
				X2[K] = i;
				Y2[K] = j + 1;
				B[i][j]--;
				B[i][j + 1]++;
				K++;
			}
		}
	}
	cout << K << "\n";
	for(int i = 0; i < K; i++) {
		cout << X1[i] + 1 << " " << Y1[i] + 1 << " " << X2[i] + 1 << " " << Y2[i] + 1 << "\n";
	}
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 6144
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
void Say(bool say, string a = "Yes", string b = "No"){cout << (say ? a : b) << endl;};

int main(){

    ll N, D;
    cin >> N >> D;
    ll ans = 0;
    for(;N>0;ans++){
        N -= (2 * D + 1);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits//stdc++.h>
using namespace std;
#define rep(i,n,k) for(int i=n;i<k;i++)
#define int long long
#define P make_pair
#define F first
#define S second
signed main(void){
    int n,m,ans,p,q;
    ans=0;
    string s;
    cin>>p>>n>>m;
    if(p==n||p==m||n==m){
        if(p==n&&p==m)
        cout<<"No"<<endl;
        else
        cout<<"Yes"<<endl;
    }
    else
    cout<<"No"<<endl;


}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <cmath>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> ab(n);
    for (int i = 0; i < n; i++) cin >> ab[i].first >> ab[i].second;

    vector<pair<int, int>> min_dist(n);
    for (int i = 1; i <= m; i++) {
        int c, d;
        cin >> c >> d;
        for (int j = 0; j < n; j++) {
            int dist = abs(ab[j].first - c) + abs(ab[j].second - d);
            if (i == 1 || min_dist[j].second > dist) {
                min_dist[j].first = i;
                min_dist[j].second = dist;
            }
        }
    }

    for (int i = 0; i < n; i++) cout << min_dist[i].first << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <string> 
#include <vector>  
#include<math.h>

#define INF 1000000000
using namespace::std;



long Lmax(long x, long y) {
	if (x > y)return x;
	return y;
}

int max(int x, int y) {
	if (x > y)return x;
	return y;
}

long Lmin(long x, long y) {
	if (x < y)return x;
	return y;
}


int min(int x, int y) {
	if (x < y)return x;
	return y;
}

int abs(int x) {
	if (x < 0) {
		return -x;
	}
	return x;
}



int  H,W,ans,N,A,B;
string S,s;


int main() {
	cin >> H >> W;

	N = H + W;

	if (N % 2 == 0) {
		cout << N / 2 << endl;
	}
	else {
		cout << (N+1) / 2 << endl;
	}

	return 0;
}




Measured memory_bytes: 256
#include <iostream>
using namespace std;
int N;
int A[200];

int main(){
    int A, B, C, X;
    cin>>A>>B>>C>>X;
    int count;
    for(int a = 0; a <= A; a++){
        for(int b = 0; b <= B; b++){
            for(int c = 0; c <= C; c++){
                if(500*a + 100*b + 50*c == X) count++;
            }
        }
    }
    cout << count << endl;
}


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

int main() {
int a, b, c;
cin >> a >> b >> c;
int K;
cin >> K;
bool frag = false;
     for(int i=0;i <=K;i++){
        for(int j=0;j <= K;j++){
            for(int k=0;k <= K;k++){
                int x = pow(2,i);
                int y = pow(2,j);
                int z = pow(2,k);
                int A, B, C;
                A = a * x;
                B = b * y ;
                C = c * z ;

         if(B > A && C > B && i + j + k <= K){
             frag = true;

                 }

            }
        }
     }
     if(frag){
                      cout << "Yes" << endl;
     }
     else{
                   cout << "No" << endl;  
     }
}


Measured memory_bytes: 4060
#include <iostream>
using namespace std;
#include<string.h>
#include<set>
#include<stdio.h>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include <cstdio>
#include <cstdlib>
#include<stack>
#include<vector>
long long  n;
struct lll
{
    long long  x,a[11];
}TM[110];
long long  s[20]={1,2,4,8,16,32,64,128,256,512,1024};
int  main()
{
    long long  n;
    cin>>n;
    long long  x;
    for(long long  i=1;i<=n;i++)
    {
        long long  sum=0;
        for(long long  j=0;j<10;j++)
        {
            cin>>x;
            sum+=s[j]*x;
            //cout<<sum<<endl;
        }
        //cout<<i<<"_"<<sum<<endl;
        TM[i].x=sum;
    }
    for(long long  i=1;i<=n;i++)
    {
        for(long long  j=0;j<=10;j++)
        {
            cin>>TM[i].a[j];
        }
    }
    long long  MAX=-1e18;
    for(long long  i=1;i<1024;i++)
    {
        long long  sum=0;
        for(long long  j=1;j<=n;j++)
        {
            long long  q=(TM[j].x&i);
            long long  sum1=0;
            while(q!=0)
            {
                if(q%2==1)
                    sum1++;
                q/=2;
            }
            sum+=TM[j].a[sum1];
            //cout<<sum<<endl;
        }
        //if(sum==0)
           // cout<<i<<endl;
         MAX=max(MAX,sum);
    }
    cout<<MAX<<endl;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
A, B, C = map(int, input().split())

#内部レーティング
if A==B==C:
    ans="No"
elif A!=B and B!=C and A!=C:
    ans="No"
else:
    ans="Yes"


# 出力
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
#define MOD(x) (x + 1000000007) % (1000000007)

using namespace std;

template <class t>
using vec = vector<t>;
using ll = long long;

const int MAX = numeric_limits<int>::max();

template <class t>
ostream &operator<<(ostream &out, vec<t> &v)
{
    for (auto &e : v)
        out << e << " ";
    out << "\n";
    return out;
}

template <class t>
istream &operator>>(istream &in, vec<t> &v)
{
    for (auto &e : v)
        in >> e;
    return in;
}

vec<ll> a;
vec<vec<pair<ll, ll>>> dp;
pair<ll, ll> DEFAULT = {0, 0};
int n;

pair<ll, ll> find(int l, int r, bool move)
{
    if (l == r)
        return (move ? pair<ll, ll>(a[l], 0) : pair<ll, ll>(0, a[l]));
    if (dp[l][r] != DEFAULT)
        return dp[l][r];
    auto lt = find(l + 1, r, !move), rt = find(l, r - 1, !move);
    if (!move)
    {
        lt = {lt.second, lt.first};
        rt = {rt.second, rt.first};
    }
    if (lt.first + a[l] > rt.first + a[r])
        dp[l][r] = {lt.first + a[l], lt.second};
    else
        dp[l][r] = {rt.first + a[r], rt.second};
    if (!move)
        dp[l][r] = {dp[l][r].second, dp[l][r].first};
    return dp[l][r];
}

int main()
{
    cin >> n;
    a = vec<ll>(n);
    cin >> a;
    dp = vec<vec<pair<ll, ll>>>(n, vec<pair<ll, ll>>(n, {0, 0}));
    auto xy = find(0, n - 1, true);
    cout << (xy.first - xy.second);
    return 0;
}

Measured memory_bytes: 144232
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,x,y;
    while(cin>>a>>b>>c>>x>>y)
    {
        int ans=0;
        if(c*2<a+b)
        {
            while(x && y)
            {
                x--;
                y--;
                ans+=c*2;
            }
            //cout<<ans<<endl;
            if(x)
            {
                if(c*2<a)
                {
                    ans+=(c*2)*x;
                }
                else
                {
                    ans+=a*x;
                }
            }
            if(y)
            {
                if(c*2<b)
                {
                    //y--;
                    ans+=(c*2)*y;
                }
                else
                {
                    ans+=y*b;
                }
            }
        }
        else
        {
            while(x)
            {
                x--;
                ans+=a;
            }
            while(y)
            {
                y--;
                ans+=b;
            }
        }
        cout<<ans<<endl;
    }

}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
#include<queue>
#include<algorithm>
using namespace std;
#define N 5000
struct mzls
{
	int to;
	double cost;
}as;
struct mzls1
{
	int x,y,z;
}a1[N+5];
vector<mzls>g[N+5];
queue<int>q;
bool f[N+5],f1;
int n;
double dist[N+5];
inline void prepare()
{
	scanf("%d%d%d%d",&a1[1].x,&a1[1].y,&a1[2].x,&a1[2].y);
	a1[1].z=a1[2].z=0;
	dist[1]=dist[2]=1e18;
	scanf("%d",&n);
	n+=2;
	for(int i=3;i<=n;i++)
	{
		scanf("%d%d%d",&a1[i].x,&a1[i].y,&a1[i].z);
		dist[i]=1e18;
	}
	for(int i=2;i<=n;i++)
		for(int j=1;j<i;j++)
		{
			double ml=sqrt(1.0*(a1[i].x-a1[j].x)*(a1[i].x-a1[j].x)+1.0*(a1[i].y-a1[j].y)*(a1[i].y-a1[j].y));
			ml-=a1[i].z+a1[j].z;
			if(ml<0.0)
				ml=0.0;
			as.cost=ml;
			as.to=j;
			g[i].push_back(as);
			as.to=i;
			g[j].push_back(as);
		}
}
inline void SPFA(int s)
{
	dist[s]=0,f[s]=1;
	q.push(s);
	while(!q.empty())
	{
		int v=q.front();q.pop();
		f[v]=0;
		for(int i=0;i<g[v].size();i++)
		{
			mzls ml=g[v][i];
			if(dist[ml.to]>dist[v]+ml.cost)
			{
				dist[ml.to]=dist[v]+ml.cost;
				if(!f[ml.to])
				{
					q.push(ml.to);
					f[ml.to]=1;
				}
			}
		}
	}
}
int main()
{
	prepare();
	SPFA(1);
	printf("%.10lf\n",dist[2]);
	return 0;
}

Measured memory_bytes: 16512
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define uint unsigned long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
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 sigma(int n){
    int sum=0;
    for (int i=1; i<=(n); i++){
        sum+=i;
    }
    return sum;
}
int distance(int yo,int xo,int yi,int xi){
    return (yo-yi)*(yo-yi)+(xo-xi)*(xo-xi);
}
signed main(){
    int m1,m2,d1,d2;
    cin >> m1 >> d1 >> m2 >> d2;
    if(d1 == 1){
        cout << 0 << endl;
        return 0 ;
    }
    if(((d2-d1)==1)){
        cout << 0 << endl;
        return 0;
    }
    else{
        cout << 1 << endl;
        return 0;
    }
}


Measured memory_bytes: 256
import math

A, B, H, M = map(int,(input().split()))

#余弦定理
# ans　**　2 == A ** 2 + B ** 2 - 2 * A * B * cosX

#時間を分に変換
hour = 60 * H + M

#回った角度
if M > 0:
    Long = 360 / (60 / M)
else :
    Long = 0

if hour == 0 :
    small = 0
else :
    small = 360 / (720 / hour)

#内角
theta = abs(Long - small)
if theta > 180 :
    theta = 360 - theta

rad = math.radians(theta)
cosX = math.cos(rad)

X  = A ** 2 + B ** 2 - 2 * A * B * cosX
ans = X ** (1/2)
print(ans)


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

using namespace std;

using ss_t = bool[50][50];

bool calc(int h, int w, const ss_t& ss) {
  for (int row = 0; row < h; row++) {
    for (int column = 0; column < w; column++) {
      if (!ss[row][column]) {
        continue;
      }
      if (row > 0 && ss[row - 1][column]) {
        continue;
      }
      if (column > 0 && ss[row][column - 1]) {
        continue;
      }
      if (row < h - 1 && ss[row + 1][column]) {
        continue;
      }
      if (column < w - 1 && ss[row][column + 1]) {
        continue;
      }
      return false;
    }
  }
  return true;
}

int main() {
  int h, w;
  std::cin >> h >> w;

  std::string s;
  ss_t ss;
  for (int row = 0; row < h; row++) {
    std::cin >> s;
    for (int column = 0; column < w; column++) {
      ss[row][column] = s[column] == '#';
    }
  }
  std::cout << (calc(h, w, ss) ? "Yes" : "No") << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
using ll=long long;


int main(){
  int N;
  cin>>N;
  vector<ll> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }

  ll ans=1000;
  for(int i=0;i<N-1;i++){
    if(A[i]<A[i+1]){
      ll x=ans/A[i];
      ans+=x*(A[i+1]-A[i]);
    }
  }
  cout<<ans<<endl;
}


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


#define x_ real()
#define y_ imag()
#define cross(a, b) (conj(a)*(b)).imag()
#define dot(a, b) (conj(a)*(b)).real()
#define PI acos(-1)
#define F first
#define S second
#define fastIO ios_base::sync_with_stdio(false), cin.tie(NULL)
#define fileIO freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef complex<ld> point;
typedef tuple<int, int, int> line;
typedef vector<point> polygon;
typedef pair<double, double> pd;
pair<int, int> dirs[] = { {1, 2}, {-1, 2}, {2, 1}, {2, -1}, {-2, 1}, {-2, -1}, {1, -2}, {-1, -2} };
ll mod = 1e9 + 7;
ld eps = 1e-6;


ll dp[107][100007], accumDP[107][100007];

int main() {
	fastIO;
	ll n, k;
	cin >> n >> k;
	ll arr[107];
	for (int i = 1; i <= n; i++) {
		cin >> arr[i];
	}

	for (int i = 0; i <= n; i++) {
		accumDP[i][0] = 1;
	}
	for (int i = 0; i <= k; i++) {
		accumDP[0][i] = 1;
	}

	for (ll i = 0; i <= n; i++) {
		for (ll j = 0; j <= k; j++) {
			if (j == 0) {
				dp[i][j] = 1;
				continue;
			}
			if (i == 0) {
				dp[i][j] = 0;
				continue;
			}
			ll sum = accumDP[i-1][j] % mod;
			if (j - arr[i] - 1 >= 0) {
				sum -= accumDP[i-1][j-arr[i]-1] % mod;
				sum += mod;
			}
			dp[i][j] = sum % mod;
			accumDP[i][j] = ((dp[i][j] % mod) + (accumDP[i][j-1] % mod)) % mod;
		}
	}
	cout << dp[n][k] % mod;

}


Measured memory_bytes: 162048
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAX 100000

main(){
    int tcase; 
    scanf("%d", &tcase);
    int n, k, pre, lm, rm, p, cur, D[MAX];
    
  for ( int t = 0; t < tcase; t++ ){
      scanf("%d %d", &n, &k);
      scanf("%d", &lm); pre = lm;
      for ( int i = 1; i < n; i++ ) {
	  scanf("%d", &p); D[i-1] = p - pre; pre = p;
	  if ( i == n-1 ) rm = p;
      }
      sort(D, D + (n-1));
      reverse(D, D + (n-1));
      int l = 0;
      for ( int i = 0; i < k-1; i++ ) l += D[i];
      printf("%d\n", max(0, rm-lm-l));
  }
}

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

int main(){
  int N;
  cin >> N;
  vector<long long> A(N);
  for(int i = 0; i < N; i++){
    cin >> A[i];
  }
  int count = 0;
  for(int i = 0; i < N; i++){
    if(A[i] < 0){
      count++;
    }
  }
  long long ans = 0;
  if(count % 2 == 0){
    for(int i = 0; i < N; i++){
      ans += abs(A[i]);
    }
  }
  if(count % 2 == 1){
    long long m = 1000000001;
    for(int i = 0; i < N; i++){
      m = min(m,abs(A[i]));
    }
    for(int i = 0; i < N; i++){
        ans += abs(A[i]);
    }
    ans -= 2 *m; 
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n,m) for(int i=(n);i<(int)(m);i++)
#define reps(i,n,m) for(int i=(n);i<=(int)(m);i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define printfdouble(x) printf("%.12f\n",(x))
#define chartoint(c) (int)((c) - '0')
#define chartoll(c) (long long)((c) - '0')
#define MOD 1000000007
#define itn int
#define enld endl
#define ednl endl
#define icn cin
#define Endl endl
#define stirng string
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
using Graph = vector<vector<int>>;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b){if(b<a){a=b; return 1;} return 0;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int N; cin >> N;
    if(N == 0){
      cout << 0 << endl;
      return 0;
    }
    string ans = "";
    while(true){
        if(N == 0) break;

        int rem = N % 2;
        if(rem == -1) rem += 2;
        N = (N - rem) / (-2);
        ans += (char)('0' + rem);
    }

    reverse(all(ans));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <complex>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(a, b, c) for(ll c=a;c<b;c++)
#define re(b, c) for(ll c=0;c<b;c++)
typedef long long int ll;
typedef long double ld;
using namespace std;
#include <iomanip>
int main(int argc, char const *argv[]) {
  ld a, b, l = 0.0, r = 10000.0;
  std::cin >> a >> b; complex<ld> x(a, b);
  std::cin >> a >> b; complex<ld> y(a, b);
  std::cin >> a >> b; complex<ld> z(a, b);
  ld xy = abs(x-y), xz = abs(x-z), yz = abs(y-z);
  ld ar_A = abs(arg(y-x)-arg(z-x));
  ld ar_B = abs(arg(z-y)-arg(x-y));
  ld ar_C = abs(arg(x-z)-arg(y-z));
  //std::cout << ar_A << " " << ar_B << " " << ar_C << '\n';

  if(ar_A>M_PI) ar_A= 2*M_PI-ar_A;
  if(ar_B>M_PI) ar_B= 2*M_PI-ar_B;
  if(ar_C>M_PI) ar_C= 2*M_PI-ar_C;
  ar_A /= 2, ar_B/=2, ar_C/=2;
  //std::cout << ar_A << " " << ar_B << " " << ar_C << '\n';
  while(r - l > 1e-12){
    ld mid = (l+r)/2;
    ld A = mid/tan(ar_A);
    ld B = mid/tan(ar_B);
    ld C = mid/tan(ar_C);
    if(A+B+2*mid<=xy||B+C+2*mid<=yz||A+C+2*mid<=xz) l = mid;
    else r = mid;
  }
  std::cout << fixed << setprecision(20) << r << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long int ll;
using namespace std;
int main()
{
  ll n, x;
  cin >> n >> x;
  ll ans = 0;
  // REP(a, n){
  //   if(a%x == 0){
  //     REP(b, n){
  // 	if(b%x == 0){
  // 	  ans += n/x;
  // 	}
  //     }
  //   }
  // }
  // if(x%2 == 0){
  //   REP(a, n){
  //     if(a%x == x/2){
  // 	REP(b, n){
  // 	  if(b%x == x/2){
  // 	    ans += (n - x/2)/x;
  // 	  }
  // 	}
  //     }
  //   }
  // }  
  ll num1 = n/x;
  ans += num1*(num1 - 1)*(num1 - 2) + 3*num1*(num1 - 1) + num1;
  // cout << num1 << endl;
  if(x%2 == 0){
    ll num2 = (n + x/2)/x;
    // cout << num2 << endl;
    ans += num2*(num2 - 1)*(num2 - 2) + 3*num2*(num2 - 1) + num2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
const long long INF = 1LL << 60;
const int MOD = 1000000007;
signed main(void){
    string s; cin>>s;
    int n = s.size();
   
    int pc=0, gc=0;
    int ans = 0;
    rep(i,n){
        if(s[i] == 'p'){
            if(gc) gc--;
            else {ans--; gc++;}
        }else{
            if(gc) {gc--; ans++;}
            else {gc++;}
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
// #define int long long
#define REP(i,n) for(int i=0; i<n; i++)
#define pb push_back
#define MOD 1000000007

using namespace std;

vector<int> compress(int n, vector<int> a) {
    vector<int> vals(n);
    REP(i,n) vals.at(i) = a[i];
    sort(vals.begin(),vals.end());
    vals.erase(unique(vals.begin(),vals.end()),vals.end());
    vector<int> id(n);
    REP(i,n) id[i] = lower_bound(vals.begin(),vals.end(),a[i]) - vals.begin();
    return id;
}

signed main() {
    int n,m;
    cin >> n >> m;
    vector<vector<int> > data;
    REP(i,m) {
        int p,y;
        cin >> p >> y;
        vector<int> dt;
        dt.pb(p); dt.pb(y);
        data.pb(dt);
    }
    vector<vector<int> > cities(n);
    REP(i,m) {
        cities[data[i][0] - 1].pb(data[i][1]);
    }
    REP(i,n) {
        sort(cities[i].begin(),cities[i].end());
        cities[i].erase(unique(cities[i].begin(),cities[i].end()),cities[i].end());
    }
    REP(i,m) {
        int p,y;
        p = data[i][0];
        y = data[i][1];
        int id;
        id = lower_bound(cities[p-1].begin(),cities[p-1].end(),y) - cities[p-1].begin() + 1;
        printf("%06d%06d\n",p,id);
    }
    return 0;
}

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

int n;
vector<vector<int>> g;
vector<vector<int>> c;
vector<int> it;
int f;
int ma;

int fa(int x, int xm = -1){
	it.at(x) = 1;
	if(x == 2*n+1){
		f = 1;
		if(xm != -1){
			c.at(xm).at(x) -= ma;
			c.at(x).at(xm) += ma;
		}
		return 0;
	}
	rep(i, g.at(x).size()){
		if(it.at(g.at(x).at(i)) == 0 && c.at(x).at(g.at(x).at(i)) != 0 && f == 0){
			if(ma > c.at(x).at(g.at(x).at(i))) ma = c.at(x).at(g.at(x).at(i));
			fa(g.at(x).at(i), x);
		}
	}
	if(f == 1){
		if(xm != -1){
			c.at(xm).at(x) -= ma;
			c.at(x).at(xm) += ma;
		}
	}
	return 0;
}

int main(){
	int ans = 0, inx, iny;
	cin >> n;
	vector<P> r(n);
	g = vector<vector<int>>(2*n+2, vector<int>(0));
	c = vector<vector<int>>(2*n+2, vector<int>(2*n+2, 0));
	it = vector<int>(2*n+2);
	rep(i, n){
		cin >> inx >> iny;
		r.at(i) = {inx, iny};
		g.at(2*n).push_back(i);
		g.at(i).push_back(2*n);
		g.at(n+i).push_back(2*n+1);
		g.at(2*n+1).push_back(n+i);
		c.at(2*n).at(i) = 1;
		c.at(i).at(2*n) = 1;
		c.at(2*n+1).at(i+n) = 1;
		c.at(i+n).at(2*n+1) = 1;
	}
	rep(i, n){
		cin >> inx >> iny;
		rep(j, n){
			if(inx > r.at(j).first && iny > r.at(j).second){
				g.at(n+i).push_back(j);
				g.at(j).push_back(n+i);
				c.at(j).at(n+i) = 1;
			}
		}
	}
	for(int i=0; i>=0; i++){
		f = 0;
		ma = 100;
		rep(i, 2*n+2) it.at(i) = 0;
		fa(2*n);
		if(f == 1) ans += ma;
		else break;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
using namespace std;
int main( void )
{
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  for( int i=0; i<4; i++ ) cout << S[i];
  cout << ' ';
  for( int i=4; i<12; i++ ) cout << S[i];
  cout << endl;
}

Measured memory_bytes: 256
N = input()
a_list = [int(i) for i in input().split(' ')]
mod = 1000000007
 
sum = 0
for i in a_list:
  sum += i
 
output_sum = 0
for idx, i in enumerate(a_list[:-1]):
  sum -= a_list[idx]
  output_sum += i*sum
  
print(output_sum%mod)

Measured memory_bytes: 31664
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 #define int long long
#define all(X) (X).begin(), (X).end()
#define reset(X) memset(X, 0, sizeof(X))
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define endl '\n'
#define fi first
#define se second
 
 
 
using namespace __gnu_pbds;
using namespace std;
 // const int mod=1e9+7;
 const int mod=998244353;
const int INF=4e18+10;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
#define read(n) int n; cin>>n;
#define readv(x, n) vector<int> x(n); for(auto &i:x) cin>>i; 
 
 
int power(int a, int b, int mod)
{
    int prod=1;
    int mult=a%mod;
    while(b!=0)
    {
        if(b%2)
        {
            prod*=mult;
            prod%=mod;
        }
        mult*=mult;
        mult%=mod;
        b/=2;
    }
    return prod;
}
int mod_inv(int q, int mod)
{
    return power(q, mod-2,mod);
}


signed main()
 
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
       cout.tie(NULL);
     #ifndef ONLINE_JUDGE
        if(fopen("INPUT.txt","r"))
        {
        freopen ("INPUT.txt" , "r" , stdin);
        freopen ("OUTPUT.txt" , "w" , stdout);
        }
     #endif
    auto clk=clock(); 
        mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    // -------------------------------------Code starts here---------------------------------------------------------------------     

    read(n);
    read(m);
    readv(a,n);
    int sum=accumulate(all(a), (int)0);
    if(sum>n)
        cout<<-1<<endl;
    else
        cout<<n-sum<<endl;
    // -------------------------------------Code ends here------------------------------------------------------------------
 
 
    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
    return 0;
 }


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

//qsort
int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}
int desc(const void *a, const void *b) {
  return *(int *)b - *(int *)a;
}

int main(void){
    int n;
    scanf("%d",&n);
    int d[n];
    for(int i=0;i<n;i++)scanf("%d",&d[i]);
    qsort(d, n, sizeof(int), asc);
    int rslt = 0;

    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            int ij = (d[j]+d[i]);
            for(int k=j+1;k<n;k++){
                if(d[k]>ij)break;
                if((d[j]<(d[i]+d[k]))&&(d[k]<ij)){
                    rslt += 1;
                }
            }
        }
    }

    printf("%d\n",rslt);
    return 0;
}


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

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#define int long long

using namespace std;

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

const int N = 200000 + 10;
const int MOD = 1000000007;
const int LOG = 20;
const int INF = 1000000010;
const int delta = 11353;

int n;
deque<int> dq;

int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	n++;
	int last = 0;
	for (int i = 0; i < 60; i++){
		if (n & (1ll << i)) last = i;
	}
	int pnt = 0;
	for (int i = last - 1; i >= 0; i--){
		//cout << pnt << '\n';
		dq.push_front(++pnt);
		if (n & (1ll << i)) dq.push_back(++pnt);
		//cout << dq.back() << ' ' << dq.front() << '\n';
	}
	vi ans;
	while (dq.size()) ans.pb(dq.back()), dq.pop_back();
	for (int i = 1; i <= pnt; i++) ans.pb(i);
	cout << ans.size() << '\n';
	for (auto u:ans)cout << u << ' ';

	return 0;
}


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

using namespace std;

int main() {
    string s;   cin >> s;
    long long k;    cin >> k;
    int sl = s.length();

    long long cnt = 0;
    long long tmp = 1;
    long long tmp2 = 0;
    long long tmp3;
    int i = 1;
    while (i < sl && s[0] == s[i]) {
        tmp++;
        i++;
    }

    if (tmp == sl) {
        cout << (tmp * k) / 2 << endl;
        return 0;
    }

    int j = sl-1;
    while (s[0] == s[j]) {
        tmp2++;
        j--;
    }

    tmp3 = tmp + tmp2;

    for (int l = i; l <= j; l++) {
        if (l+1 <= j && s[l] == s[l+1]) {
            cnt++;
            l++;
        }
    }

    cout << tmp / 2 + cnt * k + tmp2 / 2 + (tmp3/2) * (k-1) << endl;
    return 0;
}

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

#define M (1000000007LL)


/***************************************
    main
***************************************/
int main( int argc, char *argv[] )
{
    int n;

    if( scanf( "%d", &n ) != 1 ) {
        puts( "Input error." );
        exit( 0 );
    }

    printf( "%d\n", (n+1)/2 );
}


Measured memory_bytes: 128
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <cstring>
#include <iostream>
#include <algorithm>

#define fi first
#define se second
#define pb push_back
#define MP std::make_pair
#define PII std::pair<int, int>
#define all(x) (x).begin(), (x).end()
#define CL(a, b) memset(a, b, sizeof a)
#define rep(i, l, r) for (int i = (l); i <= (r); ++ i)
#define per(i, r, l) for (int i = (r); i >= (l); -- i)
#define PE(x, a) for (int x = head[a]; x;x = edge[x].next)

typedef long long ll;

const int MAXN = 1e3 + 7;
const int MAXM = 2e5 + 7;

int n, m;
std::vector<PII> E[MAXN];
int fr[MAXM], to[MAXM], col[MAXN][MAXN][2], vis[MAXN], ts;

void dfs(int u, int root, int c, int type) {
	vis[u] = ts, col[root][u][type] = c;
	for (auto v: E[u]) if (vis[v.fi] != ts) dfs(v.fi, root, c, type);
}

void solve(int u) {
	vis[u] = ++ts;
	for (auto v: E[u]) if (vis[v.fi] != ts) dfs(v.fi, u, v.se, 0);
	std::reverse(all(E[u]));
	vis[u] = ++ts;
	for (auto v: E[u]) if (vis[v.fi] != ts) dfs(v.fi, u, v.se, 1);
}

int main() {
	scanf("%d %d", &n, &m);
	rep(i, 1, m) scanf("%d %d", fr + i, to + i), E[fr[i]].pb(MP(to[i], i));
	rep(i, 1, n) solve(i);
	rep(i, 1, m) {
		if ((col[to[i]][fr[i]][0] != 0) == (col[fr[i]][to[i]][0] != i || col[fr[i]][to[i]][1] != i)) printf("same\n");
		else printf("diff\n");
	}
	return 0;
}

Measured memory_bytes: 13696
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

signed
main(){
	string s;
	cin >> s;
	map<char,int> a;
	for(int i=0;i<4;i++){
		a[s[i]]++;
	}
	bool flag = true;
	if(a.size()==2){
		for(auto b : a){
			if(b.second!=2) flag = false;
		}
	}else{
		flag = false;
	}
	if(flag) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>

 

using namespace std;

 

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a <= b && b <= c)
        cout << a << " " << b << " " << c << endl;
    else if (a <= c && c <= b)
        cout << a << " " << c << " " << b << endl;
    else if ( b <= a && a <= c)
         cout << b << " " << a << " " << c << endl;
    else if ( b <= c && c <= a)
         cout << b << " " << c << " " << a << endl;
    else if ( c <= a && a <= b)
         cout << c << " " << b << " " << a << endl;
    else if ( c <= b && b <= a)
         cout << c << " " << b << " " << a << endl;
}


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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(long long s){
    set<int> memo;
    memo.insert(s);
    REP(i, 1000001){
        s = (s % 2 == 0 ? s / 2 : 3 * s + 1);
        if(memo.count(s) == 1){
            cout << i + 2 << endl;
            return;
        }
        memo.insert(s);
    }
}

int main(){
    long long s;
    scanf("%lld",&s);
    solve(s);
    return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	var n, m, a, b int
	fmt.Scanf("%d %d", &n, &m)
	paths := make([][]int, n+10)
	for i := 0; i < m; i++ {
		a = nextInt()
		b = nextInt()
		paths[a] = append(paths[a], b)
		paths[b] = append(paths[b], a)
	}
	sign := make([]int, n+10)
	q := make([]int, 0, n+10)
	q = append(q, 1)
	sign[1] = 1
	for len(q) > 0 {
		v := q[0]
		q = q[1:]
		for _, d := range paths[v] {
			if sign[d] == 0 {
				q = append(q, d)
				sign[d] = v
			}
		}
	}
	fmt.Println("Yes")
	for i := 2; i <= n; i++ {
		fmt.Println(sign[i])
	}
}


Measured memory_bytes: 15604
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W, x, y, z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
typedef long long ll;
typedef pair<ll, ll> Pa;

class UnionFind {
public:
	vector <ll> par; // 各元の親を表す配列
	vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;
		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}

	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}
};

bool is_prime(int num){
	for(int i = 2;i<=sqrt(num);i++){
		if(num % i == 0) return false;
	}
	return true;
}

vector<int> nums;
int main() {
	cin >> N;
	for(int i=6;i<55556;i += 5){
		if(is_prime(i)) nums.push_back(i);
	}
	rep(i, N){
		cout << nums[i] << " ";
	}
}


Measured memory_bytes: 256
package main
import(
  "fmt"
)
func main(){
  var s string 
  var i, j int
  fmt.Scan(&s)
  l:
  for i=0;i<len(s);i++{
    if s[i]=='A'{
      break l
    }
  }
  k:
  for j=len(s)-1;j>i;j--{
    if s[j]=='Z'{
        break k
    }
  }
  fmt.Println(j-i+1)
}


Measured memory_bytes: 1920
n = input().split()
for i in range (3) :
    n[i] = int(n[i])

a = sorted (n)

fl = False

if (a[0] == a[1] and a[1] != a[2]) :
    fl = True
if (a[0] != a[1] and a[1] == a[2]) :
    fl = True
print ('Yes' if fl else 'No')

Measured memory_bytes: 3064
#include<iostream>
#include<iomanip>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i, a, b) for(int i = (a);i < (b);++i)
#define FORR(i, b, a) for (int i = (b) - 1;i >= 0;--i)
#define REP(i, n) for(int i = 0;i < (n);++i)
#define REPR(i, n) for(int i = (n) - 1;i >= 0;--i)
#define ITER(itr, v) for(auto itr = v.begin();itr != v.end();++itr)
#define SORT(v) sort(v.begin(), v.end())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

class BIT {
	int n;
	vector<ll> node;
public:
	BIT(int N) {
		n = N;
		node.resize(n + 1);
	}

	void add(int i, ll x) {
		for (++i;i <= n;i += (i&-i)) {
			node[i] += x;
		}
	}

	ll sum(int i) {
		ll s = 0;
		for (;i > 0;i -= (i&-i)) {
			s += node[i];
		}
		return s;
	}
};

class RSQ {
	int n;
	BIT a, b;

public:
	RSQ(int N) : n(N), a(N), b(N) {}

	void add(int l, int r, int x) {
		a.add(l, -l * x);
		a.add(r, r * x);
		b.add(l, x);
		b.add(r, -x);
	}

	ll sum(int i) {
		return a.sum(i) + b.sum(i) * i;
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, q;
	cin >> n >> q;
	RSQ rsq(n);
	REP(i, q) {
		int query;
		cin >> query;
		if (query == 0) {
			int s, t, x;
			cin >> s >> t >> x;
			rsq.add(s - 1, t, x);
		}
		else {
			int s, t;
			cin >> s >> t;
			cout << rsq.sum(t) - rsq.sum(s - 1) << endl;
		}
	}
	
	return 0;
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;

int main(){
    int N; cin >> N;
    vector<int> h(N); REP(i, N) cin >> h[i];

    vector<vector<int>> h_tmp(N, vector<int>(101));
    REP(i, N) {
        REP(k, 101) {
            if(k < h[i]) {
                h_tmp[i][k] = 1;
            } else {
                h_tmp[i][k] = 0;
            }
        }
    }

    int cnt = 0;
    REP(i, 101) {
        REP(k, N) {
            if(k == 0 && h_tmp[k][i] == 1) {
                cnt++;
            }
            
            if(k != 0 && h_tmp[k - 1][i] < h_tmp[k][i]) {
                cnt++;
            }
        }
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
#pragma region Macros
#include <bits/stdc++.h>
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll;
#pragma endregion
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	int a, b;
	cin >> a >> b;
	rep(i, max(a, b))
	{
		cout << min(a, b);
	}
	cout << '\n';
	return 0;
}


Measured memory_bytes: 256