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

ll n, k, sum, sq;
vector<int> a;

void input() {
    cin >> n >> k;
    a = vector<int>(n);
    sum = 0;
    rep(i, n) {
        cin >> a[i];
        sum += a[i];
    }
}

inline bool judge(ll x) {
    vector<ll> v(n);
    rep(i, n) v[i] = a[i] % x;
    sort(v.begin(), v.end());
    int i = 0, j = n-1;
    if (v[j] == 0) return true;
    ll y = v[i], z = x - v[j];
    while (j - i > 1) {
        if (z < y) z += x - v[--j];
        else y += v[++i];
    }
    if ((y == z) && (y <= k)) return true;
    return false;
}

int main() {
    input();
    sq = sqrt(sum);
    for (int i = 1; i <= sq; i++) {
        if (sum % i == 0) {
            if (judge(sum / i)) {
                cout << sum / i << endl;
                return 0;
            }
        }
    }
    for (int i = sq; i > 0; i--) {
        if (sum % i == 0) {
            if (judge(i)) {
                cout << i << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define endl "\n"
#define ff first
#define ss second
#define PB push_back
#define MP make_pair
#define ll long long
#define llu unsigned long long
#define MAX(a, b)  (((a) > (b)) ? (a) : (b))
#define MIN(a, b)  (((a) < (b)) ? (a) : (b))
#define ABS(X) ((X)< 0 ? -(X): (X))
#define LCM(X, Y)  ( ( (X) / (GCD( (X)  , (Y) ))) * (Y) )
#define MEM( A,  B) memset((A), (B), sizeof(A))
#define MEM_VEC(V, FILL ) fill( V.begin(), V.end(), FILL)
#define FOR_EACH(IT, V) for (auto IT = V.begin(); IT != V.end(); IT++)
#define DEBUG_ARRAY_PRINT(A,I) cout<<"at pos "<< I <<"  value is: "<< A[I]
#define TURBO ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0)
const double EPS =1e-9 ;
const double PI = 3.1415926535897932384626433832795 ;
using namespace std ;
inline ll GCD(ll A, ll B){
      if ( B == 0 ) return A;
      return GCD( (B) ,  (A % B) );
}
inline ll POW(ll BASE, ll EXP) {
   ll RES = 1;
   for(ll I= 0; I < EXP; I++) RES *= BASE ;
   return RES;
}

inline ll BIGMOD  ( ll a, ll p, ll m ) {
   ll res = 1 % m;
   ll x = a % m;
   while ( p > 0 ) {
       if ( (p & 1) > 0 ) res = ( res * x ) % m;
       x = ( x * x ) % m; p >>= 1;
   }
   return res;
}
inline void FILE_HANDLE( ){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

}

int main()
{
            //FILE_HANDLE() ;
            set <int> st;
            int t ;
            cin >> t ;
            for(int i = 0 ; i < t ; i++) 
            {
                  int temp ;
                  cin >> temp ;
                  st.insert(temp) ;
            }
            if(st.size() != t) cout <<"NO\n";
            else cout <<"YES\n";
}



Measured memory_bytes: 12988
def b165(x):

    ans = 0
    manycount = 100
    for i in range(10000000):
        if manycount >= x:
            break
        else:
            ans += 1
            manycount += manycount//100

    return ans

def main():
    x = int(input())
    print(b165(x))

if __name__ == '__main__':
    main()

Measured memory_bytes: 9180
#include<bits/stdc++.h>
 #include <ext/pb_ds/tree_policy.hpp>
 #include <ext/pb_ds/assoc_container.hpp>
 #include<chrono>
 using namespace std;
 using namespace std::chrono;      
 using namespace __gnu_pbds; 
 #define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 #define fi         first
 #define se         second
 #define int         long long 
 #define pb         push_back
 #define emp        emplace_back
 #define vv(x)      vector<x>
 #define mp(x,y)    map<x,y>
 #define dq(x)      deque<x>
 #define pql(x)     priority_queue<x>
 #define pqs(x)     priority_queue<x,vv(x),greater<x> >
 #define M          163577857
 #define forf(i,a,b) for(int i=a;i<b;i++)
 #define it(x)      x::iterator
 #define ll         long long 
 #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
 #define time__(d)  for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
 #define vii        vector<int>
 #define big        3e18
 #define sm         -1e9
 #define mkr        make_pair
 #define vpi        vector<pair<int,int> >
 #define pii        pair<int,int>
 #define rng        500005
 #define sz(x)      (int)x.size()
 #define rv(x)      reverse(x.begin(),x.end())
 #define out(x)     cout<<x.fi<<" "<<x.se<<endl;

 typedef tree<pii, null_type, less<pii>, rb_tree_tag,  
            tree_order_statistics_node_update>  odst; 


void pr_init()
{
   
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
   
    #endif
}



void solve()
{
 // int n;
 // cin >> n ;
 // int a[n+1];

 // forf(i,1,n+1) cin >> a[i];

 // map<int,int>mp;
 
 // int an =0;
 // for(int i=1;i<=n;i++)
 // {
 //   an += mp[i-a[i]];
 //   mp[a[i]+i]++;
 // }

 // cout<<an<<endl;
 
  int n,m;
  cin >> n >> m;

  int mk[n+1],h[n+1];
  for(int i=1;i<=n;i++)
    mk[i]=1;

  for(int i=1;i<=n;i++) cin >> h[i];

  forf(j,0,m)
  {
    int u,v;
    cin >> u >> v;
    if(h[u] > h[v]) mk[v]=0;
    else if(h[v]>h[u]) mk[u]=0;
    else mk[u] = mk[v] = 0;

  }

  int an=0;
  for(int i=1;i<=n;i++)
    if(mk[i]) an++;

  cout<<an<<endl;



}

int32_t main()
{
  pr_init();
  fastio;
  
  auto start = high_resolution_clock::now(); 
 
  solve();
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
  
    // cout << "Time taken by function: "
    //      << duration.count() << " microseconds" << endl; 

 }

Measured memory_bytes: 5168
#	!/usr/bin/env python3
#	encoding: UTF-8
#	Modified: <26/May/2019 06:05:50 PM>


#	✪ H4WK3yE乡
#	Mohd. Farhan Tahir
#	Indian Institute Of Information Technology (IIIT), Gwalior


import sys


def get_array(): return list(map(int, sys.stdin.readline().split()))


def get_ints(): return map(int, sys.stdin.readline().split())


def input(): return sys.stdin.readline().strip()


def main():
    a, p = get_ints()
    p += a * 3
    print(p // 2)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
const int INF = 100100100;
using namespace std;

int main()
{
  int N, M;
  unsigned int a[31];
  unsigned int like=0xffffffff;
  int res = 0;
  cin >> N >> M;

  rep(i,N){
    int k;
    cin >> k;
    a[i] = 0;
    rep(j, k){
      unsigned int aa;
      cin >> aa;
      a[i] |= 1 << (aa-1);
    }
  }

  rep(i,N){
    like &= a[i];
  }

  rep(i,M){
    res += like & 1;
    like = like >> 1;
  }

  cout << res << endl;
}

Measured memory_bytes: 256
const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = input.trim().split('\n');

while (line = lines.shift()) {
	const [n, max] = line.split(' ').map(Number);
	if (n === 0 && max === 0) {break;}
	let prices = lines.shift().split(' ').map(Number);
	let maxPrice = 0;

	for (let i = 0; i < n; i++) {
		for (let j = 0; j < n; j++) {
			if (i === j) continue;

			var sum = prices[i] + prices[j]; 
			if (sum > max) continue;
			maxPrice = Math.max(maxPrice, sum);
		}
	}

	console.log(maxPrice === 0 ? 'NONE': maxPrice);
}


Measured memory_bytes: 18436
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-12;
constexpr double pi=3.14159265358979323846264338;
//int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
int n;
signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    cin>>n;
    map<P,int>mp,mp2;
    int f=0;
    rep(i,n){
        int x,y;
        cin>>x>>y;
        if(x==0&&y==0){
            f++;
            continue;
        }
        int g=gcd(abs(x),abs(y));
        x/=g,y/=g;
        mp[{x,y}]++;
        while(x<=0||y<0){
            swap(x,y);
            x=-x;
        }
        mp2[{x,y}]++;
    }
    int ans=1;
    for(pair<P,int>hoge:mp2){
        int x=hoge.fi.fi,y=hoge.fi.se;
        vector<P>v;
        rep(i,4){
            v.pb({x,y});
            swap(x,y);
            x=-x;
        }
        int res=0;
        res++;
        rep(i,4){
            res+=modpow(2,mp[v[i]])+mod-1;
            res%=mod;
        }
        rep(i,2){
            res+=(modpow(2,mp[v[i]])+mod-1)%mod*(modpow(2,mp[v[i+2]])+mod-1)%mod;
            res%=mod;
        }
        ans*=res;
        ans%=mod;
    }
    cout<<(ans-1+f+mod)%mod<<endl;
    return 0;
}


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

const int N = 1e9 + 100;
const int M = 1e5 + 100;
const int MOD = 1e9 + 7;

int n, m;
int a[M];

struct Matrix {
	int x[3][3];

	void reset() {
		std::memset(x, 0, sizeof(x));
	}

	void setI() {
		std::memset(x, 0, sizeof(x));
		x[0][0] = x[1][1] = x[2][2] = 1;
	}

	void add(int r, int c, int delta) {
		x[r][c] += delta;
	}

	friend Matrix operator * (const Matrix &a, const Matrix &b) {
		Matrix result;
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				result.x[i][j] = 0;
				for (int k = 0; k < 3; k++) {
					result.x[i][j] += (long long)a.x[i][k] * b.x[k][j] % MOD;
					result.x[i][j] %= MOD;
				}
			}
		}
		return result;
	}

	friend Matrix operator ^ (Matrix a, int b) {
		Matrix result;
		result.reset();
		for (int i = 0; i < 3; i++) {
			result.x[i][i] = 1;
		}
		for ( ; b; b >>= 1) {
			if (b & 1) {
				result = result * a;
			}
			a = a * a;
		}
		return result;
	}
};

void init() {
	std::cin >> n >> m;
	for (int i = 1; i <= m; i++) {
		scanf("%d", &a[i]);
	}
}

void work() {
	static Matrix trans[2];
	static Matrix mat;

	mat.setI();
	trans[0].reset();
	trans[1].reset();

	// 0
	// empty
	trans[0].add(0, 0, 1);
	trans[0].add(1, 1, 1);
	trans[0].add(2, 2, 1);
	// cut
	trans[0].add(2, 0, 1);
	// cut - ball
	trans[0].add(2, 1, 2);
	// cut - ball - ball
	trans[0].add(2, 2, 1);
	// ball
	trans[0].add(0, 1, 2);
	trans[0].add(1, 2, 1);
	// ball - ball
	trans[0].add(0, 2, 1);

	// 1
	// empty
	trans[1].add(0, 0, 1);
	trans[1].add(1, 1, 1);
	trans[1].add(2, 2, 1);
	// ball
	trans[1].add(0, 1, 2);
	trans[1].add(1, 2, 1);
	// ball - ball
	trans[1].add(0, 2, 1);

	int cur = 1;
	for (int i = 1; i <= m; i++) {
		mat = mat * (trans[0] ^ (a[i] - cur));
		mat = mat * trans[1];
		cur = a[i] + 1;
	}
	mat = mat * (trans[0] ^ (n - cur));

	long long answer = 1LL * mat.x[0][2] + 2LL * mat.x[1][2] + 1LL * mat.x[2][2];
	std::cout << answer % MOD << std::endl;
}

int main() {
	init();
	work();

	return 0;
}


Measured memory_bytes: 640
#include<cstdio>
#include<string>
#include<map>
#include<queue>
#include<iostream>
#include<algorithm>
using namespace std;
map < string, int >d;
int dx[] = { -1, 1, 4, -4 };

void
swap (string & str, int x, int nx)
{
  char t = str[x];
  str[x] = str[nx];
  str[nx] = t;
}

void
bfs (void)
{
  string sp = "01234567";
  queue < string > que;
  que.push (sp);
  d[sp] = 0;
  while (!que.empty ())
    {
      string s = que.front ();
      que.pop ();
      int x = s.find ('0');
      for (int i = 0; i < 4; i++)
	{
	  int nx = x + dx[i];
	  if (0 <= nx && nx <= 7 && !(x == 3 && nx == 4) && !(x == 4 && nx == 3))
	    {
	      string ns = s;
	      swap (ns, x, nx);
	      if (d.find (ns) == d.end ())
		{
		  d[ns] = d[s] + 1;
		  que.push (ns);
		}
	    }
	}
    }
}

int
main (void)
{
  bfs ();
  string str;
  while (getline(cin, str))
    {
      string::iterator end_it = remove(str.begin(), str.end(), ' ');
      str.erase(end_it, str.end());
      printf ("%d\n", d[str]);
    }
  return 0;
}

Measured memory_bytes: 2192
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <numeric>

using namespace std;

typedef pair<long long, long long> pl;

long long N, M, k, a, b, c, d, e, H, W;
long long A[200000] = {};
long long B[2][10000] = {};
bool f;
bool ff;
string S;
set <long long>sll;
pl buf;
vector <long long>vl;

struct ST
{
	long long total;
	long long aki;
	long long itta;
};

vector <ST> vst;
ST st;

double fl, fll;


int main() {

	cin >> N >> k;
	fl = 0;
	fll = (double)1 / N;
	
	A[0] = 1;
	for (int i = 1; i < 100; i++) {
		A[i] = A[i - 1] * 2;
	}
	
	for (int i = 1; i <= N; i++) {
		a = 0;
		b = i;
		while (true) {
			if (b >= k) {
				fl += fll / (double)A[a];
				break;
			}
			else {
				a++;
				b *= 2;
			}
		}

	}

	
	printf("%.12lf\n", fl);

	return 0;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void){
 int a,b,d=0,i;
 char c[12];
 scanf("%d%d",&a,&b);
 scanf("%s",c);
 for(i=0;i<strlen(c);i++){
  if(i==a){
   if(c[i]=='-') d++;
  }else{
   if(c[i]>='0' && c[i]<='9') d++;
  }
 }
 puts(d==a+b+1?"Yes":"No");
 return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3
import sys

def s(points, k, l):
    np = list(map(lambda arg:  k*arg[0] + l*arg[1], points))
    return abs(max(np)-min(np))

def solve(N: int, x: "List[int]", y: "List[int]"):
    points = list(zip(x, y))
    print(max([
            s(points, +1, +1),
            s(points, -1, -1),
            s(points, +1, -1),            
            s(points, -1, +1),            
    ]))
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    x = [int()] * (N)  # type: "List[int]"
    y = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, x, y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 46996
#include <iostream>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <sstream>
#include <numeric>
#include <iomanip>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>

///////////////////////////////////////////////////////////////
// namespace
///////////////////////////////////////////////////////////////
using namespace std;
// namespace mp = boost::multiprecision;

///////////////////////////////////////////////////////////////
// types
///////////////////////////////////////////////////////////////
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
// using mpi = mp::cpp_int;
// using mpf = mp::number<mp::cpp_dec_float<1024>>;

void sieve(vector<bool> &is_prime) {  // O(n log log n)
    ll n = is_prime.size();
    for (ll i = 0; i < n; ++i) is_prime[i] = true;
    is_prime[0] = is_prime[1] = false;
    for (ll i = 0; i < n; ++i) {
        if (!is_prime[i]) continue;
        for (ll j = 2 * i; j < n; j += i) is_prime[j] = false;
    }
    for (ll i = 2; i < n; ++i) {
        if (!is_prime[i]) continue;
        for (ll j = i; j < n; j *= i) {
            is_prime[j] = true;
        }
    }
}

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

int main() {
    ll N; cin >> N;
    if (N == 1) {
        cout << 0 << endl;
        return 0;
    }
    // vector<bool> is_prime(5e6, false);
    // sieve(is_prime);
    // ll ans = 0;
    // for (int i = 2; i < 5e6; ++i) {
    //     if (N == 1) break;
    //     if (i > 5e6) break;
    //     if (!is_prime[i]) continue;
    //     if (N % i == 0) {
    //         cout << "* " << i  << " " << N / i << endl;
    //         N /= i;
    //         ans++;
    //     }
    // }
    // if (ans == 0) cout << 1 << endl;
    // else cout << ans << endl;
    auto m = prime_factor(N);
    ll ans = 0;
    for(auto &kv: m) {
        int i = 1;
        while (i <= kv.second) {
            ans++;
            kv.second -= i;
            ++i;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>

int main(void){
	double r, p, are, circ ;
	scanf("%lf", &r);
	p = 3.141592653589;
	are = 1.0*r*r*p ;
	circ = 2*r*p ;
	printf("%f %f\n", are, circ);
	
    return 0;
}

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

int main() {

    int N,K,X,Y;
    cin >> N >> K >> X >> Y;
    
    int syukuhakuhi = 0;
    
    for(int i=0;i<N;i++){
        if(i<K){
            syukuhakuhi += X;
        }
        else{
            syukuhakuhi += Y;
        }
    }
    
    cout << syukuhakuhi << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;
const int MOD = 1000000009;
const double pi = acos(-1);

int main() {
    int N; cin >> N;
    vector<P> red(N),blue(N);
    REP(i,N) cin >> red[i].second >> red[i].first;
    REP(i,N) cin >> blue[i].first >> blue[i].second;
    sort(red.begin(),red.end());
    reverse(red.begin(),red.end());
    sort(blue.begin(),blue.end());
    vector<bool> seen(N,false);
    REP(i,N) {
        int c = blue[i].first;
        int d = blue[i].second;
        REP(j,N) {
            int a = red[j].second;
            int b = red[j].first;
            if(seen[j]) continue;
            if(a < c && b < d) {
                seen[j] = true;
                break;
            }
        }
    }
    int ans = 0;
    REP(i,N) ans += seen[i];
    cout << ans << endl;
}

Measured memory_bytes: 3624
fun main() {
    val (n, k) = readInts()
    val prefix = MutableList(n + 1) { 0L }
    val suffix = MutableList(n + 1) { 0L }

    (0..n).forEach { num ->
        prefix[num] = num + if (num > 0) prefix[num - 1] else 0
        suffix[n - num] = n - num + if (num > 0) suffix[n - num + 1] else 0
    }
    val mod = 1000000007L
    var ans = 0L
    for (i in k..(n + 1)) ans = (ans + suffix[n - i + 1] - prefix[i - 1] + 1) % mod
    println(ans)
}

// Input Reader
private fun readLn() = readLine()!!

private fun readStrings() = readLn().trim().split(" ")
private fun readInts() = readStrings().map { it.toInt() }


Measured memory_bytes: 49128
using System;

namespace ABC112_a
{
    class Program
    {
        static void Main(string[] args)
        {
           
            string[] array = Console.ReadLine().Split(' ');
            int a = int.Parse(array[0]);
            if (a == 1)
            {
                Console.WriteLine("Hello World");
            }
            else
            {
                int[] d = new int[2];
                int c = 0;
                for (int i = 0; i < d.Length; i++)
                {
                   d[i] = int.Parse(Console.ReadLine());
                     c += d[i]; 
                }
                
                Console.WriteLine("{0}",c);
            }          
        }
            
    }
}


Measured memory_bytes: 13268
import math
A, B, H, M = map(int, input().split())

hour_rad = (60 * H + M) / 720 * (2 * math.pi)
minute_rad = (M / 60) * (2 * math.pi)
theta = hour_rad - minute_rad

res = math.sqrt(A**2 + B**2 - 2 * A*B*math.cos(theta))
print(res)


Measured memory_bytes: 62460
arr = Array.new
while line = $stdin.gets
  arr << line.chomp.split
end

# [["3", "2"], ["2"], ["1", "3"], ["1"], ["3"]]

list = Array.new(arr[0][0].to_i,0)  #人数分の入れ物を作る

arr.shift # 破壊的なメソッドなので
okashimotteru = arr.each_slice(2).map(&:last) # [["1", "3"], ["3"]]

# nilの要素であるものを返す


okashimotteru.each do |item|
    item.each do |num|
        list[num.to_i-1] += 1
    end
end

puts list.count{|element| element.zero? }

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

int main() {
  long long N,D;
  cin >> N >> D;
  D *= D;
  
  long long p,q;
  long long ans = 0;
  
  for(long long i=0;i<N;i++){
    cin >> p >> q; 
    if(p*p + q*q <= D){
      ans++;
    }
  }
  
  cout << ans << endl;
  
}


Measured memory_bytes: 3620
N = gets.to_i
h = Hash.new(0)

(0..N-1).each { |i|
  s = gets.chomp
  h[s.to_sym] += 1
}

max = h.values.max
result = h.sort.select { |k, v| v == max}

result.each { |k,v|
  puts k
}

# p h.sort.max{ |x, y|
#   x[1] <=> y[1]
# }





Measured memory_bytes: 78384
#include<iostream>
#include<vector>

int main(){
	long long answer=1;
	long long mod= 1000000007;

	int n;
	std::vector<int> tList;
	std::vector<int> aList;

	std::vector<bool> isNewT;
	std::vector<bool> isNewA;

	std::cin>>n;

	tList.resize(n);
	aList.resize(n);
	isNewT.resize(n, false);
	isNewA.resize(n, false);

	isNewT[0]= true;
	isNewA[n-1]= true;

	for(int i=0; i<n; i++)
		std::cin>>tList[i];
	for(int i=0; i<n; i++)
		std::cin>>aList[i];

	for(int i=1; i<n; i++)
		if(tList[i-1]<tList[i])
			isNewT[i]=true;

	for(int i=1; i<n; i++)
		if(aList[n-1-i]>aList[n-i])
			isNewA[n-1-i]=true;

	for(int i=0; i<n; i++){
		if(isNewT[i] && isNewA[i]){
			if(tList[i]!=aList[i]){
				answer=0;
				break;
			}
		}
	
		if(isNewT[i] && !isNewA[i]){
			if(tList[i]> aList[i]){
				answer=0;
				break;
			}
		}

		if(!isNewT[i] && isNewA[i]){
			if(tList[i]< aList[i]){
				answer=0;
				break;
			}
		}

		if(!isNewT[i] && !isNewA[i]){
			answer*= std::min(tList[i], aList[i]);
			answer= answer% mod;
		}

	}


	std::cout<<answer<<std::endl;

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
vector<string> v;
int main(){
  //freopen("input.txt", "r", stdin);
  string s;
  int n, l;
  cin >> n >> l;
  while(n--){
    cin >> s;
    v.push_back(s);
  }
  sort(v.begin(), v.end());
  for(int i = 0; i < v.size(); i++) cout << v[i];
  printf("\n");
  return 0;
}


Measured memory_bytes: 256
// B - Multiplication 2
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
	int n; cin>>n;
	ll inf = 1e18;
	ll ans = 1;
	bool ng = false;
	while(n--){
		ll a; cin>>a;
		if(a == 0){ puts("0"); return 0; }
		if(ng || inf/a < ans) ng = true;
		ans *= a;
	}
	if(ng) puts("-1");
	else cout<< ans <<endl;
}


Measured memory_bytes: 3632
while True:
    try:
        n = int(input())
        cnt = 0
        for i in range(10):
            for j in range(10):
                for k in range(10):
                    for l in range(10):
                        if i+j+k+l == n:
                            cnt += 1
        print(cnt)
    except:
        break

Measured memory_bytes: 7532
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;


int v[100];
vector<int> g[100];

inline int dfs(int x){
	int ans = 0;
	for(int i = 0,l = g[x].size(); i < l; i++){
		int y = g[x][i];
		v[x]++;
		if(!v[y]){
			ans = max(ans,dfs(y)+1);
		}
		v[x]--;
	}
	return ans;
}

int main(){
	int n;
	while(scanf("%d",&n),n){
		int M = 0;
		for(int i = 0; i < n; i++){
			int a,b;
			scanf("%d%d",&a,&b);
			M = max(M,b);
			a--;b--;
			g[a].push_back(b);
			g[b].push_back(a);
		}
		
		int ans = 0,size = 100;//sizeは嘘枝刈り用
		
		for(int i = 0; i < M; i++){
			size = min((int)g[i].size(),size);
		}
		size += 3;//2だとWAすることを確認済み
		
		for(int i = 0; i < M; i++){
			if(g[i].size()<=size)ans = max(ans,dfs(i)+1);
		}
		
		printf("%d\n",ans);
		
		for(int i = 0; i < M; i++){
			g[i].clear();
		}
	}
	return 0;
}


Measured memory_bytes: 2776
import std.algorithm, std.array, std.container, std.range, std.bitmanip;
import std.numeric, std.math, std.bigint, std.random, core.bitop;
import std.string, std.conv, std.stdio, std.typecons;

void main()
{
  while (true) {
    auto rd = readln.split.map!(to!int);
    auto h = rd[0], w = rd[1];

    if (h == 0 && w == 0) break;

    foreach (i; 0..h) {
      foreach (j; 0..w)
        write((i + j) % 2 == 0 ? '#' : '.');
      writeln;
    }

    writeln;
  }
}

Measured memory_bytes: 2484
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
template <class T1, class T2>void print(T1 a[], T2 n) { for (T2 i = 0; i < n; i++) { cout << a[i] << " ";} cout << endl;}
template <class T1, class T2>void print(vector<T1> a, T2 n) { for (T2 i = 0; i < n; i++) { cout << a[i] << " "; } cout << endl;}



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



  int n;
  cin >> n;
  int a[n + 1];
  for (int i = 0; i <= n; i++)
    a[i] = 0;

  for (int i = 0; i < n - 1; i++) {
    int x;
    cin >> x;
    a[x]++;
  }
  for (int i = 1; i <= n; i++) {
    cout << a[i] << "\n";
  }
}

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

// reverse は O(Q) で遅い
// 末尾への追加 O(1)
// 先頭への追加 O(|s|) 遅い

// queue 一方から入れて他方から出す
// deque 両側から入れて出せる

// c++ の swap は計算量 O(1)

int main(){

string s; cin >> s;
int q; cin >> q;
string r;

rep(i,q){
    int t; cin >> t;
    if(t==1){
        swap(s,r);
    }
    else{
        int f; char c;
        cin >> f >> c;
        if(f==1) r += c;
        else s += c;
    }
}
reverse (r.begin(), r.end());
r += s;
cout << r << endl;

/* 以下は間に合わないやつ
rep(i,q){
    int t; cin >> t;
    if(t==1) reverse (s.begin(), s.end());
    if (t==2){

        int f; cin >> f; char c; cin >> c;
        if (f==1) reverse (s.begin(), s.end());
        s.push_back(c);
        if (f==1) reverse (s.begin(), s.end());
    }
}


cout << s << endl;
*/

}

Measured memory_bytes: 1128
#include <bits/stdc++.h>
#include <tuple>
#include <iterator>
using namespace std;
using ll = long long;

int main()
{
  int n;
  cin >> n;
  vector<int> c(n), s(n), f(n);
  for (int i = 0; i < n - 1; ++i)
    cin >> c[i] >> s[i] >> f[i];
  for (int i = 0; i < n - 1; ++i)
  {
    int t = s[i];
    t += c[i];
    for (int j = i + 1; j < n - 1; ++j)
    {
      if (t < s[j])
      {
        t = s[j];
        t += c[j];
      }
      else if ((t - s[j]) % f[j] == 0)
      {
        t += c[j];
      }
      else
      {
        t += f[j] - (t - s[j]) % f[j];
        t += c[j];
      }
    }
    cout << t << endl;
  }
  cout << 0 << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int x,y;
    cin >> x >> y;
    bool ans = false;
    for (int i=0; i*2<=y; i++) {
        for (int j=0; j*4<=y; j++) {
            if (i*2 + j*4 > y) continue;
            if (i*2 + j*4 == y && i+j == x) ans = true;
        }
    }

    cout << (ans? "Yes" : "No") << endl;
}

Measured memory_bytes: 3128
use proconio::input;

fn main() {
    input! {
        n: usize
    }

    let v = factor(n);

    let mut count = 0;
    for &(_,m) in v.iter() {
        let mut rest = m;
        for i in 1..64 {
            if rest < i {
                break;
            }
            count += 1;
            rest -= i;
        }
    }

    println!("{}",count)
}

fn factor(n: usize) -> Vec<(usize, usize)> {
    let mut n = n;
    let mut ret = vec![];
    let ps = primes((n as f64).sqrt() as usize + 2);
    for p in ps {
        let mut cnt = 0;
        while n % p == 0 {
            n /= p;
            cnt += 1;
        }
        if cnt > 0 {
            ret.push((p, cnt));
        }
    }
    if n > 1 {
        ret.push((n, 1));
    }
    ret
}

fn primes(n: usize) -> Vec<usize> {
    let mut tbl = vec![true; n];
    let mut ps = vec![];
    tbl[0] = false;
    tbl[1] = false;
    for i in 2..n {
        if tbl[i] {
            ps.push(i);
            let mut j = i + i;
            while j < n {
                tbl[j] = false;
                j += i;
            }
        }
    }
    ps
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    double A, B;
    cin >> A >> B;
    for (int ans = 1; ans < 1000000; ans++) {
        int a = ans * 0.08, b = ans * 0.1;
        if ((A == a) && (B == b)) {
            cout << ans << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

    int main(){
        int X,A,B,temp=0,save;
        scanf("%d",&X);
        scanf("%d",&A);
        scanf("%d",&B);

        if(X>=(A+B) && X<=10000 && B<=1000 && A>=1){

        temp=X-A;
        save=temp%B;
        printf("%d",save);
     }
     return 0;
    }


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int X[]={1,2,1,-1,-2,-1};
  int Y[]={1,0,-1,-1,0,1};
  int w,h,i,j,k,nx,ny,s,t,r,x[10000],y[10000],d[110][210]={2};
  scanf("%d %d",&w,&h);
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++)scanf("%d",&d[i][j*2+i%2]);
  }
  x[0]=y[0]=t=s=0;
  for(r=1;r-t;t++){
    for(i=0;i<6;i++){
      nx=x[t]+X[i];
      ny=y[t]+Y[i];
      if(nx<0||ny<0||h+1<ny||w*2+4<nx)continue;
      if(d[ny][nx])continue;
      d[ny][nx]=2;
      x[r  ]=nx;
      y[r++]=ny;
    }
  }
  /*for(i=0;i<h+2;i++){
    for(j=0;j<w*2+4;j++)printf("%d",d[i][j]);printf("\n");
    }//*/
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      if(d[i][j*2+i%2]-1)continue;
      for(k=0;k<6;k++){
	if(d[i+Y[k]][j*2+i%2+X[k]]==2)s++;
      }
    }
  }
  printf("%d\n",s);
  return 0;
}
  

Measured memory_bytes: 776
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

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

  FOR(i, n, 1000 + 1) {
    string s = to_string(i);

    bool f = true;
    for(const auto& c: s) {
      if(c != s[0]) f = false;
    }

    if(f){
      cout << i << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 256
s = input()
K = int(input())
n = len(s)

x = dict()
y = []
for i in range(5000):
    y.append([])

#O(N^2)
"""
for i in range(n):
    t = ""
    for j in range(i,n):
        t += s[j]
        if len(t) in x:
            if t not in y[len(t)]:
                y[len(t)].append(t)
        else:
            x[len(t)] = t
            y[len(t)].append(t)
X = []
for i in range(5000):
    if len(y[i]) == 0:
        continue
    y[i].sort()
    for j in range(len(y[i])):
        X.append(y[i][j])
"""
for i in range(n):
    t = ""
    for j in range(i,i+1+K):
        if j > (n-1):
            break
        t += s[j]
        x[t] = t
X = []
for i in x:
    X.append(i)
X.sort()


#print(X)
print(X[K-1])

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

typedef long long ll;
map<int,int> cnt;

int main() {
    int n; cin >> n;
    while (n--) {
        int x; cin >> x;
        cnt[x]++;
    }
    ll ans = 0;
    for (auto xy : cnt) {
        int x,y; tie(x,y) = xy;
        if (y > x) ans += y-x;
        else if (y < x) ans += y;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4736
#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define N1 200005
#define ll long long
#define inf 0x3f3f3f3f
#define mod 998244353
using namespace std;


int n,Q;
ll val[10][N1],m10[N1];

struct SEG{
ll sum[N1<<2]; int tag[N1<<2];
void pushup(int len,int rt){ sum[rt]=(sum[rt<<1]*m10[len]%mod+sum[rt<<1|1])%mod; }
void pushdown(int l,int r,int mid,int rt)
{
	if(!tag[rt]) return;
	int w=tag[rt];
	sum[rt<<1]=val[w][mid-l+1]; tag[rt<<1]=w;
	sum[rt<<1|1]=val[w][r-mid]; tag[rt<<1|1]=w;
	tag[rt]=0;
}
void upd(int L,int R,int l,int r,int rt,int w)
{
	if(L<=l&&r<=R){ sum[rt]=val[w][r-l+1]; tag[rt]=w; return;}
	int mid=(l+r)>>1;
	pushdown(l,r,mid,rt);
	if(L<=mid) upd(L,R,l,mid,rt<<1,w);
	if(R>mid) upd(L,R,mid+1,r,rt<<1|1,w);
	pushup(r-mid,rt);
}
/*ll query(int L,int R,int l,int r,int rt)
{
	if(L<=l&&r<=R) return sum[rt];
	int mid=(l+r)>>1; ll ans=0;
	if(L<=mid) ans=query(L,R,l,mid,rt<<1)*m10[r-mid]%mod;
	if(R>mid) ans=ans+query(L,R,mid+1,r,rt<<1|1);
	pushup(mid-l+1,rt);
	return ans%mod;
}*/
}s;

void pro()
{
	m10[0]=1;
	for(int i=1;i<=n;i++)
		m10[i]=m10[i-1]*10%mod;
	for(int j=1;j<=9;j++)
	{
		val[j][0]=0;
		for(int i=1;i<=n;i++) 
		{
			val[j][i]=(val[j][i-1]*10%mod+j)%mod;
		}
	}
	s.upd(1,n,1,n,1,1);
}

int main()
{
//	freopen("e.txt","r",stdin);
	scanf("%d%d",&n,&Q);
	pro();
	int l,r,w;
	for(int i=1;i<=Q;i++)
	{
		scanf("%d%d%d",&l,&r,&w);
		s.upd(l,r,1,n,1,w);
		printf("%lld\n",s.sum[1]);
	}
	return 0;
}



Measured memory_bytes: 25012
#include <bits/stdc++.h>
using namespace std;
long long ans=0;
void dfs(string &s, int i, long long sum, long long mem){
    
    if(i==s.size()){
        ans+=sum+mem;
        return ;
    }
    if(i==0) dfs(s, i+1, sum+mem, (s[i]-'0'));
    else{
    dfs(s,i+1,sum, mem*10+(s[i]-'0'));
    dfs(s, i+1, sum+mem, (s[i]-'0'));
    }
    return ;
}
int main(void){
    string s; cin>>s;
    dfs(s,0,0,0);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#define first f
#define second s
#define ll long long
#define mp make_pair
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#include <bits/stdc++.h>
#define pii pair<string,int>
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
const int maxn=2e5+5;
const int MOD=1e9+7;
const double PI=acos(-1);
const double e=2.718281828459;

ll fac[maxn],inv[maxn];

ll qpow(ll x,int p)
{
    ll ans=1;
    while(p){
        if(p&1){
            ans=ans*x%MOD;
        }
        x=x*x%MOD;
        p>>=1;
    }
    return ans;
}
void init(int x)
{
    fac[0]=1;
    for(int i=1;i<=x;i++){
        fac[i]=fac[i-1]*i%MOD;
    }
    inv[x]=qpow(fac[x],MOD-2);
    for(int i=x-1;i>=0;i--){
        inv[i]=inv[i+1]*(i+1)%MOD;
    }
}
int main()
{
    ll n,a,b;
    scanf("%lld%lld%lld",&n,&a,&b);
    ll sum=(qpow(2,n)-1+MOD)%MOD;
    init(b);
    if(a<=n){
        ll num=1;
        for(int i=0;i<a;i++){
            num=num*(n-i);num%=MOD;
        }
        num=num*inv[a]%MOD;
        sum=(sum-num+MOD)%MOD;
    }
    if(b<=n){
        ll num=1;
        for(int i=0;i<b;i++){
            num=num*(n-i);num%=MOD;
        }
        num=num*inv[b]%MOD;
        sum=(sum-num+MOD)%MOD;
    }
    printf("%lld\n",sum);
    return 0;
}


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

int main()
{
    int H1,M1,H2,M2,K;
	long T;
	cin>>H1>>M1>>H2>>M2>>K;
	if(H2<H1||H2==H1&&M2<M1){
		H2=H2+24;
	}
	T=(H2-H1)*60+(M2-M1)-K;
	if(T<0){
		T=K;
	}
	cout << T;
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
	int n,c=0;
  	int *a;
  	scanf("%d",&n);
  	a = new int[n];
  	for(int i=0;i<n;i++){
    	scanf("%d",&a[i]);
    }
  	sort(a,a+n);reverse(a,a+n);
  	for(int i=0;i<n-2;i++){
      	for(int j=i+1;j<n-1;j++){
        	for(int k=j+1;k<n;k++){
            	if(a[i]>=a[j]+a[k]){break;}
              	c++;
            }
        }
    }
  	cout << c << endl;
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<int,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n,m;
	cin>>n>>m;
	vvi in(n,vi(m));
	rep(i,n)rep(j,m)cin>>in[i][j];
	vvi c(110,vi(110));
	rep(i,110)rep(j,110){
		int ma=0;
		rep(k,n)rep(l,m)ma=max(ma,in[k][l]-i*(k+1)-j*(l+1));
		c[i][109-j]=ma;
	}
	bool h=true;
	rep(i,n)rep(j,m){
		int mi=inf;
		rep(k,110)rep(l,110)mi=min(mi,(i+1)*k+(j+1)*l+c[k][109-l]);
		if(mi!=in[i][j])h=false;
	}
	
	if(!h)cout<<"Impossible"<<endl;
	else{
		cout<<"Possible"<<endl;
		cout<<"220 "<<218+110*110<<endl;
		rep(i,109)cout<<1+i<<" "<<2+i<<" X"<<endl;
		rep(i,109)cout<<219-i<<" "<<220-i<<" Y"<<endl;
		rep(i,110)rep(j,110){
			cout<<1+i<<" "<<111+j<<" "<<c[i][j]<<endl;
		}
		cout<<"1 220"<<endl;
	}
}









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

typedef long long ll;

const ll MOD = 1e9 + 7;

ll K, N;
vector<ll> Inv, Fact, InvFact;

void init() {
  ll limit = 3 * N;
  Inv.resize(limit);
  Fact.resize(limit);
  InvFact.resize(limit);
  Inv[1] = Fact[0] = Fact[1] = InvFact[0] = InvFact[1] = 1;
  for (ll i = 2; i < limit; ++i) {
    Inv[i] = MOD - (MOD / i) * Inv[MOD % i] % MOD;
    Fact[i] = i * Fact[i - 1] % MOD;
    InvFact[i] = Inv[i] * InvFact[i - 1] % MOD;
  }
}
ll calc(ll n, ll sep) {
  if (n < 0) return 0;
  return Fact[n + (sep - 1)] * InvFact[n] % MOD * InvFact[sep - 1] % MOD;
}
int main() {
  cin >> N >> K;
  init();
  for (ll i = 1; i <= K; ++i) {
    cout << calc(K - i, i) * calc(N - K - (i - 1), i + 1) % MOD << endl;
  }
  return 0;
}


Measured memory_bytes: 384
//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;

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

//main code

int main(int argc, char const* argv[])
{
    string s;
    cin >> s;
    VL alf(26,0);
    for (int i = 0; i < s.size(); i++) {
        alf[s[i] - 'a']++;
    }
    if (s.size() < 26) {
        for (int i = 0; i < 26; i++) {
            if (alf[i] == 0) {
                cout << s + char('a' + i) << endl;
                return 0;
            }
        }
    }
    else {
        string cp(s);
        if (!next_permutation(s.begin(), s.end())) {
            cout << -1 << endl;
            return 0;
        }
        for (int i = 0; i < s.size(); i++) {
            if (s[i] == cp[i]) {
                continue;
            }
            s.erase(s.begin() + i + 1, s.end());
            break;
        }
        cout << s << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N; cin >> N;
    vector<int> V1(N), V2(N);
    ll cnt = 0;
    rep(i,N) {
        cin >> V1.at(i) >> V2.at(i);
        if (V1[i] == V2[i]) cnt++; else cnt = 0;
        if (cnt >= 3) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3628
'use strict';
        (function(stdin) {
            var inputs = stdin
            .toString()
            .trim()
            .split('\n');

            var sorted = inputs
            .map(Number)
            .sort(function(a,b){
                return b - a;
            })
            .slice(0,3)
            .join('\n');
            console.log(sorted);
        }(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 7640
#include <algorithm>
#include <cstdio>
typedef long long ll; 
ll k[100005], b[100005]; 
int arr[100005], n, m;
inline void work(int x, int y)
{
	b[x] += x; 
	k[x]--; 
	k[y]++; 
	if (x < y)
	{
		b[1] += y - x; 
		b[y] -= x; 
	}
	else
	{
		b[1] += y; 
		b[y] += m - x; 
		k[1]--; 
	}
}
int main()
{
	// freopen("ARC077-E.in", "r", stdin); 
	scanf("%d%d", &n, &m); 
	for (int i = 0; i < n; i++)
		scanf("%d", arr + i); 
	for (int i = 0; i < n - 1; i++)
		work(arr[i] + 1, arr[i + 1] + 1); 
	ll ans = 1e18; 
	for (int i = 1; i <= m; i++)
	{
		k[i] += k[i - 1]; 
		b[i] += b[i - 1]; 
		ans = std::min(ans, k[i] * i + b[i]); 
	}
	printf("%lld\n", ans);
	return 0; 
}


Measured memory_bytes: 2048
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>

using namespace std;

int main(){
    int A,B;
    cin >> A >> B;
    
    while(A != B){
        if (A < B) {
            swap(A,B);
        }
        A = A - B;
    }
    cout << A << endl;
    return 0;
}

Measured memory_bytes: 1164
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        if(str.equals("SUN")){
            System.out.println(7);
        }else if(str.equals("MON")){
            System.out.println(6);
        }else if(str.equals("TUE")){
            System.out.println(5);
        }else if(str.equals("WED")){
            System.out.println(4);
        }else if(str.equals("THU")){
            System.out.println(3);
        }else if(str.equals("FRI")){
            System.out.println(2);
        }else if(str.equals("SAT")){
            System.out.println(1);
        }
    }
}

Measured memory_bytes: 21716
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;

int main() {

	int N;cin>>N;
	vector<int>x(N);
	vector<int>y(N);
	for (int i = 0; i < N; i++)
	{
		cin>>x[i]>>y[i];
	}
	vector<int>order(N);
	for(int i=0;i<N;i++)order[i] = i;
	
	double ans = 0;
	int cnt = 0;
	do
	{
		double dist = 0;
		for (int i = 1; i < N; i++)
		{
			dist += sqrt(pow(x[order[i]]-x[order[i-1]],2)+ pow(y[order[i]] - y[order[i-1]], 2));
		}

		ans += dist;
		cnt++;
	}
	while(next_permutation(order.begin(), order.end()));

	cout<<fixed<<setprecision(7)<<ans/cnt<<endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)
#define MAX_MN (200000+10)

using namespace std;

typedef long long int Int;

Int fact[MAX_MN];
Int inv[MAX_MN];
Int invfact[MAX_MN];

Int comb(Int n,Int k) {
    if(!(k >= 0 && k <= n))
        return 0;

    return (((fact[n]*invfact[n-k])%MOD)*invfact[k])%MOD;
}

Int solve(Int n,Int m,Int k) {
    Int patterns = comb(n*m-2,k-2);
    Int sum = 0;
    
    for(Int d = 0;d <n;d++) {
        Int ans = ((d*(n-d)%MOD)*m%MOD)*m%MOD;
        sum = (sum + ans) % MOD;
    }
    for(Int d = 0;d < m;d++) {
        Int ans = ((d*(m-d)%MOD)*n%MOD)*n%MOD;
        sum = (sum + ans) %MOD;
    }
    
    return sum * patterns % MOD;
}

int main(void) {
    Int n,m,k;
    cin>>n>>m>>k;
    
    fact[0] = 1;
    inv[1] = 1;
    invfact[0] = 1;
    
    for(Int i = 2;i <= n*m+1;i++) {
        inv[i] = MOD - (MOD / i) * inv[MOD%i] % MOD;
    }
    for(Int i = 1;i <= n*m+1;i++) {
        fact[i] = (fact[i-1]*i) % MOD;
        invfact[i] = (invfact[i-1]*inv[i])%MOD;
    }

    cout<<solve(n,m,k)<<endl;

    return 0;
}




Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>

using namespace std;

int main(){
     int H,W;
     cin>>H>>W;
     for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            string s;
            cin>>s;
            if(s=="snuke"){
                cout<<(char)('A'+j)<<i+1<<endl;
            }
        }
     }   

    return 0;
}

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

int main() {
  int x, y;
  cin >> x >> y;
  int seq1[] = {1, 3, 5, 7, 8, 10, 12};
  int seq2[] = {4, 6, 9, 11};

#define in(a, xs) (find(xs, xs + (sizeof xs / sizeof(int)), a) < (xs + sizeof xs / sizeof(int)))

  bool ans = (in(x, seq1) && in(y, seq1)) || (in(x, seq2) && in(y, seq2));
  cout << (ans ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256