akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>
#include <stdlib.h>
#include <random>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<pii, int> p3i;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<p3i> v3i;
typedef vector<vii> vvii;
typedef vector<p3i> vp3i;
typedef long double ld;
typedef vector<ld> vld;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPD(i, n) for (int (i) = (n) - 1; (i) >= 0; (i)--)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define FORD(i,a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rv(v) reverse(all(v))
#define CL(v, val) memset((v), (val), sizeof((v)))
#define SORT(a) sort(all(a))
#define un(v) SORT(v), (v).resize(unique(all(v)) - (v).begin())
#define eps 1.0e-9
#define X first
#define Y second
#define bit(n) (1 << (n))
#define bit64(n) (ll(1) << (n))
#define sqr(x) ((x) * (x))
#define sq5(x) ((x) * (x) * (x) * (x) * (x))

const double pi = acos(-1.0);

int main(void) {
	int a, b, h, m;
	scanf("%d%d%d%d", &a, &b, &h, &m);
	int tm = h * 60 + m;
	double hd = 1.0 * tm * pi * 2 / 720;
	double md = 1.0 * m * pi * 2 / 60;

	pair<double, double> ph = mp(a * cos(hd), a * sin(hd));
	pair<double, double> pm = mp(b * cos(md), b * sin(md));

	double dist = sqrt(sqr(ph.X - pm.X) + sqr(ph.Y - pm.Y));
	printf("%.9lf\n", dist);
}


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

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

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

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

using namespace std;

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

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

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

// Problem Specific Parameter:

const int limit = 200010;
int d[limit],t[limit];

map<int,int> num;

int main(void){
	int n,m;
	cin >> n;
	rep(i,n) cin >> d[i];
	cin >> m;
	rep(i,m) cin >> t[i];

	rep(i,n) num[d[i]]++;
	bool ok = true;

	rep(i,m){
		if(num[t[i]]==0) ok = false;
		num[t[i]]--;
	}

	if(ok)
		puts("YES");
	else
		puts("NO");

	return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int MOD = 1000000007;
int INF = numeric_limits<int>::max() / 2;
 
 
signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
 
  int N;
  cin >> N;
  string S[N];
  map<string, int> mp;
  for(int i=0;i<N;i++){
    cin >> S[i];
    sort(S[i].begin(), S[i].end());
    mp[S[i]]++;
  }
  int ans = 0;
  for(auto P : mp){
    ans += P.second*(P.second-1)/2;
  }

  cout << ans << endl;
}

Measured memory_bytes: 16640
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)


void solve(long long a, long long b){
    cout << ((a+b) + 2-1) / 2  << endl;
}

int main(){

    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    solve(a, b);
    return 0;
}



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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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 n, m;
bool s[202020], t[202020];
void solve(){
	cin >> n >> m;
	for(int i = 0; i < m; i++){
		int a,b;
		cin >> a >> b;
		a--; b--;
		if(a == 0){
			s[b] = 1;
		}
		if(b == n-1){
			t[a] = 1;
		}
	}
	
	for(int i = 1; i < n; i++){
		if(s[i] && t[i]){
			cout << "POSSIBLE" << endl;
			return;
		}
	}
	cout << "IMPOSSIBLE" << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

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

typedef long long int ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define sz(x) int(x.size())
const int INF = 1001001001;
const ll mod = 998244353;
const ll INFL = 1001001001001001000;

const int M = 300005;

int op(int a, int b) {
    return max(a, b);
}
 
int e() {
    return (int) 0;
}

int main() {
    int n,k; cin >> n >> k;
    segtree<int, op, e> seg(M);
    rep(i,n) {
        int a; cin >> a;
        int x = seg.prod(max(a-k, 0), min(a+k+1, M));
        seg.set(a, x+1);
    }
    int ans = seg.prod(0, 300001);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8572
/* 
	Author: ankrypt
*/
#include <bits/stdc++.h>

using namespace std;

string S;
int cntA = 0;
int cntB = 0;
int cntC = 0;

int main()
{
	cin >> S;
	for(int i = 0; i < S.size(); i++) {
		if(S[i] == 'a') {
			cntA++;
		}
		if(S[i] == 'b') {
			cntB++;
		}
		if(S[i] == 'c') {
			cntC++;
		}
	}
	if(cntA && cntB && cntC) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}

	
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define show(x) for(auto i: x){cout << i << " ";}
#define showm(m) for(auto i: m){cout << m.x << " ";}
typedef long long ll;
typedef pair<int, int> P;


int main()
{
    int h, a;
    cin >> h >> a;
    cout << ((h - 1)/ a) + 1 << endl;
}



Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = sc.next()
    val t = sc.next()
    val a = sc.nextInt()
    val b = sc.nextInt()
    val u = sc.next()

    println("${if(s==u) a-1 else a} ${if(t==u) b-1 else b}")
}

Measured memory_bytes: 29604
#include<bits/stdc++.h>
using namespace std;
const int mod=1000000007,inv_2=(mod+1)/2;
typedef long long ll;
const int N=3010;
int f[N][N],g[N][N],a[N],b[N],n,q,pw=1,ans;

int main(){
#ifdef ONLINE_JUDGE
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#endif
	cin>>n>>q;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j)
			f[i][j]=(a[i]<a[j]);
	for(int i=1;i<=q;++i){
		int x,y;cin>>x>>y;
		for(int j=1;j<=n;++j)b[j]=j;swap(b[x],b[y]);
		for(int j=1;j<=n;++j){
			g[x][j]=(ll)(f[b[x]][b[j]]+f[x][j])*inv_2%mod;
			g[j][x]=(ll)(f[b[j]][b[x]]+f[j][x])*inv_2%mod;
			g[y][j]=(ll)(f[b[y]][b[j]]+f[y][j])*inv_2%mod;
			g[j][y]=(ll)(f[b[j]][b[y]]+f[j][y])*inv_2%mod;
		}
		for(int j=1;j<=n;++j){
			f[x][j]=g[x][j];
			f[j][x]=g[j][x];
			f[y][j]=g[y][j];
			f[j][y]=g[j][y];
		}
		pw=(pw+pw)%mod;
	}
	for(int i=1;i<=n;++i)
		for(int j=1;j<i;++j)
			ans=(ans+(ll)pw*f[i][j])%mod;
	cout<<ans<<'\n';
	return 0;
}



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

typedef long long ll;

int main(void)
{
    int N,M,a,b;
    cin >> N >> M;
    dsu d(N);

    rep(i,M){
        cin >> a >> b;
        --a;
        --b;
        d.merge(a,b);
    }

    cout << d.groups().size()-1 <<endl;
     

    return 0;
}

Measured memory_bytes: 8916
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,K,a,cnt0=0;cin>>n>>K;
  lvector positive,negative;
  rep(i,n) {
    cin>>a;
    if(a<0) negative.emplace_back(a);
    else if(a>0) positive.emplace_back(a);
    else cnt0++;
  }
  sort(ALL(positive));sort(ALL(negative));
  ll pn=positive.size(),nn=negative.size();
  ll pos_pair=pn*(pn-1)/2+nn*(nn-1)/2;
  ll zero_pair=cnt0*(pn+nn)+cnt0*(cnt0-1)/2;
  ll neg_pair=pn*nn;
  if(K<=neg_pair) {
    ll min_ok=0,max_ng=-1e18-10,tag;
    while(min_ok-max_ng>1) {
      tag=(min_ok+max_ng)/2;
      ll k=0,i=0;
      for(ll e:negative) {
        while(i<pn&&e*positive[i]>tag) i++;
        k+=pn-i; 
      }
      if(k>=K) min_ok=tag;else max_ng=tag;
    }
    print(min_ok);
  }
  else if(K<=neg_pair+zero_pair) print(0);
  else {
    reverse(ALL(negative));
    K-=neg_pair+zero_pair;
    ll min_ok=1e18+10,max_ng=0,tag=0;
    while(min_ok-max_ng>1) {
      tag=(min_ok+max_ng)/2;
      ll k=0,i=pn-1;
      for(ll j=0;j<pn;++j) {
        while(i>=0&&positive[j]*positive[i]>tag) i--;
        if(i<=j) break;
        k+=i-j;
      }
      i=nn-1;
      for(ll j=0;j<nn;++j) {
        while(i>=0&&negative[j]*negative[i]>tag) i--;
        if(i<=j) break;
        k+=i-j;
      }
      if(k>=K) min_ok=tag;else max_ng=tag;
    }
    print(min_ok);
  }
  return 0;
}

Measured memory_bytes: 2420
#include <iostream>
using namespace std;
#define INF 10000000
int main(){
    int n;
    cin >> n;
    int a;
    int max=-1*INF;
    int min = INF;
    long int sum =0;
    for(int i=0;i<n;i++){
        cin>>a;
        if(max<a)max=a;
        if(min>a)min=a;
        sum += a;
    }
    cout << min<<' '<<max<<' '<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3116
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;

class Program
{

	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
		int A = int.Parse(input[0]);
		int B = int.Parse(input[1]);
		int C = int.Parse(input[2]);

		int K = int.Parse(Console.ReadLine());

		bool success = false;
		for(int i = 0; i < K; i++)
        {
			if(A >= B)
            {
				B *= 2;
            }else if(B >= C)
            {
				C *= 2;
            }

			if (A < B && B < C)
			{
				Console.WriteLine("Yes");
				success = true;
				break;
			}
		}

		if (!success)
        {
			Console.WriteLine("No");
		}
    }
}

Measured memory_bytes: 27524
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>

#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>

#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

// type
#include <cstdint>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int x, y;
    cin >> x >> y;
    int ret = 0;
    if (x == 1) ret += 300000;
    if (y == 1) ret += 300000;
    if (x == 2) ret += 200000;
    if (y == 2) ret += 200000;
    if (x == 3) ret += 100000;
    if (y == 3) ret += 100000;
    if (x == 1 && y == 1) ret += 400000;
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 256
/******************************************
* AUTHOR : HRITIK AGGARWAL *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define vi vector<int>
#define vll vector<ll>
#define forr(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define ms(s, n) memset(s, n, sizeof(s))
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define int ll
ll po(ll a, ll x, ll m) { if (x == 0) {return 1;} ll ans = 1; ll k = 1;  while (k <= x) {if (x & k) {ans = ((ans * a) % m);} k <<= 1; a *= a; a %= m; } return ans; }
// DEKHIYE JI  WALID JO THE ABBA HAMARE WO YEH function CHHOD KR GYE THE
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n, m;
    cin >> n >> m;
    string s[n];
    forr(i, n) {
        cin >> s[i];
    }
    int dp[n + 1][m + 1] = {0};
    ms(dp, 0);
    dp[0][0] = 1;
    forr(i, n) {
        forr(j, m) {
            if (s[i][j] != '#') {
                dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % MOD;
                dp[i][j + 1] = (dp[i][j + 1] + dp[i][j]) % MOD;
            }
        }
    }
    cout << dp[n - 1][m - 1] << "\n";
    return 0;
}

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

int main() {
  int a, b, c, d, ans, ans2, ans3;
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> d;
  if (a > b) {
    ans = a - b;
  }else{ 
    ans = b - a;
  }
   if (c> b) {
    ans2 =c - b;
  }else{ 
    ans2 =b - c;
  }
     if (c> a) {
    ans3 =c - a;
  }else{ 
    ans3 =a - c;
  }
  if(ans <= d && ans2 <= d || ans3 <= d) {
    cout << "Yes";
  }else{ 
    cout << "No";
  }
}

Measured memory_bytes: 256
IDENTIFICATION DIVISION.
      PROGRAM-ID. 149A.
      DATA DIVISION.
      WORKING-STORAGE SECTION.
      01 INP PIC X(300).
      01 S 	 PIC X(100).
      01 T   PIC X(100).
      01 OUT PIC X(200).
      
      PROCEDURE DIVISION.
      ACCEPT INP.

      UNSTRING INP DELIMITED BY " "
      INTO S T.

      STRING T S DELIMITED BY " "
      INTO OUT.

      DISPLAY OUT.
      
      STOP RUN.


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF ll(1e18)
#define MOD 998244353
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define MAXN 100005

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	int n; cin>>n;
	fore(i,1,n){
		if(floor(i*1.08)==n){
			cout<<i<<'\n';
			return 0;
		}
	}
	
	cout<<":(\n";
	
	return 0;
}


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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for(ll i = 0 ; i < n; i++)

#ifdef DEBUG
#define DBG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)
#else
#define DBG(fmt, ...)
#endif

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll D, T, S;
    cin >> D >> T >> S;

    if( S * T >= D ){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3632
import java.util.*;
import java.util.stream.Collectors;


public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a=scanner.nextInt();
        int b=scanner.nextInt();
        if(a+b==15){
            System.out.println("+");
        }else if(a*b==15){
            System.out.println("*");
        }else{
            System.out.println("x");
        }

    }
}

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

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

using namespace std;
using ll = long long;
const int MOD=1e9+7;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

ll gcd(ll a, ll b){
    if(b==0)return a;
    else return gcd(b,a%b);
}
int
main(void){  
  ios_base::sync_with_stdio(false);
  cin.tie(0);

  ll a, b; cin >> a >> b;
  ll val = gcd(a,b);

  // 素因数分解したら互いに素な要素だけ抽出できる
  ll ans = 1;
  for(ll i=2; i*i<=val; i++){
    if(val%i == 0) {
      while(val%i == 0) val/=i;
      ans++;
    }
  }
  if(val != 1) ans++;
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#define TRUE 1
#define FALSE 0
int n;

int solve(int *a,int i,int m){
  int res;
  
  if(m==0) return TRUE;
  if(i>=n) return FALSE;

  res = solve(a,i+1,m) || solve(a,i+1,m-a[i]);
  return res;
}

int main(){
  int a[21]; 
  int q,m[210];
  int i,res;

    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d",&a[i]);
    scanf("%d",&q);
    for(i=0;i<q;i++) scanf("%d",&m[i]);

    for(i=0;i<q;i++){
      res = solve(a,0,m[i]);
      if(res == TRUE) printf("yes\n");
      else printf("no\n");
    }
    
  return 0;
}



Measured memory_bytes: 2104
#include<bits/stdc++.h>
#include<atcoder/all>

using namespace std;
using namespace atcoder;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
    cout << a << endl;
    exit(0);
}

void Main(void)
{
    ll t; cin >> t;
    rep(i, t)
    {
        ll n, m, a, b; cin >> n >> m >> a >> b;
        cout << floor_sum(n, m, a , b) << endl;
    }
    return;
}

int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12); //高精度少数表示
    Main();
    return 0;
}

Measured memory_bytes: 3692
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

// 1. dp?????????
//???????????\???????????\
//?????????????????????????????????
//?????????????????????????????????
//?????????????????????????????????
//?????????????????????????????????
//?????????????????????????????????
//?????????????????????????????????
//?????????????????????????????????
//?????????????????????????????????
//?????????????????????????????????

int dp[10][101];
// 2. n?????????
int N,K;
int A;
int B;
// 7. calc?????????
int calc(int i,int m){
	// 8. dp???????????°??????
	if(dp[i][m]>=0)return dp[i][m];
	// 9. dp????¨????

	if(i==1)dp[i][m]=calc(4,m-1)+calc(7,m-1);
	if(i==2 || i==3)dp[i][m]=calc(1,m-1)+calc(4,m-1)+calc(7,m-1);
	if(i==4 ||i==6)dp[i][m]=calc(2,m-1)+calc(5,m-1)+calc(8,m-1);
	if(i==5)dp[i][m]=calc(2,m-1)+calc(8,m-1);
	if(i==7 || i==8)dp[i][m]=calc(3,m-1)+calc(6,m-1)+calc(9,m-1);
	if(i==9)dp[i][m]=calc(3,m-1)+calc(6,m-1);
	dp[i][m]=dp[i][m]%10000;
	return dp[i][m];
}
int main() {
	cin>>N>>K;

	//3.?????????
	for(int i=0;i<10;i++){
		for(int j=0;j<101;j++){
			dp[i][j]=-1;
		}
	}
	//4.??\???
	for(int i=0;i<K;i++){
		cin>>A>>B;
		if(B==1){
			dp[2][A]=0;
			dp[3][A]=0;
			dp[5][A]=0;
			dp[6][A]=0;
			dp[8][A]=0;
			dp[9][A]=0;
		}
		if(B==2){
			dp[1][A]=0;
			dp[3][A]=0;
			dp[4][A]=0;
			dp[6][A]=0;
			dp[7][A]=0;
			dp[9][A]=0;
		}
		if(B==3){
			dp[1][A]=0;
			dp[2][A]=0;
			dp[4][A]=0;
			dp[5][A]=0;
			dp[7][A]=0;
			dp[8][A]=0;
		}
	}

	//5.???????????¨???

	if(dp[1][1]<0&&dp[1][2]<0)dp[1][2]=1;
	if(dp[1][1]<0&&dp[2][2]<0)dp[2][2]=1;
	if(dp[1][1]<0&&dp[3][2]<0)dp[3][2]=1;
	if(dp[2][1]<0&&dp[4][2]<0)dp[4][2]=1;
	if(dp[2][1]<0&&dp[5][2]<0)dp[5][2]=1;
	if(dp[2][1]<0&&dp[6][2]<0)dp[6][2]=1;
	if(dp[3][1]<0&&dp[7][2]<0)dp[7][2]=1;
	if(dp[3][1]<0&&dp[8][2]<0)dp[8][2]=1;
	if(dp[3][1]<0&&dp[9][2]<0)dp[9][2]=1;
	//6.??????
	int total=0;
	for(int i=1;i<10;i++){
		total+=calc(i,N);
	}
	total=total%10000;
	cout<<total<<endl;



	return 0;
}

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

int main() {
  int a;
  cin >> a;
  set<int> s;
  int m = -1;
  for (int i = 1; i <= 1000000; i++) {
    if (s.count(a)) {
      m = i;
      break;
    }
    s.insert(a);
    a = a % 2 ? 3 * a + 1 : a / 2;
  }
  cout << m << endl;
}


Measured memory_bytes: 256
long long n,m,i,j,k,dp[305][305][305],M=1000000007;main(){scanf("%llu%llu",&n,&m);for(dp[0][1][0]=1;i<m;i++)for(j=1;j<=n;j++)for(k=0;k<=n-j;k++){dp[i+1][j+k][0]+=(dp[i][j][k]%=M)*j%M;dp[i+1][j][k]+=dp[i][j][k]*k%M;dp[i+1][j][k+1]+=dp[i][j][k]*(n-j-k)%M;}printf("%lld\n",dp[m][n][0]%M);}

Measured memory_bytes: 219264
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();

        int ans = 0;
        for (int i = 1; i < n; i++) {
            Set<String> l = divide(s, 0, i);
            Set<String> r = divide(s, i, n);
            int tmp = 0;
            for (String left : l) {
                if (r.contains(left)) {
                    tmp++;
                }
            }

            ans = Math.max(tmp, ans);
        }

        System.out.println(ans);
    }

    private static Set<String> divide(String s, int i, int n) {
        char[] c = s.substring(i, n).toCharArray();
        Set<String> set = new HashSet<>();
        for (char ch : c) {
            set.add(String.valueOf(ch));
        }
        return set;
    }
}


Measured memory_bytes: 22228
#include <bits/stdc++.h>
using  namespace std;
int main(){
	string s;
	int n;
	cin>>n;
	cin>>s;
	for(int i=0;s[i];i++){
		s[i]+=n;
		if(s[i]>'Z') s[i]-=26;
	}
	cout<<s<<"\n";
	return 0;
}

Measured memory_bytes: 3604
# -*- coding:utf-8 -*-

def solve():
    N = int(input())
    MOD = 10**9+7

    """考え方
    ・6の約数の個数は？
    6を素因数分解すると
    6 = 2 * 3
    2^(k1) * 3^(k2) （0<= k1,k2 <= 1）の組み合わせの数が約数（1,2,3,6）

    これは、「|k1|個のボールと|k2|個のボールを取り出す組み合わせ問題」と同じ。

    というふうに、まず素因数分解をして因数のknをそれぞれ求めて、その組合せの数を求めれば良い。
    """

    dic = {}

    for n in range(2, N+1):
        num = n
        i = 2
        while True:
            if i > num: break

            if num%i == 0:
                num = num / i
                if not i in dic: dic[i] = 1
                dic[i] += 1
                continue
            else:
                i += 1
                continue

    ans = 1
    for key, value in dic.items():
        ans *= value
        ans %= MOD

    print(ans)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 3064
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((size_t *)a) > *((size_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

int main(void) {
	size_t A, B;

	scanf("%zu\n%zu", &A, &B);

	printf("%zu\n", (A - 1)*(B - 1));

	return 0;
}


Measured memory_bytes: 128
#include <iostream>

#define N 20005

int main(void){
  int n;
  int p[N];

  int plus[N];
  int a[N];
  int b[N];
  

  std::cin >> n;
  for(int i=0; i<n; i++){
    std::cin >> p[i];
    plus[p[i]-1] = i;
  }

  for(int i=0; i<n; i++){
    a[i] = 1+n*i;
    b[n-1-i] = a[i];
    a[i] += plus[i];
  }

  std::cout << a[0];
  for(int i=1; i<n; i++){
    std::cout << " " << a[i];
  }
  std::cout << std::endl;

  std::cout << b[0];
  for(int i=1; i<n; i++){
    std::cout << " " << b[i];
  }
  std::cout << std::endl;

  
  return 0;
}

Measured memory_bytes: 896
/*  ex3_2
    person_A  */
#include<stdio.h>
int main(void){
    int naturalNumber,firstDigit;
    //Nの入力
    scanf("%d",&naturalNumber);
    //naturalNumberの一の位firstDigitの値の取得
    firstDigit=naturalNumber%10;
    //一の位の数firstDigitに応じて場合わけ
    //１の位の数が2,4,5,7,9の時 hon を出力
    if(firstDigit==2||firstDigit==4||firstDigit==5||firstDigit==7||firstDigit==9){
        printf("hon\n");
    }
    //一の位が0,1,6,8の時 pon を出力
    else if(firstDigit==0||firstDigit==1||firstDigit==6||firstDigit==8){
        printf("pon\n");
    }
    //一の位が3の時 bon を出力
    else if(firstDigit==3){
        printf("bon\n");
    }
    return 0;
}

Measured memory_bytes: 1612
using System;
class test{
    static void Main(){
        int a,b,c;
        string[] str = Console.ReadLine().Split(' ');
        a=int.Parse(str[0]);
        b=int.Parse(str[1]);
        c=int.Parse(str[2]);
        int[] x={a,b,c};
        Array.Sort(x);
        Console.WriteLine("{0} {1} {2}",x[0],x[1],x[2]);
    }
}


Measured memory_bytes: 9404
#include<bits/stdc++.h>
using namespace std;
bool isPrime(int n) // assuming n > 1
{
    int i,root;
if(n==2||n==3)
    return true;
if(n==1)
    return false;
    if (n%2 == 0 || n%3 == 0)
        return false;

    root = (int)sqrt(n);

    for (i=5; i<=root; i+=6)
    {
        if (n%i == 0)
           return false;
    }

    for (i=7; i<=root; i+=6)
    {
        if (n%i == 0)
           return false;
    }

    return true;
}
int main()
{
int a;
cin>>a;
while(!isPrime(a))
++a;
cout<<a;
return 0;
}


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

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

    int ans = n;

    for(int i = 1; i <= n; i++){
        if(pow(i, 2) == n){
            ans = n;
            break;
        } else if(pow(i, 2) < n){
            ans = pow(i, 2);
        } 
    }

    cout << ans << endl;

    return 0;
}

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

map<pair<int,int>,int> mp; 
long long ans[10];

int up[]={-1,0,1,-1,0,1,-1,0,1},le[]={-1,-1,-1,0,0,0,1,1,1};

main()
{
	long long h,w;
	int n;
	scanf("%lld %lld %d",&h,&w,&n);
	ans[0]=(h-2)*(w-2);
	for(int i=0;i<n;i++)
	{
		int a,b;
		scanf("%d %d",&a,&b);
		for(int j=0;j<9;j++)
		{
			int na=a+up[j],nb=b+le[j];
			if(na<=1||nb<=1||na>=h||nb>=w)continue;
			ans[mp[make_pair(na,nb)]]--;
			mp[make_pair(na,nb)]++;
			ans[mp[make_pair(na,nb)]]++;
		}
	}
	for(int i=0;i<=9;i++)printf("%lld\n",ans[i]);
}

Measured memory_bytes: 56448
from collections import deque
n = int(input())
edge = []
dist = [-1]*(n+1)
for i in range(n+1):
    edge.append([])
for i in range(n-1):
    a,b,c = map(int,input().split())
    edge[a].append((b,c))
    edge[b].append((a,c))
q,k = map(int,input().split())
dist[k] = 0
que = deque([k])
used = set()
used.add(k)
while que:
    here = que.popleft()
    dist_here = dist[here]
    for i in edge[here]:
        if i[0] not in used:
            que.append(i[0])
            used.add(i[0])
            dist[i[0]] = dist_here + i[1]
for i in range(q):
    x,y = map(int,input().split())
    print(dist[x]+dist[y])






Measured memory_bytes: 86812
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;

// 素数判定 O(√n)
bool is_prime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) return false;
    }
    return true;
}

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;
}
int main() {
    ll L, R; cin >> L >> R;
    if (R-L > 3000) {
        cout << 0 << endl;
    } else {
        ll res = 2018;
        for (ll i = L; i < R; ++i) {
            for (ll j = i + 1; j <= R; ++j) {
                res = min(res, (i * j) % 2019);
            }
        }
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X, i) ((X>>i)&1)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef priority_queue<pii> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);

int main() {
  int n, m; cin >> n >> m;
  vi a(n);
  rep(i,n) cin >> a[i];
  sort(all(a));
  pq cb;
  rep(i,m) {
    int b, c; cin >> b >> c;
    cb.push(mp(c, b));
  }
  int pos = 0;
  ll ans = 0;
  while (pos<n && !cb.empty()) {
    pii que = cb.top(); cb.pop();
    ll b = que.ss, c = que.ff;
    if (a[pos] >= c) break;
    while (pos<n && a[pos]<c && b>0) {
      a[pos] = c;
      b--;
      pos++;
    }
    if (b > 0) {
      cb.push(mp(c, b));
    }
  }
  for (int i = 0; i < n; i++) {
    ans += a[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define MAX_N 16000
using namespace std;
template <class T> inline void read(T &x) {
	x = 0; int c = getchar(), f = 1;
	for (; !isdigit(c); c = getchar()) if (c == 45) f = -1;
	for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0');
}
int n, x, y;
char s[MAX_N+5];
vector <int> d, a, b;
bool f[2][MAX_N+5], g[2][MAX_N+5];
int main() {
	scanf("%s", s);
	n = (int)strlen(s);
	read(x), read(y), s[n] = 'T';
	for (int i = 0, cnt = 0; i <= n; i++)
		if (s[i] == 'F') cnt++;
		else d.push_back(cnt), cnt = 0;
	for (int i = 0; i < (int)d.size(); i++)
		if (i&1) b.push_back(d[i]);
		else a.push_back(d[i]);
	f[0][MAX_N/2] = g[0][MAX_N/2] = true;
	for (int i = 0, c = 1; i < (int)a.size(); i++, c ^= 1)
		for (int j = 0; j <= MAX_N; j++) {
			f[c][j] = false;
			if (j-a[i] >= 0) f[c][j] |= f[c^1][j-a[i]];
			if (i && j+a[i] <= MAX_N) f[c][j] |= f[c^1][j+a[i]];
		}
	for (int i = 0, c = 1; i < (int)b.size(); i++, c ^= 1)
		for (int j = 0; j <= MAX_N; j++) {
			g[c][j] = false;
			if (j-b[i] >= 0) g[c][j] |= g[c^1][j-b[i]];
			if (j+b[i] <= MAX_N) g[c][j] |= g[c^1][j+b[i]];
		}
	return puts(f[a.size()&1][x+MAX_N/2] && g[b.size()&1][y+MAX_N/2] ? "Yes" : "No"), 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define maxn 1025
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fd(i,l,r) for(int i=(l);i>=(r);i--)
using namespace std;
#define Set set<int>
#define P pair<int,int>
int n,m,a[maxn],b[maxn];
//bool operat3 8 5or<(const O& lhs, const O& rhs) {  //still not pass~
//    return lhs.x<rhs.x;
//}
int main()
{
    IOS;
    int x,y,z;
    cin>>x>>y>>z;
    if((x<=z && z<=y)or (y<=z && z<=x))cout<<"Yes";
    else cout<<"No";
    return 0;
}


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

using namespace std;
const int MOD = 1e9 + 7;
const long long INF = 1e18+5;
int add(int x, int y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
int sub(int x, int y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
int main(int argc, char*argv[])
{
	int N;
	cin >> N;
	vector<int> a(N+1, 0);
	vector<vector<long  long>> dp(N+1, vector<long long>(N+1, 0)); // value of ith index and slime cost
	for (int i = 1; i <= N; ++i)
		cin >> a[i];
	vector<long long> sum(N+2, 0);
	sum[N] = a[N];
	for (int i = N-1; i >= 1; --i)
		sum[i] = sum[i+1] + a[i];
	
	// Create pair of each 
	for (int L = N; L >= 1; --L)
		for (int R = L; R<=N; ++R)
		{
			if(R==L)
				dp[L][R] = 0;
			else{
				dp[L][R] = INF;
				for (int i = L; i<R; ++i)
					dp[L][R] = min(dp[L][R], dp[L][i] + dp[i+1][R] + sum[L]-sum[R+1]);
			}
			
		}
	
	cout << dp[1][N];
}

Measured memory_bytes: 1536
#include<iostream>
#include<map>
#include<queue>
#include<cstdlib>
#define fs first
#define sc second
using namespace std;

typedef pair<int,int> P;
typedef pair<P,P> P2;

int w,h,sy,sx,gy,gx;
string room[110];
int g[110][110];
int d[110][110][50];
int num;
int dy[] = {-1,0,1,0}, dx[] = {0,1,0,-1};

int main(){
  cin >> w >> h;
  for(int i=0;i<h;i++)cin >> room[i];
    
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)g[i][j] = 1;

  num = 0;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(room[i][j] == '#'){
	for(int k=-2;k<=2;k++){
	  for(int l=-2;l<=2;l++){
	    if(i+k<0 || j+l<0 || h<=i+k || w<=j+l)continue;
	    if(abs(k)<=1 && abs(l)<=1)g[i+k][j+l] = max(g[i+k][j+l],3);
	    else g[i+k][j+l] = max(g[i+k][j+l],2);
	  }
	}
      }
      if(room[i][j] == 'M'){
	room[i][j] = '0'+num;
	num++;
      }
      if(room[i][j] == 'S'){ sy = i; sx = j;}
      if(room[i][j] == 'G'){ gy = i; gx = j;}
    }
  }
 
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
      for(int k=0;k<(1<<num);k++)d[i][j][k] = 1<<30;

  d[sy][sx][0] = 0;
  priority_queue<P2,vector<P2>,greater<P2> > q;
  q.push(P2(P(0,0),P(sy,sx)));

  while(q.size()){
    P2 p = q.top(); q.pop();
    int dis = p.fs.fs, st = p.fs.sc, y = p.sc.fs, x = p.sc.sc;

    if(gy == y && gx == x && st == (1<<num)-1){
      cout << dis << endl;
      return 0;
    }

    dis += g[y][x];
    for(int i=0;i<4;i++){
      int ty = y+dy[i], tx = x+dx[i], tst = st;
      if(ty<0 || tx<0 || h<=ty || w<=tx)continue;
      if(room[ty][tx] == '#')continue;
      if('0' <= room[ty][tx] && room[ty][tx] <= '9'){
	tst |= 1<<(room[ty][tx]-'0');
      }
      if(d[ty][tx][tst] > dis){
	d[ty][tx][tst] = dis;
	q.push(P2(P(dis,tst),P(ty,tx)));
      }
    }
  }
}

Measured memory_bytes: 3540
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace contest_Csharp
{
    class Program
    {
        public static (long m,long s)[,] dp;

        static void Main(string[] args)
        {
            checked
            {
                var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
                Console.SetOut(sw);

                var vals = Console.ReadLine().Split(' ').
                    Select(x => int.Parse(x)).ToList();

                var N = vals[0];
                var ans = N >= 30 ? "Yes" : "No";
                Console.WriteLine(ans);

                Console.Out.Flush();
            }




        }
    }
}




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

namespace _2_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray();
            bool flag = true;
            int p = 0;
            while (flag)
            {
                flag = false;
                for (int j = N - 1; j > 0; j--)
                {
                    if (A[j] < A[j - 1])
                    {
                        int x = A[j];
                        A[j] = A[j - 1];
                        A[j - 1] = x;
                        flag = true;
                        p++;
                    }
                }
            }
            Console.Write(A[0]);
            for (int y = 1; y < N; y++)
            {
                Console.Write(" " + A[y]);
            }
            Console.WriteLine();
            Console.WriteLine(p);
        }
    }
}

Measured memory_bytes: 9548
//
//  main.cpp
//  Test
//
//  Created by Nag on 2017/08/18.
//  Copyright ?? 2017??´ Nag. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <sstream>
#include <string>
#include <cstdio>

using namespace std;

int main(void) {
    string str, str1, str2;
    int times;
    int h;
    int i;
    
    cin >> str;
    
    while( str!="-" ) {
        cin >> times;
        
        for(i=0; i<times; i++) {
            cin >> h;
            str1 = str.substr(0, h);
            str2 = str.erase(0, h);
            str = str2 + str1;
            
            //cout << str << endl;
        }
        
        cout << str << endl;
        
        cin >> str;
    }
    
    return 0;
    
}

Measured memory_bytes: 3040
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<P,int>
#define vpp vector<PP>
#define fi first
#define se second
#define INF 1e9
#define MOD 1000000007
#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(x) (x).begin(),(x).end()
signed main(){
    int k;
    cin>>k;
    int n=50;
    vi vec;
    REP(i,n){
        vec.pb(i+k/n);
    }
    REP(i,k%n){
        REP(j,n){
            if(i==j){
                vec[j]+=n;
            }else{
                vec[j]--;
            }
        }
    }
    cout<<n<<endl;
    REP(i,n){
        if(i)cout<<" ";cout<<vec[i];
    }cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <complex>

using namespace std;

int main(int argc, char const *argv[]) {
	int N,Z,W,temp;
	std::cin >> N >> Z >> W;
	std::vector<int> a;
	for (size_t i = 0; i < N; i++) {
		std::cin >> temp;
		a.push_back(temp);
	}

	if (N > 1) {
		std::cout << max(abs(W-a[N-1]), abs(a[N-1]-a[N-2])) << '\n';
	}
	else {
		std::cout << abs(W-a[0]) << '\n';
	}


	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main() {

    int i,j,k;
    for(i = 1; i < 10; i++){
        for (j = 1; j < 10; j++) {
            k = i * j;
            printf("%dx%d=%d\n",i,j,k);
        }
    }
    return 0;
}



Measured memory_bytes: 2100
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <list>
#include <tuple>
#include <bitset>
#include <ciso646>
#include <cassert>

using namespace std;

#define int long long
#define double long double

typedef pair<int, int> P;
typedef tuple<int, int, int> T;

template<class T> string tostr(T x) { stringstream o; o << x; return o.str(); }
template<class T> T sqr(T x) { return x*x; }
template<class T> T mypow(T x, int n) { T r = 1; while (n > 0) { if (n & 1)r = r*x; x = x*x; n >>= 1; }return r; }

int toint(string s) { int v; stringstream i(s); i >> v; return v; }
bool check(int x, int y, int w, int h) { return x >= 0 && y >= 0 && w > x && h > y; }
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

#define REP(i,a,b)	for(int (i) = (a);i < (b);(i)++)
#define rep(i,n)	REP(i,0,n)
#define PER(i,a,b)	for(int (i) = (a-1);i >= (b);(i)--)
#define per(i,n)	PER(i,n,0)
#define each(i,n)	for(auto &i : n)
#define clr(a)		memset((a), 0 ,sizeof(a))
#define mclr(a)		memset((a), -1 ,sizeof(a))
#define all(a)		(a).begin(),(a).end()
#define dump(val) 	cerr << #val " = " << val << endl;
#define dum(val)	cerr << #val " = " << val;
#define FILL(a,v)	fill(a,a+sizeof(a)/sizeof(*a),v)

const int dx[8] = { +1,+0,-1,+0,+1,+1,-1,-1 };
const int dy[8] = { +0,-1,+0,+1,-1,+1,-1,+1 };
const int mod = 1e9 + 7;
const int INF = 1e17 + 9;

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

	int y = n / 15 * 200;
	int x = n * 800;

	cout << x - y << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
//constexpr ll MOD = 1000000007;
constexpr ll MOD = 998244353;
ll INF = 4001001001001001001;
long double EPS = 1e-9;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<tuple<ll,ll,ll>>>;

// MOD確認

int main(){
   ll Ha,Ma,Hb,Mb,K;
   cin >> Ha >> Ma >> Hb >> Mb >> K;
   cout << (Hb-Ha) * 60 + Mb-Ma - K << endl;
} 

Measured memory_bytes: 3644
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(dead_code)]

use itertools::Itertools;
use proconio::input;
use proconio::marker::{Chars, Usize1};

#[allow(unused_macros)]
#[cfg(debug_assertions)]
macro_rules! mydbg {
    //($arg:expr) => (dbg!($arg))
    //($arg:expr) => (println!("{:?}",$arg));
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
}
#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}

macro_rules! echo {
    ($($a:expr),*) => {
          $(println!("{}",$a))*
      }
}

use std::cmp::*;
use std::collections::*;
use std::ops::{Add, Div, Mul, Sub};

#[allow(dead_code)]
static INF_I64: i64 = 92233720368547758;
#[allow(dead_code)]
static INF_I32: i32 = 21474836;
#[allow(dead_code)]
static INF_USIZE: usize = 18446744073709551;
#[allow(dead_code)]
static M_O_D: usize = 1000000007;
#[allow(dead_code)]
static PAI: f64 = 3.1415926535897932;

trait IteratorExt: Iterator {
    fn toVec(self) -> Vec<Self::Item>;
}

impl<T: Iterator> IteratorExt for T {
    fn toVec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

trait CharExt {
    fn toNum(&self) -> usize;
    fn toAlphabetIndex(&self) -> usize;
    fn toNumIndex(&self) -> usize;
}
impl CharExt for char {
    fn toNum(&self) -> usize {
        return *self as usize;
    }
    fn toAlphabetIndex(&self) -> usize {
        return self.toNum() - 'a' as usize;
    }
    fn toNumIndex(&self) -> usize {
        return self.toNum() - '0' as usize;
    }
}

trait VectorExt {
    fn joinToString(&self, s: &str) -> String;
}
impl<T: ToString> VectorExt for Vec<T> {
    fn joinToString(&self, s: &str) -> String {
        return self
            .iter()
            .map(|x| x.to_string())
            .collect::<Vec<_>>()
            .join(s);
    }
}

trait StringExt {
    fn get_reverse(&self) -> String;
}
impl StringExt for String {
    fn get_reverse(&self) -> String {
        self.chars().rev().collect::<String>()
    }
}

trait UsizeExt {
    fn pow(&self, n: usize) -> usize;
}
impl UsizeExt for usize {
    fn pow(&self, n: usize) -> usize {
        return ((*self as u64).pow(n as u32)) as usize;
    }
}

fn main() {
    input! {
       N: usize,
       K:usize,
    }
    let mut u = vec![false; N];
    for _ in 0..K {
        input! {
            d:usize,
            okasi:[Usize1;d],
        }
        for &item in &okasi {
            u[item] = true;
        }
    }

    let mut ans: usize = 0;

    for &item in &u {
        if !item {
            ans += 1;
        }
    }
    echo!(ans);
}


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


int main(){


    int x, a, b;

    string s;


    cin >> x >> a >> b;


    if( a < b ){

        if( b - a <= x ) s = "safe";

        else s = "dangerous";

        }

    else s = "delicious";


    cout << s << endl;


    return 0;

    }


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let s = read::<String>().chars().collect::<Vec<char>>();
    let k = read::<usize>();
    let mut candidates = vec![];
    for i in 0..s.len() {
        let mut temp = vec![];
        for j in 0..5 {
            if i + j >= s.len() {
                break;
            }
            temp.push(s[i + j]);
            candidates.push(temp.clone());
        }
    }
    candidates.sort();
    candidates.dedup();
    // println!("{:?}", candidates);
    for &c in candidates[k - 1].iter() {
        print!("{}", c);
    }
    println!("");
}


Measured memory_bytes: 6396
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower

using namespace std;

int main()
{
  int n, k;
  cin >> n >> k;
  bool A=true;
    long long seki = 1;
  if(n==1){
    cout << k << endl;
    A=false;
  }
  else
  {
    for (int i = 1; i <= n; i++){
      if (i == 1)
        seki = k;
   
    else seki *= (k - 1);
    
    }
  }
   if(A) cout << seki << endl;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
int N;
string s;
bool pos(vector<int> V, int obj)
{
  int Vsum = 0; for(auto x: V) Vsum += x;
  obj += Vsum; if(obj%2 != 0) return false;
  obj /= 2;
  if(obj > Vsum || obj < 0) return false;
  vector<bool> dp(Vsum+1, false); dp[0] = true;
  for(auto x: V)
    for(int i=Vsum-x; i>=0; --i)
      if(dp[i]) dp[i+x] = true;
  return dp[obj];
}
int main()
{
  int x, y; vector<int> A, B;
  cin >> s >> x >> y; s+='T';
  
  bool hatsu = true;
  int cnt = 0;
  bool ap = true;
  for(auto c: s)
  {
    if(c == 'T')
    {
      if(hatsu)
      {
        x -= cnt;
        hatsu = false;
      }
      else if(cnt)
      {
        if(ap) A.push_back(cnt);
        else B.push_back(cnt);
      }
      ap = !ap;
      cnt = 0;
    }
    else ++cnt;
  }
  if(pos(A, x) && pos(B, y)) puts("Yes");
  else puts("No");
}

Measured memory_bytes: 256