akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 
ll h,w;
ll H[2010][2010];
ll W[2010][2010];
char ch[2010][2010];
int main() {
	cin>>h>>w;
	for(ll i=0;i<h;i++){
		for(ll j=0;j<w;j++){
			cin>>ch[i][j];
		}
	}
	for(ll i=0;i<h;i++){
		ll cnt=0;
		for(ll j=0;j<w;j++){
			if(ch[i][j]=='#'){
				cnt=0;
				continue;
			}
			cnt++;
			H[i][j]=cnt;
		}
		cnt=H[i][w-1];
		for(ll j=w-1;j>=0;j--){
			if(ch[i][j]=='#'){
				cnt=0;
				continue;
			}
			cnt=max(cnt,H[i][j]);
			H[i][j]=cnt;
		}
	}
	for(ll i=0;i<w;i++){
		ll cnt=0;
		for(ll j=0;j<h;j++){
			if(ch[j][i]=='#'){
				cnt=0;
				continue;
			}
			cnt++;
			W[j][i]=cnt;
		}
		cnt=W[h-1][i];
		for(ll j=h-1;j>=0;j--){
			if(ch[j][i]=='#'){
				cnt=0;
				continue;
			}
			cnt=max(cnt,W[j][i]);
			W[j][i]=cnt;
		}
	}
	ll ans=0;
	for(ll i=0;i<h;i++){
		for(ll j=0;j<w;j++){
		//	cout << W[i][j];
			ans=max(ans,H[i][j]+W[i][j]);
		}
	//	cout <<endl;
	}
	cout <<ans-1;
	// your code goes here
	return 0;
}

Measured memory_bytes: 70336
from itertools import permutations

n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))

for i, per in enumerate(permutations(range(1, n+1))):
    if p == per:
        a = i
    if q == per:
        b = i
print(abs(a - b))

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

int main(void){
		
  	int N,ans;
  	cin >> N;
  	if(N%2 == 0) cout << 0.5 << endl;
  	else cout << 1/(double)N*((double)N+1)/2.0 << endl;
  	
  	
	return 0;
  
}

Measured memory_bytes: 256
K = int(input())
import math
from functools import reduce


def gcd (*numbers):
  return reduce(math.gcd,numbers)

ans = 0
for a in range(1,K+1):
  for b in range(1,K+1):
    for c in range(1,K+1):
      ans += gcd(a,b,c)

print(ans)

Measured memory_bytes: 69740
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long n,m;
  cin>>n>>m;
  if(n==1&&m==1){
    cout<<1<<endl;
  }
  else  if(n==1||m==1){
    cout<<(n*m)-2<<endl;
  }else{
  cout<<(n*m)-((n*2)+(m*2))+4<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
	int a=sc.nextInt();
	int b=sc.nextInt();
	int c=sc.nextInt();
	if(a<b){
	    if(b<c){
		System.out.printf("%d %d %d\n",a,b,c);
	    }else if(a<c && c<b){
		System.out.printf("%d %d %d\n",a,c,b);
	    }else{
		System.out.printf("%d %d %d\n",c,a,b);
	    }
	}else{
	    if(a<c){
		System.out.printf("%d %d %d\n",b,a,c);
	    }else if(c<b){
		System.out.printf("%d %d %d\n",c,b,a);
	    }else{
		System.out.printf("%d %d %d\n",b,c,a);
	    }
	}
    }
}
		    

Measured memory_bytes: 26208
#include <iostream>
#include <iomanip>
#include <vector>
#include <stdlib.h>
#include <cmath>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
const int INF = 1e8;
using namespace std;

const int N = 105;

//n???????????¶????????????????????????k???????????¶???????????????????????????
void Pascals(double m[N][N]){
	m[0][0] = 1;
	range(i,1,N){
		rep(j,i + 1){
			if(j == 0) m[i][j] = m[i - 1][j];
			else if(j == i) m[i][j] = m[i - 1][j - 1];
			else m[i][j] = (m[i - 1][j] + m[i - 1][j - 1]);
		}
	}
}

int main(){
	int n, m, l;
	cin >> n >> m >> l;

	vector<double> p(n), t(n), v(n);
	rep(i,n){
		cin >> p[i] >> t[i] >> v[i];
		p[i] /= 100;
	}

	double pas[N][N];
	Pascals(pas);

	double c[N][N] = {{0}};
	rep(i,n){
		rep(j,m + 1){
			double rest_p = 1;
			double run_p = 1;
			for(int k = 0; k < j; k++){
				rest_p *= p[i];
			}
			for(int k = j; k < m; k++){
				run_p *= (1 - p[i]);
			}
			c[i][j] = rest_p * run_p * pas[m][j];
		}
	}


	vector<double> base_time(n);
	rep(i,n) {
		if(v[i] == 0) base_time[i] = INF;
		else base_time[i] = l / v[i];
	}

	rep(i,n){
		double ans = 0;

		rep(j,m + 1){
			double cul = c[i][j];
			if(isnan(cul)) continue;
			double time = base_time[i] + j * t[i];
			rep(k,n){
				if(i == k) continue;

				if(t[k] < 1e-10){
					if(time >= base_time[k]) cul *= 0;
					continue;
				}

				int rest = 0;
				if(time >= base_time[k]){
					rest = (time - base_time[k]) / t[k];
					while(rest * t[k] + base_time[k] <= time) rest++;
				}
				if(rest > m){
					cul *= 0;
					continue;
				}

				double sum = 0;
				range(l,rest,m + 1) sum += c[k][l];
				cul *= sum;
			}
			if(isnan(cul)) continue;
			ans += cul;
		}
		cout << fixed << setprecision(8)<<ans << endl;
	}
}

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

using namespace std;

#define INF 1000000000
#define pb(a) push_back(a)
#define vi vector<int>
#define vvi vector<vi>
#define P pair<int,int>
#define all(vec) (vec.begin()),(vec.end())
#define ll long long
#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x;
#define bit(n) (1<<(n))

#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define REP3(i, m, n) for(int i = m, i##_len=(n);i < i##_len;i++)
#define FORVEC(i, v) for(int i = 0;i < sz(v);i++)


int main(){
    string s;
    bool c[3]={};
    cin>>s;
    REP(i,3){
        c[s[i]-'a']=true;
    }
    if(c[0]&&c[1]&&c[2])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
from collections import*
I=9**9
(h,w),(s,t),(f,g)=eval('map(int,input().split()),'*3)
m,d=zip(*eval('(input(),[I]*w),'*h))
q=deque([(s-1,t-1,1)])
r=range(-2,3)
while q:
 y,x,c=q.popleft()
 if d[y][x]>c:
  for a in r:
    for b in r:i=a+y;j=b+x;d[y][x]=c;h>i>-1<j<w!=m[i][j]>'#'!=(abs(a)+abs(b)<2!=q.appendleft((i,j,c)),q.append((i,j,c+1)))
print(d[f-1][g-1]%I-1)

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

using i64 = int64_t;

int calc_distance(pair<int, int> a, pair<int, int> b){
    return abs(a.first-b.first)+abs(a.second-b.second);
}

int main(){
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> students;
    for(int i=0;i<n;++i){
        int a, b;
        cin >> a >> b;
        students.emplace_back(a, b);
    }
    vector<pair<int, int>> points;
    for(int i=0;i<m;++i){
        int c, d;
        cin >> c >> d;
        points.emplace_back(c, d);
    }
    for(int i=0;i<n;++i){
        int ans = 0;
        for(int j=1;j<m;++j){
            if(calc_distance(students[i], points[j]) < calc_distance(students[i], points[ans])){
                ans = j;
            }
        }
        cout << ans + 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
Apparently, the tree supports the same operations as the set 
(at least I haven't any problems with them before), but also there are two new features — 
find_by_order() — The first returns an iterator to the k-th largest element (counting from zero)
order_of_key() — the number of items in a set that are strictly smaller than our item. 
https://codeforces.com/blog/entry/11080
using namespace __gnu_pbds; */
using namespace std;
#define test() int t;cin>>t;for(int test=1;test<=t;test++)
#define int long long
#define MOD 1000000000000000000
#define pb push_back 
#define ins insert
#define fast(); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ld long double
#define endl '\n'
int m(int a) {
    return ((a%MOD)+MOD)%MOD;
}
int p(int a, int b) {
    int res = 1;
    while(b > 0){
        if(b&1) res = m(m(res)*m(a));
        a = m(m(a)*m(a));
        b >>= 1;
    }
    return res;
}
// vector<int> fac; //precompute fac array
// fac.resize(n+1);
// fac[0] = 1; 
// for (int i=1; i<=n; i++)   fac[i] = m(m(fac[i-1])*m(i));
// int modInverse(int n){ 
// return p(n, MOD-2); 
// }  
// int nCrModPFermat(int n, int r){   
//     if(r == 0)  return 1; 
//     return m(m(m(fac[n])*m(modInverse(fac[r])))*m(modInverse(fac[n-r]))); 
// } 
signed main(){
    fast();
    int n;
    cin >> n;
    map<int, int> ma;
    while(n%2 == 0){
        n /= 2;
        ma[2]++;
    }
    for(int i=3; i*i<=n; i+=2){
        while(n%i == 0){
            n /= i;
            ma[i]++;
        }
    }
    if(n > 1)   ma[n]++;
    int sum = 0;
    vector<int> nums(10001);
    map<int, int> st;
    nums[0] = 0;
    st[0] = 0;
    for(int i=1; i<=10000; i++){
        nums[i] = nums[i-1]+i;
        st[-nums[i]] = i;
    }
    for(auto i: ma){
        auto it = st.lower_bound(-i.second);
        sum += it->second;
    }
    cout << sum << endl;
    cerr << "\nTime elapsed : " << 1000 * clock() / CLOCKS_PER_SEC << " ms\n";
}

Measured memory_bytes: 3992
import java.util.*;

public class Main{
  public static void main(String args[] ) {
     Scanner sc = new Scanner(System.in);
     int x,t=0;
     
     while(true){
     x = sc.nextInt();
     if ( x == 0 ) break;
     t++;
     System.out.println("Case "+ t +": "+ x);
     }
  }
}



Measured memory_bytes: 40340
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

using namespace std;
//#inculude <bits/stdc++.h>
//#define int long long

template <class T>
struct Union_find {
    vector<T> parent;
    vector<T> rank;
    vector<T> size_of;

    Union_find(T n) : parent(n), rank(n), size_of(n) {
        for (T i = 0; i < n; i++) {
            parent[i] = i;
            rank[i] = 0;
            size_of[i] = 1;
        }
    }

    T root(T x) {
        return parent[x] == x ? x : parent[x] = root(parent[x]);
    }

    bool same(T x, T y) {
        return root(x) == root(y);
    }

    T size(T x) {
        return size_of[root(x)];
    }

    void unite(T x, T y) {
        x = root(x);
        y = root(y);
        if (x == y)
            return;
        if (rank[x] < rank[y]) {
            size_of[y] += size_of[x];
            parent[x] = y;
        }
        else {
            size_of[x] += size_of[y];
            parent[y] = x;
            if (rank[x] == rank[y])
                rank[x]++;
        }
        return;
    }
};

signed main() {
    int v, e;
    cin >> v >> e;
    vector<pair<int, pair<int, int>>> g(e);
    rep(i, e) cin >> g[i].second.first >> g[i].second.second >> g[i].first;
    sort(g.begin(), g.end());
    int ans = 0;
    Union_find<int> uf(v);
    rep(i, e) {
        if (!uf.same(g[i].second.first, g[i].second.second)) {
            ans += g[i].first;
            uf.unite(g[i].second.first, g[i].second.second);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4072
//it was hard to write
//so it should be hard to read
#include <bits/stdc++.h>
#define sz size
#define pb push_back
#define ll long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define last(x) (x).size() - 1
#define mp make_pair

using namespace std;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef double ld;

const int MAXN = 1e6 + 5;
const ll INF = 1e18 + 7;
const int inf = 1e9 + 7;
const double EPS = 1e-9;

int n, d;
double x[25][25];

double dist(int a, int b) {
	double res = 0;
	for (int i = 1; i <= d; i++) {
		res += ((x[a][i] - x[b][i]) * (x[a][i] - x[b][i]));
	}
	return sqrt(res);
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.precision(9);
	cout << fixed;
	cin >> n >> d;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= d; j++) {
			cin >> x[i][j];
		}
	}
	int ct = 0;
	for (int i = 1; i < n; i++) {
		for (int j = i + 1; j <= n; j++) {
			double dist_ = dist(i, j);
			if ((double)( (int) dist_)  == dist_) ct++;
		}
	}
	cout << ct;
	return 0;
}     

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class AStillTBD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String[] arr = in.next().split("/");
            out.print(Integer.parseInt(arr[1]) > 4 ? "TBD" : "Heisei");
        }

    }

    static class InputReader implements AutoCloseable {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public void close() {
        }

    }
}



Measured memory_bytes: 21332
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(a,b) memset(a,b,sizeof(a))
#define msn(a,n,b) for(int i=0;i<=n;i++)a[i]=b
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define fi first
#define se second
using namespace std;
mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const int mod=1e9+7;
const int seed=233;
const double PI=acos(-1.0);
const double eps=1e-7;
const int inf=0x3f3f3f3f;
const int max_n=100005;
ll ceil(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?(x+y-1)/y:-x/y;}
ll floor(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?x/y:-(x+y-1)/y;}
namespace {
    inline int Add(int x,int y){return (x+=y)>=mod?x-mod:x;}
    inline int Sub(int x,int y){return (x-=y)<0?x+mod:x;}
    inline int Mul(int x,int y) {return 1ll*x*y%mod;}
    inline int Pow(int x,int y=mod-2){if(y==0)return 1;int res=1;while(y){if(y&1)res=1ll*res*x%mod;x=1ll*x*x%mod;y>>=1;}return res;}
}
/**********************head************************/
int h,a;
int main(){
    scanf("%d%d",&h,&a);
    printf("%lld\n",ceil(h,a));
    return 0;
}

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

#define PI 3.14159265
int main()
{
double a,b,x;
scanf("%lf %lf %lf",&a,&b,&x);
double c,d,t,k;
t=x/a/a;
if(t<b)
{
if(t<=b/2)
{
c=x*2/a/b;
//printf("%lf\n",c);
d=atan(b/c)*180/PI;
}
else
{
c=2*((b*a*a)-x);
c=c/a/a;
d=atan(c/a)*180/PI;

}
}
else
d=0;
printf("%.10f\n",d);
}

Measured memory_bytes: 256
#include <cstdio>
#include <cctype>
#include <utility>
#include <vector>
#include <queue>
#include <functional>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m?-n:n;}
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

using V = vector<int>;
using VV = vector<V>;
struct P {int x, y;};

int main() {
	int dx[] = {4, 2}, dy[] = {2, 4};
	for (int w, h; w = in(), h = in();) {
		P s = {in(), in()}, g = {in(), in()};
		int n = in();
		VV m(h + 2, V(w + 2));
		while (n--) {
			int c = in(), d = in(), x = in(), y = in();
			for (int i = 0; i < dy[d]; i++)
				for (int j = 0; j < dx[d]; j++)
					m[i + y][j + x] = c;
		}
		int c = m[s.y][s.x];
		m[s.y][s.x] = 0;
		function<bool(int, int)> f = [&](int x, int y) {
			if (x == g.x && y == g.y)
				return true;
			P d = {1, 0};
			for (int i = 0; i < 4; i++) {
				int tx = x + d.x, ty = y + d.y;
				if (m[ty][tx] == c) {
					m[ty][tx] = 0;
					if (f(tx, ty))
						return true;
				}
				swap(d.x, d.y *= -1);
			}
			return false;
		};
		outl(c ? f(s.x, s.y) ? "OK" : "NG" : "NG");
	}
}


Measured memory_bytes: 2656
#include<cstdio>
#define N 100010
using namespace std;
 
int n;
char s[N];
int a[N];
 
void print(){
	for(int i=1;i<=n;i++) printf("%c",a[i]?'W':'S');
}
 
bool judge(int d,char c,int x,int y){
	if(d==0&&c=='o'&&x==y){return 1;}
	if(d==0&&c=='x'&&x!=y){return 1;}
	if(d==1&&c=='x'&&x==y){return 1;}
	if(d==1&&c=='o'&&x!=y){return 1;}
	return 0;
}
 
int main(){
	scanf("%d",&n);
	scanf("%s",s+1);
	for(int d0=0;d0<=1;d0++){
		for(int d1=0;d1<=1;d1++){
			a[1]=d0;a[2]=d1;
			for(int i=3;i<=n;i++){
				if(a[i-1]==0&&s[i-1]=='o') 
				a[i]=a[i-2];
				if(a[i-1]==0&&s[i-1]=='x') 
				a[i]=a[i-2]^1;
				if(a[i-1]==1&&s[i-1]=='x')
				 a[i]=a[i-2];
				if(a[i-1]==1&&s[i-1]=='o')
				 a[i]=a[i-2]^1;
			}
			if(judge(a[1],s[1],a[n],a[2])&&judge(a[n],s[n],a[n-1],a[1])){
				print();
				return 0;
			}
		}
	}
	printf("-1");
	return 0;
}

Measured memory_bytes: 768
X = int(input())
L=[]
for i in range(2,11):
    for j in range(1001):
        if j**i > 1000:
            break
        if  j**i not  in L:
            L.append(j**i)
L=sorted(L)

if  X not in L:
    L.append(X)
    L=sorted(L)
    n = L.index(X)
    print(L[n-1])
else:
    print(X)

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


typedef pair<int, int> idNodePair;
vector<bool> loopedEdges;
vector<vector<idNodePair>> edges;

void dfs(int currentNode, vector<bool> visitedNodes, vector<idNodePair> usedEdges);

int main()
{
    int N, M;
    cin >> N >> M;
    edges = vector<vector<idNodePair>>(N, vector<idNodePair>(0)); 
    for(int i = 0; i < M; i++){
        int a , b;
        cin >> a >> b;
        --a;
        --b;
        edges.at(a).push_back(idNodePair(i, b));
        edges.at(b).push_back(idNodePair(i, a));
    }
    loopedEdges = vector<bool>(M, false);
    vector<bool> visitedNodes(N, false);
    vector<idNodePair> usedEdges(0);
    dfs(0, visitedNodes, usedEdges);
    int answer = M;
    for(bool looped: loopedEdges){
        if(looped){
            --answer;
        }
    }
    cout << answer << endl;
    return 0;
}

void dfs(int currentNode, vector<bool> visitedNodes, vector<idNodePair> usedEdges)
{
    if(visitedNodes.at(currentNode)){
        while(usedEdges.size() > 0 && usedEdges.back().second != currentNode)
        {
            loopedEdges.at(usedEdges.back().first) = true;
            usedEdges.pop_back();
        }
        loopedEdges.at(usedEdges.back().first) = true;
        return;
    }
    visitedNodes.at(currentNode) = true;
    int prevNode = -1;
    if(usedEdges.size() > 0){
        prevNode = usedEdges.back().second;
    }
    for(idNodePair pair : edges.at(currentNode)){
        if(pair.second == prevNode){
            continue;
        }
        usedEdges.push_back(idNodePair(pair.first, currentNode));
        dfs(pair.second, visitedNodes, usedEdges);
        usedEdges.pop_back();
    }
}

Measured memory_bytes: 256
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
S = input()
Slist = S.replace("><",">,<").split(",")
ans = 0
for s in Slist:
    cnt = Counter(s)
    num = max(cnt["<"],cnt[">"])
    ans += (num+1)*num//2
    num = min(cnt["<"],cnt[">"]) - 1
    ans += (num+1)*num//2

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


Measured memory_bytes: 13204
#include<bits/stdc++.h>
#define ll long long int
#define ar array
#define pb push_back
#define forf(i,a,b) for(i = a; i< b; i++)
#define forb(i,a,b) for(i = b; i>=a; i--)
using namespace std;
const int mod = 1e9+7;
ll power(ll a,ll b){ll r=1;for(;b;b>>=1){if(b&1)r=r*a%mod;a=a*a%mod;}return r;}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	string s;
	map<string,int> m;
	int i;
	forf(i,0,n){cin>>s;
		m[s]++;}
	int m1;
	cin>>m1;
	forf(i,0,m1){cin>>s;
		m[s]--;}
	int ans = 0;
	for(auto it:m)
		ans = max(ans,it.second);
	cout<<ans<<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 ll long long

const long long MOD = 1000000007;

int main(){
  string n;
  cin >> n;
  int s = 0;
  rep(i,n.size()){
    s += n.at(i) - '0';
    s %= 9;
  }
  if(s==0) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3748
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		
		int[] dp = new int[30];
		dp[0] = 1;
		dp[1] = 2;
		dp[2] = 4;
		for (int i = 3; i < 30; i++) {
			dp[i] = dp[i - 3] + dp[i - 2] + dp[i - 1];
		}
		
		while (true) {
			int n = sc.nextInt();
			if (n == 0) break;
			int year = dp[n - 1] / 3650 + min(1, dp[n - 1] % 3650);
			out.println(year);
		}
		
		out.flush();
	}
	
	static int min(int a, int b) {
		return a < b ? a : b;
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) return false;
		}
		return true;
	}
	
	private byte readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	
	private boolean isPrintableChar(int c) {
		return '!' <= c && c <= '~';
	}
	
	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
	}
	
	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}
	
	public int nextInt() {
		if (!hasNext()) { throw new NoSuchElementException(); }
		int n = 0;
		boolean minus = false;
		byte b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) { throw new NumberFormatException(); }
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	
}

Measured memory_bytes: 24208
using namespace std;

#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <utility>
#include <functional>
#include <queue>
#include <cmath>
#include <numeric>
using namespace std;


int main(void){
	long long int N, M, Lm = 0, Rm = 100000;

	cin >> N >> M;

	
	cout << (N * 3 + M) / 2 << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<unordered_map>
#include<bitset>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<ctype.h>
#include<unordered_set>
#include<string>
#include<iomanip>
#include<queue>
#include<limits>
#include<map>
#include<stack>
#include<iterator>
#include<cstring>
 
#include<deque>
#define pi 3.141592653589793238
#include<chrono>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
 
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
 
 
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    //cin >> T;
    while (T--) {
        ll a, b;
        cin >> a >> b;
        for(i = 1; i <= 3; i++){
            if((a * b * i) % 2 == 1){
                cout << "Yes";
                return 0;
            }
        }
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 3616
n = gets.to_i
a = gets.chomp.split(" ").map(&:to_i)
a = a.sort
INF = (10 ** 6)
arr = Array.new(INF+1,0)
a.each do |i|
    if arr[i] == 2
        next 
    end
    sa = i
    until i > 10 ** 6 
        arr[i] += 1 
        i += sa
    end
end
count = 0
a.each do |i|
    if arr[i] == 1
        count += 1
    end
end
puts count

Measured memory_bytes: 40024
#!/usr/bin/env python3
#ABC138 C

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
v = LI()
v.sort()
ans = v[0]
for i in range(1,n):
    ans = (ans+v[i])/2
print(ans)


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

#define pb push_back
#define fst first
#define snd second
#define ALL(s) s.begin(),s.end()
#define fill(a,c) memset(&a, c, sizeof(a))
#define fore(i,x,y) for(ll i=x;i<y;i++)
#define SZ(x) ((int)(x).size())
#define PI acos(-1)
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

typedef long long ll;
using namespace std;

int main() {FIN;
    int n,w; cin>>n>>w;
    vector<vector<ll>> v(n,vector<ll> (2));
    fore(i,0,n) fore(j,0,2) cin>>v[i][j];
    ll dp[n+1][w+1];
    fore(i,0,w+1) dp[0][i] = 0;
    fore(i,1,n+1){
        fore(j,0,w+1){
            dp[i][j] = dp[i-1][j];
            if(v[i-1][0]<=j) dp[i][j] = max(dp[i][j],dp[i-1][j-v[i-1][0]]+v[i-1][1]);
        }
    }
    cout<<dp[n][w]<<"\n";
    return 0;
}



Measured memory_bytes: 82460
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int n, x, t;
    cin >> n >> x >> t;
    cout << CEIL(n, x) * t << "\n";

    return 0;
}



Measured memory_bytes: 3616
import scala.io.StdIn._

object Main extends App {

  def linearSearch(key: Int, a: Array[Int]): Boolean = {
    val added_a = a :+ key
    var i = 0
    while (added_a(i) != key) {
      i += 1
    }
    i != (added_a.size - 1)
  }

  readLine
  val S = readLine.split(" ").map(_.toInt)
  readLine
  val T = readLine.split(" ").map(_.toInt)
  var cnt = 0
  T.foreach{
    case key => if (linearSearch(key, S)) cnt += 1
  }
  println(cnt)
}


Measured memory_bytes: 51648
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
using namespace std;
#define lint long long int
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
*/

int main() {
	string S;
	cin >> S;
	if (S == "Sunny") {
		cout << "Cloudy" << endl;
	}
	else if (S == "Cloudy") {
		cout << "Rainy" << endl;
	}
	else if(S=="Rainy"){
		cout << "Sunny" << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <cctype>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n, a;
    cin >> n;
    vector<int> ans(n, 0);
    for(int i=1;i<n;++i) {
        cin >> a;
        ++ans[a-1];
    }

    for(int i=0;i<n;++i) {
        cout << ans[i] << "\n";
    }
}


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

int main() {
	scanf("%lld", &S);
	long long x = (S + 999999999) / 1000000000;
	long long y = x * 1000000000 - S;
	printf("0 0 1 1000000000 %lld %lld\n", x, y);
	return 0;
}

Measured memory_bytes: 3772
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;


class Program
{
    public static long Read()
    {
        return long.Parse(Console.ReadLine());
    }

    public static long[] Reads()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    public static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);

        var input = Reads();
        var a = input[0];
        var b = input[1];
        if (a > 9 || b > 9)
            Console.WriteLine("-1");
        else
            Console.WriteLine(a * b);



        Console.Out.Flush();
    }
}


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

// 型名の省略
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> P;
typedef pair<lint, lint> Plint;
 
const int MOD = 1e9+7;
const int INF = 1<<18;
const lint INFLINT = 1LL<<60;
const double PI=acos(-1.0);
 
// cinとcoutの高速化
#define endl "\n"
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;
 
// 繰り返し
#define rep(i,n) for(lint i=0;i<(lint)(n);i++)
#define reps(i,n) for(lint i=0;i<=(lint)(n);i++)
#define rrep(i,n) for(lint i=(lint)(n)-1;i>0;i--)
#define rreps(i,n) for(lint i=(lint)(n)-1;i>=0;i--)

#define pb push_back

#define ALL(s) s.begin(), s.end()
#define SZ(s) s.size()

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

// Union-Find-Tree
class UnionFind {
	vector<int> par;
	UnionFind(int n):par(n){rep(i,n)par[i]=i;}
	int root(int x){if(par[x]==x)return x;return par[x]=root(par[x]);}
	void unite(int x,int y){int rx=root(x);int ry=root(y);if(rx==ry)return;par[rx]=ry;}
	bool same(int x,int y){return root(x)==root(y);}
};

// Final Weapon!
// #define int lint

int main() {
    int n;
    cin >> n;
    vector<int> d(n);
    rep(i, n) cin >> d[i];
    sort(ALL(d));
    
    int maxabc = d[n / 2 - 1];
    int minarc = d[n / 2];
    
    cout << minarc - maxabc;
    
    return 0;
}


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

int main(){
  string s,t;
  cin>>s>>t;
  string mins=s,mint=t;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  if (s<t)
  {
    /* code */
    cout<<"Yes"<<endl;
  }
  else
  {
    cout<<"No"<<endl;
  }
  
  
  }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
const ll MOD = 1000000007;
ll cnt =0,ans=0;
const int MAX = INF;

int main (){
 int x , y;	cin >> x >> y ;
 
 if(2*x <= y && y <= 4*x && y % 2 == 0){
 cout << "Yes" << endl;
 return 0;
 }
 cout << "No" << endl;
}


Measured memory_bytes: 3620
/*
    NEVER GIVE UP!
    THE EXPERT IN ANYTHING WAS ONCE A BEGINNER
*/

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define f(i,a,b) for(ll i=a; i<=b; i++)
#define fi(i,a,b) for(ll i=a; i>=b; i--)
#define fa(x,b) for(auto x:b)
#define TC ll test_case; cin>>test_case; for(ll number=1 ; number <= test_case ; number ++ )
#define vll vector<ll>
#define pb push_back
#define pll pair<ll,ll>
#define mp make_pair
#define ff first
#define ss second
#define sz(a) (ll)(a).size()
#define sp(x) cout << fixed << setprecision(x);
#define ReadFile freopen("input.txt","r",stdin)
#define WriteFile freopen("output.txt","w",stdout)
#define endl "\n"

const ld pi = acos(-1);
const ll M=1e9+7,N=1e5+5,INF=1e18;

void solve()
{
    ll l;
    string a,b;
    cin >> l >> a >> b;
    f(i,0,l-1)
    {
        cout << a[i] << b[i];
    }
}

int32_t main()
{
    FIO
    solve();
    return 0;
}

Measured memory_bytes: 764
// header {{{
#include <bits/stdc++.h>
#include <string>
#include <cmath>

using namespace std;

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}

constexpr i64 INF = 1'010'000'000'000'000'017LL;

constexpr i64 MOD = 1'000'000'007LL;

constexpr f64 EPS = 1e-12;

constexpr f64 PI = 3.14159265358979323846;

// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}

template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}
// }}}

// init {{{
struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
// }}}

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


signed main() {


	i64 ans = 0;
	string ANS;
	int N, M;

	cin >> N >> M;
	vector<i64> vec(M);
	for (i64 i = 0; i < M; i++) {
		cin >> vec.at(i);
		ans += vec.at(i);
	}
	if (N<ans+1) {
		ANS = "Yes";
	}
	else {
		ANS = "No";
	}
	cout << ANS << "\n";
	return 0;
}

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

int main()
{
    string s;
    cin >> s;
    int w;
    cin >> w;
    int n = (s.size() + w - 1) / w;
    string t;
    rep(i, n) {
        t.push_back(s[w * i]);
    }
    cout << t << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    int X,Y,Z; cin >>X>>Y>>Z;
    swap(X,Y);
    swap(X,Z);
    cout << X<< " " << Y << " " << Z << endl;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.util.Objects;
import java.util.stream.Stream;
import java.util.Map;
import java.util.Collection;
import java.util.Scanner;
import java.util.HashMap;
import java.util.OptionalInt;

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

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            if (N == 1) {
                out.println(1);
                return;
            }
            int[][] balls = new int[N][2];
            for (int i = 0; i < N; i++) {
                balls[i] = new int[]{in.nextInt(), in.nextInt()};
            }
            Map<B.Pair, Integer> map = new HashMap<>();
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < N; j++) {
                    if (i == j) continue;
                    B.Pair p = new B.Pair(balls[i][0] - balls[j][0], balls[i][1] - balls[j][1]);
                    map.put(p, map.getOrDefault(p, 0) + 1);
                }
            }
            int maxVal = map.values().stream().mapToInt(n -> n).max().getAsInt();
            out.println(N - maxVal);
        }

        static class Pair {
            int x;
            int y;

            Pair(int x, int y) {
                this.x = x;
                this.y = y;
            }

            public boolean equals(Object o) {
                if (this == o) return true;
                if (o == null || getClass() != o.getClass()) return false;
                B.Pair pair = (B.Pair) o;
                return x == pair.x &&
                        y == pair.y;
            }

            public int hashCode() {
                return Objects.hash(x, y);
            }

        }

    }
}



Measured memory_bytes: 30672
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
#define ll long long 
#define pb push_back
int main(){	
	fast;
		ll a,b;  cin>>a>>b;
		for(ll i=1;i<10000;i++){
			if((i*8)/100==a && (i*10)/100==b){
				cout<<i;
				return 0;
				}
	}
	cout<<"-1";
	}
		
	
	

	
	
	
		

Measured memory_bytes: 256
package main

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

func main() {
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var N, A, B int
	fmt.Scan(&N, &A, &B)
	if A+B-1 > N || A*B < N {
		fmt.Fprint(w, -1)
		return
	}
	r := 1
	remaining := N - A
	for r <= N {
		l := r + remaining
		if remaining > B-1 {
			l = r + B - 1
		}
		for i := l; i >= r; i-- {
			fmt.Fprint(w, i, " ")
		}
		remaining -= l - r
		r = l + 1
	}
}


Measured memory_bytes: 5140
#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long dp[21][1<<21];
int a[21][21];
long long calculate(int i, int j, int n){
   // cout<<i<<" "<<j<<endl;
    if(i == n)return 1;
    if(dp[i][j] != -1)return dp[i][j];
    long long ans = 0;
    for(int k = 0 ; k < n ; k++){
       // cout<<a[i][k]<<" "<<(j & (1<<k))<<endl;
        if((a[i][k] == 1) && ((j & (1<<k)) == 0)){
            ans += calculate(i + 1, (j | 1 << k), n);
            ans =  ans % mod;
        }
    }
   // cout<<i<<" "<<j<<" "endl;
    dp[i][j] = ans;
    return ans;
}

int main(){
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n;
    cin>>n;
//    int a[n][n];

    for(int i = 0 ; i < n ; i++){
        for(int j = 0 ; j < n ; j++){
            cin>>a[i][j];
        }
    }
    memset(dp, -1, sizeof(dp));
    cout<<calculate(0, 0, n)<<endl;

    return 0;
}


Measured memory_bytes: 344320
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        boolean[] a1 = new boolean[n];
        boolean[] an = new boolean[n];
        for(int i = 0; i < m;i++){
            int a = sc.nextInt();
            int b = sc.nextInt();
            if(a == 1){
                a1[b] = true;
            }else if(b == n){
                an[a] = true;
            }
        }
        boolean bool = false;
        for(int i = 2; i < n;i++){
            if(a1[i] && an[i]){
                bool = true;
                break;
            }
        }
        
        System.out.println(bool ? "POSSIBLE" : "IMPOSSIBLE");
        
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
            return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }
    
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) a[i] = nextLong();
        return a;
    } 
}


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

int main(){
  int n, hp[100000], min=1000000000, d[100000], ans, dmin = 1000000000;
  cin >> n;
  for(int i=0; i < n; i++){
    cin >> hp[i];
    if(min > hp[i]) min = hp[i];
  }
  sort(hp, hp+n);
  for(int i=0; i < n-1; i++){
    d[i] = hp[i+1] - hp[i];
    if(dmin > d[i]) dmin = d[i];
  }
  if(dmin != 0) min = std::min(min, dmin);
  for(ans = min; ans > 0; ans--){
    for(int i=0; i < n; i++){
      if(hp[i] % ans != 0) break;
      if(i == n-1) {
        cout << ans << endl;
        return 0;
      }
    }
  }
}


Measured memory_bytes: 640
a = input().split()
a = [int(i) for i in a]

kakuritu = 0
for i in range(1, a[0] + 1):
    num = i
    kakuritu_count = a[0]
    while (True):
        if (num >= a[1]):
            break
        num *= 2
        kakuritu_count *= 2

    kakuritu += 1/kakuritu_count

print(kakuritu)

Measured memory_bytes: 3060
x1, y1, x2, y2 = map(int, input().split())
dx, dy = x2 - x1, y2 - y1
x3, y3 = x2 - dy, y2 + dx
x4, y4 = x3 - dx, y3 - dy
print(x3, y3, x4, y4)

Measured memory_bytes: 2940
// C.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long LL;

LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }

int main(int argc, char *argv[]) {
	LL n, x;
	cin >> n >> x;
	vector<LL> a(n + 1);
	for (LL i = 0; i < n; ++i) {
		cin >> a[i];
	}
	a[n] = x;
	sort(a.begin(), a.end());
	LL ans = a[n] - a[n - 1];
	for (LL i = 1; i < n; ++i) {
		ans = min(ans, gcd(ans, a[i] - a[i - 1]));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024