akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;

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

    for(ll i = 0;i < (ll)s.size();i++){
        if(s[i] == '?'){
            s[i] = 'D';
        }
    }

    cout << s;

    return 0;
}

Measured memory_bytes: 3724
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;

ll dist[int(1e5)+2];
void dfs(vector<ar<ll,2>> *v, int vertex, ll c)
{
	dist[vertex] = c;
	for(auto it:v[vertex])
	{
		if(dist[it[0]]>dist[vertex]+it[1])
			dfs(v,it[0],dist[vertex]+it[1]);
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	memset(dist,0x3f, sizeof(dist));
	int n;
	cin>>n;
	vector<ar<ll,2> > v[n];
	for(int i = 0,j,k,c; i<n-1; i++)
	{
		cin>>j>>k>>c, --j, --k;
		v[j].push_back({k,c});
		v[k].push_back({j,c});
	}
	int q,k;
	cin>>q>>k, --k;
	dist[k] = 0;
	dfs(v,k,0);
	while(q--)
	{
		int x,y;
		cin>>x>>y, --x, --y;
		cout<<dist[x]+dist[y]<<endl;
	}
	return 0;
}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl
 
 
 
 
template<class T>
vector<T> cumsum1d(const vector<T> &v){
    int size = v.size();
    vector<T> cum(size+1,0);
    for(int i = 0; i < size; i++){
        cum[i+1] = v[i] + cum[i];
    }
    return cum;
}
 
int main() {
    ll n, num;
    cin >> n >> num;
 
    vector<ll> p(n), c(n);
    for(int i = 0; i < n; i++){
        cin >> p[i];
        p[i]--;
    }
    for(int i = 0; i < n; i++){
        cin >> c[i];
    }
    vector<ll> group(n, -1);
    vector<vector<ll>> loops(n);
    ll group_id = 0;
    for(int i = 0; i < n; i++){
        ll idx = i;
        if(group[idx] != -1){continue;}
 
        while(group[idx] == -1){
            group[idx] = group_id;
            loops[group_id].push_back(c[idx]);
            idx = p[idx];
        }
        group_id++;
    }
 
    for(int i = 0; i < group_id; i++){
        int lim = loops[i].size();
        for(int j = 0; j < lim; j++){
            loops[i].push_back(loops[i][j]);
        }
    }
 
    vector<vector<ll>> loops2(group_id);
    for(int i = 0; i < group_id; i++){
        loops2[i] = cumsum1d(loops[i]);
    }
 
    vector<ll> loop_sum(group_id, 0);
    for(int i = 0; i < group_id; i++){
        loop_sum[i] = loops2[i][loops[i].size()/2];
    }
 
    ll ans = -1e9-1;
    for(int i = 0; i < group_id; i++){
        int size =  loops[i].size()/2;
        for(int j = 0; j < size; j++){
            for(int k = j+1; k < j+1 + size; k++){
                if(num < k-j){continue;}
                ll tmpsum = loops2[i][k] - loops2[i][j];
                ans = max(ans, tmpsum);
                if(loop_sum[i] > 0){
                    ans = max(ans, tmpsum + (ll)(num - (k-j))/((ll)loops[i].size()/2)*(ll)loop_sum[i]);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4068
#pragma region RegionDefs
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
const ll INF = 1e9;
template<class T=ll> using V = vector<T>;
template<class T=ll> using PQ = priority_queue<T>;
template<class T=ll> using PQG = priority_queue<T, V<T>, greater<T>>;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
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 (a>b) {a=b; return 1;} return 0;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#define YN(e) cout << ((e) ? "YES" : "NO") << endl
#define yn(e) cout << ((e) ? "Yes" : "No") << endl
#pragma endregion RegionDefs

void solve()
{
    IN(a, b, h, m);
    double ax = a * cos((h / 12.0 + m / 60.0 / 12.0) * 2 * M_PI);
    double ay = a * sin((h / 12.0 + m / 60.0 / 12.0) * 2 * M_PI);
    double bx = b * cos(m / 60.0 * 2 * M_PI);
    double by = b * sin(m / 60.0 * 2 * M_PI);
    cout << sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by)) << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 4120
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
		int N = Integer.parseInt(in.next());
		String ans = "YES";
		for(int i = 0; i<N; i++) {
			int D = Integer.parseInt(in.next());
			if (map.containsKey(D))map.put(D,map.get(D)+1);
			else map.put(D,1);
		}
		int M = Integer.parseInt(in.next());
		for(int i = 0; i<M; i++) {
			int T =Integer.parseInt(in.next());
			if (map.containsKey(T)&&map.get(T)>0)map.put(T,map.get(T)-1);
			else {
				ans = "NO";
				break;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 99284
#include<iostream>
#include<vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <limits>
#include <map>
#include <bitset>
#include <iomanip>

#define rep(i,n) for(int (i) = 0; (i)<(n); (i)++)
#define FOR(i,s,e) for(int (i) = (s); (i)<(e); (i)++)
#define vecall(itr,vec) for(auto (itr) = (vec).begin(); (itr) != (vec).end(); (itr)++)
#define vecshow(vec) for(auto itr = (vec).begin(); itr != (vec).end(); itr++)cout << *itr << " ";

using namespace std;
using p = pair<int, int>;
using ll = long long;

int gcd(int a, int b) {
	int l = max(a, b);
	int s = min(a, b);
	while (l * s != 0) {
		int tmp = s;
		s = l % s;
		l = tmp;
	}

	return l;
}

vector<vector<int>> path;

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> p(n);
	rep(i, n)cin >> p[i];
	sort(p.begin(), p.end());
	int sum = 0;
	rep(i, k)sum += p[i];
	cout << sum << endl;
	return 0;
}

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

int main() {
	int A,B;
	string S;
	cin >> A >> B;
	cin >> S;

	if (S.size() != A + B + 1) {
		cout << "No" << endl;
		return 0;
	}
	if (S[A+1-1] != '-') {
		cout << "No" << endl;
		return 0;
	}
	for (int i = 0; i < S.size(); i++) {
		if (i == A) continue;
		if ( (S[i] < '0' || '9' < S[i]) && S[i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#include <sstream>
#include <bitset>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x)  if(DEBUG_Switch) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
ll poww(ll a, ll b) { if (a == 0ll) {return 0ll;} ll ans = 1; while (b) {if (b & 1) {ans = ans * a ;} a = a * a ; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
const int maxn = 1000010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
#define DEBUG_Switch 0
int main()
{
#if DEBUG_Switch
    freopen("C:\\code\\input.txt", "r", stdin);
#endif
    //freopen("C:\\code\\output.txt","r",stdin);
    int a, b, c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b << endl;
    return 0;
}




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

using namespace std;
using ll = long long;
int n,m;
ll a[211111];
deque<ll> d;
int main(){
    ios_base::sync_with_stdio(0);cin.tie(nullptr);
    cin>>n>>m;
    for(int i=1; i<=n; i++) cin>>a[i];
    for(int i=1; i<=n; i++){
        if(i > m){
            if(d.front() >= a[i]) cout<<"No\n";
            else cout<<"Yes\n";
            d.pop_front();
            d.push_back(a[i]);
        }
        else d.push_back(a[i]);
    }
}

Measured memory_bytes: 6336
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ull, ull> UP;
typedef tuple<int, int, int> T;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int gcd(int a, int b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
int digisum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}

ll cnt[502][502];

int main() {
	string s;
	cin >> s;
	int ans = 0;
	REP(i, s.size()) {
		if (s[i] == '+')ans++;
		else ans--;
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
n = int(input())
strs = sorted([''.join(sorted(input().strip())) for _ in range(n)])

i, j = 0, 1
lcnt = 1
res = 0
while j < n:
    if strs[i] == strs[j]:
        lcnt += 1
        j += 1
    else:
        res += lcnt * (lcnt - 1) // 2
        i = j
        j = i + 1
        lcnt = 1
res += lcnt * (lcnt - 1) // 2

print(res)

Measured memory_bytes: 60376
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        while(true) {
            int H = stdIn.nextInt();
            int W = stdIn.nextInt();
            int i;
            int j;
            if(H == 0 && W == 0) {
                break;
            }
            for(i = 0; i < H; i++) {
                for(j = 0; j < W; j++) {
                    if( i != 0 && j != 0 && j != W-1  && i != H-1){
                        System.out.print(".");
                    } else {
                        System.out.print("#");
                    };
                }
                System.out.println("");
            }
            System.out.println("");
        }
    }
}


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

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

int main() {
	int n, cnt = 0;
	int a[22], b[22], c[22];
	cin >> n;
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];
	rep(i, n-1) cin >> c[i];
	for(int i = 0; i < n; i++){
		cnt += b[a[i]-1];
		if(i != 0 && a[i]-a[i-1] == 1){
			cnt += c[a[i-1]-1];
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
/* clang-format on */


int main() {
  ll n,ans=0;
  cin >> n;
  priority_queue<pair<ll,ll>> q;
  vector<ll> a(n), b(n);
  REP(i, n) {
    cin >> a[i] >> b[i];
    q.push({a[i] + b[i],i});
  }

  while (true) {
    if (q.empty()) break;
    ans += a[q.top().second];
    q.pop();
    if (q.empty()) break;
    ans -= b[q.top().second];
    q.pop();
  }
  cout << ans << endl;
  
  return 0;
}


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

#define NDEBUG
#include <cassert>


typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<llll> vllll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define repC3(vari,varj,vark,n)  for(int vari=0;vari<(n)-2;++vari)for(int varj=vari+1;varj<(n)-1;++varj)for(int vark=varj+1;vark<(n);++vark)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair
#define clamp(v,lo,hi) min(max(v,lo),hi)
#define ABS(x) max((x),-(x))

void solve(int N, vi &u, vi &v, vi &w)
{
    vector<vector<ii>> nxt(N);
    rep(i, N - 1)
    {
        nxt[u[i]].emplace_back(v[i], w[i]);
        nxt[v[i]].emplace_back(u[i], w[i]);
    }
    queue<ii> q;
    q.emplace(0, 0);
    vi visited(N, INT_MAX);
    while (!q.empty())
    {
        int u = q.front().first, d = q.front().second;
        q.pop();
        if (visited[u] != INT_MAX)
            continue;
        visited[u] = d % 2;
        for (auto &p : nxt[u])
        {
            int v = p.first, d2 = p.second;
            q.emplace(v, d + d2);
        }
    }
    rep(i, N)
    {
        printf("%d\n", visited[i]);
    }
}

int main()
{
    int N;
    scanf("%d%*c", &N);
    vi u(N - 1), v(N - 1), w(N - 1);
    rep(i, N - 1)
    {
        scanf("%d %d %d%*c", &u[i], &v[i], &w[i]);
        u[i]--;
        v[i]--;
        w[i] %= 2;
    }
    solve(N, u, v, w);
    return 0;
}

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

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

  for (int i = 1; i < N; i++)
  {
    int tmp = 0;
    cin >> tmp;
    A[tmp-1]++;
  }

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


    return 0;
}

Measured memory_bytes: 4376
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
const ll mod=1e+9+7;
int main(void){
    int n,m;cin>>n>>m;
    map<int,int> mp;
    rep(i,m){
        int a;cin>>a;
        mp[a]++;
    }
    vector<ll> b(n+100,0);
    b[0]=1;
    rep(i,n){
        if(mp[i+1]==0){
            b[i+1]+=b[i];
            b[i+1]%=mod;
        }
        
        if(mp[i+2]==0){
            b[i+2]+=b[i];
            b[i+1]%=mod;
        }
        
    }
    cout<<b[n]<<endl;
}

Measured memory_bytes: 5760
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const ll mod = 998244353;

ll dp[6060];

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


	int A, B, C, D;
	cin >> A >> B >> C >> D;

	C -= A;
	D -= B;

	dp[C + 2] = 1;
	for (int i = C + 2; i < C + D + 2; i++) dp[i + 1] = dp[i] * A % mod;

	for (int i = A; i < A + C; i++) {
		auto t = dp + C - i + A - B + 2;

		for (int j = B; j <= B + D; j++) {
			t[j - 1] = t[j - 2] * (i + 1) + t[j] * j - t[j - 1] * i * (j - 1);

			//t[j - 1] %= mod;
			t[j - 1] -= int(double(t[j - 1]) / mod) * mod;

		}
	}
	co((dp[D + 2] + 10 * mod) % mod);

	Would you please return 0;
}

Measured memory_bytes: 3652
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
4
0 0
3 1
2 3
0 3
3
2 1
0 2
3 2

output:
2
1
0
"""

import sys

EPS = 1e-9


def cross(a, b):
    return a.real * b.imag - a.imag * b.real


def dot(a, b):
    return a.real * b.real + a.imag * b.imag


def check_contains(g, p):
    flag = False
    for j in range(edges):
        a, b = g[j] - p, g[(j + 1) % edges] - p
        if abs(cross(a, b)) < EPS and dot(a, b) < EPS:
            return 1
        elif a.imag > b.imag:
            a, b = b, a

        if a.imag < EPS < b.imag and cross(a, b) > EPS:
            flag = not flag
    return 2 if flag else 0


def solve(_p_info):
    for point in _p_info:
        px, py = map(float, point)
        p = px + py * 1j
        print(check_contains(polygon, p))
    return None


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    edges = int(_input[0])
    e_info = map(lambda x: x.split(), _input[1:edges + 1])
    points = int(_input[edges + 1])
    p_info = map(lambda x: x.split(), _input[edges + 2:])

    polygon = [float(x) + float(y) * 1j for x, y in e_info]
    solve(p_info)

Measured memory_bytes: 7944
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main()
{   string s;
int k;
cin>>k;
	cin>>s;
    int l=(s.size());
	
	if(l<=k)
	cout<<s<<endl;
	else
	cout<<s.substr(0,k)<<"..."<<endl;

    return 0;
}

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

int main() {
    int h, w, a, b;
    scanf("%d %d %d %d", &h, &w, &a, &b);
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            printf("%d", (i < b) ^ (j < a));
        }
        puts("");
    }
    return 0;
}

Measured memory_bytes: 1280
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int x;
        while(a>b || b>c){
            if(a>b){
                x=a;
                a=b;
                b=x;
            }
            if(b>c){
                x=b;
                b=c;
                c=x;
            }
        }
        System.out.println(a+" "+b+" "+c);
    }
}


Measured memory_bytes: 26208
using System.Collections.Generic;
    using System.Collections;
    using System.IO;
    using System.Linq;
    using System.Text;
    using System;

    namespace cysharp_test
    {
        class Program
        {
            static void Main (string[] args)
            {
                new Program ().solve ();
            }

            void solve ()
            {int[] nk = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            bool[] hasTreet = new bool[nk[0]];
            for (int i = 0; i < nk[0];i++)hasTreet[i] = false;
            for (int i = 0; i < nk[1]; i++)
                {
                    int D = int.Parse(Console.ReadLine());
                    int[] sunuke = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

                    foreach (var n in sunuke)
                    {
                        hasTreet[n - 1] = true;
                    }
                }
            Console.WriteLine(hasTreet.Count(s => !s));
            Console.ReadKey();
        }
        }
        struct Vector2
        {
            public Vector2 (long x, long y)
            {
                this.x = x;
                this.y = y;
            }

            public long x, y;

            public static Vector2 operator + (Vector2 a, Vector2 b)
            {
                return new Vector2 (a.x + b.x, a.y + b.y);
            }

            public static Vector2 operator - (Vector2 a, Vector2 b)
            {
                return new Vector2 (a.x - b.x, a.y - b.y);
            }

            public static Vector2 operator * (Vector2 a, long scala)
            {
                return new Vector2 (a.x * scala, a.y + scala);
            }

            public static bool operator == (Vector2 a, Vector2 b)
            {
                return (a.x == b.x) && (a.y == b.y);
            }

            public static bool operator != (Vector2 a, Vector2 b)
            {
                return !(a.x == b.x) && (a.y == b.y);
            }

            public override int GetHashCode ()
            {
                return (int) (x + y);
            }

            public override bool Equals (object obj)
            {
                if (!(obj == null) && obj is Vector2)
                {
                    return (this == (Vector2) obj);
                }
                else return false;
            }

            public override string ToString ()
            {
                return ("(" + x + "," + y + ")");
            }
        }
    }

Measured memory_bytes: 19580
import math
import itertools

n = int(input())
List = [list(map(int, input().split())) for i in range(n)]
dis_sum, count = 0, 0
for v in itertools.permutations(List):
    for i in range(len(v)-1):
        z = (v[i][0]-v[i+1][0])**2 + (v[i][1]-v[i+1][1])**2
        dis = math.sqrt(z)
        dis_sum += dis
    count += 1
print(dis_sum/count)

Measured memory_bytes: 40684
import sys
A = []
for i in range(3):
    ls = [int(i) for i in input().split()]
    A.append(ls)
N = int(input())
ls = []
for i in range(N):
    num = int(input())
    ls.append(num)
for x in ls:
    for i in range(3):
        for j in range(3):
            if A[i][j] == x:
                A[i][j] = 0
for i in range(3):
    if sum(A[i]) == 0:
        print('Yes')
        sys.exit()
    num = 0
    for j in range(3):
        num += A[j][i]
    if num == 0:
        print('Yes')
        sys.exit()
num = 0
for i in range(3):
    num += A[i][i]
if num == 0:
    print('Yes')
    sys.exit()
if A[0][2] + A[1][1] + A[2][0] == 0:
    print('Yes')
    sys.exit()
print('No')

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

int main(void) {
	int n;
	double ans;
	cin >> n;
	while (n) {
		ans = sqrt(n);
		if (ceil(ans) == floor(ans)) {
			cout << n << endl;
			return 0;
		}
		n--;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		int n = sc.nextInt();
		int[] Sequence = new int[n];
		for (int i = 0; i < n; i++) {
			Sequence[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		for (int i = 0; i < q; i++) {
			int b = sc.nextInt();
			int e = sc.nextInt();
			int k = sc.nextInt();
			int num = 0;
			for (int j = b; j < e; j++) {
				if (Sequence[j] == k) num++;
			}
			System.out.println(num);
		}
	}
}



Measured memory_bytes: 36588
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
/* 大文字を小文字に変換 tolower*/
/* 小文字を大文字に変換 toupper*/
 
int main () {
	int a,b,c;
	cin >> a  >> b >>c;
	if (a+b == c || b+c == a || a + c == b) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
{-# OPTIONS_GHC -O3 #-}
{-# LANGUAGE ViewPatterns, ScopedTypeVariables #-}

import qualified Data.ByteString as B (getLine)
import qualified Data.ByteString.Char8 as C (readInt, words, unpack, reverse, dropWhile)
import qualified Data.Maybe as M (fromJust)
import Data.Char as C (isSpace)

rstrip = C.reverse . C.dropWhile C.isSpace . C.reverse

main = do
    (C.unpack . rstrip -> xxs) <- B.getLine
    putStrLn $ [x | (xi, x) <- (zip [1..] xxs), xi `mod` 2 == 1]


Measured memory_bytes: 1532
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char s[105];
	int f=0;
	scanf("%s",s);
	for(int i=0;i<strlen(s);i+=2){
		if(s[i]!='R'&&s[i]!='U'&&s[i]!='D'){
			f=1;
		}
	}
	for(int i=1;i<strlen(s);i+=2){
		if(s[i]!='L'&&s[i]!='U'&&s[i]!='D'){
			f=1;
		}
	}
	if(f==0) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
s = input()
a = None
for i in range(len(s) - 2):
    x = int(s[i])*100+int(s[i+1])*10+int(s[i+2])
    if i == 0:
        a = abs(753-x)
    elif a > abs(753-x):
        a = abs(753-x)
print(a)

Measured memory_bytes: 2940
#!usr/bim/python
#! -*- coding: utf-8 -*-

nt = raw_input()
nt = nt.split()
n,t = map(int,nt)

p = raw_input()
p = p.split()
p = map(int,p)

ans = 0

i = 0
while i < n-1:
    if p[i+1] - p[i] > t:
        ans += t
    else:
        ans += p[i+1]-p[i]
    i += 1

ans += t

print ans


Measured memory_bytes: 20036
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    int cnt1 = 0;
    int cnt4 = 0;
    cin >> n;
    REP(i, n){
        int a;
        cin >> a;
        if(a % 4 == 0){
            cnt4++;
        }else if(a % 2 == 1){
            cnt1++;
        }
    }

    if(cnt1 + cnt4 == n){
        if(cnt4 + 1 >= cnt1){
            cout << "Yes" << "\n";
        }else{
            cout << "No" << "\n";
        }
    }else{
        if(cnt4 >= cnt1){
            cout << "Yes" << "\n";
        }else{
            cout << "No" << "\n";
        }
    }


    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++)
typedef long long ll;
typedef pair<int,int> P;
int main()
{
  long X;
  cin >> X;
  long uresisa = 0;
  uresisa += (X / 500) * 1000;
  X %= 500;
  uresisa += (X / 5) * 5;
  cout << uresisa << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b,c,flag;
int main()
{
    scanf("%d%d%d",&a,&b,&c);
    if(a+b==c||a+c==b||b+c==a)++flag;
    if(flag)printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

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();
        int D = sc.nextInt();

        if(A*B>=C*D){
            System.out.println(A * B);
        }
        else{
            System.out.println(C * D);
        }
    }
}

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

uint64_t gcd(uint64_t a, uint64_t b)
{
  return b == 0 ? a : gcd(b, a % b);
}

uint64_t lcm(uint64_t a, uint64_t b)
{
  return a / gcd(a, b) * b;
}

int main()
{
  uint64_t a, b, c, d;
  cin >> a >> b >> c >> d;
  a--;
  uint64_t x = a - a / c - a / d + a / lcm(c, d);
  uint64_t y = b - b / c - b / d + b / lcm(c, d);
  cout << y - x << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

const int D = 60;
const int MAX_N = 200005;
vvi to(D,vi(MAX_N));

int main(){
    int64_t k;
    int n,rev,loop; cin >> n >> k;
    vi a(n);
    for(int ix=0;ix<n;ix++){ cin >> to.at(0).at(ix); to.at(0).at(ix)--; }
    
    for(int ix=0;ix<D-1;ix++) for(int ix2=0;ix2<n;ix2++) to.at(ix+1).at(ix2) = to.at(ix).at(to.at(ix).at(ix2));
    
    int v=0;
    for(int ix=D-1;ix>=0;ix--){
        int64_t l = 1ll<<ix;
        if(l<=k){
            v = to.at(ix).at(v);
            k -=l;
        }
    }
    cout << v+1 << endl;
}


Measured memory_bytes: 51216
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
// using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1}, dy[8] = {-1, 0, 1, 1, -1, 1, 0, -1};

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int H, W, K;
  cin >> H >> W >> K;
  vector<string> S(H);
  for (auto &it : S)
    cin >> it;
  int ans = INT_INF;
  for (int bit = 0; bit < (1 << H - 1); bit++)
  {
    vector<int> grp(H, 0);
    int N = 0;
    bool gok = true;
    for (int i = 0; i < H - 1; i++)
    {
      if (!(bit & (1 << i)))
        grp[i + 1] = grp[i];
      else
        grp[i + 1] = grp[i] + 1, N++;
    }
    int add = 0;
    vector<int> nums(N + 1, 0);
    for (int w = 0; w < W; w++)
    {
      vector<int> one(N + 1, 0);
      bool ok = true;
      for (int h = 0; h < H; h++)
      {
        one[grp[h]] += S[h][w] - '0';
        nums[grp[h]] += S[h][w] - '0';
        if (one[grp[h]] > K)
          gok = false;
        if (nums[grp[h]] > K)
          ok = false;
      }
      if (!ok)
        add++, nums = one; // 左隣に切れ目が入るため各グループの個数(nums)は現在のwにおける個数（ones）と同じにする
    }
    if (gok)
      ans = min(ans, N + add);
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  string s;
  cin>>s;
  int n=s.size();
  REP(i, n){
    cout<<'x';
  }
  return 0;
}


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

template<class Abel> struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<Abel> diff_weight;

    UnionFind(int n = 1, Abel SUM_UNITY = 0) {
        init(n, SUM_UNITY);
    }

    void init(int n = 1, Abel SUM_UNITY = 0) {
        par.resize(n); rank.resize(n); diff_weight.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

    Abel weight(int x) {
        root(x);
        return diff_weight[x];
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y, Abel w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }

    Abel diff(int x, int y) {
        return weight(y) - weight(x);
    }
};

int main(){
    int N,M;cin>>N>>M;
    UnionFind<int> uf(N);
    for(int i = 0; i < M ;i++){
        int l,r,d;cin >> l >> r >> d;
        l--,r--;
        if(uf.issame(l,r)){
            int diff = uf.diff(l,r);
            if(diff != d){
                cout << "No" << endl;
                return 0;
            }
        }
        else uf.merge(l,r,d);
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <set>
using namespace std;

int main(){
	int n;
	cin>>n;
	set<string> st;
	while(n--){
		string o,s;
		cin>>o>>s;
		if(o=="insert")
			st.insert(s);
		else{
			if(st.find(s)!=st.end())
				cout<<"yes"<<endl;
			else
				cout<<"no"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 32000
#include <stdio.h>
#include <string.h>
#include <vector>

#define pb push_back

using namespace std;

int main() {
	int n, a[200010], cnt, temp;
	vector<int> ans;
	bool put[200010];
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	memset(put, false, sizeof put);
	for (int i = n; i > 0; i--) {
		temp = i + i;
		cnt = 0;
		while (temp <= n) {
			cnt += (put[temp] ? 1 : 0);
			temp += i;
		}
		cnt %= 2;
		if (cnt != a[i]) {
			put[i] = true;
			ans.pb(i);
		}
	}
	n = ans.size();
	if (n < 1)
		puts("0");
	else {
		printf("%d\n", n);
		for (int i = 0; i < n; i++) {
			if (i > 0)
				putchar(' ');
			printf("%d", ans[i]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 2552
n = int(input())
a_d = {}
for i in range(n):
    a = int(input())
    if a in a_d:
        a_d[a] += 1
    else:
        a_d[a] = 1
 
ans = 0
for i in a_d.values():
    if i % 2:
        ans += 1
print(ans)

Measured memory_bytes: 15072
#include<bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int               long long
#define endl              "\n"
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define ff                first
#define ss                second
#define pii               pair<int,int>
#define vi                vector<int>
#define vpi               vector<pair<int,int>>
#define mii               map<int,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define repe(i,a,b)        for(int i=a;i<=b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll
#define INF 100000000000
#define mod 1000000007
#define esp 10e-7
const int mx=100001;

signed main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    //freopen("error.txt" , "w" , stderr);
    #endif
    IOS
    double d,t,s;
    cin>>d>>t>>s;
    double req=d/(s);
    // cout<<req<<endl;
    if((req)<=t)
      cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;
 
    return 0;
}


Measured memory_bytes: 3720
using System;
class p
{
  static void Main()
  {
    string[] input = Console.ReadLine().Split(' ');
    int A = int.Parse(input[0]);
    int B = int.Parse(input[1]);
    Console.WriteLine(((A*B)%3==0) || ((A+B)%3==0) ? "Possible" : "Impossible");
  }
}

Measured memory_bytes: 13140
mod1,mod2=10**9+7,998244353
mod=mod1
n,m=map(int,input().split())
mod=10**9+7
fact=[1]*(n+50+1)
inv=[1]*(n+50+1)
for i in range(2,n+50+1):
    fact[i]=i*fact[i-1]%mod
inv[-1]=pow(fact[-1],mod-2,mod)
for i in range(n+50,1,-1):
    inv[i-1]=inv[i]*i%mod
def comb(x,y):return fact[x]*inv[y]%mod*inv[x-y]%mod if x>=y>=0 else 0
from math import floor,sqrt
ans=1
for i in  range(2,floor(sqrt(m))+1):
    if m%i:continue
    cnt=0
    while m%i==0:
        cnt+=1
        m//=i
    ans=ans*comb(n-1+cnt,cnt)%mod
if m!=1:
    ans=ans*comb(n,1)%mod
print(ans)

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

int main () {
  string S,T;
  cin >> S >> T;
  int N = S.size();
  int M = T.size();
  int L = -1;
  for (int i = 0; i < N-M+1; i++) {
    for (int j = 0; j < M; j++) {
      if (S.at(i+j) != T.at(j) && S.at(i+j) != '?'){
        break;
      }
      else if (j == M-1){
        L = i;
      }
    }
  }
  
  if (L == -1){
    cout << "UNRESTORABLE" << endl;
    return 0;
  }

  for (int i = L; i < L+M; i++) {
    S.at(i) = T.at(i-L);
  }
  
  for (int i = 0; i < N; i++) {
    if (S.at(i) == '?'){
      S.at(i) = 'a';
    }
  }
  cout << S << endl;
}



Measured memory_bytes: 3592
package main
 
import (
  "fmt"
  "math"
  "strconv"
)
 
func main() {
  var N int
  fmt.Scan(&N)
  
  ans := 10
  root := math.Pow(float64(N), 0.5)
  for i := 1; float64(i) <= root ; i++ {
    if N % i != 0 {
      continue
    }
    F := len(strconv.Itoa(i))
    if len(strconv.Itoa(i)) < len(strconv.Itoa(N / i)) {
      F = len(strconv.Itoa(N / i))
    }
    if F < ans {
      ans = F
    }
  }
  fmt.Printf("%d\n", ans)
}

Measured memory_bytes: 1844
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#define FUP(i,x,y) for(int i=(x);i<=(y);i++)
#define FDW(i,x,y) for(int i=(x);i>=(y);i--)
#define MAXN 110
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define ll long long
#define db double
using namespace std;
int read(){
    int w=0,flg=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')flg=-1;ch=getchar();}
    while(ch<='9'&&ch>='0'){w=w*10-'0'+ch,ch=getchar();}
    return w*flg;
}
int n,m,a[MAXN],sum,ans;
int main(){
	n=read(),m=read();
	FUP(i,1,n)
	{
		a[i]=read();
		sum+=a[i];
	}
	FUP(i,1,n)
	{
		if(a[i]*4*m>=sum) ans++;
	}
	if(ans<m) puts("No");
	else puts("Yes");
    return 0;
}

Measured memory_bytes: 256
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
from functools import lru_cache, reduce
INF = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# ここから書き始める
n = float(input())
ans = int(n / 1.08)
if int(ans * 1.08) == n:
    print(ans)
elif int((ans + 1) * 1.08)== n:
    print(ans + 1)
elif int((ans - 1) * 1.08)== n:
    print(ans - 1)
else:
    print(":(")


Measured memory_bytes: 5184
#define DBG 0 //submit 0
#if DBG
    #include <algorithm>
    #include <ctime>
    #include <cstdlib>
    #include <string>
    #include <vector>
    #include <iostream>
    #include <cmath>
    #include <numeric>
#else
    #include <bits/stdc++.h>
#endif

using namespace std;


int main(){
    int C,D,L,i,j,k,tmp = 0,tmpi = 0,ans = 0;
    int N;
    //string S;
    cin >> N;
    int d[N];
    for(i=0;i<N;i++){
        cin >> d[i];
    }

    for(i=0;i<N;i++){
      for(j=i+1;j<N;j++){
		ans += d[i]*d[j];
      }
    }

  cout << ans << endl;
}


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

int N;

int main() {
    cin >> N;
    vector<int> t(N), v(N), s(N + 1);
    for (int i = 0; i < N; i++) {
        cin >> t[i];
        t[i] <<= 1;
        s[i + 1] = t[i] + s[i];
    }
    for (int i = 0; i < N; i++) {
        cin >> v[i];
        v[i] <<= 1;
    }
    int time = s[N];
    vector<int> mx(time);   //各時間に出せる最大速度
    for (int i = 0; i < time / 2; i++) {
        mx[i] = i;
    }
    for (int i = time / 2; i < time; i++) {
        mx[i] = time - i;
    }
    int ans = 0;
    for (int j = 0; j < time; j++) {
        for (int i = 0; i < N; i++) {
            if (j < s[i]) {
                mx[j] = min(mx[j], -(j - s[i]) + v[i]);
            } else if (j > s[i + 1]) {
                mx[j] = min(mx[j], j - s[i + 1] + v[i]);
            } else {
              mx[j] = min(mx[j], v[i]);
            }
        }
        ans += mx[j];
    }
    cout << fixed << setprecision(4) << (double) ans * 0.25 << endl;
}





Measured memory_bytes: 384
import java.lang.ArithmeticException
import java.lang.IllegalArgumentException

val MOD = 1000000007L

val fact = Array(200010) { ModInt(1, MOD) }
val invfact = Array(200010) { ModInt(1, MOD) }

class ModInt (value: Long, val mod: Long) {
    init {
        if (mod <= 0) {
            throw IllegalArgumentException("ModInt cannot be created for non-positive mod: ${mod}")
        }
    }

    val value = (value % mod + mod) % mod

    private fun assertSameMod(other: ModInt) {
        if (mod != other.mod) {
            throw IllegalArgumentException(
                "You cannot operate summation, subtraction and multiplication for ModInts with different mods: $mod, ${other.mod}"
            )
        }
    }

    operator fun unaryMinus(): ModInt {
        return ModInt(mod - value, mod)
    }

    operator fun plus(other: ModInt): ModInt {
        assertSameMod(other)

        return ModInt((value + other.value) % mod, mod)
    }

    operator fun plus(other: Long): ModInt {
        return plus(ModInt(other, mod))
    }

    operator fun minus(other: ModInt): ModInt {
        assertSameMod(other)

        return plus(-other)
    }

    operator fun minus(other: Long): ModInt {
        return minus(ModInt(-other, mod))
    }

    operator fun times(other: ModInt): ModInt {
        assertSameMod(other)

        return ModInt((value * other.value) % mod, mod)
    }

    operator fun times(other: Long): ModInt {
        return times(ModInt(other, mod))
    }

    fun pow(k: Long): ModInt {
        var res = 1L
        var a = value
        var l = k

        while (l > 0) {
            if ((l and 1L) == 1L) {
                res = (res * a) % mod
            }

            a = a * a % mod
            l /= 2L
        }

        return ModInt(res, mod)
    }

    fun inv(): ModInt {
        return pow(mod - 2)
    }

    operator fun div(other: ModInt): ModInt {
        assertSameMod(other)
        if (other.value == 0L) {
            throw ArithmeticException()
        }

        return times(other.inv())
    }

    operator fun div(other: Long): ModInt {
        return div(ModInt(other, mod))
    }
}

fun comb(n: Long, m: Long): ModInt {
    if ( n < m )
        return ModInt(0L, MOD)

    return fact[n.toInt()] * invfact[(n - m).toInt()] * invfact[m.toInt()]
}

fun f(n: Long, m: Long): ModInt {
    var res = ModInt(0L, MOD)
    val p = comb(n * m, 2).inv()

    for (i in 1L until n) {
        res += ModInt(n - i, MOD) * i * m * m * p
    }

    return res
}

fun main(args: Array<String>) {
    val (N, M, K) = readLine()!!.split(" ").map { s -> s.toLong() }

    for(i in 1 until 200010) {
        fact[i] = fact[i - 1] * i.toLong()
        invfact[i] = invfact[i - 1] / i.toLong()
    }

    val a = ModInt(K, MOD) * (K - 1) / 2L
    val b = f(N, M) * a
    val c = f(M, N) * a

    val res = (b + c) * comb(N * M, K)

    println(res.value)
}


Measured memory_bytes: 89880