akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <queue>
using namespace std;
#define INF 1000000000

queue<pair<int, int> > que;
pair<int, int> p;

int main(){
  int i, j, k, l, n, m, o;
  int sx, sy;
  int gx, gy;
  int dx[4] = {1, 0, -1, 0};
  int dy[4] = {0, 1, 0, -1};
  int d[100][100];
  int N, M;
  char s[100][101];
  int ans = 0;

  cin >> N >> M;
  for (i = 0; i < N; i++) {
    for (j = 0; j < M; j++) {
      cin >> s[i][j];
      d[i][j] = INF;
    }
  }
  for(o = 0; o < N; o++) {
    for (j = 0; j < M; j++) {
      for (k = 0; k < N; k++) {
        for (l = 0; l < M; l++) {
          for (n = 0; n < N; n++) {
            for (m = 0; m < M; m++) {
              d[n][m] = INF;
            }
          }
          sx = o;
          sy = j;
          gx = k;
          gy = l;
          if (s[sx][sy]=='#' || s[gx][gy]=='#')
            continue;
          que.push(make_pair(sx, sy));
          d[sx][sy] = 0;
          while(que.size()) {
            p = que.front();
            que.pop();
            if (s[p.first][p.second] == 'G')
              break;
            for (i = 0; i < 4; i++) {
              int nx = p.first+dx[i];
              int ny = p.second+dy[i];
              if (s[nx][ny] != '#' && d[nx][ny] == INF && nx >= 0 && nx < N && ny >= 0 && ny < M) {
                que.push(make_pair(nx, ny));
                d[nx][ny] = d[p.first][p.second] + 1;
              }
            }
          }
          if (ans < d[gx][gy])
            ans = d[gx][gy];
        }
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <climits>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <unordered_map>
#include <random>
#define _USE_MATH_DEFINES
#include <math.h>
#include <complex>

using namespace std;

#define INF (int)1e8
#define _INF (int)-1e8
#define INFLL (long long)1e15
#define _INFLL (long long)-1e15
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> P;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef complex<double> cdouble;
typedef vector<complex<double>> vcd;
typedef vector<vector<complex<double>>> vvcd;

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

ll ceil_div(ll a, ll b) {
  if (a % b == 0) return a / b;
  else return a / b + 1;
}

int main() {
  int n;
  ll h;
  cin >> n >> h;
  vll a(n), b(n);
  Loop(i, n) {
    cin >> a[i] >> b[i];
  }
  sort(a.begin(), a.end(), greater<ll>());
  sort(b.begin(), b.end(), greater<ll>());
  ll max_a = a[0];
  int ans = 0;
  Loop(i, n) {
    if (b[i] > max_a && h > 0) {
      h -= b[i];
      ans++;
    }
    else break;
  }
  if (h > 0) ans += ceil_div(h, max_a);
  cout << ans << endl;
}

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

#人が一人しかいないとき
if N == 1:
    print(1)
    exit()

#人が2人以上いるとき
#N人それぞれが正直か不誠実かの全パターンを生成
H = []
for i in range(2**N):
    S = str(bin(i))
    H.append(S[2:].zfill(N))
#入力を受け取る
IXY = []
for i in range(N):
    t = int(input())
    for j in range(t):
        x,y = map(int,input().split())
        #i番目の人が「x番目の人はyである」と証言
        IXY.append([i,x,y])

ans = 0
for h in H:
    cnt = h.count("1")
    for ixy in IXY:
        i,x,y = ixy[0],ixy[1]-1,ixy[2]
        if h[i] == "1" and h[x] != str(y):
            cnt = 0
            break
    ans = max(ans,cnt)
print(ans)

Measured memory_bytes: 5500
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.first<<","<<p.second<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
#else
#define dbg(...) {}
#endif

#define long long long // for codeforces

int dp[2][55*55][55*55];


int main(){
  int n;
  cin>>n;
  vector<int> t(n);
  rep(i,n) cin>>t[i];

  auto pre = dp[0];
  auto nxt = dp[1];

  const int INF = 1234567890;

  fill(pre[0], pre[55*55], INF);
  pre[0][0] = 0;
  rep(i,n){
    fill(nxt[0], nxt[55*55], INF);

    auto upd = [&](vector<int> v){
      sort(all(v));
      nxt[v[0]][v[1]] = min(nxt[v[0]][v[1]], v[2]);
    };

    rep(j, 50*50) rep(k,50*50) if(pre[j][k] < INF){
      int l = pre[j][k];
      upd({j + t[i], k, l});
      upd({j, k + t[i], l});
      upd({j, k, l + t[i]});
    }

    swap(pre, nxt);
  }

  int ans = INF;
  rep(i, 51*51) rep(j,51*51) ans = min(ans, pre[i][j]);

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 74640
#include<bits/stdc++.h>
#define UL unsigned int
#define ULL unsigned long long int
#define LI long int
#define LL long long
#define LF double
#define LLF long double
#define FOR(a,b,c) for(a=b;a<=c;a++)
#define rFOR(a,b,c) for(a=b;a>=c;a--)
#define pb push_back
#define mp make_pair
#define IOF ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int MOD1=1000000007;
int binoMax=10000;
vector<LL> numInv(binoMax+1),factNumInv(binoMax+1),fact(binoMax+1);
// If needed call this function for generating ncrmodp
inline void generate_ncrp(LL p){
	int i;
	numInv[0]=numInv[1]=1;
	FOR(i,2,binoMax){
		numInv[i]=numInv[p%i]*(p-p/i)%p;
	}
	factNumInv[0]=factNumInv[1]=1;
	FOR(i,2,binoMax){
		factNumInv[i]=(numInv[i]*factNumInv[i-1])%p;
	}
	fact[0]=1;
	FOR(i,1,binoMax){
		fact[i]=(fact[i-1]*i)%p;
	}
}
// calculates C(n,r)%p in O(1) for many queries
LL ncrmodp(LL n,LL r,LL p){
	LL ans = ((fact[n]*factNumInv[r])%p*factNumInv[n-r])%p;
	return ans;
}

LL expmodp(LL x,LL y,LL p){
	LL res = 1;
	while(y>0){
		if(y&1)res=(res*x)%p;
		y=y>>1;
		x=(x*x)%p;
	}
	return res;
}

int main(){
	IOF
	string s;
	cin>>s;
	int l=s.length();
	if(s[l-1]=='s')cout<<s<<"es"<<endl;
	else cout<<s<<"s"<<endl;
return 0;
}

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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;

const ll LINF=1LL<<60;
const int INF=1<<29;
const ll MOD=1e9+7;

int main(){
    int L, R, d; cin >> L >> R >> d;
    int res;
    if(L%d == 0) res=R/d-L/d+1;
    else res=R/d-L/d;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3588
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)       for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define CtoI(c)         int((c)) - int('0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    ll n, a, b; cin >> n >> a >> b;

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

    ll q = n / (a + b);
    ll r = n % (a + b);

    if(r == 0){
        cout << q * a << endl;
        return 0;
    }

    else{
        chmin(r, a);
        cout << q * a + r << endl;
        return 0;
    }

}

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

int main() {
    int n;
    cin >> n;
    if(n % 2 == 0) {
        cout << n/2.0 / n << endl;
    }
    else {
        double m;
        m = double(n/2+1)/n;
        cout << m << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define oo 1000000007
using namespace std;
long long d;
long long dp[10005][105][2];
string s;
vector<long long>num;
long long solve(long long idx, long long sum, long long tight)
{
    if(idx==num.size())
        return(sum%d==0);
    if(dp[idx][sum][tight]!=-1)
        return dp[idx][sum][tight];
    long long res=0;
    long long k=(tight)?num[idx]:9;
    for(int i=0;i<=k;i++)
    {
        long long newtight=(num[idx]==i)?tight:0;
        res=(res+solve(idx+1,(sum+i)%d,newtight))%oo;
    }
    dp[idx][sum][tight]=res;
    return res;
}
long long khoitao(string s)
{
    for(int i=0;i<s.size();i++)
        num.push_back(s[i]-'0');
    return solve(0,0,1);
}
main()
{
    num.clear();
    memset(dp,-1,sizeof(dp));
    cin>>s>>d;
    cout<<(khoitao(s)-1+oo)%oo;
    return 0;
}


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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define INF 2000000000

#ifdef LOCAL
  #define eprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define eprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

int ctoi(char c) {
  return c - '0';
}

template <class C>
void printContainer(C &container, const char *delim=",") {
  for(const auto &e : container) {
    std::cout << e << delim;
  }
  std::cout << "\n";
}

// Greatest common divisor
template<class T>
T gcd(T x, T y) {
  if(x < y) {
    std::swap(x, y);
  }
  T r = x % y;
  while(r != 0) {
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

// Least common multiple
template<class T>
T lcm(T x, T y) {
  return (x*y)/gcd(x,y);
}

int main() {
  int n;
  cin >> n;
  cout << (n+1)*n/2 <<endl;
}


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

#define MAX 100002

int n;

vector<int> v[MAX];
struct BIT{
	vector<int> bit;
	void resize(int N){
		bit.assign(N, 0);
	}
	void add(int i, int j){
		i++;
		while (i < bit.size()){
			bit[i] += j;
			i += i&-i;
		}
	}
	int sum(int i){
		int r = 0;
		i++;
		while (i){
			r += bit[i];
			i -= i&-i;
		}
		return r;
	}
	int rng(int lef, int rig){
		int F = sum(rig);
		if (lef){
			F -= sum(lef - 1);
		}
		return F;
	}
};
BIT bit;
bool par(vector<int> &vv){
	bit.resize(300002);
	int sum = 0;
	for (int i = 0; i < vv.size(); i++){
		sum += i - bit.sum(vv[i]);
		bit.add(vv[i], 1);
		sum %= 2;
	}
	return sum;
}
vector<bool> inv;
int main(){
	cin >> n;
	for (int i = 0; i < 3; i++){
		for (int j = 0; j < n; j++){
			int a;
			scanf("%d", &a);
			v[j].push_back(a);
		}
	}
	for (int j = 0; j < n; j++){
		if (v[j][1] % 3 != 2){
			puts("No");
			return 0;
		}
		if (abs(v[j][0] - v[j][1]) != 1){
			puts("No");
			return 0;
		}
		if (abs(v[j][1] - v[j][2]) != 1){
			puts("No");
			return 0;
		}
		int ex = 2;
		if (j % 2){
			ex = 5;
		}
		if (v[j][1] % 6 != ex){
			puts("No");
			return 0;
		}
		inv.push_back(v[j][0] > v[j][1]);
	}
	vector<int> k[2];
	int cc[] = { 0, 0 };
	for (int i = 0; i < n; i++){
		k[i % 2].push_back(v[i][1]);
		cc[i % 2] += inv[i];
	}
	cc[0] %= 2;
	cc[1] %= 2;
	if (par(k[0]) == cc[1] && par(k[1]) == cc[0]){
		puts("Yes");
	}
	else{
		puts("No");
	}
	return 0;
}

Measured memory_bytes: 7420
using System;
using System.Linq;

public class Problem_B
{
  public static void Main(string[] args)
  {
    var n = int.Parse(Console.ReadLine());
    var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
    int d = input[0], x = input[1];
    var eaten = 0;
    var a = new int[n];
    for (var i = 0; i < n; i++) a[i] = int.Parse(Console.ReadLine());

    for (var i = 0; i < d; i++)
    {
      foreach (var num in a)
      {
        if (i * num + 1 <= d) eaten++;
      }
    }
    Console.WriteLine($"{x + eaten}");
  }
}

Measured memory_bytes: 13396
(defun app ()
    (let ((a (read))
        (b (read))
        (c (read))
        (ans 0))
    (if (>= b c)
        (setq ans (+ b c))
        (if (>= a (- c b))
            (setq ans (+ b c))
            (setq ans (+ b (+ b a 1)))
        )
    )
    (princ ans)
    )
)
(app)


Measured memory_bytes: 24276
#include<bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define ll long long
#define vi vector<ll>
#define ss second
#define ff first
#define pii pair<int,int>
#define mii map<int,int>
#define mod 1000000007
#define w(x) int x; cin>>x; while(x--)
#define ps(x,y) fixed<<setprecision(y)<<x;
#define fo(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define re(i, j) fo(i, 0, j, 1)
#define pi 3.1415926535897932384626433832795
#define all(cont) cont.begin(), cont.end()
#define countbit(x) __builtin_popcount(x)
#define mod 1000000007
#define lo lower_bound
#define de(n) ll n;cin>>n;
#define def(a,n) ll n;cin>>n;ll a[n];re(i,n){cin>>a[i];}
using namespace std;
ll ab(ll a,ll b)
{
    if(a>b)
    return a-b;
return b-a;
}
ll factor(ll n)
{
    ll ans=0;
    for(ll j=1;j*j<=n;j++)
    {
        if(n%j==0)
        {
            if(j*j==n)
            ans++;
            else
            {
                ans+=2;
            }
        }
    }
    return ans;
}
ll power(ll x, ll y,ll p)  
{  
    int res = 1;
    x = x % p; 
    if (x == 0) return 0;
    while (y > 0)  
    {   
        if (y & 1)  
            res = (res*x) % p;  
   
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}
ll pow(ll x,ll y) 
{ 
    int res = 1; 
   
    while (y > 0) 
    { 
        if (y & 1) 
            res = res*x; 
   
        y = y>>1; 
        x = x*x;   
    } 
    return res; 
}
void cp()
{
    ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); 
    #ifndef ONLINE_JUDGE  
    freopen("input.txt", "r", stdin);  
    freopen("output.txt", "w", stdout); 
  
#endif
}
vector<ll> get_prime_factors_less_than(ll n){
    vector<ll> factor;
    vector<ll> prime(n,1);
    prime[0]=0,prime[1]=0;
    for(ll i = 2 ; i <= n ; i++){
        if(prime[i]==1){
            for(ll j=i*i;j<=n;j=j+i) prime[j]=0; 
            factor.push_back(i);
        }
    }
    return factor;
}
ll digit(ll n)
{
    ll q=0;
    while(n>0)
    {
        q++;
        n/=10;
    }
    return q; 
}
ll sq(ll n)
{
    return n*n;
}
ll NR(ll n, ll r) 
{ 
    long long p = 1, k = 1; 
    if (n - r < r) 
        r = n - r; 
  
    if (r != 0) { 
        while (r) { 
            p *= n; 
            k *= r; 
  
            // gcd of p, k 
            long long m = __gcd(p, k); 
            p /= m; 
            k /= m; 
  
            n--; 
            r--; 
        } 
    } 
  
    else
        p = 1; 
  
    // if our approach is correct p = ans and k =1 
    return p ;
}
int main() 
{
    cp();
    de(n);
    de(m);
    cout<<n*m;
    return 0;
}

Measured memory_bytes: 3640
N = list(map(int,input().split()))
def cf(x1,x2):
    cf=[]
    for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf
ans = cf(N[0],N[1])
print(ans[-N[2]])

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <utility>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef long long int ll;

int main() {
  int N;
  cin>>N;
  
  vector<int> A(N);
  rep(i,N){
    cin>>A[i];
  }
  
  bool flag=true;
  
  sort(A.begin(),A.end());
  
  rep(i,N){
    if(A[i]==A[i+1]){
      flag=false;
      break;
    }
  }
 
  if(flag)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
  
  public static void main (String[] args){
  
  Scanner scanner = new Scanner (System.in);
  
  int R = scanner.nextInt();
  int G = scanner.nextInt();
    
  //今のレート＋パフォーマンス＝結果レート＊２
  //パフォーマンス＝結果レート＊２－今のレート
    
  int performance = G*2-R;
   
  System.out.println(performance);
  
  }
}

Measured memory_bytes: 21712
#include <cstdio>
#include <algorithm>
#include <utility>
#include <vector>
#include <queue>
#include <functional>
#include <stack>
#include <set>
#include <map>
#include <ctype.h>
#include <cstring>
#include <string>
#include <iostream>

#define fi first
#define se second
#define sz(x) ((int)x.size())

using namespace std;

typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,int> pli;
typedef pair<lli,lli> pll;

int n,m;
char str[5010],tmp[5010];

void make(int l) {
	vector<char> arr;
	for(int i=0;i<n-l && m>0;i++) {
		int f=1;
		for(int j=0;j<l;j++) if(str[i+j]!=tmp[j]) {
			f=0;
			break;
		}
		if(f) arr.push_back(str[i+l]);
	}
	if(arr.empty() || !m) return;
	
	sort(arr.begin(),arr.end());
	for(int i=0;i<sz(arr) && m>0;i++) {
		if(i!=0 && arr[i]==arr[i-1]) continue;
		tmp[l] = arr[i];
		m--;
		if(!m) printf("%s\n",tmp);
		else make(l+1);
		tmp[l] = 0;
	}
}

int main() {
	scanf("%s",str);
	scanf("%d",&m);
	n=strlen(str);

	make(0);
	
	return 0;
}


Measured memory_bytes: 256
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int64_t, int64_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int32_t N;
  cin >> N;
  vector<int32_t> P(N, 0);
  vector<int32_t> Q(N, 0);
  for (int32_t i = 0; i < N; ++i) {
    cin >> P[i];
  }
  for (int32_t i = 0; i < N; ++i) {
    cin >> Q[i];
  }

  vector<int32_t> permutation(N);
  for (int32_t i = 0; i < N; ++i) {
    permutation[i] = i + 1;
  }
  map<vector<int32_t>, int32_t> order_map;
  int32_t order = 1;
  do {
    order_map[permutation] = order;
    ++order;
  } while (next_permutation(permutation.begin(), permutation.end()));

  cout << abs(order_map[P] - order_map[Q]) << endl;

  return 0;
}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

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

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

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

// 多重vector
// auto dp=make_v<int>(4,h,w) みたいに使える
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...));
}

// 多重vectorのためのfill
// fill_v(dp,0) みたいに使える
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);
}

//main code

int main(int argc, char const* argv[])
{
	int n,x;
	cin >> n >> x;
	if (x == n*2-1 or x == 1) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	VL ans(n*2-1,-1);
	ans[n-1] = x;
	ans[n-2] = 1;
	ans[n] = 2*n-1;
	int index = 0;
	for (int i = 2; index < 2*n-1; i++) {
		if (i == x) continue;
		if (index == n-2) index = n+1;
		if (index >= 2*n-1) break;
		ans[index] = i;
		index++;
	}
	for (auto&& var : ans) {
		cout << var << endl;
	}
	return 0;
}



Measured memory_bytes: 3072
# include <bits/stdc++.h>
using namespace std;
long double pi = 3.14159265359;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    long double R;
    cin >> R;
    cout << setprecision(9) << (long double)2 * R * pi << '\n';
}

Measured memory_bytes: 3808
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    char a[100],b[100];
    int i,len,ok=1;
    cin>>a>>b;
    len=strlen(a);
    for(i=0;i<len;i++) if (a[i]!=b[i]) ok=0;
    if(ok==1) cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int NIL = -1;
const int MAX = 10000;
const int MOD = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int n;
    ll k;
    cin >> n >> k;
    vector<int> nextTown(n + 1);
    for (int i = 1; i <= n; i++) cin >> nextTown[i];

    vector<int> visited(n + 5, NIL), town(n + 5, 0);
    town[0] = 1;
    int t = 1;  // start: town-1
    ll loopSize = 0, beforeLoop = 0;
    visited[t] = 0;
    for (int cnt = 1; cnt <= n; cnt++) {
        t = nextTown[t]; // 移動
        if (visited[t] != NIL) {
            loopSize = cnt - visited[t];
            beforeLoop = visited[t];
            break;
        }
        town[cnt] = t;
        visited[t] = cnt;
    }
    if (k <= beforeLoop) {
        cout << town[k] << '\n';
    }
    else {
        ll loopRest = (k - beforeLoop) % loopSize;
        cout << town[beforeLoop + loopRest] << '\n';
    }
}


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

inline int read() {
	register int x = 0, v = 1;
	register char ch = getchar();
	while (!isdigit(ch)) {
		if (ch == '-') v = -1;
		ch = getchar();
	}
	while (isdigit(ch)) {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * v;
}

int p[100];
int tot;

int main() {
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	int tmp = 1;
	p[++tot] = 1;
	// for (int i = 1; i < c; ++i) {
	while (1) {
		++tmp;
		while ((a % tmp != 0 || b % tmp != 0) && tmp <= std::min(a, b)) ++tmp;
		if (tmp > std::min(a, b)) break;
		p[++tot] = tmp;
	}
	// for (int i = 1; i <= tot; ++i) printf("%d ", p[i]);
	printf("%d\n", p[tot - c + 1]);
	return 0;
}



Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        const int MaxNumber = 13;
        const int CardTypeCount = 4;

        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());

            var notFountList = new List<InputModel>();

            var set = new List<InputModel>();
            for (var i = 0; i < n; i++)
            {
                var array = Console.ReadLine().Split();
                var model = new InputModel() { Type = array[0], Number = int.Parse(array[1]) };
                set.Add(model);
            }

            var typeList = new List<string>() { "S", "H", "C", "D" };

            // Typeが丸ごと存在しない場合はパッと思いつかないから冗長だけど別で先に出す
            foreach (var l in typeList)
            {
                if (!set.Select(s => s.Type).Contains(l))
                {
                    foreach (var val in Enumerable.Range(1, 13))
                    {
                        var tmp = new InputModel();
                        tmp.Type = l;
                        tmp.Number = val;
                        tmp.Priority = GetPriority(l);
                        notFountList.Add(tmp);
                    }
                }
            }

            // 本体
            foreach (var type in set.GroupBy(g => g.Type))
            {
                foreach (var val in Enumerable.Range(1, 13))
                {
                    if (!type.Any(a => a.Number == val))
                    {
                        var tmp = new InputModel();
                        tmp.Type = type.Key;
                        tmp.Number = val;
                        tmp.Priority = GetPriority(type.Key);
                        notFountList.Add(tmp);
                    }
                }
                foreach (var m in type)
                {

                    if (!Enumerable.Range(1, 13).Contains(m.Number))
                    {
                        notFountList.Add(m);
                    }

                }
            }

            foreach (var item in notFountList.OrderBy(o => o.Priority).ThenBy(t => t.Number))
            {
                Console.WriteLine($"{item.Type} {item.Number}");
            }


        }
        static int GetPriority(string s)
        {
            switch (s)
            {
                case "S":
                    return 1;
                case "H":
                    return 2;
                case "C":
                    return 3;
                case "D":
                    return 4;
                default:
                    return 0;
            }
        }
    }

    class InputModel
    {
        public string Type { get; set; }
        public int Priority { get; set; }
        public int Number { get; set; }
    }
}



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

#define N 200010 

using namespace std;

typedef long long ll;

int a[N], pre[N], nxt[N], val[N];

char *p1, *p2, buf[100000];

#define nc() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1 ++ )

int rd() {
	int x = 0;
	char c = nc();
	while (c < 48) {
		c = nc();
	}
	while (c > 47) {
		x = (((x << 2) + x) << 1) + (c ^ 48), c = nc();
	}
	return x;
}

ll rd2() {
	ll x = 0;
	char c = nc();
	while (c < 48) {
		c = nc();
	}
	while (c > 47) {
		x = (((x << 2) + x) << 1) + (c ^ 48), c = nc();
	}
	return x;
}

int First[N];

int main() {
	int n = rd();
	ll k = rd2();
	for (int i = 1; i <= n; i ++ ) {
		a[i] = rd();
	}
	if (n == 1) {
		if (k & 1) {
			printf("%d\n", a[1]);
		}
		return 0;
	}
	for (int i = n; i; i -- ) {
		First[a[i]] = i;
	}
	for (int i = 1; i <= n; i ++ ) {
		if (pre[a[i]]) {
			nxt[pre[a[i]]] = (i + 1) % n;
			if (!nxt[pre[a[i]]]) {
				nxt[pre[a[i]]] = n;
			}
		}
		pre[a[i]] = i;
	}
	for (int i = 1; i <= n; i ++ ) {
		if (!nxt[i]) {
			if (First[a[i]] != i) {
				nxt[i] = First[a[i]] + 1;
			}
			else {
				if (i == n) {
					nxt[i] = 1;
				}
				else {
					nxt[i] = i + 1;
				}
			}
		}
	}
	for (int i = 1; i <= n; i ++ ) {
		if (nxt[i] >= i + 2) {
			val[i] = nxt[i] - i;
		}
		else {
			val[i] = nxt[i] + n - i;
		}
	}
	if (nxt[n] == 1) {
		val[n] = n + 1;
	}
	ll mdl = 0;
	int now = 1;
	while (1) {
		mdl += val[now];
		now = nxt[now];
		if (now == 1) {
			break;
		}
	}
	ll pre = mdl / n;
	// cout << pre << endl ;
	k %= pre;
	if (!k) {
		return 0;
	}
	// puts("Fuck");
	int id = 1;
	now = 1;
	while (1) {
		if (nxt[now] >= now + 2) {
			now = nxt[now];
			continue;
		}
		if (id == k) {
			if (nxt[now] == 1 && now != n) {
				return 0;
			}
			printf("%d ", a[now]);
			if (now == n) {
				return 0;
			}
			now ++ ;
		}
		else {
			id ++ ;
			now = nxt[now];
		}
	}
	return 0;
}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mo = 1000000007;
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;
}
ll mypow(ll a, ll b){
  ll res = 1;
  a %= mo;
  while (b)
  {
    if (b & 1)
      res = res * a % mo;
    a = a * a % mo;
    b >>= 1;
  }
  return res;
}
int main()
{
ll n ;
cin >> n ;
ll a , b , c , d ;
cin >> a >> b >> c >> d ;
COMinit();
vector<vector<ll>> dp(b-a+2, vector<ll>(n+1,0) );

dp[0][0]=1;
rep(i,b-a+1)rep(j,n+1){
  ll te=dp[i][j];
  for (ll k = 0; k <= d && j+k*(i+a)<=n ; k++)
  {
    if(te==0)break;
    if(k){
      te*=COM(n-j-(k-1)*(i+a),i+a);
      te%=mo;
      te*=mypow(k,mo-2);
      te%=mo;
    }
    te%=mo;
    if(k==0 || k>=c)dp[i+1][j+k*(i+a)]=(dp[i+1][j+k*(i+a)]+te)%mo;
  }
  
}

cout << dp[b-a+1][n]%mo << endl;
return 0;
}

Measured memory_bytes: 20096
#include<bits/stdc++.h>
#define _USE_MATH_DEFINES
using namespace std;
    
#define ll long long int
#define pb push_back
#define rep(i , j , n) for(ll i = j ; i < n ; i++)
#define pre(i , j , n) for(ll i = j ; i >= n ; i--)
#define all(x) x.begin(), x.end()
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef vector<int>		vi;
typedef vector<ll>		vll;
typedef vector<char>	vc;
typedef vector<bool>	vb;
#define br "\n"
#define MAX  1000001
#define ff first
#define ss second
ll mod = 1e9 + 7;
ll maxi = 3e5 + 1;

ll h,w;
ll xi,yi,xf,yf;
vector<vll> grid,dist;
ll x[] = {1,0,-1,0};
ll y[] = {0,-1,0,1};

void solve(){
    cin >> h >> w >> xi >> yi >> xf >> yf;
    xi--;
    xf--;
    yi--;
    yf--;
    grid.assign(h,vll(w,0));
    dist.assign(h,vll(w,1e6));
    rep(i,0,h){
        rep(j,0,w){
            char c;
            cin >> c;
            if(c == '.') grid[i][j] = 1;
        }
    }
    deque<pll> q;
    if(grid[xi][yi] == 1) q.push_front({xi,yi});
    dist[xi][yi] = 0;
    while(!q.empty()){
        ll xt = q.front().ff;
        ll yt = q.front().ss;
        // cout << xt << " " << yt << br;
        q.pop_front();
        rep(i,0,4){
            ll cox = xt + x[i];
            ll coy = yt + y[i];
            if(cox < h && cox >= 0 && coy < w && coy >= 0 && grid[cox][coy] == 1){
                // cout << cox << " " << coy << " ";
                if(dist[xt][yt] < dist[cox][coy]){
                    // cout << cox << " " << coy << " ";
                    dist[cox][coy] = dist[xt][yt];
                    q.push_front({cox,coy});
                }
                

            }
        }
        // cout << br;
        rep(i,-2,3){
            rep(j,-2,3){
                ll cox = xt + i;
                ll coy = yt + j;
                if(cox < h && cox >= 0 && coy < w && coy >= 0 && grid[cox][coy] == 1){
                    if(dist[xt][yt] + 1 < dist[cox][coy]){
                        // cout << cox << coy << " "; 
                        dist[cox][coy] = dist[xt][yt] + 1;
                        q.push_back({cox,coy});

                    }
                } 
            }
        }
        // cout << br;

    }
    if(dist[xf][yf] == 1e6) cout << -1;
    else cout << dist[xf][yf];


}
	
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif  
 
    ll t = 1;
    // cin >> t;
    rep(i,0,t){
        solve();
    }
 
}	


Measured memory_bytes: 19460
import itertools
import math
n = int(input())
town = [tuple(map(int, input().split())) for _ in range(n)]
ans = 0
cnt = 0

for p in itertools.permutations(range(0, n), n):
    for i in range(n - 1):
        distance = (town[p[i]][0] - town[p[i + 1]][0]) ** 2 + \
            (town[p[i]][1] - town[p[i + 1]][1]) ** 2
        ans += math.sqrt(distance)
    cnt += 1
ans /= cnt
print(ans)


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

#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long 
#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,arr,n) for(int i=arr;i<=n;i++)
#define repd(i,arr,n) for(int i=arr;i>=n;i--)
#define trav(arr,x) for(auto& arr:x)
#define all(c) c.begin(), c.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(arr) arr.size()
#define pi 3.14159265358979323846
#define MAX (1000*1000*1000+7)
#define vi vector<int>
#define pii pair<int,int>
#define pqueue priority_queue<int>
#define pdqueue priority_queue<int,vi,greater<int> >
 
const int mod=1000000007;
int power(int a,int b)
{
    int ans=1;
    while(b)
    {
        if(b&1)
        {
            ans=(ans*a)%mod;
        }
        a=(a*a);
        a%=mod;
        b>>=1;
    }
    return ans;
}


int32_t main()
{
    fast;
    int n;
    cin>>n;
    string str;
    std::vector<string> v;
    
    rep(i,n)
    {
        cin>>str;
        sort(all(str));
        v.pb(str);
    }
    sort(all(v));
    int cnt=1,ans=0;
    rep(i,n-1)
    {
        if(v[i]==v[i+1])
            cnt++;
        else
        {
            //cout<<cnt<<endl;
            ans+=(cnt*(cnt-1)/2);
            cnt=1;
        }
    }
    //cout<<ans<<endl;
    ans+=((cnt*(cnt-1))/2);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5748
#include <iostream>
using namespace std;
int main(void){
    int a,b,g=100,h=0,j = 0;
    for(int i = 0; i < 4; i++){
    cin >>a;
    g = min(g,a);
    j = j + a;
    }
    j = j - g;    
    for(int i = 0; i < 2; i++){
    cin >>b;
    h = max(h,b);
    }
    cout<<j + h<<endl;
}



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

int main(void){
	int n, tmp, max;
	int ans = 0;
	cin >> n;

	for(int i=0; i<n; i++){
		cin >> tmp;
		if(max < tmp) max = tmp;
		ans += tmp;
	}
	cout << ans - 0.5*max << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        long ans = total(s, new ArrayList<>(), 0, 1);
        System.out.println(ans);
    }

    static long total(String s, List<Long> values, int from, int to) {
        if (to == s.length()) {
            values.add(Long.valueOf(s.substring(from, to)));
            long total = 0;
            for (Long i : values) {
                total += i;
            }
            return total;
        }
        long total = 0;
        List<Long> cValues = new ArrayList<>();
        cValues.addAll(values);
        total += total(s, cValues, from, to + 1);
        cValues.clear();
        cValues.addAll(values);
        cValues.add(Long.valueOf(s.substring(from, to)));
        total += total(s, cValues, to, to + 1);
        return total;
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n; cin >> n;
  map<int, int> mp;
  REP(i,n){
    int a; cin >> a;
    mp[a]++;
  }
  if(mp.size()==1){
    if(mp[0]>0){
      cout << "Yes\n";
      return 0;
    }
  }else if(mp.size()==2){
    if(n%3==0 && mp[0]==n/3){
      cout << "Yes\n";
      return 0;
    }
  }else if(mp.size()==3){
    bool flag = true;
    int tmp = 0;
    for(auto p: mp){
      if(p.second>n/3) flag = false;
      tmp ^= p.first;
    }
    if(flag && n%3==0 && tmp==0){
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
  return 0;
}


Measured memory_bytes: 7184
#include<stdio.h>
int main(){
	int n,m,l,x,y,z,a[100][100],b[100][100];
	long long int c[100][100]={0};
	scanf("%d %d %d",&n,&m,&l);
	for(y=0;y<n;y++){
		for(x=0;x<m;x++){
			scanf("%d",&a[y][x]);
		}
	}
	for(y=0;y<m;y++){
		for(x=0;x<l;x++){
			scanf("%d",&b[y][x]);
		}
	}
	for(y=0;y<n;y++){
		for(x=0;x<l;x++){
			for(z=0;z<m;z++){
				c[y][x]=c[y][x]+(a[y][z]*b[z][x]);
			}
		}
	}
	for(y=0;y<n;y++){
		for(x=0;x<l;x++){
			if(x!=(l-1)){
				printf("%lld ",c[y][x]);
			}
			else{
				printf("%lld",c[y][x]);
			}
		}
		printf("\n");
	}
}



Measured memory_bytes: 2848
#include<stdio.h>

int main(){
	int a, b, c, f, N, i;
	scanf("%d", &N);
	for(i = 0; i < N; i++){
		f = 0;
		scanf("%d %d %d", &a, &b, &c);
		if(a*a == c*c+b*b){
			f = 1;
		}
		if(b*b == c*c+a*a){
			f = 1;
		}
		if(c*c == a*a+b*b){
			f = 1;
		}
		if(f == 1){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
	
}

Measured memory_bytes: 580
#include <stdio.h>
#include<iostream>
#include<cstring>
using namespace std;
char str[200005];
int main(void)
{
	while(~scanf("%s",str)){
		int len=strlen(str);
		int s=0;
		int cnt=0;
		for(int i=0;i<len;i++){
			if(str[i]=='S'){
				s++;
			}
			else {
				if(s>0){
					s--;cnt+=2;
				}
			}
		}
		printf("%d\n",len-cnt);
	}
	return 0;
}


Measured memory_bytes: 384
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
#include<chrono>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define vint(a,n) vint a(n); rep(i, n) cin >> a[i];
#define vll(a,n) vll a(n); rep(i, n) cin >> a[i];
#define ALL(n) begin(n),end(n)
#define RALL(n) rbegin(n),rend(n)
#define MOD (1000000007)
#define INF (2e9)
#define INFL (2e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using vint=vector<int>;
using vll=vector<ll>;
using vbool=vector<bool>;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    int n; cin >> n;
    vint x(n), y(n), h(n);
    rep(i, n) cin >> x[i] >> y[i] >> h[i];

    rep(cx, 101) rep(cy, 101){
        int ch;
        rep(i, n) if(h[i]>0){
            ch = h[i] + abs(x[i] - cx) + abs(y[i] - cy);
        }
        bool flg = false;
        rep(i, n){
            int t = max(ch - abs(cx - x[i]) - abs(cy-y[i]), 0);
            if(t != h[i]){
                flg = true;
                break;
            }
        }
        if(flg) continue;
        cout << cx << " " << cy << " " << ch << endl;
        return 0;
    }
    return 0;}

Measured memory_bytes: 3588
#include "bits/stdc++.h"

#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=n-1;i>=m;--i)
#define ALL(v) v.begin(),v.end()
#define PB(a) push_back(a)
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-9

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

using namespace std;


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << max(a*b, c*d) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define F first
#define S second
#define db double
#define pb push_back
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
using namespace std;
 
 ll mod=998244353;
 
ll expo(ll base,ll exponent,ll mod){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}
 
vector<bool>  prime(90000002,true);
void Sieve() 
{ 
   
    for (int p=2; p*p<=90000001; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=90000001; i += p) 
                prime[i] = false; 
        } 
    } 
}

const ll M=200006;
ll f[M],inv[M];

void compute(){
    f[0]=1;
    rep(i,1,M-1){
        f[i]=(1LL*i*f[i-1])%mod;
    }
    inv[M-1]=expo(f[M-1],mod-2,mod);
    for(ll i=M-2;i>=0;i--){
        inv[i]=(1LL*(i+1)*inv[i+1])%mod;
    }
}
ll C(ll n,ll r){
    return (1LL*((1LL*f[n]*inv[r])%mod)*inv[n-r])%mod;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // compute();
    // Sieve();
    ll tests=1;
    // cin>>tests;
    while(tests--)
    {
      ll i,j,n,zero=0;
      cin>>n;
      vector<ll>a(n);
      rep(i,0,n-1) 
      {
        cin>>a[i];
        if(a[i]==0) zero++;
      }
      if(zero>0) {cout<<0;return 0;}
      ll cnt=to_string(a[0]).length(),ans=1;
      rep(i,1,n-1)
      {
        cnt+=to_string(a[i]).length()-1;
      }
      if(cnt>19) {cout<<-1; return 0;}
      // ll zero=0;
      rep(i,0,n-1)
      {
        // if(a[i]==0) {zero++;break;}
        // ans*=a[i];
        ll prev=ans;
         cnt=to_string(ans).length() + to_string(a[i]).length()-1;
        ans*=a[i];
        if(ans>1000000000000000000 || ans<prev || cnt>19) {cout<<-1; return 0;}
      }
      // if(zero>0) cout<<0;
      // else
      cout<<ans;
    }
    return 0;
   }

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

// repetition
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

// const value
// const ll MOD = 1e9 + 7;
// const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
// const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

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

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}

template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  cout << ((n - 1) + (k - 2)) / (k - 1) << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using static System.Math;
class Program
{
    public static void Main(string[] args)
    {
        var v = Enumerable
            .Range(0, 5)
            .Select(_ => int.Parse(Console.ReadLine()))
            .Select(x => new { V = x, R = ((x + 9) / 10 * 10), A = (x % 10) == 0 ? 0 : (10 - x % 10) })
            .ToLookup(x => x.A == 0);

        int i = 0;
        int sum = 0;
        foreach (var item in v[true])
        {
            sum += item.V;
            i++;
        }
        foreach (var item in v[false].OrderBy(x => x.A))
        {
            sum += (i == 4)
                ? item.V
                : item.R;
            i++;
        }

        Console.WriteLine(sum);
    }
}

Measured memory_bytes: 13536
#include<iostream>
#define N 1000000007
using namespace std;
typedef long long ll;

int mod_pow(int m,int n){
  ll a=1,x=m;
  while(n){
    if(n&1)a=a*x%N;
    x=x*x%N;
    n>>=1;
  }
  return a;
}

int main(){
  int m,n;
  cin>>m>>n;
  cout<<mod_pow(m,n)<<endl;
  return 0;
}

Measured memory_bytes: 1164
import java.util.Scanner;

public class Main {

    static Scanner scan;
    static int[] W;
    static final int n = 0;
    static final int k = 0;

    public static void main(String[] args) {
        scan = new Scanner(System.in);

        int n = scan.nextInt();
        int k = scan.nextInt();
        int gross = 0;
        W = new int[n];

        for(int i = 0; i < n; i++) {
            W[i] = scan.nextInt();
            gross += W[i];
        }

        if(k == 1) {
            System.out.println(gross);
            return ;
        }
        int min = gross / k; // 積載重量平均値
        int max = gross; // 合計積載重量最大値
        int mid = (max + min) / 2;

        while(max - min > 1) {
            mid = (max + min)/2;
            if(carry(mid, k, n)) {
                max = mid;
                continue;
            } else break;
        }

        while(true) {
            if(carry(max, k, n)) {
                max--;
                continue;
            }
            else {
                max++;
                break;
            }
        }
        System.out.println(max);
    }

    static public boolean carry(int P, int k, int n) {
        if(P == 0) {
            return false;
        }
        int j = 0;
        for(int i = 0; i < k; i++) {
            int s = 0;
            while(s + W[j] <= P) {
                s += W[j];
                j++;
                if(j == n) return true;
            }
        }
        return false;
    }
}



Measured memory_bytes: 71752
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int ret=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') w=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') ret=ret*10+ch-'0',ch=getchar();
	return w*ret;
}
long long n,a,b;
int main()
{
	cin>>a>>b>>n;
	if(a>=n) cout<<a-n<<" "<<b<<endl;
	else cout<<0<<" "<<max((long long)0,b-n+a)<<endl;
	return 0;
}


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

using namespace std;

int main() {
    int r, d, x2000;
    cin >> r >> d >> x2000;
    int x = x2000;
    for (int i = 0; i < 10; i++) {
        x = r*x-d;
        cout << x << endl;
    }
}


Measured memory_bytes: 256
import math

N, D = map(int, input().split())
X = [[0 for i in range(D)] for j in range(N)]

for i in range(N):
    x = []
    for j in input().split():
        x.append(int(j))
    X[i] = x

ans = 0

for i in range(N-1):
    l = 0
    for j in range(i+1, N):
        sum = 0
        for k in range(D):
            t = (X[i][k] - X[j][k])**2
            sum += t
        l = math.sqrt(sum)
        if l.is_integer():
            ans += 1

print(ans)

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

int main() {
	int x, y; cin >> x >> y;
	
	bool ans = false;
	
	for (int i = 0; i <= x && !ans; ++i)
		if (2 * i + 4 * (x - i) == y)
			ans = true;
	
	cout << (ans ? "Yes\n" : "No\n");
	
}



Measured memory_bytes: 3632