akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main() {
  int N, K, Q;
  cin >> N >> K >> Q;
  vector<int> A(Q), score(N, K - Q);
  rep(i, Q) cin >> A[i];

  rep(i, Q) {
    score[A[i] - 1] += 1;
  }

  rep(i, N) {
    if (score[i] > 0)
      puts("Yes");
    else
      puts("No");
  }
}

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

int main() {
	//int n, k,m;
	double res,j,n,k,m;
	res = 0;
	cin >> n >> k;
	for (int i = 1; i <= n; i++) {
		m = i;
		j = 1 / n;
		while (m < k) {
			j /= 2;
			m *= 2;
		}
		res += j;	
	}
	cout << setprecision(15) << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <chrono>
#include <tuple>
#include <random>
#include <cmath>

using namespace std;

typedef long long ll;
typedef long double ld;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

const ll SIZE = 1e6 * 2 + 10, INF = 1e9 * 1e9 + 10;
ll n, x, m;
ll binpow(ll a, ll n) {
	if (n == 0)
		return 1;
	if (n % 2 == 1)
		return (binpow(a, n - 1) * a) % m;
	else {
		ll b = binpow(a, n / 2);
		return (b * b) % m;
	}
}

ll kek() {
	ll curM = x;
	ll ans = x;

	map<ll, ll> t;
	map<ll, ll> s;
	t[x] = 0;
	s[x] = 0;

	ll lft = 0;
	for (int i = 1; i < n; i++) {
		if (i == n - 3) {
			cout << "";
		}
		curM = binpow(curM, 2);
		ans += curM;
	}

	return ans;
}

int main()
{
	fastInp;

	ll ans = 0;

	cin >> n >> x >> m;

	ll curM = x;
	ans = x;
	
	map<ll, ll> t;
	map<ll, ll> s;
	t[x] = 0;
	s[x] = 0;
	
	ll lft = 0;

	for (int i = 1; i < n; i++) {
		curM = binpow(curM, 2);
		if (t.find(curM) != t.end()) {
			ll cycl = i - t[curM];
			lft = (n - i - 1) % cycl; ll q = (n - i - 1) / cycl;
			ll curS = s[curM], pr = ans;
			ans += q * (pr - curS);
			ans += curM;
			break;
		}
		t[curM] = i;
		s[curM] = ans;
		ans += curM;
		
		
	}

	
	for (int i = 0; i < lft; i++) {
		curM = binpow(curM, 2);
		ans += curM;
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 9424
N, M = map(int, input().split())
L = [0] * N
D = {}
c = 1
for i in range(M):
  A, B = map(int, input().split())
  if L[A - 1] == L[B - 1] == 0:
    D[c] = set()
    D[c].add(A)
    D[c].add(B)
    L[A - 1] = c
    L[B - 1] = c
    c += 1
  elif L[A - 1] == 0:
    D[L[B - 1]].add(A)
    L[A - 1] = L[B - 1]
  elif L[B - 1] == 0:
    D[L[A - 1]].add(B)
    L[B - 1] = L[A - 1]
  elif L[A - 1] != L[B - 1]:
    if len(D[L[A - 1]]) < len(D[L[B - 1]]):
      A, B = B, A
    D[L[A - 1]] |= D[L[B - 1]]
    for j in D.pop(L[B - 1]):
      L[j - 1] = L[A - 1]
  #print(L, D, sep = "\n")
print(len(D) + L.count(0) - 1)

Measured memory_bytes: 25448
#include <bits/stdc++.h>
#define ll long long int
#define fr(i, a, b) for (ll i = a; i < b; i++)
#define pb(v, a) v.push_back(a)
#define Sort(v) sort(v.begin(), v.end())
#define For(m) for (auto it = m.begin(); it != m.end(); it++)
#define mp(p1,p2) make_pair(p1,p2)
#define mod 1000000007
#define PI 3.14159265358979323846
#define pii pair<ll ,ll>
using namespace std;
#define fast                                                                   \
 ios_base::sync_with_stdio(false);                                            \
 cin.tie(NULL);                                                               \
 cout.tie(NULL);
 
 
int main()
{
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
   fast
   string s;
   cin >> s;
   ll a=0;
   fr(i,0,s.length())
   {
      if(s[i]=='o')a++;
   }
   a+=(15-s.length());
   if(a>=8)
   {
      cout << "YES";
   }
   else
      cout << "NO";
   return 0;
}

Measured memory_bytes: 256
a,b,c=map(int,input().split())

if -(-c//a)<=7:
    print(-(-c//a))
elif b+7*a>=c:
    print('7')
else:
    d=c//(7*a+b)
    e=c%(7*a+b)
    if (7*a+b)-e>=b:
        f=-(-e//a)
        print(d*7+f)
    else:
        print(7*d+7)


Measured memory_bytes: 5596
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <math.h>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <numeric>
#include <list>
#include <deque>
#include <map>
#include <set>

using namespace std;

typedef long long LL;
typedef pair<int, int>PII;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), rend()
#define PB pushback
#define SORT(c) sort((c).begin(),(c).end())

const LL INF = 1LL << 60;

//priority_queue<int> p;

int i, j, k, tmp, ans, cnt, N;
string s;

//scanf("%d",&N);

//printf("%d", ans);

//cout <<  << endl;


int main(void) {
	cin >> s;
	REP(i, s.size()) {
		if ((i+1) % 2 == 0) {
			if (s.at(i) == 'R') {
				printf("No");
				return 0;
			}
		}
		else {
			if (s.at(i) == 'L') {
				printf("No");
				return 0;
			}
		}
	}

	printf("Yes");
	return 0;
}

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

//昇順かどうかを返す関数を作ったが、今回はこんなもの使わなくてもできる
bool sorted(vector<int> *p){
    vector<int> v = *p;
    int siz = v.size();
    bool ans=true;
    for(int i=1; i<siz; i++){
        if(v[i-1] > v[i]) ans = false;
    }
    return ans;
}

void solve(){
    int n;
    cin >> n;
    vector<int> p;
    rep(i,n){
        int tmp;
        cin >> tmp;
        p.emplace_back(tmp);
    }
    //cout << sorted(&p) << endl;
    int count=0;
    rep(i,n){
        if(p[i]!=i+1) count++;
    }
    if(count==0||count==2) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

Measured memory_bytes: 256
#include <cstdio>
#include <utility>
#include <unordered_map>
#include <string>
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;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_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;}
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
//_vo(string &s){for(char c:s)pcu(c);}
_vo(string s){for(char c:s)pcu(c);}
_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');}
//_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	unordered_map<string, int> m;
	string k;
	for (int i = in(); i; i--) {
		int o = in();
		scan(k);
		switch(o) {
		case 0:
			m[k] = in();
			break;
		default:
			outl(m[k]);
			break;
		}
	}
}


Measured memory_bytes: 25916
/********************************************************************************
	
	Code by a weak man who named CYJian, and he hopes the code can get more points.

	Algorithm: 

 ********************************************************************************/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

//{{{ FAST IO AND SOME FUNCTIONS
const int __SIZE = 1 << 18;
char ibuf[__SIZE], *iS, *iT;

#define ge (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS++)) : *iS++)
#define ri read_int()
#define rl read_ll()
#define ra read_alpha()
#define FILE(s) freopen(s"in", "r", stdin), freopen(s"out", "w", stdout)

template<typename T>
inline void read(T &x) {
	char ch, t = 0; x = 0;
	while(!isdigit(ch = ge)) t |= ch == '-';
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = ge;
	x = t ? -x : x;
}
inline char read_alpha() { char c = ge; while(!isalpha(c) && c != EOF) c = ge; return c; }
inline int read_int() { int x; return read(x), x; }
inline ll read_ll() { ll x; return read(x), x; }

template<typename T> inline void chkmin(T&a, T b) { a = a < b ? a : b; }
template<typename T> inline void chkmax(T&a, T b) { a = a > b ? a : b; }
//}}}

int a[20];

inline ll dp(int l, int r, int L, int R) {
	if(l == r - 1) return 0;
	ll res = 1LL << 60;
	for(int i = l + 1; i <= r - 1; i++)
		chkmin(res, dp(l, i, L, L + R) + dp(i, r, L + R, R) + 1LL * (L + R) * a[i]);
	return res;
}

int main() {
#ifdef LOCAL
	FILE("");
#endif
	int n = ri;
	for(int i = 1; i <= n; i++) a[i] = ri;
	cout << a[1] + a[n] + dp(1, n, 1, 1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define M 300010
inline int read() {
	char ch = getchar(); int x = 0, f = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-') f = -1;
		ch = getchar();
	}
	while('0' <= ch && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
struct Node{
	int x, y;
	inline bool operator < (const Node& rhs) const {
		return x < rhs.x || (x == rhs.x && y < rhs.y);
	}
} a[M], L[M], R[M];
int lz[M * 4], mx[M * 4];
int w, h, n;
int Ans;
inline void build(int l, int r, int o) {
	lz[o] = 0; mx[o] = -1e9;
	if(l == r) return; 
	int mid = (l + r) / 2;
	build(l, mid, 2 * o);
	build(mid + 1, r, 2 * o + 1);
}
inline void update(int o, int x) {
	mx[o] += x; lz[o] += x;
}
inline void pushdown(int l, int r, int o) {
	if(lz[o]) {
		update(2 * o, lz[o]);
		update(2 * o + 1, lz[o]);
		lz[o] = 0;
	}
}
inline void change(int l, int r, int o, int x, int y, int z) {
	if(x <= l && r <= y) {
		update(o, z);
		return;
	}
	pushdown(l, r, o);
	int mid = (l + r) / 2;
	if(x <= mid) change(l, mid, 2 * o, x, y, z);
	if(y > mid) change(mid + 1, r, 2 * o + 1, x, y, z);
	mx[o] = max(mx[2 * o], mx[2 * o + 1]);
}
inline void Do() {
	build(1, n, 1);
	sort(a + 1, a + n + 1);
	int t1 = 0, t2 = 0;
	for(int i = 1; i < n; ++ i) {
		//cerr << i << endl;
		if(a[i].y <= h / 2) {
			//if(i == 3) puts("fuck");
			int lst = i - 1;
			while(t1 && a[i].y > L[t1].y) {
				//if(i == 3) printf("%d %d\n", L[t1].x, lst);
				change(1, n, 1, L[t1].x, lst, L[t1].y - a[i].y);
				lst = L[t1].x - 1; -- t1;
			}
			if(lst != i - 1) L[++ t1] = (Node){lst + 1, a[i].y};
		}
		else {
			int lst = i - 1;
			while(t2 && a[i].y < R[t2].y) {
				change(1, n, 1, R[t2].x, lst, a[i].y - R[t2].y);
				lst = R[t2].x - 1; -- t2;
			}
			if(lst != i - 1) R[++ t2] = (Node){lst + 1, a[i].y};
		}
		L[++ t1] = (Node){i, 0};
		R[++ t2] = (Node){i, h};
		change(1, n, 1, i, i, 1e9 + h - a[i].x);
		Ans = max(Ans, mx[1] + a[i + 1].x);
	}
}
int main() {
	//freopen("a.in", "r", stdin);
	w = read(), h = read(), n = read();
	for(int i = 1; i <= n; ++ i) {
		a[i] = (Node){read(), read()};
	}
	a[++ n] = (Node){0, 0};
	a[++ n] = (Node){w, h};
	//cerr << 233 << endl;
	Do();
	for(int i = 1; i <= n; ++ i) {
		swap(a[i].x, a[i].y);
	}
	swap(w, h);
	//cerr << 233 << endl;
	Do();
	printf("%d\n", Ans * 2);
}

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

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

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

  while(true){
	int N, M; cin >> N >> M;
	if(N == M && M == 0) break;
	int day[101], mx = 0;
	fill(day, day+101, 0);
	REP(i,N){
	  int m, d;
	  cin >> m;
	  REP(j,m){
		cin >> d;
		mx = max(mx, ++day[d]);
	  }
	}
	if(mx < M) cout << 0 << endl;
	else{
	  REP(i,101)
		if(day[i] == mx){
		  cout << i << endl;
		  break;
		}
	}
  }
  
  return 0;
}

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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;

int main()
{
    speed;
    cout << fixed << setprecision(6);
    /*start*/
    char a;
    cin >> a;
    if (a < 97)
    {
        c("A");
    }
    else
    {
        c("a");
    }
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a),i##_end=(b);i<=i##_end;++i)
#define per(i,a,b) for(int i=(b),i##_end=(a);i>=i##_end;--i)
#define For(i,a,b) for(int i=(a),i##_end=(b);i<i##_end;++i)
#define foe(i,a) for(__typeof(a.begin())i=a.begin();i!=a.end();++i)
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
typedef double ld;
typedef long long L;
typedef vector<int> vi;
typedef pair<int,int> pa;

int main(){

	int a,b,c;
	cin>>a>>b>>c;
	cout<<b+min(a+b+1,c);
}

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

int N, K;
vector<vector<int> > G;

using pint = pair<int,int>;
vector<pint> dp;
pint rec(int v, int p) {
    for (auto nv : G[v]) {
        if (nv == p) continue;
        rec(nv, v);
    }
    pint res = {0, 1};
    for (auto nv : G[v]) {
        if (nv == p) continue;
        res.first += dp[nv].first;
        res.second = max(res.second, dp[nv].second + 1);
    }
    if (v != 0 && p != 0 && res.second >= K) ++res.first, res.second = 0;
    return dp[v] = res;
}

int main() {
    cin >> N >> K;
    int res = 0;
    G.clear(); G.resize(N);
    for (int i = 0; i < N; ++i) {
        int a; cin >> a; --a;
        if (i == 0 && a != 0) ++res;
        if (i != 0) {
            G[i].push_back(a);
            G[a].push_back(i);
        }
    }
    dp.assign(N, pint(N, N));
    rec(0, -1);
    cout << res + dp[0].first << endl;
}

Measured memory_bytes: 12800
#include <iostream>
#include <sstream>
#include <iomanip>
#include <fstream>

using namespace std;

struct xy {
    double x;
    double y;
};

// solve:
// ax + by = c
// dx + ey = f
// a != 0
xy solve(double a, double b, double c, double d, double e, double f){
    xy result;
    // get y
    if (d == 0){
        result.y = f / e; // e!=0 to have an answer
    } else {
        // dx + (d/a)by = (d/a)c, dx + ey = f
        // (d/a-e)y = (d/a)c - f
        result.y = ((d/a)*c-f)/((d/a)*b-e);
    }
    result.x = (c-b*result.y) / a;
    return result;
}

int main(){
    //ifstream cin("input.txt");
    string line;
    while(getline(cin,line)){
        stringstream ss_line(line);        
        // input equation data
        double a,b,c,d,e,f;
        ss_line >> a >> b >> c >> d >> e >> f;
        // solve the equation
        xy result;
        if (a != 0)
            result = solve(a,b,c,d,e,f);
        else    // d != 0 since the equation has an answer 
            result = solve(d,e,f,a,b,c);
        cout << fixed << setprecision(3) << result.x << " " << result.y << endl;
    }

    return 0;
}

Measured memory_bytes: 1296
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define intarr(arr, n)  ll arr[n];  for (ll i = 0; i < n; i++)  cin >> arr[i]
#define inpvec(vec,n) for(ll i=0;i<n;i++){ll var;cin>>var;vec.push_back(var);}
#define ff first
#define ss second
#define pb push_back
#define mkp make_pair
#define vec vector<ll>
#define pi pair<ll,ll>
#define changeline cout<<endl
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define rev(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) v.begin(),v.end()
#define mod2 998244353
#define NO cout << "NO" <<endl
#define YES cout << "YES" <<endl
#define mem(arr,val) memset(arr,val,sizeof(arr));
const ll mod=1e9+7;
#define piii 3.14159265358979323846264338327950
#define print(a, n, m)     for (ll i = n; i < m; i++) {  cout << a[i] << " "; }  cout << endl
#define con continue

bool prime(ll n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
bool isPerfectSquare(ll x) {   
  long double sr = sqrt(x); 
  return ((sr - floor(sr)) == 0); 
} 
bool subsequence_checker(string str1, string str2, ll m, ll n) 
{ 
    if (m == 0) return true; 
    if (n == 0) return false; 
    if (str1[m-1] == str2[n-1]) 
        return subsequence_checker(str1, str2, m-1, n-1); 
    return subsequence_checker(str1, str2, m, n-1); 
}
bool cmp(const pair<int,int> &a,  const pair<int,int> &b) 
{ 
    if(a.ff == b.ff)
        return a.ss < b.ss;
    return (a.ff > b.ff); 
}
//////////////////////////////////////////////////// Lets Do It ////////////////////////////////////////////////////////

void solve()
{
    
    ll n;
    cin>>n;

    ll ans = 0;
    loop(i,1,n+1)
    {
        if(i%3!=0 and i%5!=0)
            ans+=i;
    }

    cout<<ans;

    return;
}
 
int main()
{
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
    IOS;
    ll t;
    //cin>>t;
    t=1;

    while(t--){
        solve();
        cout<<endl;
    }

    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
} 

Measured memory_bytes: 3604
import Control.Monad

slice :: String -> Int -> Int -> String
slice s a b = take (b - a + 1) $ drop a s

rev :: String -> Int -> Int -> String
rev s a b = take a s ++ (reverse $ slice s a b) ++ drop (b + 1) s

rep :: String -> Int -> Int -> String -> String
rep s a b p = take a s ++ p ++ drop (b + 1) s

solve :: String -> [String] -> [String]
solve s ss = snd $ foldl (\a l -> f a (words l)) (s, []) ss
    where
        f (s, ss) (o:a:b:xs)
            | o == "print"   = (s, ss ++ [slice s (read a) (read b)])
            | o == "reverse" = (rev s (read a) (read b), ss)
            | o == "replace" = (rep s (read a) (read b) (xs !! 0), ss)

main :: IO ()
main = do
    s  <- getLine
    n  <- readLn
    ss <- replicateM n getLine
    putStr $ unlines $ solve s ss

Measured memory_bytes: 5528
#include <stdio.h>

int main()
{
    int x, y;
        scanf("%d %d", &x, &y);
    while (x != 0 || y != 0){
        if (x < y)
            printf("%d %d\n", x, y);
        else 
            printf("%d %d\n", y, x);
        scanf("%d %d", &x, &y);
    }
   return 0;
}



Measured memory_bytes: 2040
dxy = zip([1,0,-1,0],[0,1,0,-1])
def rec(x,y,t):
    global ans
    if t >= ans: return
    for dx,dy in dxy:
        nx,ny = x+dx,y+dy
        while 0 <= nx < W and 0 <= ny < H:
            if   field[ny][nx] == 3: ans = t
            elif field[ny][nx] == 1:
                if abs(nx-x)+abs(ny-y) == 1: break
                field[ny][nx] = 0
                rec(nx-dx,ny-dy,t+1)
                field[ny][nx] = 1
                break
            nx += dx; ny += dy

while 1:
    W,H = map(int,raw_input().split())
    if W == 0: break
    field = [map(int,raw_input().split()) for _ in range(H)]
    for y in range(H):
        for x in range(W):
            if field[y][x] == 2: sx,sy = x,y
    ans = 11
    rec(sx,sy,1)
    print ans if ans < 11 else -1

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

int main() {
	int A,B;
	cin>>A>>B;
	if(A==1)A=14;
	if(B==1)B=14;
	if(A>B)cout << "Alice" << endl;
	if(A<B)cout << "Bob" << endl;
	if(A==B)cout << "Draw" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<utility>//swapでaとbの値を入れ替える
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
#define sort(s) sort(s.begin(),s.end())
#define r(s) reverse(s.begin(),s.end())
using namespace std;
 
int main() {
	int a,b,c;
	cin >> a>>b>>c;
	if (a + b >= c)cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

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

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

    int count1 = 0; 
    int count2 = 0;

    char a = str[0];
    char b;

    for(int i = 0; i < 4; i++){
        if(str[i] != a){
            b = str[i];
            break;
        }
    }

    for(int i = 0; i < 4; i++){
        if(str[i] == a){
            count1++;
        }else if(str[i] == b){
            count2++;
        }
    }

    //cout << count1 << count2 << a << b << endl;

    if(count1 == 2 && count2 == 2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
//#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 10000000000000
#define N 100005
#define vi vector<int>
#define all(v) v.begin(),v.end()
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n,k;
   cin>>n>>k;
   vi a(n);
   int s=0;
   rep(i,0,n){cin>>a[i];s+=a[i];}
   int ans=1;
   for(int i=1;i*i<=s;i++)
   {   if(s % i == 0)
       {vi b(n);
       b=a;
       int sum=0;
       rep(j,0,n)
       {b[j]%=i;sum+=b[j];}
       int s1=0;
       sort(all(b));
       //debug(b);
       rep(j,0,n)
       {
           s1+=b[j];
           if((n - j - 1)*i == sum && s1<=k)
           {
               ans=max(ans,i);
               break;
           }
       }
       vi c(n);c=a;
       sum=0;
       //debug(s/i);
       rep(j,0,n)
       {
           c[j]%=(s/i);sum+=c[j];
       }
       s1=0;
       sort(all(c));
       //debug(c);
       //debug(sum);
       rep(j,0,n)
       {
           s1+=c[j];
           if((n - j - 1)*(s/i) == sum && s1<=k)
           {
               ans=max(ans,(s/i));
               break;
           }
       }
       }

   }
   cout<<ans<<endl;

}


Measured memory_bytes: 3624
import java.util.*;
//import java.util.stream.Collectors;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		Integer[] a = new Integer[n];
		Arrays.setAll(a, i -> Integer.parseInt(sc.next()));
		List<Integer> list = new ArrayList<>(Arrays.asList(a));
		list.sort(Comparator.reverseOrder());
		double limit = list.stream().mapToInt(Integer::intValue).sum() / (4.0 * m);
		System.out.println(list.get(m-1) >= limit ? "Yes" : "No");
	}
}


Measured memory_bytes: 36020
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, math.MaxInt64)
}

func readInt() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

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

func main() {
	_, m, x := readInt(), readInt(), readInt()
	var a []int
	for i := 0; i < m; i++ {
		a = append(a, readInt())
	}
	for i := 0; i < m; i++ {
		if a[i] > x {
			fmt.Println(min(len(a[:i]), len(a[i:])))
			break
		}
	}
}


Measured memory_bytes: 640
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int X = sc.nextInt();
		for(int i=0;i<2*K-1;i++) {
			System.out.print(X-K+1+i+" ");
		}
	}
}



Measured memory_bytes: 21844
import numpy as np


def enum_753_number():
    enum_array = [3, 5, 7]
    enum_array = enum_753_number_(enum_array, 1)
    return enum_array


def enum_753_number_(enum_array, now_digit):
    now_digit += 1;
    if (now_digit > 9):
        return enum_array
    else:
        enum_3_array = [10*num + 3 for num in enum_array]
        enum_5_array = [10*num + 5 for num in enum_array]
        enum_7_array = [10*num + 7 for num in enum_array]
        enum_array.extend(enum_753_number_(enum_3_array, now_digit))
        enum_array.extend(enum_753_number_(enum_5_array, now_digit))
        enum_array.extend(enum_753_number_(enum_7_array, now_digit))
        return enum_array


def check_753_number(number):
    flag_3 = False
    flag_5 = False
    flag_7 = False
    if (number < 100):
        return False
    while (number > 1):
        if (number % 10 == 3): flag_3 = True
        if (number % 10 == 5): flag_5 = True
        if (number % 10 == 7): flag_7 = True
        number = int(number / 10)
    if (flag_3 == True and flag_5 == True and flag_7 == True):
        return True
    else:
        return False


def main():
    string = input()
    N = int(string)
    count = 0
    enum_array = enum_753_number()
    for elem in enum_array:
        if (elem <= N and check_753_number(elem)): count+=1
    print(count)


if __name__ == '__main__':
    main()


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

struct Mod
{
    static const auto P = int(1e9+7);
    long long k;

    Mod(const long long k) : k(k%P) {}
};

Mod operator*(const Mod a, const Mod b) { return a.k * b.k; }
Mod& operator*=(Mod& a, const Mod b) { return a = a * b; }

int main()
{
    int N; cin >> N;

    auto candidates = 0;
    auto result = Mod(1);
    for (auto i = 0; i < N; i++)
    {
        int x; cin >> x;
        if (x < 2*(candidates+1)-1)
        {
            result *= candidates+1;
            candidates--;
        }
        candidates++;
    }
    for (auto i = 1; i <= candidates; i++)
        result *= i;
    cout << result.k << endl;
}


Measured memory_bytes: 384
#include<stdio.h>
int main(void)
{
	int a,b,c,box;
	scanf("%d %d %d",&a,&b,&c);
	box=a;
	a=b;
	b=box;
	box=a;
	a=c;
	c=box;
	printf("%d %d %d\n",a,b,c);
	return 0;
}

Measured memory_bytes: 1704
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    void solve() throws IOException {
        long x = nl();
        if (x <= 6) {
            out.println(1);
            return;
        }

        if (x < 12) {
            out.println(2);
            return;
        }

        if (x % 11 == 0) {
            out.println(x * 2 / 11);
            return;
        }

        if (x % 11 <= 6) {
            out.println(x / 11 * 2 + 1);
            return;
        }

        out.println(x / 11 * 2 + 2);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 8276
#include "bits/stdc++.h"
#include<vector>
#include<iostream>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<iomanip>
#include<assert.h>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<stack>
#include<complex>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;
	
#define WHATS(var)cout<<__LINE__<<' '<<#var<<"="<<var<<endl;
	
template<class S, class T> ostream& operator <<(ostream &os, const pair<S, T> v){
	os << "( " << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator <<(ostream &os, const vector<T> &v){
	for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator <<(ostream &os, const vector<vector<T>> &v){
	for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> ostream& operator <<(ostream &os, const vector<set<T>> &v){
	for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> ostream& operator <<(ostream &os, const set<T> &v){
	int i=0;
	for(auto it:v){
		if(i > 0){os << ' ';}
		os << it;
		i++;
	} 
	return os;
}

map<long long int, int>soinnsuu(long long int a) {
	map<long long int, int>ans;
	for (long long i = 2; i*i <= a; ++i) {
		while (a%i == 0) {
			ans[i]++;
			a /= i;
		}
	}
	if (a != 1)ans[a]++;


	return ans;
}
	
int main() {
	ios::sync_with_stdio(false);
	int N,M;cin>>N>>M;
	vector<int>ms(M);
	for(int i=0;i<M;++i){
		cin>>ms[i];
		ms[i]--;
	}
	ms.push_back(N);
	sort(ms.begin(),ms.end());
	vector<int>ds;
	for(int i=0;i<M;++i){
		int d=ms[i+1]-ms[i];
		if(d)ds.push_back(d);
	}
	//WHATS(ds)
	sort(ds.begin(),ds.end());
	int answer=N;
	vector<int>answers(N+1);
	int x=0;
	answers[0]=answer;
	for(int len=1;len<=N;++len){
		answer-=(ds.size()-x);
		while(x!=ds.size()&&ds[x]==len){
			x++;
		}
		answers[len]=answer;
	}
	//WHATS(answers);
	int Q;cin>>Q;
	while(Q--){
		int t;cin>>t;
		auto it=lower_bound(answers.begin(),answers.end(),t,greater<int>());
		//auto it=lower_bound(answers.begin(),answers.end(),greater<int>(),t);
		int num=it-answers.begin();
		if(!num)num++;
		if(num==N+1)num=-1;
		cout<<num<<endl;
	}
	return 0;	
}


Measured memory_bytes: 4224
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

S = S()
ans = 0

for i in range(1<<(len(S)-1)):
    tmp_ans = 0
    bit = i

    for j in range(len(S)-1):
        if (bit & 1):
            tmp_ans *= 10
            tmp_ans += int(S[j])
            ans += tmp_ans
            tmp_ans = 0
        else:
            tmp_ans *= 10
            tmp_ans += int(S[j])
       
        bit >>= 1
    
    if (not tmp_ans):
        ans += int(S[-1])
    else:
        tmp_ans *= 10
        tmp_ans += int(S[-1])
        ans += tmp_ans

print(ans)


Measured memory_bytes: 40048
#include<stdio.h>

int main(void)
{
	int x,y,z,k,i,n;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		k=0;
		for(x=1;x*x<=i;x++)
		{
			for(y=1;y*y<=(i-x*x-x*y);y++)
			{
				for(z=1;z*z<=(i-x*x-x*y-x*z-y*y-y*z);z++)
				{
					if(x*x+y*y+z*z+x*y+y*z+z*x==i)
					{
						k=k+1;
					}
				}
			}
		}
		printf("%d\n",k);
	}
	return 0;
}

Measured memory_bytes: 2144
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>

struct Node{
  int key;
  Node *next, *prev;
};
Node *nil;

void init() {
  nil = (Node*)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
}

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

void printList() {
  Node *cur = nil->next;
  for(int i = 0; cur != nil; i++) {
    if(i > 0) printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
  }
  printf("\n");
}

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

void deleteFirst() {
  deleteNode(nil->next);
}

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

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

void insert(int key) {
  Node *x = (Node*) malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  x->prev = nil;
  nil->next = x;
}

int main() {
  int key, n, i, j = 0;
  char com[20];
  scanf("%d", &n);
  init();
  for(i = 0; i < n; i++) {
    scanf("%s%d", com, &key);
    if(strcmp(com, "insert") == 0) {
      insert(key);
    } else if(strcmp(com, "delete") == 0) {
      deleteKey(key);
    } else if(strcmp(com, "deleteFirst") == 0) {
      deleteFirst();
    }else if(strcmp(com, "deleteLast") == 0){
      deleteLast();
    }
  }
  printList();

  return 0;
}



Measured memory_bytes: 34364
#include <bits/stdc++.h>
using namespace std;
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v){
  const char* delimiter = "";
  for(const auto& x:v) cout << exchange(delimiter, ",") << x;
  return os;
}
template<typename T>
vector<bool> prime_table(T n){
  vector<bool> prime(n+1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(T i = 2; i * i <= n; i++){
    if(!prime[i]) continue;
    for(T j = i + i; j <= n; j += i){
      prime[j] = false;
    }
  }
  return prime;
}
int32_t main(){
  const size_t LIM=1e5;
  vector<bool> prime=prime_table(LIM);
  vector<bool> like(LIM+1, false);
  for(size_t i=1; i<LIM+1; i+=2){
    if(prime[i] && prime[(i+1)/2]) like[i]=true;
  }
  vector<size_t> sum(LIM+2); sum[0]=0;
  for(size_t i=1; i<LIM+2; ++i){
    if(like[i-1]) sum[i]=sum[i-1]+1;
    else sum[i]=sum[i-1];
  }
  size_t q; cin>>q;
  for(size_t i=0; i<q; ++i){
    size_t l,r; cin>>l>>r;
    cout<<sum[r+1]-sum[l]<<'\n';
  }
}

Measured memory_bytes: 1408
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>
#include<iso646.h>
#include<bitset>

using namespace std;

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

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;

int main(){
	int N, H, W;
	cin >> N >> H >> W;
	cout << (N - H + 1) * (N - W + 1) << endl;
	return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0)
#define mapmax(v) v.rbegin()->first
#define mapmin(v) v.begin()->first
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<string> vs;

typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

map<long long,long long> prime_factor(long long n) {
    map<long long,long long> ret;
    for(long long i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

int main()
{
	ll a,b,ans=1;
	cin >> a >> b;
	for(auto& e:prime_factor(gcd(a,b))) ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import re
hoge = list(input())
i = 0
while i < len(hoge):
    if i%2==0 and re.findall(r'[RDU]',hoge[i]):
        pass
    elif i%2==1 and re.findall(r'[LDU]',hoge[i]):
        pass
    else:
        break
    i+=1
if i == len(hoge):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3188
import java.io.*;

class Main {
	public static void main(String[] arg)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] div = br.readLine().split(" ");
		double x1 = Double.parseDouble(div[0]);
		double y1 = Double.parseDouble(div[1]);
		double x2 = Double.parseDouble(div[2]);
		double y2 = Double.parseDouble(div[3]);

		System.out.println(Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2)));
	}
}

Measured memory_bytes: 17056
from heapq import heappop,heappush
N,Q = map(int,input().split())
route = [[] for _ in range(N)]
ans = [0] * N
for i in range(N - 1):
    a,b = map(int,input().split())
    route[a - 1].append(b)
    route[b - 1].append(a)
for i in range(Q):
    p,x = map(int,input().split())
    ans[p - 1] += x
W = [(0,1)]
A = [1] * N
while W:
    de,nod = heappop(W)
    A[nod - 1] = 0
    for i in route[nod - 1]:
        if A[i - 1] == 1:
            heappush(W,(de + 1,i))
            ans[i - 1] += ans[nod - 1]
print(*ans)

Measured memory_bytes: 64352
S = input()
N = len(S)

RL_index = []
L_last_index = []
for i in range(N):
    if i == N-1:
        break
    if S[i] == "L" and S[i+1] == "R":
        L_last_index.append(i)
    if S[i] == "R" and S[i+1] == "L":
        RL_index.append(i)
L_last_index.append(N-1)
# print("RL_ind: ", RL_index)
# print("L_last: ", L_last_index)
now = 0
ans = [0] * N
for k in range(len(L_last_index)):
    length = L_last_index[k] - now + 1
    # print(length)
    if length % 2 == 0:
        ans[RL_index[k]] = ans[RL_index[k]+1] = int(length / 2)
    else:
        L_len = L_last_index[k] - RL_index[k]
        R_len = length - L_len
        # print("L_len: ", L_len)
        # print("R_len: ", R_len)
        if R_len % 2 == 1:
            ans[RL_index[k]] = int(length / 2) + 1
            ans[RL_index[k]+1] = int(length / 2)
        elif L_len % 2 == 1:
            ans[RL_index[k]] = int(length / 2)
            ans[RL_index[k]+1] = int(length / 2) + 1

        # longer = max(L_len, R_len)
        # if longer - 1 % 2 == 0:
        #     ans[RL_index[k]] = int(length / 2) + 1
        #     ans[RL_index[k]+1] = int(length / 2)
        # else:
        #     ans[RL_index[k]] = int(length / 2)
        #     ans[RL_index[k]+1] = int(length / 2) + 1
        # if L_len > R_len:
        #     ans[RL_index[k]] = int(length / 2)
        #     ans[RL_index[k]+1] = int(length / 2) + 1
        # else:
        #     ans[RL_index[k]] = int(length / 2) + 1
        #     ans[RL_index[k]+1] = int(length / 2)
    now = L_last_index[k]+1
print(" ".join(map(str, ans)))

Measured memory_bytes: 14436
#include<stdio.h>

int main(void)
{
	while(1)
	{
	int dataset = 0;
	int age;
	int i;
	int s;
	int pnum[7] = {0};
	scanf("%d",&dataset);
	if(dataset == 0) break;
	for(i = 0;i < dataset;i++)
	{
		scanf("%d",&age);
		if(age >= 70)
		{
			age = 60;
		}
		s = (age / 10);
		pnum[s]++;
	}
	for(i = 0;i < 7;i++)
	{
		printf("%d\n",pnum[i]);
	}
	}
	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <climits>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
 
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

#define MOD 1000000007LL
int N;


ll mpow(int n, int m) {
  if (m==0) return 1;
  if (m==1) return n;
  ll r1 = mpow(n, m/2);
  r1 = (r1*r1) % MOD;
  if (m%2==1) {
    r1 *= n;
    r1 %= MOD;
  }
  return r1;
}

ll f(int n) {
  ll r;

  r = mpow(10, n) + mpow(8, n) - mpow(9, n)*2;
  while (r<0)
    r+=MOD;
  return r;
}
int main()
{

  cin >> N;

  cout << f(N) << endl;
  return 0;
}
/*

  全ての数:10^N
  0を含まないもの9^N
  9を含まないもの9^N
  0も9も含まないもの8^N
  */

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;

int main() {
    int n, m, x;    cin >> n >> m >> x;
    int *a = new int[m];
    int j = m;
    bool flag = false;
    for (int i = 0; i < m; i++) {
        cin >> a[i];
        if (x < a[i] && !flag) {
            j = i;
            flag = true;
        }
    }

    cout << min(j, m-j) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <list>
#include <algorithm>
using namespace std;

int main(){
	int N,M;
	while(cin >> N >> M&&N!=0){
		vector<pair<int,int>> place(M);
		for(int i=0; i<N; ++i){
			for(int j=0; j<M; ++j){
				int tmp;
				cin >> tmp;
				place[j].second=j+1;
				place[j].first+=tmp;
			}
		}
		for(int i=0; i<M; ++i){
			for(int j=0; j+1<M-i; ++j){
				if(place[j].first<place[j+1].first) swap(place[j],place[j+1]);
			}
		}
		for(int i=0; i<M; ++i){
			cout << place[i].second << (i==M-1?'\n':' ');
		}
	}
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main(){
  int h,w;
  cin>>h>>w;
  vector <string> m(h+5);
  for (int ii=0;ii<h;ii++){

      cin >> m[ii] ;



  }


const int INF = 1001001001;
int di[] = {-1,0,1,0};
int dj[] = {0,-1,0,1};
int ans=0;


for (int i=0;i<h ;i++){
  for (int j=0;j<w;j++){
    vector<vector<int> > dist(h, vector<int>(w, INF));
    queue <P> q;

    auto update = [&](int i, int j, int x) {
        if (dist[i][j] != INF) return;
        dist[i][j] = x;
        q.push(P(i,j));
    };
    //if (dist[i][j] !=INF) continue;
    update(i,j,0);
    if (m[i][j]=='#') continue;
    while (!q.empty()){
      int i_now = q.front().first;
      int j_now = q.front().second;
      q.pop();
      for (int d=0; d<4; d++){
        int ni = i_now + di[d], nj = j_now + dj[d];
        if (ni<0 || ni>= h||nj<0||nj>=w) continue;
        if (m[ni][nj] == '#') continue;
        update(ni,nj,dist[i_now][j_now]+1);

      }
    }

    for (int ii=0;ii<h ;ii++){
      for (int jj=0;jj<w;jj++){
        if (dist[ii][jj]!=INF)
        ans=max(ans,dist[ii][jj]);

        }
      }




  }
}
  cout<<ans;


}


Measured memory_bytes: 256
w = int(raw_input())
n = int(raw_input())

s = [i+1 for i in range(w)]
for i in range(n):
    a, b = map(int, raw_input().split(","))
    tmp = s[a-1]
    s[a-1] = s[b-1]
    s[b-1] = tmp

for i in s:
    print i

Measured memory_bytes: 4216
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<vector>
#include<queue>
#include<set>
#include<algorithm>
#define INF 0x3f3f3f3f
#define mod 1000000009
#define e  2.718281828459045
#define eps 1.0e18
#define PI acos(-1)
#define lowbit(x) (x&(-x))
#define memset(x,y) memset(x,y,sizeof(x))
#define lson i << 1,l,m
#define rson i << 1 | 1,m + 1,r
#define ll long long
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	ll a,b;
	cin>>a>>b;
	ll ans=(a*b+1)/2;
	if(a==1||b==1) cout<<1<<endl; 
	else cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int main(){
  int N;

  char before;
  cin >> N;

  set<string> st;
  {
    string w;
    cin >> w;
    st.insert(w);
    before = w.back();
  }
  rep(i,1,N - 1){
    string w;
    cin >> w;
    if(st.count(w) || before != w.front()){
      cout << "No" <<endl;
      return 0;
    }
    st.insert(w);
    before = w.back();
  }

  cout << "Yes" << endl;
}


Measured memory_bytes: 256