akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl 
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl 
#define no cout<<"no"<<endl
#define vec(a,y,x)  vector<vector<char>> a (y,vector<char>(x))
const vector<int> dx={1,0,-1,0};
const vector<int> dy={0,1,0,-1};

int gcd(int a,int b){
  if(a*b==0) return 0;
  if(a%b==0 || b%a==0) return a;
  if(a>b)
    return gcd(a-b,b);
  else
    return gcd(b-a,a);
}

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(c%gcd(a,b)==0)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
	
	int main(){
		int n;
		long long int sum=0;
		int max;
		int min;
		int x;
		scanf("%d",&n);
		int i;
		for(i=0;i<n;i++){
			scanf("%d",&x);
			if(i==0)min = max = x;
			if(max<x) max = x;
			if(min>x) min = x;
			sum+=x;
		}
		printf("%d %d %lld\n",min,max,sum);	
		return 0;
	}

Measured memory_bytes: 600
#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include<stdbool.h>

#define limit 1000
#define limit_word 10

//#define DEBUG_BUILD

#ifdef DEBUG_BUILD
# define DEBUG_PRINT(fmt, ...)  printf(fmt, ## __VA_ARGS__)
#else
# define DEBUG_PRINT(fmt, ...)
#endif

int serachWord(char W[], char T[]);

int main(void) {
	char W[limit_word + 1] = { 0 };
	char T[limit + 1] = { 0 };

	static int count = 0;

	scanf("%s", W);
	while (1) {
		memset(T, 0, sizeof(T));
		scanf("%s", T);
		DEBUG_PRINT("T=%s len=%d\n", T, (int )strlen(T));
		if (strstr(T, "END_OF_TEXT") != NULL) {
			break;
		}
		//含まれるか調べる
		count += serachWord(W, T);
	}

	printf("%d\n", count);

	return 0;
}

int serachWord(char W[], char T[]) {
	int count = 0;
	char *p = T;

	int lenW = strlen(W);
	//WとTの長さが一致しなければ不一致
	if (lenW == strlen(T)) {
		while (*p != '\0') {
			int pCount = 0;
			for (int i = 0; i < lenW; i++) {
				DEBUG_PRINT("%c", p[pCount]);
				//文字が一致していればを進める
				if ((p[pCount] != 0)
						&& (toupper(W[pCount]) == toupper(p[pCount]))) {
					pCount++;
				}
				//一致していなければ開始位置を進める
				else {
					pCount = 0;
					while ((p[pCount] != 0) && (p[pCount] != EOF)) {
						p++;
					}
					break;
				}
				//Wの最後まで一致していたらcountをインクリメント
				if (pCount == lenW) {
					count++;
					DEBUG_PRINT(" len=%d\n+\n", pCount);
					p += lenW;
					pCount = 0;
				}
			}
		}
	}

	return count;
}



Measured memory_bytes: 2028
#include<iostream>
#include<string>
using namespace std;
int main(){
string s;
bool first=true;
int t=0,d=0,y;
cin>>s;
for(int i=0;i<s.size();i++){

if(s[i]=='A' && first){
	t=i;
first=false;

}

if(s[i]=='Z' && i>d){
d=i;
}
}
cout<<d-t+1;


}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
	int i,n,a[1003]={0},ans=0,k;
	cin>>n>>k;
	for(i=1;i<=n;i++)cin>>a[i];
	for(int i=0;i<=n;i++)
        for(int j=0;j<=n-i-1;j++)
            if(a[j]>a[j+1])swap(a[j], a[j+1]);
	for(i=1;i<=k;i++)ans+=a[i];
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<cstring>
#include<cmath>
#include<cstdio>
using namespace std;
char a[102];
int main()
{
	cin>>a;
	int c=0;
	for(int i=1;i<=strlen(a)-2;i++)
	{
		c++;
	}
	cout<<a[0]<<c<<a[strlen(a)-1]<<endl;
	return 0;
 } 

Measured memory_bytes: 256
#!/usr/bin/env python3
def main():
    def rec(d: int, val: int, all: list):
        all.append(val)
        if d == 10:
            return
        for j in range(-1, 2):
            add = (val % 10) + j
            if add >= 0 and add <= 9:
                rec(d + 1, val * 10 + add, all)
    
    K = int(input())

    all = []
    for v in range(1, 10):
        rec(1, v, all)
    print(sorted(all)[K - 1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 20896
fun main(args: Array<String>) {
    val (N, M, C) = readLine()!!.split(" ").map { it.toInt() }
    val Bn = readLine()!!.split(" ").map { it.toInt() }
    val An = (1..N).map { readLine()!!.split(" ").map { it.toInt() } }

    val ans = solve(Bn, An, C, M)
    println(ans)
}

fun solve(Bn: List<Int>, An: List<List<Int>>, C: Int, M: Int): String {
    val list = An.map { ai ->
        val result = (0 until M).map { ai[it] * Bn[it] }.sum() + C
        if (result > 0) {
            1
        } else {
            0
        }
    }
    return list.sum().toString()
}


/**
 * ファクション
 */
fun floor(target: Double): Double {
    return Math.floor(target)
}

fun ceil(target: Double): Double {
    return Math.ceil(target)
}


Measured memory_bytes: 37908
N = int(input())
W = []
for i in range(N):
  tmp = input()
  W.append(tmp)

flag = 1
for i in range(N):
  count = W.count(W[i])
  if count > 1:
    flag = 0
    break
if flag == 0:
  print('No')
else:
  for i in range(1,N):
    if W[i-1][-1] != W[i][0]:
      flag = 0
      break
  if flag == 0:
    print('No')
  else:
    print('Yes')
    
  

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

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}


void solve(long long H, long long W, std::vector<std::string> S){
  ll d[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
  ll ans = 0;
  queue<pair<ll, ll>> q;
  vector<vector<ll>> v(H, vector<ll>(W, 0));
  for(ll i=0; i<H; i++) {
    for(ll j=0; j<W; j++) {
      if(S[i][j]=='#' and v[i][j]==0) {
	ll w = 0;
	ll b = 0;
	q.push(make_pair(i, j));
	v[i][j] = 1;
	while (!q.empty()) {
	  auto now = q.front();
	  q.pop();
	  if(S[now.first][now.second]=='#')b++;
	  else w++;
	  for(ll k=0; k<4; k++) {
	    ll y = now.first+d[k][0];
	    ll x = now.second+d[k][1];
	    if(0<=x and x<W and 0<=y and y<H and v[y][x]==0 and
	       S[now.first][now.second]!=S[y][x]) {
	      v[y][x] = 1;
	      q.push(make_pair(y, x));
	    }
	  }
	}
	ans += b*w;
      }
    }
  }
  std::cout << ans << std::endl;
}

int main(){
  long long H;
  scanf("%lld",&H);
  long long W;
  scanf("%lld",&W);
  std::vector<std::string> S(H);
  for(int i = 0 ; i < H ; i++){
    std::cin >> S[i];
  }
  solve(H, W, std::move(S));
  return 0;
}



Measured memory_bytes: 1792
/*
   AUTHOR :- Gaurang_Kothiya
   
   Quote:-" Great things never come from comfort zones."                                                                                                                
*/
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>  
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
#include <bitset>
#include <cstdint>
#include <initializer_list>
 
using namespace std;
using namespace __gnu_pbds;  

typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> data_set; 
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long  
#define ld long double
#define f(i,x,n) for(ll i=x;i<=n;i++)
#define fe(x,v)   for(auto &x :v)
#define nf(i,x,n) for(ll i=n;i>=x;i--)
#define all(a)   a.begin(),a.end()
#define rall(a)  a.rbegin(),a.rend()
#define b_s(a,b)   binary_search( all(a),b)
#define lb(v,n)  lower_bound(all(v) ,n )
#define ub(v,n)  upper_bound( all(v) , n)
#define gcd(a,b) __gcd(a,b)
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define RE rend()
#define RB rbegin()
#define B begin()
#define E end()
#define acc(v, x) accumulate(all(v), x)
#define p(a,b) pair<a,b>
#define F first
#define S second
#define sz size()
#define v(x) vector<x>
#define m(a,b) map<a,b>
#define u_m(a,b) unordered_map<a,b>
#define mm(a,b) multimap<a,b>
#define s(a) set<a>
#define us(a) unordered_set<a>
#define ms(a) multiset<a>
#define maxy __LONG_LONG_MAX__
#define miny INT_MIN
#define PI 3.14159265358979323846
#define MOD 1000000007



void Solve()
{
	ll a,b,c,k;
	cin>>a>>b>>c>>k;
	
	if(k<=a+b) cout<< min(a,k);
	else
	{
		ll tmp= k- (a+b);
		cout<< a-tmp;
	}
	
}

signed main() 
{
	speed		
	
	int q=1;
	//cin>>q;
	
	while(q--)
	Solve();
	
	//cout << "\n\n"<<"Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " seconds.\n";
	return 0;
}

 
 

Measured memory_bytes: 3652
import sys
input = sys.stdin.readline
import numpy as np
c = []
for _ in range(3):
    c.append([int(x) for x in input().split()])
c = np.array(c)
c_t = c.T
a = c[1] - c[0]
b = c[2] - c[1]
d = c[2] - c[0]
e = c_t[1] - c_t[0]
f = c_t[2] - c_t[1]
g = c_t[2] - c_t[0]
x = []
x.append(a)
x.append(b)
x.append(d)
x.append(e)
x.append(f)
x.append(g)
x = np.array(x)
for i in x:
    if i[0] != i[1] or i[1] != i[2] or i[2] != i[0]:
        print("No")
        sys.exit()
print("Yes")

Measured memory_bytes: 12448
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using System.Numerics;
//using static System.Math;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;

    // https://beta.atcoder.jp/contests/agc020/submissions/1975881
    void solve()
    {
        int N = cin.nextint;
        var A = cin.scanint;
        int sum = A.Sum();
        BigInteger can = 1;
        foreach (var i in A)
        {
            can |= can << i;
        }
        int x = sum / 2;
        //mask suru shinai
        can &= ((BigInteger)1 << (x + 1)) - 1;
        while ((can >> x & 1) != 1) x--;

        WriteLine(sum - x);
    }


}


class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

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


long long int Gcd(long long int m, long long int n)
{
	long temp;
	while(m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

long long int Lcm(long long int m, long long int n)
{
	return m * n / Gcd(m, n);
}

int main()
{
	long long int A, B, answer = 0;
	long long int C, D;
	cin >> A >> B >> C >> D;

	long long int lcmCD = Lcm(C, D);

	long long int cTemp = B / C - (A - 1) / C;
	long long int dTemp = B / D - (A - 1) / D;
	long long int cdTemp = B / lcmCD - (A - 1) / lcmCD;

	answer = (B - A + 1) - (cTemp + dTemp - cdTemp);

	cout << answer << endl;
	return 0;
}

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

using namespace std;

int X;

struct A {
  int t, a, id, p;
};

const int N = 100005;

int a[N * 4], b[N * 4];

void pushdown(int p) {
  a[p * 2] += b[p];
  a[p * 2 + 1] += b[p];
  b[p * 2] += b[p];
  b[p * 2 + 1] += b[p];
  b[p] = 0;
}

void update(int l, int r, int p, int L, int R, int val) {
  if (L > R) return;
  if (L <= l && R >= r) {
    a[p] += val;
    b[p] += val;
    return;
  }
  pushdown(p);
  int m = (l + r) / 2;
  if (m >= L) update(l, m, p * 2, L, R, val);
  if (m + 1 <= R) update(m + 1, r, p * 2 + 1, L, R, val);
}

int query(int l, int r, int p, int P) {
  if (l == r) {
    return a[p];
  }
  pushdown(p);
  int m = (l + r) / 2;
  if (m >= P) return query(l, m, p * 2, P);
  else return query(m + 1, r, p * 2 + 1, P);
}

int main(int argc, char *argv[]) {
  int K;
  cin >> X >> K;
  vector<int> R(1, 0);
  for (int i = 0, t; i < K; i++) {
    cin >> t;
    R.push_back(t);
  }
  R.push_back(2e9);
  vector<A> Q;
  int m;
  cin >> m;
  for (int i = 0, x, y; i < m; i++) {
    cin >> x >> y;
    Q.push_back({x, y, i, 0});
  }
  sort(Q.begin(), Q.end(), [](const A& x, const A& y) {
      return x.a < y.a;
    });
  int n = Q.size();
  for (int i = 0; i < (int)Q.size(); i++) {
    Q[i].p = i + 1;
    update(1, n, 1, i + 1, i + 1, Q[i].a);
  }
  int nl = 1, nr = n;
  vector<int> ans(n);
  sort(Q.begin(), Q.end(), [](const A& x, const A& y) {
      return x.t < y.t;
    });
  int h = 0;
  for (int i = 1; i < (int)R.size(); i++) {
    while (h < n && Q[h].t <= R[i]) {
      int p = Q[h].p;
      p = max(p, nl);
      p = min(p, nr);
      int x = query(1, n, 1, p);
      int y = Q[h].t - R[i - 1];
      if (i & 1) {
        y = -y;
      }
      ans[Q[h].id] = x + y;
      h++;
    }
    int y = R[i] - R[i - 1];
    if (i & 1) {
      y = -y;
      int low = nl, high = nr;
      while (low <= high) {
        int mid = (low + high) / 2;
        if (query(1, n, 1, mid) + y > 0) {
          high = mid - 1;
        } else {
          low = mid + 1;
        }
      }
      if (high >= nl) {
        int v = query(1, n, 1, high);
        update(1, n, 1, high, high, -v);
        update(1, n, 1, high + 1, nr, y);
        nl = high;
      } else {
        update(1, n, 1, nl, nr, y);
      }
    } else {
      int low = nl, high = nr;
      while (low <= high) {
        int mid = (low + high) / 2;
        if (query(1, n, 1, mid) + y < X) {
          low = mid + 1;
        } else {
          high = mid - 1;
        }
      }
      if (low <= nr) {
        int v = query(1, n, 1, low);
        update(1, n, 1, low, low, X-v);
        update(1, n, 1, nl, low - 1, y);
        nr = low;
      } else {
        update(1, n, 1, nl, nr, y);
      }
    }
  }
  for (auto x : ans) {
    x = max(x, 0);
    x = min(x, X);
    cout << x << endl;
  }
}


Measured memory_bytes: 5616
n=int(input())
c=[]
for i in range(10):
  c.append([0]*10)
for i in range(1,n+1):
  for j in range(1,10):
    for k in range(1,10):
      if str(i)[0]==str(j) and str(i)[len(str(i))-1]==str(k):
        c[j][k]+=1
num=0
for j in range(1,10):
  for k in range(1,10):
    num+=c[j][k]*c[k][j]
print(num)
        
  


Measured memory_bytes: 43100
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////

int main() {
	ll N;
	cin >> N;
	cout << N * (N + 1) / 2;

	system("PAUSE");
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep3(i, n) for (int i = 1; i < (int)(n+1); i++)
#define rep4(i, s, n) for (int i = (s); i < (int)(n+1); i++)
#define repr(i,n) for (int i = (n-1); i>=0;i--)
#define repr3(i,n) for(int i = (n);i>0;i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
#define INF const ll INF = 1001001001;
#define PI const ld PI = 3.14159265358979323846;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

vector<vector<long long>> comb(int n, int r) {
  vector<vector<long long>> v(n + 1,vector<long long>(n + 1, 0));
  ll div=(ll)powl(10,9)+7;
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k])%div;
    }
  }
  return v;
}
vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main() {
    ll N,P;
    cin >> N>>P;
    //pairの書き換えが煩雑であるので、素数リストと指数連想配列に分ける
   map<ll,ll> prime_count;
   vector<ll> prime_list;
   
    //resに素数のペア(素数、その素数の指数）の配列が入る
    const auto  &res = prime_factorize(P);
    
   rep(i,res.size()){
       if(prime_count[res[i].first]==0){
           prime_list.push_back(res[i].first);
       }
       prime_count[res[i].first]+=res[i].second;
   }
   
    

   ll ans=1;
   rep(i,prime_list.size()){
       ans*=(ll)powl(prime_list[i],prime_count[prime_list[i]]/N);
   }
   cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
n,m,l = map(int,input().split())

A = []
B = []
C = [[0]*l for _ in range(n)]


for i in range(n):
    number = [int(x) for x in input().split()]
    A.append(number)
    
for i in range(m):
    number = [int(x) for x in input().split()]
    B.append(number)

for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += A[i][k]*B[k][j]

for p in range(n):
    print(*C[p])


Measured memory_bytes: 7044
s=input()
cnt=0
for i in range(len(s)):
    if i%2==1 and s[i]=='g':
        cnt+=1
    elif i%2==1 and s[i]=='p':
        pass
    elif i%2==0 and s[i]=='g':
        pass
    else:
        cnt-=1
print(cnt)


Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int num[] = new int[3];
		for(int i = 0; i < 3;i++) {
			num[i] = sc.nextInt();
		}
		for(int i = 0;i < 3;i++) {
			for(int j = i+1;j < 3;j++) {
				if(num[i] < num[j]) {
				int tmp = num[i];
				num[i] = num[j];
				num[j] = tmp;
			}
			}
		}
		int ans = num[0] * 10 + num[1] + num[2];
		System.out.println(ans);
	}
}


Measured memory_bytes: 22612
from collections import Counter

N = int(input())
D = list(map(int, input().split()))

if N > 23:
    print(0)
elif N > 11:
    D.append(0)
    D_count = Counter(D)
    if D_count.most_common()[0][1] > 2:
        print(0)
    else:
        print(1)
else:
    ans = 0
    for i in range(2 ** (N - 1)):
        bit = '0' + bin(i)[2:].zfill(N - 1)
        D_mod24 = [0] * N
        for j in range(N):
            if bit[j] == '0':
                D_mod24[j] = D[j]
            else:
                D_mod24[j] = 24 - D[j]
        D_mod24.sort()
        ans_temp = min(min(D_mod24), 24 - max(D_mod24))
        for j in range(N-1):
            ans_temp = min(ans_temp, D_mod24[j+1] - D_mod24[j])
        ans = max(ans, ans_temp)
    print(ans)


Measured memory_bytes: 43100
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int main(){

    int d,t,s;
    cin >> d >> t >> s;
    if(d>s*t){
        cout<<"No"<<endl;
    }else{
        cout<<"Yes"<<endl;
    }
    

    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
const ll MAX = 2*(ll)pow(10, 5);
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  vector <ll> v(5);
  ll k;
  rep(i, 5) cin >> v.at(i);
  cin >> k;
  bool flag = 1;
  rep(i, 5) {
    rep(j, 5) {
      if (abs(v.at(i)-v.at(j)) > k) flag = 0;
    }
  }
  if (flag) cout << "Yay!" << endl;
  else cout << ":(" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());
using ll = long long;
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; }

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  int N;
  cin >> N;
  vector<pair<int, int>> pos(N);
  set<pair<int, int>> pos_set;
  rep(i, N)
  {
    cin >> pos[i].first >> pos[i].second;
    pos_set.insert(pos[i]);
  }

  if (N == 1)
  {
    cout << 1 << endl;
    return 0;
  }

  SORT(pos);
  int ans = INT32_MAX;

  rep(i, N) rep(j, N)
  {
    ll p = pos[i].first - pos[j].first;
    ll q = pos[i].second - pos[j].second;
    if (p == 0 && q == 0)
      continue;

    int score = 0;
    set<pair<int, int>> temp_set = pos_set;

    for (pair<int, int> P : pos_set)
    {
      if (temp_set.find(P) == temp_set.end())
        continue;

      score++;
      pair<int, int> now = P;
      temp_set.erase(P);
      while (temp_set.size())
      {
        pair<int, int> next = now;
        next.first += p;
        next.second += q;
        if (temp_set.find(next) != temp_set.end())
        {
          temp_set.erase(next);
          now = next;
          continue;
        }

        break;
      }
    }
    ans = min(ans, score);
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
	int a, b , c;
	cin >> a >> b >> c;
	if ((a + b == c) || (a + c == b) || (c + b == a)) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

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

using namespace std;
using ll = long long int;
const int MOD = 1e9 + 7;
// const int N = 1e5 + 5;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	ll a, b, c; cin >> a >> b >> c;
	if (c-a-b > 0 and 4LL*a*b < (c-a-b)*(c-a-b)) cout << "Yes\n";
	else cout << "No\n";
}

// s(a) + s(b) < s(c)
// 2s(ab) < c - a - b
// 4ab < (c-a-b)^2

Measured memory_bytes: 256
def apc001_c():
    import sys
    n = int(input())

    def ask(x:int):
        print(x)
        sys.stdout.flush()
        res = str(input())
        return res

    lower = 0
    seat_low = ask(lower)
    if seat_low == 'Vacant': return

    upper = n-1
    seat_up = ask(upper)
    if seat_up == 'Vacant': return

    while upper - lower > 1:
        x = (upper + lower) // 2
        s = ask(x)
        if s == 'Vacant': return
        if x % 2 == 0:
            if s == seat_low: lower = x
            else: upper = x
        else:
            if s == seat_up: lower = x
            else: upper = x

if __name__ == '__main__':
    apc001_c()

Measured memory_bytes: 9236
//monk
#include<bits/stdc++.h>
using namespace std;
#define Fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
typedef vector<int>Vl;
typedef pair<int,int>pii;
typedef vector<pii>Vll;
typedef vector<pair<int,pii> >Vlll;
typedef priority_queue<int>PQL;
typedef map<int,int>M;
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) cin>>n
#define pl(n) cout<<n
const int mod=1e9+7;
const int sze=1e5+2;
const int inf= (int)(1e19+10LL);
int nc2(int n){
	return (n*(n-1))/2;
}
void solve()
{
  int n;
  sl(n);
  Vl arr(n);
  unordered_map<int,int>freq,group1,group2;  
  for(auto &it:arr){sl(it);freq[it]++;}
  for(auto it:freq){
	 group1[it.F]=nc2(it.S);
	 group2[it.F]=nc2(it.S-1);  
  }
  int ulti=0;
  for(auto it:group1){
	  ulti+=it.S;
  }  
  for(int i=0;i<n;i++){
     int val=ulti-group1[arr[i]]+group2[arr[i]];
     cout<<val<<endl;
  }
  
 
}
 
signed main(){
	int test=1;
   //sl(test);
   while(test--){
	 solve();
   }
  return 0;
}


Measured memory_bytes: 22984
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<utility>
#include<functional>
#include<algorithm>
#include<queue>
#include<map>
#include<string>
#include<numeric>


#define FOR(i, a, b) for(int i=a; i<b; i++)
#define rep(i, n) for(int i=0; i<n; i++)
#define COUT(a) cout << a << endl;
#define PB push_back

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

vector<char> answer;
vector<vector<char>> field;

vector<ll> enum_div(ll n)//nの約数を列挙
{
	std::vector<ll> ret;
    ret.PB(n);
	for(ll i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
    ret.PB(n);
	return ret;
}

int main() {
    ll N, M;
    cin >> N >> M;
    ll ans = 0;

    vector<ll>divs = enum_div(M);
    sort(begin(divs), end(divs));

    for (auto fact : divs){
        if (M / fact >= N){
            ans = fact;
        }else{
            COUT(ans);
            return 0;
        }

    }


    COUT(ans);

  
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int count = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n+1];
		for (int i = 0 ;i < n;i++) {
			a[i] = sc.nextInt();
		}
		int m = sc.nextInt();
		int[] b = new int[m];
		for(int j = 0 ;j < m;j++) {
			b[j] = sc.nextInt();
		}
		sc.close();
		for(int j = 0 ;j < m;j++) {
			if(LineSearch1(a,b[j])) {
				count++;
			}
		}
		System.out.println(count);
		
	}
	public static boolean LineSearch1(int[] arr,int key) {
		for(int i = 0;i < arr.length;i++) {
			if(arr[i] == key) {
				return true;
			}
		}
		return false;
		
	}
	public static boolean LineSearch(int[] arr,int key) {
		int i = 0;
		int n = arr.length-1;
		//最后一个设置为Key
		arr[n] = key;
		while(arr[i] != key) {
			i++;
			if(i == n) {
				return false;
			}
		}
		return true;
		
	}
}



Measured memory_bytes: 40280
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
#define MOD 1000000007
#define MAX_V 100010
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll junnretu(ll n){
    ll ans=1;
    for (ll i=1;i<=n;i++){
        ans*=i;
    }
    return ans;
}
 
map<ll,ll> prime_factor(ll n){
    map<ll,ll> mp;
    for(ll i=2; i*i<=n; i++){
        while(n % i == 0){
            mp[i]++;
            n /= i;
        }
    }
    if(n != 1) mp[n] = 1;
    return mp;
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}
int main(){
    string s;
    cin >> s;
    for (ll i=0;i<s.size();i++)cout << 'x';
    cout << endl;
    return 0;
}
 


Measured memory_bytes: 256
# AOJ 0147 Fukushimaken
# Python3 2018.6.23 bal4u
# キューで待ち行列

S = 17
seat = [[0 for t in range(27)] for id in range(27)]
ans = [0]*105
id = 0
Q = []
for i in range(S): seat[i][0] = -1
t = -1
while ans[99] == 0:
	t += 1
	# グループ到着
	if t % 5 == 0 and id <= 99:
		n = 5 if (id % 5) == 1 else 2
		Q.append((id, n, t))
		id += 1

	# 食事時間の確認
	for i in range(S):
		if seat[i][1] == 0: continue
		seat[i][1] -= 1
		if seat[i][1] == 0: seat[i][0] = -1

	# 待ち行列の案内
	f = len(Q)
	while f > 0:
		i, n = Q[0][0], Q[0][1]
		f = 0;
		for j in range(S):
			g = 0
			for k in range(n):
				if seat[j+k][0] >= 0:
					g = 1
					break
			if g: continue
			ans[i] = t-Q[0][2]
			del Q[0]
			f = len(Q)
			for k in range(n):
				seat[j+k][0] = i
				seat[j+k][1] = 17*(i&1) + 3*(i%3) + 19
			break

while 1:
	try: n = int(input())
	except: break	
	print(ans[n])


Measured memory_bytes: 5608
#include <algorithm>
#include <cmath>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using std::cin;
using std::cout;
using std::endl;
using std::cerr;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::stack;
using std::priority_queue;
using std::pair;
using std::make_pair;

using std::min;
using std::max;
using std::sort;
using std::abs;

using std::fixed;
using std::setprecision;
using std::setw;

typedef long long int ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 314;

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

    vector<int> c(n - 1);
    vector<int> s(n - 1);
    vector<int> f(n - 1);
    for (int i = 0; i < n - 1; i++) {
        cin >> c[i] >> s[i] >> f[i];
    }

    for(int k = 0; k < n; k++){
        int t = 0;
        int i = k;
        while (i < n - 1) {
            if (t < s[i]) {
                t = s[i];
            }
            if (t % f[i] == 0) {
                t += c[i];
                i++;
            }else{
                t++;
            }
        }
        cout << t << endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define TRNP 36
typedef struct{
  int k;
  char mozi;
}card;
    
int main(){
  int m,min;
  card num[TRNP],suit[TRNP],temp;
  scanf("%d",&m);
  int i,j;  
  for(i=0;i<m;i++){
    scanf(" %c%d",&num[i].mozi,&num[i].k);
    suit[i].mozi=num[i].mozi;
    suit[i].k=num[i].k;
  }
  for(i=0;i<m;i++){
    for(j=m-1;j>i;j--){
      if(num[j].k<num[j-1].k){
	temp=num[j];
	num[j]=num[j-1];
	num[j-1]=temp;
      }
    }
  }
  for(i=0;i<m-1;i++){
    printf("%c%d ",num[i].mozi,num[i].k);
  }
  printf("%c%d\nStable\n",num[i].mozi,num[i].k);
  for(i=0;i<m-1;i++){
    min=i;
    for(j=i;j<=m-1;j++){
      if(suit[j].k<suit[min].k)
	min=j;
    }
    temp=suit[i];
    suit[i]=suit[min];
    suit[min]=temp;
  }
  for(i = 0; i < m-1; i++){ 
    printf("%c%d ",suit[i].mozi,suit[i].k);
  }
  printf("%c%d\n",suit[i].mozi,suit[i].k);
  for(i = 0;i<m; i++){
    if(suit[i].mozi!=num[i].mozi) {
      printf("Not stable\n");
      break;
    }
  }
  if(i==m)printf("Stable\n");
  return 0;
}



Measured memory_bytes: 2040
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: i64,
        k: i64,
    }
    let mod_10_9:i64 = 10i64.pow(9)+7;

    let mut cnt :i64= 0;

    for i in k..n + 2 {
        let min = i * (i-1) / 2;

        let max = n*i - min;
        cnt += max - min + 1;

        cnt %= mod_10_9;
    }

    println!("{}", cnt);
}


Measured memory_bytes: 2180
#include <bits/stdc++.h>
#define rep2(i,m,n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i,n) rep2(i,0,n)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
using ll = long long;
template <typename T>
T sq(T x){
  return x * x;
}

signed main (){
  int N;
  cin >> N;
  vector<int> a(N);
  rep(i,N){
cin >> a.at(i);
  }
int b = 1;
int cnt = 0;
  rep(i,N){
b = a.at(b-1);
cnt++;
  if(b==2){
cout << cnt << endl;
return 0;
  }
  }
  cout << "-1" << endl;
    return 0;
}


Measured memory_bytes: 640
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#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>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

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

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

#define MP make_pair
#define MT make_tuple
#define EACH(i,c) for(auto i: c)
#define SORT(c) sort((c).begin(),(c).end())

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

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

	LL Q, H, S, D;
	cin >> Q >> H >> S >> D;
	LL N;
	cin >> N;

	if(Q * 2 < H) H = Q * 2;
	if(H * 2 < S) S = H * 2;
	if(S * 2 < D) D = S * 2;

	LL ret = 0;
	ret += N / 2 * D;
	N %= 2;
	ret += N * S;

	cout << ret << endl;





	return 0;
}


Measured memory_bytes: 256
class Tree
  attr_accessor :root,:childs,:cost,:id
  def initialize id,root,cost
    @id,@root,@cost,@childs = id,root,cost,[]
  end
  def set_child node
    @childs << node
    node.root = self
  end
end
def getalltime root
  sum = 0
  return sum if root.childs.size == 0
  root.childs.each do |node|
     sum += getalltime node
  end
  return (sum+root.cost)
end
def getgreatertime root,count,greater
    return count > greater ? count : greater if root.childs.size == 0
    count += root.cost
    root.childs.each do |node|
       greater = getgreatertime node,count,greater
    end
    return greater
end
until (n = gets.chomp.to_i) == 0
  tree = Array.new
  tree[1]  = Tree.new(1,nil,0)
  (n-1).times do
    root,id,cost = gets.chomp.split.map!(&:to_i)
    tree[id]  = Tree.new(id,nil,cost)
    tree[root].set_child tree[id]
  end
  p (getalltime tree[1])*2 - (getgreatertime tree[1],0,0)
end

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main(void){
	ll x,y;
	cin >> x >> y;

	ll ans=1LL<<50;
	if(x<=y) chmin(ans,y-x);
	
	if(abs(x)<=abs(y)){
		ll cur=0;
		if(x<0) cur++;
		cur+=abs(y)-abs(x);
		if(y<0) cur++;
		chmin(ans,cur);
	}else{
		ll cur=0;
		if(x>0) cur++;
		cur+=abs(x)-abs(y);
		if(y>0) cur++;
		chmin(ans,cur);
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define INF 999999999
using namespace std;

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

    int num;
    num = a + b + 1;
    if(num != (int)s.size()) goto no;

    if(s[a] != '-') goto no;

    s[a] = '1';
    rep(i, 0, a+b){
        if(isdigit(s[i])) continue;
        else goto no;
    }

    cout << "Yes" << endl;
    return 0;

    no:;
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {
	int num, buf, i = 0, ans = 0;
	cin >> num;
	for (; i < num; i++) {
		scanf("%d", &buf);
		while ((buf & 1) == 0) {
			ans++;
			buf >>= 1;
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size, -1) { }
    bool 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;
        }
        return x != y;
    }
    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)];
    }
};
template<class Type>
Type solve(Type res = Type()){
    int N,M; cin >> N >> M;
    UnionFind UF(N+1);
    for(int i = 0; i < M;i++){
        int A,B; cin >> A >> B;
        UF.unionSet(A, B);
    }
    for(int i = 1; i<= N;i++) res = max(res,(ll)UF.size(i));
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


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

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vvvvll = vector<vector<vector<vector<ll>>>>;
using pl4 = pair<ll,ll>;
using str = string;
using vpl4 = vector<pair<ll,ll>>;

#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define llin(x) ll (x);cin >>(x);
#define stin(x) str (x);cin >>(x);
#define vllin(x,n) vll (x)(n);FOR(i,0,n-1){cin >>(x)[i];}
#define vllin2(a,b,n) vll (a)(n);vll (b)(n);FOR(i,0,n-1){cin >>(a)[i]>>b[i];}
#define vpl4in(x,n) vpl4 (x)((n),mp(0,0));FOR(i,0,n-1){cin >>x[i].fi>>x[i].se;}
#define FOR(i,a,b) for(ll i = a ; i <= b ; i++)
#define rFOR(i,b,a) for(ll i = a; i >= b ; i--)
#define SORT(x) sort(x.be, x.en)
#define rSORT(x) sort(x.rbegin(), x.rend())
#define say(x) cout<<(x);
#define sal(x) cout<<(x)<<endl;
#define says(x) cout<<(x)<<(' ');
#define sas cout<<(' ');
#define sayR(x) cout<<fixed<<setprecision(10)<<(x);
#define salR(x) cout<<fixed<<setprecision(10)<<(x)<<endl;
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;
#define Imp(a) cout <<((a)?"Possible":"Impossible")<<endl;
#define IMP(a) cout <<((a)?"POSSIBLE":"IMPOSSIBLE")<<endl;
#define pow(a,b) ll(pow(a,b))

ll MOD=1000000007;

ll n;
vvvvll m(0,vvvll(4,vvll(4,vll(4,0))));

bool judge(ll i,ll o,ll t,ll h){
	if(i==0&o==1&t==2) return false;
	if(i==0&o==2&t==1) return false;
	if(i==1&o==0&t==2) return false;
	if(o==0&t==1&h==2) return false;
	if(o==0&t==2&h==1) return false;
	if(o==1&t==0&h==2) return false;
	if(i==0&o==1&h==2) return false;
	if(i==0&t==1&h==2) return false;
	return true;
}

ll solve(ll i,ll o,ll t,ll h){
	if(i==0) return 1;
	if(m[i][o][t][h]>0) return m[i][o][t][h];
	ll l=0;
	FOR(j,0,3){
		if(judge(j,o,t,h)){
			l=(l+solve(i-1,j,o,t))%MOD;
		}
	}
	return m[i][o][t][h]=l;
}

signed main(){
	cin >>n;
	m.assign(n-2,vvvll(4,vvll(4,vll(4,0))));
	ll l=0;
	FOR(i,0,3){
		FOR(j,0,3){
			FOR(k,0,3){
				if(judge(i,j,k,3)){
					l=(l+solve(n-3,i,j,k))%MOD;
				}
			}
		}
	}
	sal(l);
}


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


int main()
{
  int N, Pi, Qi, Ppointer = -1, Qpointer = -1, pp=0;
  cin >> N;
  vector<int> P, Q, sortP;

  for (int i = 0; i < N; i++)
  {
    std::cin >> Pi;
    P.push_back(Pi);
  }

  for (int i = 0; i < N; i++)
  {
    std::cin >> Qi;
    Q.push_back(Qi);
  }

  sortP = P;
  sort(sortP.begin(), sortP.end());
   
  do
  {
    ++pp;
    if (sortP == P)
    {
      Ppointer = pp;
    }
    if (sortP == Q)
    {
      Qpointer = pp;
    }
    if (Ppointer >= 0  && Qpointer >= 0)
    {
      if (Ppointer >= Qpointer)
      {
        cout << Ppointer - Qpointer;
        break;
      }else
      {
        cout << Qpointer - Ppointer;
        break;
      }
      
    }
    
  }while(next_permutation(sortP.begin(), sortP.end()));
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int a,b,c,count=0,counta=0;
  cin>>a>>b>>c;
  int d;
  for(int i=0;i<b;i++){
    cin>>d;
    if(d>c)
      count++;
    else if(d<c)
      counta++;
  }
  cout<<min(count,counta)<<endl;
}

Measured memory_bytes: 256
def Int():
    return int(input())
def Ints():
    return map(int,input().split())
def IntList():
    return list(Ints())
def IntMat(N):
    return [IntList() for i in range(N)]

import sys
sys.setrecursionlimit(4100000)
rl = sys.stdin.readline

import math

A,B,H,M = Ints()

def dist(p1,p2):
    x1,y1 = p1
    x2,y2 = p2
    
    return ((x1-x2)**2+(y1-y2)**2)**0.5

def rotate(p,deg):
    x,y = p
    theta = deg*math.pi/180
    cos = math.cos(theta)
    sin = math.sin(theta)
    
    return [x*cos-y*sin, x*sin+y*cos]

deg1 = 30*H+M/2
deg2 = 6*M
p1 = [0,A]
p2 = [0,B]

p1n = rotate(p1,deg1)
p2n = rotate(p2,deg2)

print(dist(p1n,p2n))

Measured memory_bytes: 62836
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N; cin>>N;
    vint a(N+1),b(N+1);
    for(int i=1;i<=N;i++) cin>>a[i];
    for(int i=1;i<=N;i++) cin>>b[i];

    for(int i=2;i<=N;i++) a[i]+=a[i-1];
    for(int i=2;i<=N;i++) b[i]+=b[i-1];

    int ans=0;
    for(int i=1;i<=N;i++){
        ans=max(ans,a[i]+b[N]-b[i-1]);
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 256
let split_string ?(pattern="") = Str.split @@ Str.regexp pattern
let a, b, c = 
  match read_line () |> split_string ~pattern:" " |> List.map int_of_string |> List.sort compare with
    | a :: b :: c :: [] -> (a, b, c)
    | _ -> failwith ""

let () =
  let t = c * 2 - a - b in
  Printf.printf "%d\n" @@ if t mod 2 = 0 then t / 2 else (t + 3) / 2

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define int long long
#define ieps (int) 1e6
#define eps (int) 1e9
#define pii pair<int,int>



int32_t main(){
	int a , b, c , d;
	cin>>a>>b>>c>>d;
	int resp = 0LL;
	int simul = max(b,d);
	bool flag1 = false;
	bool flag2 = false;
	for(int i = 0;i<=simul;i++){
		if(i == a) flag1 = true;
		if(i == c) flag2 = true;
		if(i == b) flag1 = false;
		if(i == d) flag2 = false;
		if(flag1 && flag2) resp++;
	}
	cout<<resp<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s,t;
int main()
{
    cin>>s>>t;
	int ls=s.length();
	int flag=1;
	for(int i=0;i<ls;i++)
	{
		if(s[i]!=t[i]) flag=0;
	}
	if(flag==1) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3636
H, W, M = map(int, input().split())
hw = [list(map(int, input().split())) for _ in range(M)]

h_count = {}
w_count = {}
for h,w in hw:
    if h in h_count:
        h_count[h] += 1
    else:
        h_count[h] = 1
    if w in w_count:
        w_count[w] += 1
    else:
        w_count[w] = 1

max_h = max(h_count.values())
max_w = max(w_count.values())
ans = max_h + max_w

max_h_list = set([k for k,v in h_count.items() if v == max_h])
max_w_list = set([k for k,v in w_count.items() if v == max_w])

num = 0
for h,w in hw:
    if h in max_h_list and w in max_w_list:
        num += 1

if num < len(max_h_list)*len(max_w_list):
    print(ans)
else:
    print(ans-1)

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

const ll mod = 1e9 + 7 ;
int main(){
 ll n ;
 cin >> n ;
 vector<ll> m(400) ;
 rep(i,2*n){
     ll a ;
     cin >> a ;
     m[i] = a ;
 }
 ll count = 0 ;
 rep(i,2*n){
     if(m[i] == m[i+1] ){
         count++ ;
         if( count == 3 ){
             cout << "Yes" << endl;
             return 0 ;
         }
     }
     else{
         count = 0 ;
     }
     i++ ;
 }
 cout << "No" << endl;
}

Measured memory_bytes: 3632
stdin.ReadLine()
|> (fun x ->
    match x with
    | "SUN" -> 7
    | "MON" -> 6
    | "TUE" -> 5
    | "WED" -> 4
    | "THU" -> 3
    | "FRI" -> 2
    | _ -> 1)
|> printfn "%d"


Measured memory_bytes: 29976
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<bitset>
using namespace std;

int main() {

	int N;
	cin >> N;

	int x_max = N / 4;
	bool jdg = false;
	for (int x = 0; x <= x_max; x++) {
		if (0 == (N - 4 * x) % 7) {
			jdg = true;
			break;
		}
	}

	if (jdg == true) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}



Measured memory_bytes: 256