akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#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 all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}

int inf=1e9;
struct segtree{
	static const int N=1<<18;
	int seg[N*2];
	segtree(){
		rep(i,N*2) seg[i]=0;
	}
	segtree(vector<int>& vi){
		rep(i,N*2) seg[i]=0;
		rep(i,vi.size()) seg[N+i]=vi[i];
		for(int i=N-1;i>0;i--) seg[i]=max(seg[i*2],seg[i*2+1]);
	}


	void update(int x,int v){
		x+=N;
		chmax(seg[x],v);
		x/=2;
		while(x){
			seg[x]=max(seg[x*2],seg[x*2+1]);
			x/=2;
		}
	}
	int getmax(int a,int b,int l=0,int r=N,int k=1){
		if(b<=l||r<=a) return 0;
		if(a<=l&&r<=b) return seg[k];
		return max(getmax(a,b,l,(l+r)/2,k*2),getmax(a,b,(l+r)/2,r,k*2+1));
	}
}seg[2];

vector<int> xs;
const int MN=100000;
typedef pair<int,int> P;
typedef pair<P,int> PP;
int a[MN],b[MN],c[MN];
int main(){
	int N;
	cin>>N;
	vector<PP> vp;
	rep(i,N) cin>>a[i]>>b[i];
	rep(i,N) xs.pb(a[i]),xs.pb(b[i]);
	sort(all(xs));
	xs.erase(unique(xs.begin(),xs.end()),xs.end());
	rep(i,N) a[i]=lower_bound(all(xs),a[i])-xs.begin(),b[i]=lower_bound(all(xs),b[i])-xs.begin();
	rep(i,N){
		vp.pb(PP(P(a[i],-b[i]),0));
		vp.pb(PP(P(b[i],-a[i]),1));
	}
	sort(all(vp));

	int K = xs.size();
	int ans=0;

	vector<P> upd[2];
	rep(i,N*2){
		PP pp=vp[i];
		int x = pp.fs.fs,y=-pp.fs.sc,c=pp.sc;
		int mx = seg[c].getmax(0,y)+1;
		chmax(ans,mx);
//		seg[1-c].update(y,mx);
		upd[1-c].pb(P(y,mx));
		if(i==N*2-1 || x!=vp[i+1].fs.fs){
			rep(t,2){
				for(P p:upd[t]) seg[t].update(p.fs,p.sc);
				upd[t].clear();
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 13520
#include <cstdio>
#include <algorithm>
#include <iostream>
#define fo(i,a,b) for(int i=a;i<=b;++i)
#define fod(i,a,b) for(int i=a;i>=b;--i)
#define efo(i,q) for(int i=A[q];i;i=B[i][0])
#define min(q,w) ((q)>(w)?(w):(q))
#define max(q,w) ((q)<(w)?(w):(q))
using namespace std;
typedef long long LL;
const int N=100500,mo=1e9+7;
int read(int &n)
{
	char ch=' ';int q=0,w=1;
	for(;(ch!='-')&&((ch<'0')||(ch>'9'));ch=getchar());
	if(ch=='-')w=-1,ch=getchar();
	for(;ch>='0' && ch<='9';ch=getchar())q=q*10+ch-48;n=q*w;return n;
}
int m,n,ans;
int a[N];
int zx[N];
LL jc[N],jcn[N];
int f[N][201];
LL ksm(LL q,int w)
{
	LL ans=1;
	for(;w;w>>=1,q=q*q%mo)if(w&1)ans=ans*q%mo;
	return ans;
}
LL P(int m,int n){return jc[m]*jcn[m-n]%mo;}
LL C(int m,int n){return jc[m]*jcn[m-n]%mo*jcn[n]%mo;}
LL ss(int q,int e)
{
	if(q<a[1])return q*jc[e]%mo;
	if(f[q][e])return f[q][e];
	int e1=e;
	e=zx[q];
	LL ans=0;
	fo(i,1,e)
	{
		// ans=(ans+ss(q%a[i],i-1)*P(e1,e1-i))%mo;
		ans=(ans+ss(q%a[i],i-1)*P(e1,e1-e)%mo*P(e-1,e-i))%mo;
	}
	return f[q][e1]=ans;
}
int main()
{
	int q,w,mx=0;
	read(n),read(m);
	fo(i,1,n)read(a[i]);
	sort(a+1,a+1+n);
	mx=max(m,a[n]);
	fo(i,1,n)zx[a[i]]=i;
	fo(i,1,mx)if(!zx[i])zx[i]=zx[i-1];

	jc[0]=1;fo(i,1,n)jc[i]=jc[i-1]*i%mo;
	jcn[n]=ksm(jc[n],mo-2);fod(i,n-1,0)jcn[i]=jcn[i+1]*(i+1LL)%mo;
	ans=ss(m,n);
	printf("%lld\n",(ans+mo)%mo);
	return 0;
}

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

int main(void){
    int a,b;
    int ans=0;
    cin>>a>>b;
    if(a >= 13)
        ans = b;
    else if(6 <= a && a <=12)
        ans = b/2;
    
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
/*
#include<algorithm>
#include<array>
#include<cassert>
#include<cmath>
#include<cstdlib>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<typeinfo>
#include<utility>
#include<vector>
*/
#define int long long int
#define double long double
using namespace std;
#define MOD 1000000007
#define INF 1000000000000000007
const int MAX_N = 1 << 17;
#define REP(i, n) for (int(i) = 0, i##_len = (n); (i) < i##_len; (i)++)
#define REPS(i, x) for (int(i) = 1; (i) <= (int)(x); (i)++)
#define RREP(i, x) for (int(i) = ((int)(x)-1); (i) >= 0; (i)--)
#define RREPS(i, x) for (int(i) = ((int)(x)); (i) > 0; (i)--)
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define pb push_back
#define mp make_pair
#define BIT(n) ((int)(1) << (n))
#define ALL(x) (x).begin(), (x).end()
#define debug(x) std::cout << #x << ": " << (x) << std::endl
#define nint int
using namespace std;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
typedef pair<int, int> pii;
typedef pair<double, double> dop;
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;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
struct aaa {
    aaa()
    {
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(20);
    };
} aaaaaaa;


signed main()
{
    std::string s, t;
    cin >> s >> t;
    int sl = s.length();
    int tl = t.length();
    std::vector<pair<int, string>> dp(tl, {0, ""});
    for (int i = 0; i < sl; i++) {
        for (int j = tl - 1; j >= 0; j--) {
            if (i == 0 || j == 0) {
                if (s[i] == t[j]) {
                    dp[j].first = 1;
                    dp[j].second = s[i];
                }
            } else {
                if (s[i] == t[j]) {
                    if (chmax(dp[j].first, dp[j - 1].first + 1)) {
                        dp[j].second = dp[j - 1].second + s[i];
                    }
                }
            }
        }

        for (int j = 1; j < tl; j++) {
            if (chmax(dp[j].first, dp[j - 1].first)) {
                dp[j].second = dp[j - 1].second;
            }
        }
    }
    int out = 0;
    std::string outstring = "";
    for (int i = 0; i < tl; i++) {
        if (chmax(out, dp[i].first)) {
            outstring = dp[i].second;
        }
    }
    cout << outstring << endl;
    return 0;
}

Measured memory_bytes: 14464
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll k,x,y,z,n,w;
ll mini(ll x,ll y)
{
	if(x>y)
		return y;
	else
		return x;
}
int main()
{
	ll sum=0;
	cin>>n;
	cin>>w;
	vector<pair<ll,ll> > h(n+1);
	
	for (int i = 1; i <= n; ++i)
	{
		cin>>h[i].first>>h[i].second;
		sum+=h[i].second;
	}
	std::vector<ll> dp(sum+1,pow(10,17));
	dp[0]=0;
	for (int i = 1; i <= n; ++i)
	{
		for (int j = sum; j >= h[i].second; --j)
		{
			//if(i==0 || j==0)
			//	dp[j]=0;
			
				dp[j]=mini(dp[j],h[i].first+dp[j-h[i].second]);
		}
	}
	for (int i = 1; i <= sum; ++i)
	{
		if(dp[i]<=w)
			z=i;
	}
	cout<<z<<"\n";
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

int main()
{
    int h, w;
    char v[50][50];
    int ans = 0;

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

    for (int i = 1; i < h; i++) {
        for (int j = 1; j < w; j++) {
            if ((v[i][j] == '#') && (v[i][j+1] != '#') && (v[i][j-1] != '#') && (v[i+1][j] != '#') && (v[i-1][j] != '#')) {
                ans++;
            }
        }
    }

    if (ans  == 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
struct Point{
	double x,y;
};
typedef struct Point Point;
double calc(Point a,Point b,Point c){
	Point m=(Point){b.x-a.x,b.y-a.y};
	Point n=(Point){c.x-a.x,c.y-a.y};
	double S=fabs(m.x*n.y-m.y*n.x);
	return S/2.0;
}
int main(){
	Point a,b,c,p;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
		&a.x,&a.y,&b.x,&b.y,&c.x,&c.y,&p.x,&p.y)!=EOF){
		double S=calc(a,b,c);
		double s1=calc(p,a,b),s2=calc(p,b,c),s3=calc(p,c,a);
		if(s1==0.0||s2==0.0||s3==0.0){
			printf("NO\n");
			continue;
		}
		if(S>=s1+s2+s3)	printf("YES\n");
		else 	printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 612
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
int main() {
	// your code goes here
	ll h1,m1,h2,m2,k;
	cin>>h1>>m1>>h2>>m2>>k;
	int res=((h2-h1)*60)+(m2-m1)-k;
	cout<<res<<endl;
	return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000003;
#define MAX_X 1000010

struct mint {
    ll x;
    mint(ll x = 0) : x(x % MOD) {}
    mint& operator += (const mint a) {
        if ( (x += a.x) >= MOD) { x -= MOD; }
        return *this;
    }
    mint& operator -= (const mint a) {
        if ( (x += MOD - a.x) >= MOD) { x -= MOD; }
        return *this;
    }
    mint& operator *= (const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator + (const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator - (const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator * (const mint a) const {
        mint res(*this);
        return res *= a;
    }
};

// x の y 乗を求める O(log MOD)
ll modpow(ll x, ll y) {
    if (y == 0) return 1;
    ll res = modpow(x, y / 2);
    return res * res % MOD * (y & 1 ? x : 1) % MOD;
}
// x の逆元を求める O(logMOD)
ll modinv(ll x) { return modpow(x, MOD - 2); }
mint modinv(mint x) { return modpow(x.x, MOD - 2); }

ll Q;

vector<mint> fact;    // 階乗 i!

ll solve(ll x, ll d, ll n) {
    // 等差数列の積は d^n * ( (x/d + n - 1)! / (x/d - 1)! ) である
    mint x_d = mint(x) * mint(modinv(d));

    // d が 0 のときは例外 -> x^n になる
    if(d == 0) { return modpow(x, n); }

    // 剰余の関係上 MOD! 以上の階乗は 0 になる
    if(x_d.x + n - 1 >= MOD) { return 0; }

    mint ret = modpow(d, n);
    ret *= fact[ (x_d + n - 1).x ];
    ret *= modinv(fact[ (x_d - 1).x ]);

    return ret.x;
}

signed main()
{
    cin >> Q;

    // fact の作成
    fact.resize(MAX_X);
    fact[0] = 1;
    fact[1] = 1;
    for(int i = 2; i < MAX_X; ++i) {
        fact[i] = fact[i-1] * i;
    }

    REP(i, Q) {
        ll x, d, n;
        cin >> x >> d >> n;
        ll ans = solve(x, d, n);
        printf("%lld\n", ans);
    }
    return 0;
}


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

using namespace std;

class Solution {
public:
	void solve() {
		int n, k;
		cin >> n >> k;
		vector<bool> ok(n);
		for (int i = 0; i < k; i++) {
			int d;
			cin >> d;
			for (int i = 0; i < d; i++) {
				int x;
				cin >> x;
				ok[x - 1] = true;
			}
		}
		int ans = 0;
		for (int i = 0; i < n; i++)
			if (!ok[i]) ans++;
		cout << ans << "\n";

		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Measured memory_bytes: 3668
n = int(input())
a = list(map(int, input().split()))
pre = 0
onef = False
twef = False
badf = False
for i,num in enumerate(a):
    if i+1 != num:
        if not onef:
            onef = True
            badf = True
        elif not twef:
            twef = True
            badf = False
        else:
            badf = True
if not badf:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 38384
#include <iostream>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;

using P = pair<double, double>;

#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<endl

void print(P p) {
  cout << fixed << setprecision(8) << p.first << " " << p.second << endl;
}
void solve(P p1, P p2, int n) {
  if (n == 0)
    return;

  double x1 = p1.first, y1 = p1.second, x2 = p2.first, y2 = p2.second;
  P s = make_pair(x1 + (x2 - x1) / 3.0, y1 + (y2 - y1) / 3.0);
  P t = make_pair(x2 - (x2 - x1) / 3.0, y2 - (y2 - y1) / 3.0);
  double dx = t.first - s.first, dy = t.second - s.second;
  P u = make_pair(s.first + dx / 2.0 - dy * sqrt(3) / 2.0, s.second + dx * sqrt(3) / 2.0  + dy / 2.0);

  solve(p1, s, n-1);
  print(s);
  solve(s, u, n-1);
  print(u);
  solve(u, t, n-1);
  print(t);
  solve(t, p2, n-1);

}
int main() {
  IN(N);

  P s = make_pair(0.0, 0.0), t = make_pair(100.0, 0.0);
  print(s);
  solve(s, t, N);
  print(t);
  return 0;
}



Measured memory_bytes: 3256
#include<iostream>
using namespace std;
string s;
int main(){
    int i,C0=0,C1=0,C2=0,C3=0;
    long long N;
    cin >> N;
    for(i=1;i<=N;i++){
        cin >> s;
        if(s=="AC"){
            ++C0;
        }
        if(s=="WA"){
            ++C1;
        }
        if(s=="TLE"){
            ++C2;
        }
        if(s=="RE"){
            ++C3;
        }
    }
    cout << "AC x " << C0 << endl;
    cout << "WA x " << C1 << endl;
    cout << "TLE x " << C2 << endl;
    cout << "RE x " << C3 << endl;

    

}

Measured memory_bytes: 3612
#include<stdio.h>
#include<iostream>

using namespace std ;

int main()
{
	int s ;
	cin >> s ;
	int h = s / 3600 ,m = ( s / 60 ) % 60 ;
	s -= ( h * 3600 + m * 60 ) ;
	printf( "%d:%d:%d\n" ,h ,m ,s ) ;
	return 0 ;
}

Measured memory_bytes: 3224
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		char[]s = stdIn.next().toCharArray();

		//パーの回数＜＝グーの回数

		int cntp = 0;
		int cntg = 0;
		int lose = 0;
		int aiko = 0;

		for(int i = 0; i < s.length; i++) {
			if(s[i]=='g' && cntp < cntg) {
				cntp++;
			}else if(s[i] == 'g' && cntp==cntg) {
				cntg++;
			}else if(s[i]=='p'&& cntp < cntg) {
				cntp++;
				aiko++;
			}else {
				lose++;
				cntg++;
			}
		}

		System.out.println(cntp-aiko-lose);


	}

}


Measured memory_bytes: 27300
#include<cstdio>
#include<algorithm>
using namespace std;
inline int read()
{
	int s=0;
    char c=getchar();
    while(c<'0' || c>'9')c=getchar();
    while(c>='0'&&c<='9')s=(s<<1)+(s<<3)+c-48,c=getchar();
    return s;
}
int n,a[100005],ans;
int main()
{
	n=read();
	for(register int i=1;i<=n;i++)
		a[i]=read();
	sort(a+1,a+n+1);
	for(register int i=1;i<=n;i++)
	{
		int t=i;
		while(a[t+1]==a[i] && t+1<=n)  t++;
		int cnt=t-i+1;
		if(cnt>a[i])  ans+=cnt-a[i];
		if(cnt<a[i])  ans+=cnt;
		i=t;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<=b;i++) 
using namespace std;
typedef long long ll;

ll n, a,b,ans = 1e15;
int main() {
    ios::sync_with_stdio(false);
    cin >> a >> b;
  	if (a < 10 and b < 10) cout << a*b; else cout <<"-1";
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
int dp[(1<<16)];
int x[20][20];
int n;
int main(){
    while(1){
        cin>>n;
        if(n == 0) return 0;
        for(int i=0;i<n;i++){
            for(int j=0;j<=n;j++) cin >> x[i][j];
        }
        rep(i,(1<<16)) dp[i] = 1e9;
        dp[0] = 0;
        rep(i,(1<<n)){
            vector<int>vec; vec.pb(0);
            rep(j,n) if(((i>>j)&1)) vec.pb(j+1);
            rep(j,n) if(!((i>>j)&1)){
                int mn = 1e9;
                rep(k,vec.size()) mn=min(mn,x[j][vec[k]]);
                dp[i+(1<<j)] = min(dp[i+(1<<j)],dp[i]+mn);
                
            }
        }
        cout << dp[(1<<n)-1] << endl;
    }
}



Measured memory_bytes: 3380
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
arr = [111 * k for k in range(10)]
for i in range(len(arr) - 1):
    if arr[i] < n <= arr[i+1]:
        print(arr[i+1])
        break

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
ll PS(ll y) {
  ll axe=1;
  repl(i,1,y+1) {
    axe*=i;
  }
  return axe;
}
int main() {
  
  int N;
  cin>>N;
  vector<int>P(N);
  vector<int> Q(N);
  rep(i,N) {
    cin >>P.at(i);
  }
  rep(i,N) {
    cin >>Q.at(i);
  }
  
ll a[109]; 
  ll b[PS(N)][N];
for (ll i = 0; i < N; i++) {
 a[i]=i+1;
}
  ll count=0;

  
do {
    for (ll i = 0; i < N; i++) {
        if (i+1) 
        
         
     b[count][i]=a[i];
    }
  

  count++;
} while(next_permutation(a, a + N));
  
  ll c[PS(N)][N+1];
  rep(i,PS(N)) {
    rep(j,N) {
      c[i][j]=b[i][j];
    }
  }
  
  rep(k,PS(N)) {
    c[k][N]=k+1;
  }
  
  
  ll A=0;
  ll B=0;
  ll counting1=0;
  rep(i,PS(N)) {
       
    rep(j,N) {
 
  if(P.at(j)==c[i][j]) {
    counting1++;
  }
    }
    if(counting1==N) {
      A=i;
      break;
    }
    else if(counting1!=N) {
      counting1=0;
    }
  }
  
   ll counting2=0;
  rep(i,PS(N)) {
       
    rep(j,N) {
 
  if(Q.at(j)==c[i][j]) {
    counting2++;
  }
    }
    if(counting2==N) {
      B=i;
      break;
    }
    else if(counting2!=N) {
      counting2=0;
    }
  }
    
    
  //cout<<A<<" "<<B<<endl;
    ll finale=abs(B-A);
  cout<< finale <<endl;
}
  
 
  
  
  


Measured memory_bytes: 5632
#include <iostream>
#include <cmath>
#include <bits/stdc++.h>

using namespace std;
int main(void){
    // Your code here!
    double a,b,C;
    double S,L,h;
    cin>>a>>b>>C;
    S=a*b*sin(C*acos(-1)/180)/2;
    L=a+b+sqrt(pow(a,2)+pow(b,2)-2*a*b*cos(C*acos(-1)/180));
    h=S*2/a;
    cout<<fixed << setprecision(10)<<S<<endl;
    cout<<fixed << setprecision(10)<<L<<endl;
    cout<<fixed << setprecision(10)<<h<<endl;
}



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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
ll A,B,C,K;

void solve() {
    int i,j,k,l,r,x,y; string s;
    bool exit = false;
    cin>>A>>B>>C;
    cin>>K;
    ll ret;
    if(K%2==0){
        ret = A-B;    
    }
    else{
        ret = B-A;
    }
    if(ret>1000000000000000000){
        cout<<"Unfair"<<endl;
        return;
    }
    cout<<ret<<endl;
    /*cin>>N;
    vector<ll> V;
    FOR(x,N+1) {
            FOR(y,N+1) {
                    ll ret=1;
                    FOR(i,x) ret*=2;
                    FOR(i,y) ret*=5;
                    V.push_back(ret);
            }
    }
    sort(ALL(V));
    FORR(v,V) cout<<v<<endl;*/
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}



Measured memory_bytes: 256
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

public class Main {
	private static final int MOD = 1000000007;

	public static void main(String[] args) throws Exception {
		java.util.Scanner sc = new java.util.Scanner(System.in);
		String[] S = sc.nextLine().split("/");

		if (Integer.parseInt(S[0]) >= 2019) {
			if (Integer.parseInt(S[1]) >= 5) {
				System.out.println("TBD");
			} else {
				System.out.println("Heisei");
			}
		} else {
			System.out.println("Heisei");
		}

	}

	private static boolean isDebug = System.getProperty("sun.desktop") != null;

	private static void debug(Object... o) {
		if (isDebug) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	public static class Scanner {
		private BufferedInputStream inputStream;

		public Scanner(InputStream in) {
			inputStream = new BufferedInputStream(in);
		}

		public int nextInt() throws IOException {
			int num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(int[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
			}
		}

		public long nextLong() throws IOException {
			long num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(long[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
			}
		}

		public void fill(long[] a, long[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
				b[i] = nextLong();
			}
		}

		public long[] nextLong(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextLong();
			}

			return array;
		}

		public String next() throws IOException {
			StringBuilder builder = new StringBuilder();

			int read = skip();
			do {
				builder.append((char) read);
			} while ((read = inputStream.read()) > 0x20);

			return builder.toString();
		}

		private int skip() throws IOException {
			int read;
			while ((read = inputStream.read()) <= 0x20)
				;

			return read;
		}
	}
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef pair<ll,ll> prl;
typedef vector<ll> vcl;
typedef map<ll,ll> mapl;
typedef unordered_map<ll,ll> umap;
#define pb push_back
#define all(v) v.begin(), v.end()
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repi(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define reps(i,v) for(ll i=0;i<v.size();i++)
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
const ll mod = 1e9+7;

int main() {
    // your code goes here
    ll n,a[100005]={0},b[100005],c[100005],pv,ans=0;
  	bool ok=false;
    cin >> n;
    rep(i,0,n){
        cin >> a[i];
    }
    rep(i,0,n){
        if(i==0){
            if(a[i]>1){
                cout << -1 << endl;
                return 0;
            }
            b[0]=1;
        } else {
        	if(ok) b[i]=2*1e17;
            else b[i]=(b[i-1]-a[i-1])*2;
          	if(b[i]>=1e17) ok=true;
            if(a[i]>b[i]){
                cout << -1 << endl;
                return 0;
            }
        }
    }
    b[n+1]=1;
    repr(i,n,0){
        if(i==n){
            c[i]=a[i];
        } else {
            c[i]=c[i+1]+a[i];
        }
    }
    c[n+1]=0;
    rep(i,0,n){
        ans+=min(b[i],c[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5964
#include <iostream>
#include <vector>
#include <string>
using namespace std;

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

using ull = unsigned long long;

const vector<bool> dx = {true, false};
const vector<bool> dy = {false, true};

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

  vector<string> s(h);
  for (int i = 0; i < h; i++) cin >> s[i];

  vector<vector<ull>> dp(h, vector<ull>(w, 100));

  if (s[0][0] == '#')
    dp[0][0] = 1;
  else 
    dp[0][0] = 0;

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      for (int dir = 0; dir < 2; dir++) {
        int ni = i + dx[dir];
        int nj = j + dy[dir];

        if (ni >= h || nj >= w)
          continue;

        int add = 0;
        if (s[ni][nj] == '#' && s[i][j] == '.')
          add++;
        
        chmin(dp[ni][nj], dp[i][j] + add);
      }
    }
  }
  
  cout << dp[h-1][w-1] << endl;
}

Measured memory_bytes: 384
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
   return os<<"{"<<p.fs<<","<<p.sc<<"}";
}
template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
   os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}
template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}



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

  if(siz(s)<=k){
    cout<<s<<ENDL;
  }else{
    cout<<s.substr(0,k)<<"..."<<ENDL;
  }
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 3660
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(long long(a), long long(b), long long(c)) {
	return max(max(a,b), c);
}
int Min(long long(a), long long(b), long long(c)) {
	return min(min(a, b), c);
}





int main() {

	long long N, H, m;
	cin >> N >> H;
	vector<long long> A(N);
	vector<long long> B(N);
	m = 0;
	rep(i, N) {
		cin >> A.at(i) >> B.at(i);
		m = max(m, A.at(i));
	}
	
	sort(B.begin(), B.end());
	reverse(B.begin(), B.end());
	long long i = 0;
	while (H > 0 && i < N && B.at(i) > m) {
		H -= B.at(i);
		i++;
	}
	if (H > 0) {
		i += (1 + (H - 1) / m);
	}

	cout << i << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxx = 2e5 + 7;
const int Inf = 1 << 30;
const LL INF = 1LL << 60;
int k, n;
int a[maxx];

int main() {
	scanf("%d %d", &k, &n);
	for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
	int ans = a[n] - a[1];
	for(int i = 2; i <= n; i++) {
		int tmp = a[n] - a[i];
		tmp += k - a[n];
		tmp += a[i - 1] - 0;
		ans = min(ans, tmp);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
typedef long long ll;
int main(){

ll N,M,a[10000000],sum=0;
scanf("%lld%lld",&N,&M);
for(ll i=0;i<M;i++) scanf("%lld",&a[i]);
for(ll i=0;i<M;i++) sum+=a[i];
if(N>=sum) printf("%lld",N-sum);
else printf("-1");
}

Measured memory_bytes: 1756
S = input()
if S == 'SUN':
    print(7)
if S == 'MON':
    print(6)
if S == 'TUE':
    print(5)
if S == 'WED':
    print(4)
if S == 'THU':
    print(3)
if S == 'FRI':
    print(2)
if S == 'SAT':
    print(1)

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

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

// 約数列挙
vector<ll> divisor(ll N) {
    vector<ll> res;
    for (ll i = 1L; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            ll j = N / i;
            if (j != i) {
                res.push_back(j);
            }
        }
    }
    sort(res.begin(), res.end());
    return res;
}


void Main() {
    ll A, B;
    cin >> A >> B;
    vector<ll> a_d = divisor(A);
    vector<ll> b_d = divisor(B);

    vector<ll> target;
    rep(i, a_d.size()) {
        ll a = a_d[i];
        rep(j, b_d.size()) {
            ll b = b_d[j];
            if (a == b) {
                target.push_back(a);
                break;
            }
        }
    }

    vector<ll> used;
    sort(target.begin(), target.end());
    for (ll t : target) {
        if (used.size() == 0) {
            used.push_back(t);
        } else {
            bool flg = true;
            for (ll u : used) {
                if (gcd(t, u) != 1) {
                    flg = false;
                    break;
                }
            }
            if (flg) {
                used.push_back(t);
            }
        }
    }

    cout << used.size() << '\n';

}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  
  int N;
  double ans;
  cin >> N;
  
  for (int i = 0; i < N ; i++){
    
    double x;
    string u;
    cin >> x >> u;
    
    if (u == "JPY")
      ans += x;
    else
      ans += x * 380000.0;
  }
  
  cout << ans << endl;
}

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


int main(){

  int n;
  cin>>n;

 vector<int> arr(n);

 for(int i = 0;i < n; i++) cin>>arr[i];

 sort(arr.begin(),arr.end());

  int res = arr[0];
  int diff = arr[n-1] - arr[0]*2;
  //cout<<v<<endl;
  for(int i = 1; i<n;i++){
  	if(abs(arr[n-1] - 2*arr[i])<diff){
  		diff = abs(arr[n-1] - 2*arr[i]);
  		res = arr[i];
  	}
  }

  cout<<arr[n-1]<<" "<<res;

}


// 11 9 6 4 2

// 5mod3 = 2mod3

// 5 = 2mod3



Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<ll> vl;
#define inf 1000000000
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define f first
#define ss second
#define pb push_back

ll x, i;

int main(){
cin >> x;

for(i =1; i<=100000; i++){
    if(i*(i+1)/2 >= x)break;
}

cout << i << endl;




return 0;}






Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
using std::sort;
using std::min;
#define N 203010
#define ll long long
int a[N];
ll abs(ll a) {return a>0?a:-a;}
int main()
{
	int n;ll sum=0,ans1=0,ans2=0,B1,B2;
	scanf("%d",&n);
	for (int i=1;i<=n;++i) scanf("%d",&a[i]),a[i]-=i;
	sort(a+1,a+1+n);
	if (n&1) B1=B2=a[(n>>1)+1];else B1=floor((a[n>>1]+a[(n>>1)+1])/2.0),B2=ceil((a[n>>1]+a[(n>>1)+1])/2.0);
//	B1=floor(1.0*sum/n);B2=ceil(1.0*sum/n);
//	printf("%lf %d %d\n",sum/n,B1,B2);
	for (int i=1;i<=n;++i) ans1+=abs(a[i]-B1),ans2+=abs(a[i]-B2);
	printf("%lld",min(ans1,ans2));
	return 0;
}

Measured memory_bytes: 1024
// inputに入力データ全体が入る
function Main(input) {
  const heisei = input.split("/");
  for(i=0;i<=2;i++){
    heisei[i] = parseInt(heisei[i],10);
  }
  if(heisei[0] <= 2019 && heisei[1] <= 4 && heisei[2] <= 30){
     console.log("Heisei");
  }else{
     console.log("TBD");
  }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main(){
	string s;
	cin >> s;
	int n=s.length();
	int m=1000;
	rep(i,n-2){
		int tmp=(int)(s[i]-'0')*100;
		tmp += (int)(s[i+1]-'0')*10;
		tmp += (int)(s[i+2]-'0');
		m=min(m,abs(753-tmp));
	}
	cout << m << endl;
				
	return 0;
}




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

int main() {
    int N, D, X;
    cin >> N >> D >> X;
    int memo = 0;
    for (int i = 0; i < N; i++){
        int A;
        cin >> A;
        memo += (D-1)/A + 1;
    }
    cout << memo + X << endl;
}


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

int main(){
    cout << fixed << setprecision(6);
    double x[100],y[100];
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> x[i];
    }
    for(int i=0;i<n;i++){
        cin >> y[i];
    }
    double mn1 =0,mn2 =0,mn3 =0 ,mni =0,a;
    for(int i=0;i<n;i++){
        a = abs(x[i]-y[i]);
        mn1 += a;
        mn2 += a*a;
        mn3 += a*a*a;
        mni = max(mni,a);
    }
    cout << mn1 << endl;
    cout << sqrt(mn2) << endl;
    cout << pow(mn3,1/3.0) << endl;
    cout << mni << endl;
    return 0;
}


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

int jadge1(string s){
    int count = 0;
    for(int i = 0; i < s.size()/2; i++){
        if(s[i] != s[s.size()-1-i]) count += 1;
       // cout << count;
    }
    if(count == 0) return 1;
    else return 0;
};

int jadge2(string s){
    int count = 0;
    for(int i = 0; i < (s.size()/2)/2; i++){
        if(s[i] != s[s.size()/2-i-1]) count += 1;
    }
    if(count == 0) return 1;
    else return 0;
};

int jadge3(string s){
    int count = 0;
    for(int i = 0; i <  (s.size()/2)/2; i++){
        if(s[i+(s.size()/2)+1] != s[s.size()-i-1]) count += 1;
    }
     if(count == 0) return 1;
    else return 0;
};


int main(void){
    string s;
    cin >> s;
    
    if(jadge1(s) + jadge2(s) + jadge3(s) == 3) cout << "Yes";
    else cout << "No";
}


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

struct Card {
  int n, h, w, s = 0;
  Card(){};
  Card(int _n, int _h, int _w) {
    n = _n;
    h = _h;
    w = _w;
  };
};

int main() {
  int h, w, d;
  cin >> h >> w >> d;
  int n = h * w;
  vector<Card> v(n);
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      int x;
      cin >> x;
      v[i * w + j] = Card(x, i, j);
    }
  }
  int q;
  cin >> q;
  vector<int> l(q), r(q);
  for (int i = 0; i < q; i++) {
    cin >> l[i] >> r[i];
  }
  sort(v.begin(), v.end(),
       [&](const Card &x, const Card &y) { return x.n < y.n; });

  for (int i = 0; i < d; i++) {
    for (int j = d + i; j < n; j += d) {
      v[j].s = v[j - d].s + abs(v[j].h - v[j - d].h) + abs(v[j].w - v[j - d].w);
    }
  }

  // for (int i = 0; i < n; i++) {
  //   cout << v[i].n << " " << v[i].h << " " << v[i].w << " " << v[i].s <<
  //   endl;
  // }

  for (int i = 0; i < q; i++) {

    cout << v[r[i] - 1].s - v[l[i] - 1].s << endl;
  }
}


Measured memory_bytes: 3328
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;\
int yushu,N,A;
int main() 
{
	cin>>N>>A;
	yushu=N%500;
	if(A>=yushu)
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cassert>
#include <iostream>
#include <queue>
#include <cstring>
#include <map>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
using namespace std;

#define N 2020
#define B 80
#define M 1000020
#define LOGN 35
#define mod 998244353
#define inf 0x3f3f3f3f
#define LL long long

int to_min(int h, int m)
{
  return h * 60 + m;
}
int main()
{
  int h2, h1, m2, m1, k;
  scanf("%d%d%d%d%d", &h1, &m1, &h2, &m2, &k);
  int len = to_min(h2, m2) - to_min(h1, m1) - k;
  if (len < 0)
    len = 0;
  printf("%d\n", len);
  return 0;
}

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


void solve() {
  string S,T;
  cin >> S >> T;
  int ans = 0;
  for (int i = 0; i < (int)(S.length()); i++) {
    if (S[i] != T[i]) {
      ans++;
    }
  }

  cout << ans << "\n";
}

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


Measured memory_bytes: 3884
//  ____            _                  _                       _       _
// |  _ \ _   _ ___| |_    ___ _ __   | |_ ___ _ __ ___  _ __ | | __ _| |_ ___
// | |_) | | | / __| __|  / __| '_ \  | __/ _ \ '_ ` _ \| '_ \| |/ _` | __/ _ \
// |  _ <| |_| \__ \ |_  | (__| |_) | | ||  __/ | | | | | |_) | | (_| | ||  __/
// |_| \_\\__,_|___/\__|  \___| .__/___\__\___|_| |_| |_| .__/|_|\__,_|\__\___|
//                            |_| |_____|               |_|

//https://github.com/manta1130/Competitive_Programming_Template_Rust

mod union_find {

///素集合データ構造
pub struct UnionFind {
    v: Vec<usize>,
    h: Vec<usize>,
}

impl UnionFind {
    ///要素数nの素集合データ構造を構築する。
    pub fn new(n: usize) -> UnionFind {
        let mut v = Vec::new();
        for i in 0..n {
            v.push(i);
        }
        let h = vec![1; n];
        UnionFind { v: v, h: h }
    }

    ///親を探索する。
    pub fn find(&mut self, a: usize) -> usize {
        if a == self.v[a] {
            return a;
        }

        let buf = self.v[a];
        let parent = self.find(buf);
        self.v[a] = parent;
        parent
    }

    ///親が同じか判定する。
    pub fn same(&mut self, a: usize, b: usize) -> bool {
        self.find(a) == self.find(b)
    }

    ///結合する。
    pub fn union(&mut self, a: usize, b: usize) {
        let parent_a = self.find(a);
        let parent_b = self.find(b);
        if self.h[parent_a] < self.h[parent_b] {
            self.v[parent_a] = parent_b;
        } else {
            self.v[parent_b] = parent_a;

            if self.h[parent_a] == self.h[parent_b] {
                self.h[parent_a] += 1;
            }
        }
    }
}
}

#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

use union_find::*;

#[fastout]
fn main() {
    input! {
        n:usize,q:usize,
    }
    let mut uf = UnionFind::new(n);
    for _ in 0..q {
        input! {
            t:usize,u:usize,v:usize
        }
        if t == 0 {
            uf.union(u, v);
        } else {
            println!("{}", if uf.same(u, v) { "1" } else { "0" });
        }
    }
}


Measured memory_bytes: 6640
#include <iostream>
using namespace std;
 
int main()
{
    int n,tn,tmp = 0;
    cin >> n;
    tn = n;
 
    while(tn){
        tmp = tmp * 10 + tn % 10;
        tn /= 10;
    }
 
    cout << (n == tmp ? "Yes" : "No") << endl;
 
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int t = sc.nextInt();
        int num = t / a;
        int ans = num * b;
        System.out.println(ans);
        sc.close();
    }
}

Measured memory_bytes: 23252
import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
import sys
import random
import time
inf = 10**9


def main():
    n = int(input())
    d = list(map(int, input().split()))

    d.sort()
    if d[int(n/2-1)] == d[int(n/2)]:
        print(0)
        return
    print(d[int(n/2)]-d[int(n/2-1)])


if __name__ == '__main__':
    main()


Measured memory_bytes: 16652
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32

class UnionFind:
    def __init__(self, n):
        # par = Parent Number or NoV
        self.par = [-1] * (n+1)
        # rank = Tree Height
        self.rank = [0] * (n+1)
    
    # 自分が所属する集合の数を返す
    def size(self, x):
        return -1*self.par[self.find(x)]
    
    def size_list(self):
        return [x*(-1) for x in self.par[1:] if x < 0]

    # 根なら番号を返す
    def find(self, x):
        
        if(self.par[x] < 1):
            return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]

    # 親が同じか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

    def union(self, x, y):
        # 根を探す
        x = self.find(x)
        y = self.find(y)

        # もう繋がれている
        if(x == y):
            return False

        # つなぎ替える
        if(self.size(x) < self.size(y)):
            x,y = y,x
        
        # xのサイズを更新
        self.par[x] += self.par[y]
        # yのサイズ(おやばんごう)をxに
        self.par[y] = x

        return True 

    def root_nodes(self):
        # print([i for i in self.par[1:]])
        return len([i for i in self.par[1:] if i <= -1])


def solve(N: int, M: int, X: "List[int]", Y: "List[int]", Z: "List[int]"):
    uf = UnionFind(N)
    for i in range(M):
        uf.union(X[i], Y[i])
    print(uf.root_nodes())
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    X = [int()] * (M)  # type: "List[int]"
    Y = [int()] * (M)  # type: "List[int]"
    Z = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        X[i] = int(next(tokens))
        Y[i] = int(next(tokens))
        Z[i] = int(next(tokens))
    solve(N, M, X, Y, Z)

if __name__ == '__main__':
    main()


Measured memory_bytes: 15016
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <initializer_list>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, a, n) for (int i = (a); i < (int)(n); i++)
#define repc(i, a, n) for (int i = (a); i <= (int)(n); i++)
#define all(t) t.begin(), t.end()
#define rall(t) t.rbegin(), t.rend()
#define mat(type, row, col, init)                                              \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
#define DBG(str) cerr << (str) << endl;
int main() {
  int h, w;
  cin >> h >> w;
  auto c = mat(char, h, w, '.');
  rep(i,0,h){
      rep(j,0,w){
          cin>>c[i][j];
      }
  }
  rep(i,0,h){
      rep(l,0,2){
          rep(j,0,w){
              cout<<c[i][j];
          }
          cout<<endl;
      }
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  string s;
  cin >> s;
  int N = s.size();
  ll sum = 0;
  ll tmp = 0;
  for(int bit = 0; bit < (1 << (N-1)); bit++){
    tmp = s[0] - 0x30;
    for(int i = 0; i < N-1; i++){
      if(bit & (1 << i)){
        //フラグが立っているので、足し算を入れる
        sum += tmp;
        tmp = s[i+1]-0x30;
      ///  tmp = 0;
      }else{
        tmp *= 10;
        tmp += s[i+1] - 0x30;
      }
    }
    sum += tmp;
  }
  cout << sum << endl;
  return 0;
}


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

int main(int argc, char const *argv[]) {
    int n, d;
    int x[10][10];
    double ans;
    double num=0;
    cin >> n >> d;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < d; ++j) {
            cin >> x[i][j];
        }
    }
    for (int i = 0; i < n-1; ++i) {
        for(int k = i+1; k < n; ++k){
            ans=0.0;
            for (int j = 0; j < d; ++j) {
                ans+=pow(x[i][j]-x[k][j] ,2);
            }
            ans=sqrt(ans);
            if(ans==round(ans)){
                num++;
            }
//            cout << i << " " << k << ": " << ans << endl;
        }
    }
    cout << num << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
#define MOD (1000000007ll)
#define l_ength size
#define EPS (1e-10)

int main(void){
	int n,i,cnt[225816],p,ans=INF;
	bool alr[225816];
	fill(alr,alr+225816,false);
	fill(cnt,cnt+225816,1);
	alr[0] = true; cnt[0] = 0;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> p;
		if(alr[p-1]){
			cnt[p] = cnt[p-1] + 1;
		}
		alr[p] = true;
	}
	for(i=1; i<=n; ++i){
		ans = min(ans,n-cnt[i]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define randome_generate srand(std::chrono::high_resolution_clock::now().time_since_epoch().count())
using namespace std;
long long n;
long long noz(long long x){
	long long res=0LL;
	while(x){
		res+=x/5;
		x/=5;
	}
	return res;
}
long long f(long long x){
	if(x==0){
		return 0LL;
	}
	if(x%2==0){
		return noz(x/2);
	}
	else{
		return 0;
	}
}
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	cout<<f(n)<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main {
  public static void main(String args[]) {
      Scanner sc = new Scanner(System.in);
      int s = sc.nextInt();
      int w = sc.nextInt();

      if (s <= w) {
        System.out.println("unsafe");
      } else {
        System.out.println("safe");
      }
      sc.close();
  }
}

Measured memory_bytes: 35768
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long num = sc.nextLong();
        long sum = 0;
        for (long i = 1; i <= num; i++){
            if(i % 3 == 0 || i % 5 == 0){

            }else{
                sum = sum + i;
            }
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 35712
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

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

 	int n;
 	cin >> n;
 	n--;
 	int ans = 0;
 	vector<int> a(n);
 	for (auto &t : a) {
 		cin >> t;
 	}
 	for (int i = 0; i + 1 < n; i++) {
 		ans += min(a[i], a[i + 1]);
 	}
 	ans += a.front();
 	ans += a.back();
 	cout << ans << endl;
}

Measured memory_bytes: 256