akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int A,B;cin >> A >> B;
  if(A+B>=10)cout << "error" << endl;
  else cout << A+B << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define bp(x) __builtin_popcountll(x)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define ll int64_t
#define fw(i, l, r, c) for(ll i = l; i <= r; i += c)
#define bw(i, r, l, c) for(ll i = r; i >= l; i -= c)
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef vector<ll> vi;
const ll mod = 1e9 + 7, inf = 1061109567, N = 2e3 + 5;
const long long infll = 4557430888798830399;

int n, a[N], d[N];

signed main(){
//	freopen(".inp", "r", stdin);
//	freopen(".out", "w", stdout);
	fastio;
	cin >> n;
	fw(i, 0, n - 1, 1){
		cin >> a[i];
	}
	sort(a, a + n);
	if(n == 3){
		if(a[0] + a[1] <= a[2]){
			return cout << 0, 0;
		}
		return cout << 1, 0;
	}else if(n <= 2){
		return cout << 0, 0;
	}
	d[0] = 0;
	d[1] = a[2] - a[1];
	fw(i, 2, n - 2, 1){
		d[i] = d[i - 1] + a[i + 1] - a[i];  
	}
	int res = 0;
	fw(i, 0, n - 3, 1){
		fw(j, i + 1, n - 2, 1){
			fw(k, 0, i, 1){
				if(a[k] > d[j] - d[i]){
					res++;
				}
			}
		}
	}
	cout << res;
}

Measured memory_bytes: 3640
/*
  ????????????????????????????????????????????????
  ??????????????????????????????????????????????????????????????????????????????????????¨??????????????°????±???????
  ??¢?????´?????????????????¢??°?????? O(n log n)
 */
#include <bits/stdc++.h>

using namespace std;

struct Point {
    int x, y;
    Point(int x, int y) : x(x), y(y) {}
    Point() {}
};
/**
 * Line in two dimensional
 */
class Line : public std::array<Point, 2> {
public:
    Line() {}
    Line(const Point &p1, const Point &p2) {
        (*this)[0] = p1;
        (*this)[1] = p2;
    }
};
// Input of a line
std::istream& operator>>(std::istream &is, Line &l) {
    return is >> l[0].x >> l[0].y >> l[1].x >> l[1].y;
}
/**
 * Segment in two dimensional
 */
class Segment : public Line {
public:
    Segment() {}
    Segment(const Point &p1, const Point &p2) : Line(p1, p2) {}
};

enum SegmentType {
    BOTTOM, LEFT, RIGHT, TOP,
};
struct EndPoint {
    Point p;
    int id;
    SegmentType type;
    EndPoint(Point p, int id, SegmentType type) : p(p), id(id), type(type) {}
    EndPoint() {}

    bool operator<(const EndPoint &ep) const {
        if (p.y == ep.p.y)
            return type < ep.type;
        return p.y < ep.p.y;
    }
};


int SegmentIntersectionManhattan(vector<Segment> &segs) {
    const int n = segs.size();
    int MAX_X = 0;
    vector<EndPoint> event(2 * n);

    for (int i = 0, k = 0; i < n; ++i) {
        if (segs[i][0].y > segs[i][1].y ||
            (segs[i][0].y == segs[i][1].y && segs[i][0].x > segs[i][1].x))
            swap(segs[i][0], segs[i][1]);


        if (segs[i][0].y == segs[i][1].y) { // horizontal segment
            event[k++] = EndPoint(segs[i][0], i, LEFT);
            event[k++] = EndPoint(segs[i][1], i, RIGHT);
        }
        else { // vertical setment
            event[k++] = EndPoint(segs[i][0], i, BOTTOM);
            event[k++] = EndPoint(segs[i][1], i, TOP);
        }

        MAX_X = max({MAX_X, segs[i][0].x, segs[i][1].x});
    }

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

    set<int> bt; // binary search tree
    bt.insert(MAX_X + 1); // sentinel
    int cnt = 0;

    for (int i = 0; i < 2 * n; ++i) {
        if (event[i].type == TOP)
            bt.erase(event[i].p.x);
        else if (event[i].type == BOTTOM)
            bt.insert(event[i].p.x);
        else if (event[i].type == LEFT) {
            auto lb = lower_bound(bt.begin(), bt.end(), segs[event[i].id][0].x);
            auto ub = upper_bound(bt.begin(), bt.end(), segs[event[i].id][1].x);

            cnt += distance(lb, ub);
        }
    }

    return cnt;
}

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

    int n;

    cin >> n;
    vector<Segment> segs(n);
    for (int i = 0; i < n; ++i)
        cin >> segs[i];

    cout << SegmentIntersectionManhattan(segs) << endl;

    return 0;
}

Measured memory_bytes: 10040
#include<bits/stdc++.h>
using namespace std;
#define FORR(x,arr) for(auto& x:arr)
int n,p;
string s;
void solve()
{
    if(p==2 || p==5)
    {
        long long int res=0;
        for(int i=0;i<n;i++)
        {
            if((s[i]-'0')%p==0)
            {
                res+=i+1;
            }
        }
        cout<<res<<endl;
        return;
    }
    vector<long long> v(p,0);
    v[0]=1;
    int cur=0;
    long long int res=0;
    int pow10=1;
    for(int i=n-1; i>=0; --i) {
        cur=(pow10*(s[i]-'0')+cur)%p;
        res+=v[cur];
        v[cur]++;
        pow10=pow10*10%p;
  }
  cout<<res<<endl;
}
void solve_tle() {
  unordered_map<int,long long int> cnt;
  cnt[0]=1;
  int cur=0;
  long long res=0;
  for(int i=0;i<n;i++) {
    cur=(cur*10+s[i]-'0')%p;
    res+=cnt[cur];
    cnt[cur]++;
    unordered_map<int,long long int> cnt2;
    FORR(kvp,cnt) {
      cnt2[kvp.first*10%p]+=kvp.second;
    }
    swap(cnt,cnt2);
  }
  cout<<res<<endl;
}
int main()
{
    cin>>n>>p>>s;
    solve();
    return 0;
}

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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

int H,W;
const int INF = 1e9;

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

	cin >> H >> W;
	vector<string> S(H);
	FOR(i,0,H){
		cin >> S [i];
	}

	ll ans = 0;
	FOR(x,0,W - 1){
		int y = x + 1;
		vector< vector<int> > cost(H + 1,vector<int>(H + 1)),dp(H + 1,vector<int>(H + 1,INF));
		for(int i = 0;i <= H;i++){
			cost [i] [0] = 0;
			for(int j = 0;j + i < H;j++){
				cost [i] [0] += S [j] [x] == S [j + i] [y];
			}
			for(int j = 1;j + i <= H;j++){
				int c = S [H - (j + i)] [x] == S [H - j] [y];
				cost [i + j] [j] = cost [i + j - 1] [j - 1] - c;
			}
		}
		for(int i = 0;i <= H;i++){
			cost [0] [i] = 0;
			for(int j = 0;j + i < H;j++){
				cost [0] [i] += S [j + i] [x] == S [j] [y];
			}
			for(int j = 1;j + i <= H;j++){
				int c = S [H - j] [x] == S [H - (j + i)] [y];
				cost [j] [i + j] = cost [j - 1] [i + j - 1] - c;
			}
		}
		dp [0] [0] = 0;
		for(int i = 0;i <= H;i++){
			for(int j = 0;j <= H;j++){
				if(i) chmin(dp [i] [j],dp [i - 1] [j] + cost [i - 1] [j]);
				if(j) chmin(dp [i] [j],dp [i] [j - 1] + cost [i] [j - 1]);
			}
		}
		ans += dp [H] [H];
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
int main()
{
    ll N;
    cin >> N;
    if(N % 10 == 7) {
        cout << "Yes" << endl;
    } else if (N % 100 >= 70 && N % 100 < 80) {
        cout << "Yes" << endl;
    } else if (N / 100 == 7) { 
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3640
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define printall(n,array) for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 1000000007; //10^9+7
 
int myhash(int h){
  int sum=0;
  while(h){
    int dig=h%10;
    sum+=dig;
    h/=10;
  }
  return sum;
}
 
int main(){
  int n;
  cin>>n;
  if(n%myhash(n)==0){print("Yes");}
  else{print("No");}
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>

#define rep(i,n) for(int (i)=0;i < (n);(i)++)
#define ll long long
#define INF 9223372036854775807

using namespace std;

// input
ll n,m,k;
vector<ll> par;
vector<ll> size;
vector<ll> ans;

ll root(ll n) {
  if(par[n] == n) return n;
  else {
	ll r = root(par[n]);
	par[n] = r;
	return r;
  }
}

bool unite(ll n1,ll n2) {
  ll n1_r = root(n1);
  ll n2_r = root(n2);
  if(n1_r == n2_r) return false;
  if(n1_r > n2_r) swap(n1_r,n2_r);
  par[n2_r] = n1_r;
  size[n1_r] += size[n2_r];
  return true;
}

bool same(ll n1,ll n2) {
  ll n1_r = root(n1);
  ll n2_r = root(n2);
  return n1_r == n2_r;
}

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

  cin >> n >> m >> k;
  rep(i,n) {
	par.push_back(i);
	size.push_back(1);
	ans.push_back(0);
  }

  rep(i,m) {
	ll left,right;
	cin >> left >> right;
	unite(left-1,right-1);
	ans[left-1]--; ans[right-1]--;
  }

  rep(i,n) {
	ll r = root(i);
	ans.push_back(size[r]);
  }

  rep(i,k) {
	ll left,right;
	cin >> left >> right;
	if(same(left-1,right-1)) {
	  ans[left-1]--;
	  ans[right-1]--;
	}
  }

  rep(i,n) {
	ll r = root(i);
	ans[i] += size[r] - 1;
  }
  rep(i,n) cout << ans[i] << " ";

}



Measured memory_bytes: 4192
#include <bits/stdc++.h> // Include every standard library 
using namespace std; 
  
typedef long long ll; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
  
#define fi first 
#define se second 
#define mp make_pair 
#define pb push_back 
#define all(v) v.begin(), v.end() 
#define input_arr(a,n) for(int i=0;i<n;i++)cin>>a[i];
#define print_arr(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" ";



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





Measured memory_bytes: 1024
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

result=0
for i in range(N):
    result+=b[i]

for j in range(1,N):
    if a[j-1]+1==a[j]:
        result+=c[a[j-1]-1]

print(result)

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

int main()
{
	int n,t;
	cin >> n >> t;
	int ans = 1001;
	for(int i = 0;i<n;i++)
	{
		int x,y;
		cin >> x >> y;
		if(y<=t)
		{
			ans = min(x,ans);
		}
	}
	if(ans == 1001)cout<<"TLE"<<endl;
	else cout<<ans<<endl;
	return 0;
}


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

int main() {
  int N; cin >> N; N %= 10;
  string ans;
  if (N == 3) ans = "bon";
  else if (N <= 1 || N == 6 || N == 8) ans = "pon";
  else ans = "hon";
  cout << ans;
}

Measured memory_bytes: 3628
from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))
bl = [(i * (i - 1)) // 2 for i in range(N + 3)]
L = [0, 0]
for i in range(1, N + 1):
    L.append(bl[i + 1] - bl[i])
D = defaultdict(int)
for a in A:
    D[a] += 1
RES = 0
for d in D.values():
    RES += bl[d]

for a in A:
    print(RES - L[D[a]])


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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

//#define int long long
#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, d;
    cin >> n >> m >> d;
    char g[n][m];
    rep(i, n)rep(j, m) cin >> g[i][j];
    int ans = 0;
    rep(i, n)rep(j, m - d + 1) {
        bool ok = true;
        rep(k, d) {
            if (g[i][j + k] == '#') {
                ok = false;
                break;
            }
        }
        if (ok) ans++;
    }
    rep(j, m)rep(i, n - d + 1) {
        bool ok = true;
        rep(k, d) {
            if (g[i + k][j] == '#') {
                ok = false;
                break;
            }
        }
        if (ok) ans++;
    }
    cout << ans << endl;
}

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


int main()
{
    long long m;
    cin>>m;
    if(m<1200)
    cout<<"ABC\n";
    else
    cout<<"ARC\n";
   // freopen("asass.txt","w",stdout);

   /*long long start=0,ends=0,i,l;
   string st;
   cin>>st;
   l=st.size();
   for(i=0;i<l;i++)
   {
       if(st[i]=='A')
       {
           start=i;
           break;
       }
   }
   for(i=l-1;i>start;i--)
   {
       if(st[i]=='Z')
       {
           ends=i;
           break;
       }
   }
   cout<<(ends-start)+1<<"\n";*/
    return 0;
}


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

void Main() {
  int X, Y, Z;
  cin >> X >> Y >> Z;

  cout << Z << " " << X << " " << Y << endl;
}

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



Measured memory_bytes: 256
import sys

inf = 1<<30
w = 100

def solve():
    while 1:
        e = int(sys.stdin.readline().rstrip())

        if e == 0:
            return

        ans = inf

        z0 = int(e**(1/3))

        for z in range(max(0, z0 - w), z0 + w):
            if e - z**3 < 0:
                break

            y0 = int((e - z**3)**0.5)
            for y in range(max(0, y0 - w), y0 + w):
                x = e - z**3 - y**2

                if x < 0:
                    break

                ans = min(ans, x + y + z)

        print(ans)

if __name__ == '__main__':
    solve()

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;


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

    int x;
    cin >> x;

    int ans = 0, dis = 0;
    rep(i, x+1){
        dis += i;
        if(x <= dis){
            ans = i;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

class question {
public:
	int N;
	vector<int> A;
	
	void ans() {
		cin >> N;
		A.resize(N + 2);
		A[0] = 0;
		A[N + 1] = 0;
		int sum = 0;
		vector<int> d(N+1);
		REP(i, N) {
			cin >> A[i + 1];
			d[i] = abs(A[i + 1] - A[i]);
			sum += d[i];
		}
		d[N] = abs(A[N]);
		sum += d[N];
		REP(i, N) {
			cout << sum - d[i] - d[i + 1] + abs(A[i + 2] - A[i]) << "\n";
		}
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	question q;
	q.ans();
	
	return 0;
}

Measured memory_bytes: 2048
// ---------- begin chmin, chmax ----------
trait ChangeMinMax {
    fn chmin(&mut self, x: Self) -> bool;
    fn chmax(&mut self, x: Self) -> bool;
}

impl<T: PartialOrd> ChangeMinMax for T {
    fn chmin(&mut self, x: Self) -> bool {
        *self > x && {
            *self = x;
            true
        }
    }
    fn chmax(&mut self, x: Self) -> bool {
        *self < x && {
            *self = x;
            true
        }
    }
}
// ---------- end chmin, chmax ----------

use proconio::*;
use std::cmp::*;

fn run() {
    input! {
        n: usize,
        p: [(i64, i64); n],
    }
    let mut a = (std::i64::MAX, std::i64::MIN);
    let mut b = (std::i64::MAX, std::i64::MIN);
    for (x, y) in p {
        a.0.chmin(x + y);
        a.1.chmax(x + y);
        b.0.chmin(x - y);
        b.1.chmax(x - y);
    }
    let ans = max(a.1 - a.0, b.1 - b.0);
    println!("{}", ans);
}

fn main() {
    run();
}


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

int main(){
	int num[101] = {0}, n, max=0;
	while(cin >> n) num[n]++;
	for(int i=1; i<=100; i++)
		if(max < num[i]) max = num[i];
	for(int i=1; i<=100; i++)
		if(num[i] == max) cout << i << '\n';
	return 0;
}

Measured memory_bytes: 1160
#include <cstdio>
using namespace std;

int main(int argc, char** argv)
{
	int x, y;
	scanf("%d%d", &x, &y);
  	if(y % 2 == 1)
    {
      puts("No");
      return 0;
    }
	int a = (x << 2) - y >> 1;
	int b = x - a;
	puts((a >= 0 && b >= 0 && y != 1)? "Yes": "No");
	return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
#define ll long long
#define MAX 100100
inline int read()
{
    int x = 0;
    bool t = false;
    char ch = getchar();
    while ((ch < '0' || ch > '9') && ch != '-')
        ch = getchar();
    if (ch == '-')
        t = true, ch = getchar();
    while (ch <= '9' && ch >= '0')
        x = x * 10 + ch - 48, ch = getchar();
    return t ? -x : x;
}
struct Line
{
    int v, next, w;
} e[MAX << 1];
int h[MAX], cnt = 1, dg[MAX];
inline void Add(int u, int v, int w)
{
    e[cnt] = (Line){v, h[u], w};
    h[u] = cnt++;
}
int n, m;
ll ans;
int vis[MAX], f[3], edge, size;
bool label;
void dfs(int u, int d)
{
    vis[u] = d;
    f[d] += 1;
    ++size;
    for (int i = h[u]; i; i = e[i].next)
    {
        int v = e[i].v;
        if (e[i].w == 1)
            ++edge;
        if (vis[v] == -1)
            dfs(v, (d + e[i].w) % 3);
        else if (vis[v] != (vis[u] + e[i].w) % 3)
            label = false;
    }
}
int main()
{
    n = read();
    m = read();
    for (int i = 1; i <= m; ++i)
    {
        int x = read(), y = read();
        Add(x, y, 1);
        Add(y, x, 2);
    }
    memset(vis, -1, sizeof(vis));
    for (int i = 1; i <= n; ++i)
        if (vis[i] == -1)
        {
            label = true;
            f[0] = f[1] = f[2] = 0;
            size = edge = 0;
            dfs(i, 0);
            if (label)
                ans += (!min(f[0], min(f[1], f[2]))) ? (edge) : (1ll * f[0] * f[1] + 1ll * f[1] * f[2] + 1ll * f[2] * f[0]);
            else
                ans += 1ll * size * size;
        }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8064
import itertools
import numpy as np

h,w,k = list(map(int, input().split()))

matrix = np.empty((h,w), dtype = 'str')

for i in range(h):
    matrix[i] = list(input())

if np.count_nonzero(matrix=='#') == k:
    cnt = 1
else:
    cnt = 0

for n_row in range(h+1):
    for n_col in range(w+1):
        for r in itertools.combinations(range(h), n_row):
            for c in itertools.combinations(range(w), n_col):
                if not r and not c:
                    continue
                chg_matrix = matrix.copy()
                chg_matrix[:,c] = '&'
                chg_matrix[r,:] = '&'
                if np.count_nonzero(chg_matrix=='#') == k:
                    cnt += 1

print(cnt)

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

sp_list = []
for i in range(N):
    S,P = input().split()
    P = int(P)    
    sp_list.append([S,P])

city_dict = {}
for i,sp in enumerate(sp_list):
    s = sp[0]
    p = sp[1]
    if s in city_dict:
        city_dict[s] = city_dict[s]+[[p,i+1]]
    else:
#         print()
        city_dict[s] = [[p,i+1]]

from operator import itemgetter
for k, v in sorted(city_dict.items()):
#     print(k,v)
    v.sort(key=itemgetter(0))
    for v0,v1 in v[::-1]:
        print(v1)
    

Measured memory_bytes: 38384
class BigCombination(object):
    __slots__ = ["mod", "factorial", "inverse"]

    def __init__(self, mod: int = 10**9+7, max_n: int = 10**6):
        fac, inv = [1], []
        fac_append, inv_append = fac.append, inv.append

        for i in range(1, max_n+1):
            fac_append(fac[-1] * i % mod)

        inv_append(pow(fac[-1], mod-2, mod))

        for i in range(max_n, 0, -1):
            inv_append(inv[-1] * i % mod)

        self.mod, self.factorial, self.inverse = mod, fac, inv[::-1]

    def get_combination(self, n, r):
        if n < r or n == 0 or r == 0:
            return 0
        return self.factorial[n] * self.inverse[r] * self.inverse[n-r] % self.mod

    def get_permutation(self, n, r):
        return self.factorial[n] * self.inverse[n-r] % self.mod

N = int(input())
A = [int(x) for x in input().split()]
se = []
c = sum(A) - N * (N + 1) / 2
for i in range(len(A)):
    if A[i] == c:
        se.append(i)
l = se[0]
r = se[1]
import math
mod = 10**9+7
print(N)
Big = BigCombination()

for i in range(2,N+2):
    k = Big.get_combination(N+1, i)
    
    t = Big.get_combination(l+N-r,i-1)
    res  = k -t
    print(res%mod)



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

int main(){
    int n;
    string s,smp[4]={"SS","SW","WS","WW"},ans="";
    cin >> n >> s;
    for(int i = 0;i < 4;i ++){
        string s0 = smp[i];
        for(int i = 1;i < n-1;i ++){
            bool issame;
            if((s0[i]=='S'&&s[i]=='o')||(s0[i]=='W'&&s[i]=='x')) issame=1;
            else issame=0;
            if(issame) s0 += s0[i-1];
            else s0 += s0[i-1]=='S'?'W':'S';
        }
        string smps = s;
        if(s0[0]=='W') smps[0] = smps[0]=='o'?'x':'o';
        if(s0[n-1]=='W') smps[n-1] = smps[n-1]=='o'?'x':'o';
        if(((smps[0]=='o'&&s0[1]==s0[n-1])||(smps[0]=='x'&&s0[1]!=s0[n-1]))&&
            ((smps[n-1]=='o'&&s0[0]==s0[n-2])||(smps[n-1]=='x'&&s0[0]!=s0[n-2]))){
                ans = s0;
                break;
            }
    }
    if(!ans.size()) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 768
import sys

def calcLength(H1, M1, H2, M2):
    return (H2-H1)* 60 + (M2-M1)


if(__name__ == "__main__"):
    HMKList = input().strip().split()
    H1 = int(HMKList[0])
    M1 = int(HMKList[1])
    H2 = int(HMKList[2])
    M2 = int(HMKList[3])
    K = int(HMKList[4])
    Time = calcLength(H1, M1, H2, M2)
    StudyTime = Time-K
    print(StudyTime)


Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, number = 0;
  cin >> A >> B;
  
  for(int i = A; i <= B; i++){
    int a = i / 10000, b = i / 1000 % 10, c = i / 100 % 10, d = i / 10 % 10, e = i % 10;
    if(a == e && b == d)
      number++;
  }
  
  cout << number << endl;
}

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

using namespace std;

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

    return false;
}

int main()
{
    int A, V, B, W, T;
    cin >> A >> V >> B >> W >> T;

    int speed = V - W;
    if (speed <= 0)
    {
        cout << "NO" << endl;
        return 0;
    }

    int dist = abs(B - A);

    for (int i = 0; i < T; i++)
    {
        dist -= speed;
        if (dist <= 0)
        {
            cout << "YES" << endl;
            return 0;
        }
    }

    cout << "NO" << endl;
}


Measured memory_bytes: 3624
package main

import "fmt"

func main() {
	var n, x, y int
	fmt.Scan(&n, &x, &y)
	x--
	y--

	ds := make(map[int]int)
	for i := 0; i < n-1; i++ {
		for j := i + 1; j < n; j++ {
			d := min(j-i, abs(x-i)+1+abs(j-y))
			ds[d]++
		}
	}

	for i := 1; i < n; i++ {
		fmt.Println(ds[i])
	}
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define REP(i, n) for(long long i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

int binary(long long bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}

int main(){
  int a,b,k;
  cin >> a >> b >> k;
  vector<int> n;
  for (int i = 100;i >0 ;i--) {
    if (a%i == 0 && b%i == 0) {
      n.push_back(i);
    }
  }
  cout << n[k-1];
} 

Measured memory_bytes: 256
n=gets.to_i
as=gets.split.map(&:to_i)

tmp = 0
as_ = as.map {|a|
  tmp += a
  tmp
}

l = 0
r = 1
ls = []
while r < as_.length - 2
  while l+1 != r && (as_[r]/2 - as_[l]).abs > (as_[r]/2 - as_[l+1]).abs
    l += 1
  end
  ls << l
  r += 1
end

tmp = 0
as_ = as.reverse.map {|a|
  tmp += a
  tmp
}

l = 0
r = 1
rs = []
while r < as_.length - 2
  while l+1 != r && (as_[r]/2 - as_[l]).abs > (as_[r]/2 - as_[l+1]).abs
    l += 1
  end
  rs << l
  r += 1
end

rs = rs.map {|r| as.length - 1 - r - 1}.reverse

ret = []
1.upto(ls.length) do |i|
  ret << [ls[i-1],i,rs[i-1]]
end

tmp = 0
as_ = as.map {|a|
  tmp += a
  tmp
}

min = nil
ret.each do |l,c,r|
  tmp = [
    as_[l] - 0,
    as_[c] - as_[l],
    as_[r] - as_[c],
    as_[-1] - as_[r],
  ]

  # p [tmp, l,c,r]
  tmp.sort!
  t = tmp[-1] - tmp[0]
  min = t if !min || t < min
end

p min

Measured memory_bytes: 42044
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cctype>
#define rep(i,a,b) for(int i=(a);i<b;i++)
#define INF 1000000000
#define MAX_N 105
#define X 1000000007
using namespace std;
bool debug=false;


int main(){
  string s,ans="";
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(ans.size()!=0&&s[i]=='B')ans.pop_back();
    else if(s[i]=='0')ans.push_back('0');
    else if(s[i]=='1')ans.push_back('1');
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys

def resolve():
  s = input()
  for i in range(len(s)):
      if (i+1) %2 == 0:
          if s[i] != 'L' and s[i] != 'U' and s[i] != 'D':
              print('No')
              return
      else:
          if s[i] != 'R' and s[i] != 'U' and s[i] != 'D':
              print('No')
              return

  print('Yes')
  return


if __name__ == "__main__":
    resolve()


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

#define en "\n"
#define INF (int) 9e18
#define HELL (int) (1e9 + 7)
#define int long long
#define double long double
#define uint unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fs first
#define sc second
#define size(a) (int) a.size()
#define deb(x) cerr << #x << " => " << x << en
#define debp(a) cerr << #a << " => " <<"("<<a.fs<<", "<<a.sc<<") " << en;
#define deba(x) cerr << #x << en; for (auto a : x) cerr << a << " "; cerr << en;
#define debpa(x) cerr << #x << en; for (auto a : x)cerr<<"("<<a.fs<<", "<<a.sc<<") "; cerr << en;
#define debm(x) cerr << #x << en; for (auto a : x){for(auto b : a) cerr << b << " "; cerr << en;}
#define getMat(x, n, m, val) vector<vector<int>> x(n, vector<int> (m, val))
#define fastio ios_base :: sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pout cout << fixed << setprecision(10)
int fastpow(int a, int b, int m = HELL) { int res = 1; a %= m;
while (b > 0) { if (b & 1) res = (res * a) % m; a = (a * a) % m; b >>= 1; } return res;}
#define inv(a, m) fastpow(a, m - 2)
#define mul(a, b, m) ((a % m) * (b % m)) % m

int32_t main() { fastio;
	int n, x, m;
	cin >> n >> x >> m;
	set<int> s;
	vector<int> okay;
	int curr = x, cycle_breaker = -1;
	while (true) {
		s.insert(curr);
		okay.pb(curr);
		curr = mul(curr, curr, m);
		if (s.find(curr) != s.end()) {
			cycle_breaker = curr;
			break;
		}
	}
	int res = 0;
	if (size(s) >= n) {
		for (int i = 0; i < n; i++) {
			res = res + okay[i];
		}
	} else if (okay.back() == 0) {
		for (auto y : okay) {
			res += y;
		}
	} else {
		int rem = 0;
		for (int i = 0; i < size(okay); i++) {
			if (okay[i] == cycle_breaker) {
				rem = i;
				break;
			}
			res += okay[i];
		}
		n -= rem;
		for (int i = rem, j = 0; j < (n % (size(s) - rem)); i++, j++) {
			res = res + okay[i];
		}
		for (int i = rem; i < size(okay); i++) {
			res += (okay[i] * (n / (size(s) - rem)));
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 5924
#include <bits/stdc++.h>
using namespace std;
int main(){
	char x,fh[2]={'-','+'};
	int a[4],i,j,k,sum;
	for(i=0;i<4;i++)
	{
		cin>>x;
		a[i]=x-'0';
	}
	for(i=0;i<=1;i++)
	{
		for(j=0;j<=1;j++)
		{
			for(k=0;k<=1;k++)
			{
				sum=a[0];
				if(i)
				{
					sum+=a[1];
				}
				else
				{
					sum-=a[1];
				}
				if(j)
				{
					sum+=a[2];
				}
				else
				{
					sum-=a[2];
				}
				if(k)
				{
					sum+=a[3];
				}
				else
				{
					sum-=a[3];
				}
				if(sum==7)
				{
					cout<<a[0]<<fh[i]<<a[1]<<fh[j]<<a[2]<<fh[k]<<a[3]<<"=7"<<endl;
					return 0;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<map>
#include<cmath>
#include<queue>
#include<cstdio>
#include<algorithm>

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

using namespace std;

typedef vector< vector<int> > graph;

// G を連結成分に分解する
vector<graph> decomp(const graph &G){
	int n=G.size();
	vector<graph> cc;
	map<int,int> f; // G における頂点番号 -> 連結成分の番号
	map<int,int> g; // G における頂点番号 -> 連結成分における頂点番号

	int c_id=0;
	vector<bool> vis(n);
	rep(u,n) if(!vis[u]) {
		vis[u]=true;

		vector<int> tmp; // 今調べている連結成分
		queue<int> Q; Q.push(u);
		while(!Q.empty()){
			int v=Q.front(); Q.pop();
			tmp.push_back(v);
			rep(i,G[v].size()){
				int w=G[v][i];
				if(!vis[w]) vis[w]=true, Q.push(w);
			}
		}

		cc.push_back(graph(tmp.size()));
		rep(i,tmp.size()){
			f[tmp[i]]=c_id;
			g[tmp[i]]=i;
		}
		c_id++;
	}

	rep(u,n) rep(i,G[u].size()) {
		int v=G[u][i];
		cc[f[u]][g[u]].push_back(g[v]);
	}

	return cc;
}

bool is_bipartite(const graph &G,int &L_res,int &R_res){
	int n=G.size();
	int L=0,R=0;
	vector<int> color(n,-1);

	rep(u,n) if(color[u]==-1) {
		color[u]=2*(L++);

		queue<int> Q; Q.push(u);
		while(!Q.empty()){
			int v=Q.front(); Q.pop();

			rep(i,G[v].size()){
				int w=G[v][i];
				if(color[w]%2==color[v]%2) return false;
				if(color[w]==-1){
					if(color[v]%2==0) color[w]=2*(R++)+1;
					else              color[w]=2*(L++);
					Q.push(w);
				}
			}
		}
	}

	L_res=L;
	R_res=R;
	return true;
}

vector<int> unify_ones(const vector<int> &a){
	vector<int> res;
	int one=0;
	rep(i,a.size()){
		if(a[i]==1) one++;
		else        res.push_back(a[i]);
	}

	int two=1;
	while(one>0){
		res.push_back(min(two,one));
		one-=min(two,one);
		two<<=1;
	}
	return res;
}

int main(){
	int n,m; scanf("%d%d",&n,&m);
	graph G(n);
	rep(i,m){
		int u,v; scanf("%d%d",&u,&v); u--; v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}

	vector<graph> cc=decomp(G);

	vector<int> L(cc.size()),R(cc.size()); // 二部グラフの左右の頂点数
	rep(i,cc.size()){
		if(!is_bipartite(cc[i],L[i],R[i])) return puts("-1"),0;
		if(L[i]>R[i]) swap(L[i],R[i]);
	}

	int L_sum=0;
	vector<int> add(cc.size());
	rep(i,cc.size()){
		L_sum+=L[i];
		add[i]=R[i]-L[i];
	}

	// add[i]==1 がたくさんあると部分和問題を解くのに時間がかかりすぎるので, 適当にまとめる ( 個数制約があるナップザックと同じ tips )
	add=unify_ones(add);
	sort(add.begin(),add.end());

	// knapsack DP
	int N=L_sum; // 最適な左の頂点数 ( n/2 以下で最大になるよう振り分ける )
	vector<bool> dp(n+1); dp[0]=true;
	rep(i,add.size()){
		for(int j=n/2-L_sum-add[i];j>=0;j--){
			if(dp[j]){
				dp[j+add[i]]=true;
				if(abs(L_sum+j+add[i]-n/2.0)<abs(N-n/2.0)) N=L_sum+j+add[i];
			}
		}
	}

	printf("%u\n",N*(n-N)-m);

	return 0;
}

Measured memory_bytes: 22516
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

class Solution {
public:
	/* time: O(1), space: O(1) */
	int taxIncrease(int a, int b) {
		if (a > b)
			return -1;

		int x_min = ceil(a * 100 / (long double)8);
		int x_max = ceil((a + 1) * 100 / (long double)8);

		int y_min = ceil(b * 100 / (long double)10);
		int y_max = ceil((b + 1) * 100 / (long double)10);

		//cout << x_min << " " << x_max << " " << y_min << " " << y_max << endl;
		int ans = max(x_min, y_min);
		if (ans >= min(x_max, y_max))
			return -1;
		return ans;
	}
};

int main() {
	int a, b;
	cin >> a >> b;

	Solution sol;
	const int ans = sol.taxIncrease(a, b);
	cout << ans << endl;
	return 0;
}


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

int main(){
  long a, b;
  cin >> a >> b;
  
  if( a > 0 ){
    cout << "Positive" << endl;
  }else if ( b < 0 && (b - a) % 2 == 1 ){
    cout << "Positive" << endl;
  }else if ( b < 0 ){
    cout << "Negative" << endl;
  }else{
    cout << "Zero" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n,k;
    cin>>n>>k;
    ll arr[n+1];
    for(int i=1;i<=n;i++)cin>>arr[i];
    bool visit[n+1];
    for(int i=1;i<=n;i++)visit[i]=false;
    ll tyme[n+1];
    for(int i=1;i<=n;i++)tyme[i]=-1;
    ll ty=0;
    ll x=1;
    while(visit[x]==false){
        visit[x]=true;
        tyme[x]=ty++;
        x=arr[x];
    }
    if(k<=tyme[x]){
        for(int i=1;i<=n;i++){
            if(tyme[i]==k){
                cout<<i<<endl;
                return 0;
            }
        }
    }
    else{
        k-=tyme[x];
        k=k%(ty-tyme[x]);
        while(k!=0){
            x=arr[x];
            k--;
        }
        cout<<x;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 6936
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n,k,a[100000],sum=0;
	cin>>n>>k;
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a+0,a+n);
	for(int i=n-1;i>=n-k;i--) sum+=a[i];
	cout<<sum;
}

Measured memory_bytes: 256
#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>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)

const ll INF = 1e18 + 10;
 
int main() {
    int d, t, s;
    cin >> d >> t >> s;
    cout << (s*t >= d ? "Yes" : "No") <<endl;
    return 0;
}

Measured memory_bytes: 3612
<?php

$chrs = array_merge(range('a', 'z'), explode(',', '.,?,!, '));
$encode = array_fill(1, 6, array());
for ($i = 1; $i <= 6; $i++) {
    for ($j = 1; $j <= 5; $j++) {
        $encode[$i][$j] = array_shift($chrs);
    }
}

while (($line = trim(fgets(STDIN))) !== '') {
    $len = strlen($line);
    if ($len % 2 !== 0) {
        echo "NA\n";
        continue;
    }

    $str = '';
    for ($i = 0; $i < $len; $i += 2) {
        $j = (int)$line[$i];
        $k = (int)$line[$i + 1];
        if (isset($encode[$j][$k])) {
            $str .= $encode[$j][$k];
        } else {
            $str = 'NA';
            break;
        }
    }
    echo $str, PHP_EOL;
}

Measured memory_bytes: 6680
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <map>
#include <set>
#include <sstream>
#include <queue>
#include <stack>
#include <functional>
#include <math.h>
#include <iomanip>
using namespace std;

int main(void)
{
    long int N;
    vector<int> P;
    P.push_back(0);
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int tmp;
        cin >> tmp;
        P.push_back(tmp);
    }
    int max = *max_element(P.begin(), P.end());

    int sum = 0;
    for (int i = max; i >= 0; i--)
    {
        vector<int> P2(P);
        for (int j = 1; j <= N; j++)
        {
            if (P[j] == i)
            {
                if (P[j - 1] < P[j])
                {
                    sum++;
                }
                P2[j]--;
            }
        }
        P = P2;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll K;
ll ret = 0;
string s;
ll R, S, P;
string T;

ll win(char c) {
  if (c == 'r') return P;
  else if (c == 's') return R;
  else return S;
}

int main(void){
  
  IN(N);
  IN(K);
  IN(R);
  IN(S);
  IN(P);
  IN(T);

  REP(i, K) {
    vector<char> g;
    for (ll j = i; j < N; j += K) {
      g.pb(T[j]);
    }
    bool pass = false;
    ret += win(g[0]);
    FOR(k, 1, g.size()) {
      if (!pass && g[k] == g[k-1]) {
        pass = true;
        continue;
      } else {
        ret += win(g[k]);
        pass = false;
      }
    }
  }
  PRINT(ret);

}


Measured memory_bytes: 640
/*
 * main.c
 *
 *  Created on: 2020/07/27
 *      Author: 113896
 */
#include <stdio.h>

void swap(int *x, int *y) {
	int tmp = *x;
	*x = *y;
	*y = tmp;
}

int main() {

	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	if (a > b) {
		swap(&a, &b);
	}
	if (b > c) {
		swap(&b, &c);
	}
	if (a > b) {
		swap(&a, &b);
	}
	printf("%d %d %d\n", a, b, c);

	return 0;
}




Measured memory_bytes: 2052
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
string s;
int main()
{
	cin>>s;
	for(int i=0;i<s.length();i++)
		if(s[i]=='1') cout<<"9";
		else if(s[i]=='9') cout<<"1";
		else cout<<s[i];
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
const double PI = acos(-1);
int main()
{
    vector<int> h, w;
    int _h, _w;
    while (1)
    {
        cin >> _h >> _w;
        if (_h == 0 && _w == 0)
        {
            break;
        }
        h.push_back(_h);
        w.push_back(_w);
    }
    int n = h.size();
    rep(i, n)
    {
        string rect = "";
        rep(y, h[i])
        {
            rep(x, w[i])
            {
                if(y==0 || y==h[i]-1 ||x==0||x==w[i]-1){
                    rect += "#";
                }
                else{
                    rect += ".";
                }
            }
            rect += "\n";
        }
    cout<<rect<<endl;        
    }
   // system("pause");
    return 0;
}


Measured memory_bytes: 3168
from collections import Counter
x="abcdefghijklmnopqrstuvwxyz"
X=list(x)
let=[]
while(1):
    try:
        A=input().split()
    except EOFError:
        break
    A="".join(A)
    let.append(A)
Let="".join(let)
Let=Let.lower()
count=Counter(Let)
for st in X:
    print(f"{st} : {count[st]}")


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

typedef long long ll;

const int MOD = 1e9 + 7;
const int N = 2e6 + 5;

int f[N], inv[N], finv[N];
// inv[]: inverse element

int powMod(int u, int v) {
    int res = 1;
    while (v) {
        if (v & 1) res = (ll)res * u % MOD;
        v >>= 1;
        u = (ll) u * u % MOD;
    }
    return res;
}

void initInv() {
    f[0] = 1;
    for (int i = 1; i < N; i++) {
        f[i] = (ll)f[i - 1] * i % MOD;
    }
    inv[0] = inv[1] = 1;
    for (int i = 2; i < N; i++) {
        inv[i] = (ll)(MOD - MOD / i) * inv[MOD % i] % MOD;
    }
    finv[0] = finv[1] = 1;
    for (int i = 2; i < N; i++) {
        finv[i] = ((ll)finv[i - 1] * inv[i]) % MOD;
    }
}

int C(int x, int y) {
    if (y < 0) return 0;
    return ((ll)f[x] * finv[y] % MOD) * finv[x - y] % MOD;
}

int Lucas(int u, int v) {
    if (v == 0) return 1;
    return (ll)C(u % MOD, v % MOD) * Lucas(u / MOD, v / MOD) % MOD;
}

int k, n, ans;
string s;

int main() {
    ios::sync_with_stdio(false);
    initInv();
    cin >> k >> s;
    n = s.length();
    for (int pref = 0; pref <= k; pref++) {
        ans = (ans + ((ll)powMod(26ll, pref) * powMod(25ll, k - pref) % MOD * Lucas(n + k - 1 - pref, n - 1) % MOD)) % MOD;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  int n;
  list<int> L;
  char str[15];
  scanf("%d",&n);
  for(int i=0,num;i<n;i++){
    scanf("%s",str);
    if(str[0]=='i'){
      scanf("%d",&num);
      L.push_front(num);
    }
    else if(str[6]=='F'){
      L.pop_front();
    }
    else if(str[6]=='L'){
      L.pop_back();
    }
    else{
      scanf("%d",&num);
      for(list<int>::iterator it=L.begin();it!=L.end();it++){
	if(*it==num){
	  L.erase(it);
	  break;
	}
      }
    }
  }
  int i=0;
  for(list<int>::iterator it=L.begin();it!=L.end();it++){
    if(i++)printf(" ");
    printf("%d",*it);
  }
  printf("\n");
}
  


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

using namespace std;

#define pb push_back
#define mp make_pair
#define x first
#define y second
#define foreach(it,x) for(typeof((x).begin()) it=(x).begin(); it!=(x).end(); it++)
#define sz(x) ((int)((x).size()))
#define fr(i,a,b) for(int i=(a); i<(b); ++i)
#define fo(i,t) fr(i,0,t)
#define fi(n) fo(i,n)

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> ii;

const int N = 2e5+5, M = 21;
bool ok[M][N];

inline int getint(){
  int a;
  scanf("%d", &a);
  return a;
}

double EPS = 1e-9;

bool doit(int i, double delta, vi &a){
  // base case
  if(i==sz(a))
    return true;
  // general case
  bool touched = false;
  int bot = a[i]*(1-delta)-EPS+1;
  int top = a[i]*(1+delta)+EPS;
  fr(j,bot,top+1) // branch from every ok spot
    if(ok[i][j])
      for(int k=1; k*j<N; ++k){ // ok all its multiples
        ok[i+1][k*j] = true;
        touched = true;
      }
  // must complete from here
  return touched ? doit(i+1, delta, a) : false;
}

int main() {

  int n=getint();
  vi a;
  fi(n)
    a.pb(getint());

  double lo=0, hi=1;
  fo(numtimes, 60){
    memset(ok, false, sizeof(ok));
    double mid = (lo+hi)/2;
    int bot = a[0]*(1-mid)-EPS+1;
    int top = a[0]*(1+mid)+EPS;
    fr(i,bot,top+1)
      ok[0][i] = true;
    if(doit(0, mid, a))
      hi = mid;
    else
      lo = mid;
  }

  printf("%.12lf\n", (lo+hi)/2);

  return 0;

}

Measured memory_bytes: 5344
#include<stdio.h>

int main(){
    int i,j,h,w;
    while(1){
       scanf("%d%d",&h,&w);
       if(h+w==0)break;
       for(i=0;i<h;i++){
                      for(j=0;j<w;j++){
                      if(i==0||i==h-1||j==0||j==w-1)printf("#");
                      else printf(".");
                      }
              printf("\n");
              }
       printf("\n");
       }
    return 0;
    }


Measured memory_bytes: 2056
[n, k] = map(int, raw_input().split())
xs = map(int, raw_input().split())
d = dict()
for x in xs:
    if x in d:
        d[x] += 1
    else:
        d[x] = 1
v = d.values()
v.sort()
if len(v) <= k:
    r = []
else:
    r = v[:len(v)-k]
print sum(r)


Measured memory_bytes: 28412
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int cnt = 0;
		for(int i=0;i<line.length();i++) {
			char c = line.charAt(i);
			if(c == '1') cnt++;
		}
		System.out.println(cnt);
	}
}


Measured memory_bytes: 19156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////

vector<l_l>fact(ll n){
    vector<l_l>v;
    for(ll i=2;i*i<=n;i++){
        ll c=0;
        if(n%i==0){
            while(n%i==0){
                n/=i;
                c++;
            }
            v.pb(l_l(i,c));
        }
    }
    if(n!=1)v.pb(l_l(n,1));
    return v;
}
ll len;
vector<l_l>v;
vector<ll>q;
void dfs(ll pos,ll val){
    if(pos==len){
        q.pb(val);return;
    }
    ll ne=val;
    rep(i,0,v[pos].second){
        dfs(pos+1,ne);
        ne*=v[pos].first;
    }
}

int main(){
    ll n,k;cin>>n>>k;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    ll sum=0;
    rep(i,0,n-1)sum+=a[i];
    v=fact(sum);
    len=v.size();
    dfs(0,1);
    sort(q.begin(),q.end());
    reverse(q.begin(),q.end());
    //for(auto x:q)cout<<x<<" ";
    ll ans=1;
    for(auto x:q){
        vector<ll>mo;
        rep(i,0,n-1){
            if(a[i]%x==0)continue;
            mo.pb(a[i]%x);
        }
        sort(mo.begin(),mo.end());
        ll m=mo.size();
        if(m==0){
            Max(ans,x);continue;
        }
        ll b[m],c[m];
        b[0]=mo[0];
        rep(i,1,m-1)b[i]=b[i-1]+mo[i];
        rep(i,0,m-1)mo[i]=x-mo[i];
        c[m-1]=mo[m-1];
        for(ll i=m-2;i>=0;i--){
            c[i]=c[i+1]+mo[i];
        }
        
        rep(i,0,m-2){
            if(b[i]==c[i+1]){
                if(b[i]<=k){
                    Max(ans,x);
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

















Measured memory_bytes: 256