akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=16;
const int MAXLOSE=16;
const int MOD=1000000007;
const int MAXSTATES=43046721;

int n,nlose;
int lose[MAXLOSE];

int fac[(1<<MAXN)+1];
int ifac[(1<<MAXN)+1];
int inv[(1<<MAXN)+1];
int C(int n,int k) { if(k<0||k>n) return 0; assert(n>=0&&n<=(1<<MAXN)); return (ll)fac[n]*ifac[k]%MOD*ifac[n-k]%MOD; }

int dp[MAXLOSE+1][1<<MAXN]; // dp[i][mask] = #ways to meet opponents in positions in mask using only opponents >= i



void run() {
	scanf("%d%d",&n,&nlose);
	REP(i,nlose) scanf("%d",&lose[i]);
	sort(lose,lose+nlose);
	nlose=unique(lose,lose+nlose)-lose;

	inv[1]=1; FORE(i,2,1<<MAXN) inv[i]=(ll)(MOD-MOD/i)*inv[MOD%i]%MOD;
	fac[0]=1; FORE(i,1,1<<MAXN) fac[i]=(ll)fac[i-1]*i%MOD;
	ifac[0]=1; FORE(i,1,1<<MAXN) ifac[i]=(ll)ifac[i-1]*inv[i]%MOD;

	REP(mask,1<<n) dp[nlose][mask]=mask==0?1:0;
	for(int i=nlose-1;i>=0;--i) REP(mask,1<<n) {
		dp[i][mask]=dp[i+1][mask];
		int rem=(1<<n)-lose[i]+1;
		REP(j,n) if(mask&(1<<j)) rem-=1<<j;
		if(rem>=0) REP(j,n) if(mask&(1<<j)) dp[i][mask]=(dp[i][mask]+(ll)C(rem+(1<<j)-1,(1<<j)-1)*dp[i+1][mask^(1<<j)])%MOD;
	}

	int ret=0;
	REP(mask,1<<n) {
		int cur=dp[0][mask];
		int rem=(1<<n)-1;
		REP(j,n) if(mask&(1<<j)) rem-=1<<j;
		REP(j,n) if((mask&(1<<j))==0) { cur=(ll)cur*C(rem,(1<<j))%MOD; rem-=1<<j; }
		assert(rem==0);
		int cnt=0; REP(j,n) if(mask&(1<<j)) ++cnt;
		if(cnt%2==0) ret=(ret+cur)%MOD; else ret=(ret+MOD-cur)%MOD;
	}
	REP(i,n) ret=(ll)ret*fac[1<<i]%MOD;
	REP(i,n) ret=(ll)ret*2%MOD;
	printf("%d\n",ret);
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[8] = {-1,0,1,0,-1,1,1,-1};
int dx[8] = {0,1,0,-1,1,1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100005;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int d;
    cin>>d;
    int c[26];
    for(int i=0;i<26;i++)cin>>c[i];
    int s[d][26];
    for(int i=0;i<d;i++){
        for(int j=0;j<26;j++)cin>>s[i][j];
    }
    /* vector<int> t(d);
    for(int i=0;i<d;i++)cin>>t[i];
    for(int i=0;i<d;i++)t[i]--; */
    vector<int> last(26,0);
    int res=0;
    for(int i=0;i<d;i++){
        int M=-1;
        int idx=-1;
        for(int j=0;j<26;j++){
            if(s[i][j]>M){
                M=s[i][j];
                idx=j;
            }
        }
        /* res+=M;
        last[idx]=i+1;
        for(int j=0;j<26;j++){
            res-=c[j]*(i+1-last[j]);
        }
        cout<<res<<endl; */
        cout<<idx+1<<endl;
    }
}

Measured memory_bytes: 3732
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;

int main() {
  int N, X, Y;
  cin >> N >> X >> Y;
  vector<vector<int>> G(N, vector<int>(N));
  vector<int> s(N, 0);
  for (int i = 0; i < N; ++i) {
    for (int j = i + 1; j < N; ++j) {
      ++s[min(j - i, abs(j - (Y - 1)) + 1 + abs((X - 1) - i))];
    }
  }
  for (int k = 1; k < N; ++k) cout << s[k] << endl;
}

Measured memory_bytes: 16000
#include <stdio.h>
int main(void)
{
    int x, a, b, c, d;
    scanf("%d",&x);
    a=x/3600;
    b=x%3600;
    c=b/60;
    d=b%60;
    printf("%d:%d:%d\n",a,c,d);
    return 0;
}



Measured memory_bytes: 2048
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
//int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
//int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    fio();
    int n;
    cin >> n;
    set<string> st;
    rep (i, n) {
        string s;
        cin >> s;
        st.insert(s);
    }
    cout << st.size() << endl;
}

Measured memory_bytes: 19240
#![allow(unused_imports)]
use itertools::Itertools;
use num::clamp;
use proconio::{fastout, input, marker::*};
use std::cmp::*;
use std::collections::*;
use superslice::*;

#[fastout()]
fn main() {
    input! {
        n: usize,
        a: [isize; n+1],
    }

    let mut cum = vec![0; n + 1];
    cum[0] = a[0];
    for i in 1..n + 1 {
        cum[i] = cum[i - 1] + a[i];
    }

    let mut ans = cum[n];
    let mut b = 1 - a[0];
    if b < 0 {
        println!("-1");
        return;
    }
    ans += b;
    for i in 1..n + 1 {
        let sum_a = cum[n] - cum[i];
        b = min(2 * b - a[i], sum_a);
        ans += b;
        if b < 0 {
            println!("-1");
            return;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4356
import math
a, b, h, m = [int(i) for i in input().split()]

rad = math.pi * 2 * (h/12.0 + m/60.0 / 12.0 - m/60.0)
ans = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(rad))
print(ans)


Measured memory_bytes: 9492
use std::cmp;

const INF: u32 = 1e7 as u32;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let s = sc
        .chars()
        .into_iter()
        .map(|c| c as usize - 'a' as usize)
        .collect::<Vec<_>>();
    let n = s.len();

    let mut dp = 0;
    let mut min = vec![INF; 1 << 26];
    min[0] = 0;
    let mut hash = 0;
    for i in 0..n {
        hash ^= 1 << s[i];
        let split_min = (0..26)
            .map(|i| {
                let palindrome_prefix = 1 << i;
                let suffix = hash ^ palindrome_prefix;
                min[suffix] + 1
            })
            .min()
            .unwrap();

        dp = cmp::min(split_min, min[hash] + 1);
        min[hash] = cmp::min(min[hash], dp);
    }

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

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 268668
/*

                   بِسْمِ ٱللَّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ
                  لآ اِلَهَ اِلّا اللّهُ مُحَمَّدٌ رَسُوُل اللّهِ
*/

/*
    Auther:   n0oO0o0Ob(None of them)
    from  :   https://n0oo0o0ob.sleek.page/

*/




#include <bits/stdc++.h>

using namespace std;
#define endl "\n"
#define pb push_back

                                        #define noob n0oO0o0Ob
// ---------------------------------
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
//----------------------------------
const ld PI = acos((ld)-1);
const int MOD = 1000000007;
//----------------------------------


int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    
    int t;
    cin >> t;
    int a, b;
    vector<int> v;
    int x;
    for(int i = 0; i< t ; i++){
    	cin >> a >> b;
		x = (10*a)+b;
		v.pb(x);
		//v2.pb(b);		
	}
	for(int i = 0; i < t-2; i++){
		if((v[i]%11==0)&&(v[i+1]%11==0)&&v[i+2]%11==0){
			cout << "Yes" << endl;
			goto done;
		}
	}
	cout << "No" << endl;
	done:
		;
		
	return 0;
}










Measured memory_bytes: 3648
#include<iostream>
using namespace std;
int main(void)
{
  while(true)
    {
      int n,x,count=0;
      cin>>n;
      cin>>x;
      if(n==0 && x==0)break;
      for(int i=1;i<=n;i++)
	{
	  for(int j=i;j<=n;j++)
	    {
	      for(int k=j;k<=n;k++)
		{
		  
		  if(i+j+k==x && i!=j && j!=k && i!=k)
		    {
		     
count++;
		    }
		}
	    }
	}
      cout<<count<<endl;
    }
  return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
string s;

int main(){
    cin>>n>>s;
    int ans=0;
    for(char i='0';i<='9';i++)for(char j='0';j<='9';j++)for(char k='0';k<='9';k++){
        int x=0;
        while(x<n&&s[x]!=i)x++;
        x++;
        while(x<n&&s[x]!=j)x++;
        x++;
        while(x<n&&s[x]!=k)x++;
        if(x<n){
            ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
//config = {stdin: 'tmp', newline: '\r\n'}; // win
config = {stdin: '/dev/stdin', newline: '\n'}; // linux

line = require('fs').readFileSync(config.stdin, 'ascii')
       .trim()
       .split(config.newline)
       .map(function (line) { return line.split(' '); });

number = line[0];

dice_init = { 'T': number[0], 'S': number[1], 'E': number[2],
              'W': number[3], 'N': number[4], 'B': number[5] };
function assign(dst, src) {
  for (var i in src) dst[i] = src[i];
  return dst;
}
dice = assign({}, dice_init);
src = assign({}, dice);

function turn_east(dst, src) {
  dst.T = src.W; dst.S = src.S; dst.E = src.T;
  dst.W = src.B; dst.N = src.N; dst.B = src.E;
}
function turn_north(dst, src) {
  dst.T = src.S; dst.S = src.B; dst.E = src.E;
  dst.W = src.W; dst.N = src.T; dst.B = src.N;
}
function turn_south(dst, src) {
  dst.T = src.N; dst.S = src.T; dst.E = src.E;
  dst.W = src.W; dst.N = src.B; dst.B = src.S;
}
function turn_west(dst, src) {
  dst.T = src.E; dst.S = src.S; dst.E = src.B;
  dst.W = src.T; dst.N = src.N; dst.B = src.W;
}
function turn_clockwise(dst, src) {
  dst.T = src.T; dst.S = src.E; dst.E = src.N;
  dst.W = src.S; dst.N = src.W; dst.B = src.B;
}

for (i = 2; i < line.length; i++) {
  top = line[i][0];
  front = line[i][1];
  while (dice.T !== top && dice.S !== top && dice.N !== top) {
    tmp = src;
    src = dice;
    dice = tmp;
    turn_east(dice, src);
  }
  while (dice.T !== top) {
    tmp = src;
    src = dice;
    dice = tmp;
    turn_south(dice, src);
  }
  while (dice.S !== front) {
    tmp = src;
    src = dice;
    dice = tmp;
    turn_clockwise(dice, src);
  }
  console.log(dice.E);
}

Measured memory_bytes: 15496
#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(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	int N, K; cin >> N >> K;
	vi A(N);
	REP(i, N) {
		cin >> A[i];
		--A[i];
	}
	vi s(N + 1);
	s[0] = 0;
	REP(i, N) {
		s[i + 1] = (s[i] + A[i]) % K;
	}
	queue<int> que;
	map<int, int> mp;
	ll res = 0;
	REP(i, N + 1) {
		while (que.size() >= K) {
			int v = que.front(); que.pop();
			mp[v]--;
		}
		res += mp[s[i]];
		mp[s[i]]++;
		que.push(s[i]);
	}
	cout << res << endl;
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 12032
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(long long i=0;i<n;i++)
#define REP1(i,n) for(long long i=1;i<=n;i++)
#define PER(i,n) for(long long i=((n)-1);i>=0;i--)
#define PER1(i,n) for(long long i=(n);i>0;i--)
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define FORE(i,a,b) for(long long i=(a);i<=(b);i++)
#define ITE(arr) for(auto ite=(arr).begin();ite!=(arr).end();ite++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define YNPRT(b) cout<<((b)?"Yes":"No")<<endl
#define REV(arr) reverse(ALL(arr))
#define PRT(a) cout<<a<<endl;
#define PRTLST(arr,num) REP(_i,num) cout<<_i<<" - "<<arr[_i]<<endl;
#define PRTLST2(arr2,d1,d2) REP(_i,d1) REP(_j,d2) cout<<_i<<","<<_j<<" : "<<arr2[_i][_j]<<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int INF_INT = 2147483647;
const ll INF_LL = 9223372036854775807LL;
const ull INF_ULL = 18446744073709551615Ull;
const ll P = 92540646808111039LL;
const int Move[4][2] = {-1,0,1,0,0,1,0,-1};
const int Move_[8][2] = {-1,-1,-1,0,-1,1,0,-1,0,1,1,-1,1,0,1,1};

//---------------------
#define MAXN 100000
//---------------------

ll x , a;

int main(){
	cin>>x>>a;
	cout<< (x<a?0:10) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,0,n+1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int MOD=1e9+7;

signed main(){
    int N,X;cin>>N>>X;
    int A[N];
    REP(i,N)cin>>A[i];
    int ans=0;
    if(A[0]>X){
        ans+=A[0]-X;
        A[0]=X;
    }
    REP(i,N-1){
        if(A[i]+A[i+1]>X){
            int d=A[i]+A[i+1]-X;
            if(A[i+1]>=d){
                ans+=d;
                A[i+1]-=d;
            }
            else{
                ans+=d;
                A[i+1]=0;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
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;}

ll n;
ll r[105],c[105];
ll dp[105][105];
ll f(ll lx,ll rx){
    if(rx-lx==1)return 0;
    if(dp[lx][rx]!=-1)return dp[lx][rx];
    ll ret=LINF;
    fore(i,1,rx-lx-1){
        chmin(ret,f(lx,lx+i)+f(lx+i,rx)+r[lx]*r[lx+i]*c[rx-1]);
    }
    return dp[lx][rx]=ret;
}
void solve(){
    cin>>n;
    rep(i,n)cin>>r[i]>>c[i];

    rep(i,n+1)rep(j,n+1)dp[i][j]=-1;
    cout<<f(0,n)<<endl;
}

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



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

long long int N, M, i, j, k, a, b, c;
long long int d[100][100], t[100][100];
vector<pair<long long int, long long int> > w;
bool u[1000];

int main(){
    scanf("%lld%lld", &N, &M);
    for(i = 0; i < N; ++i){
        for(j = 0; j < N; ++j){
            d[i][j] = 2147483647;
            t[i][j] = j;
        }
        d[i][i] = 0;
    }
    for(i = 0; i < M; ++i){
        scanf("%lld%lld%lld", &a, &b, &c);
        d[a - 1][b - 1] = c;
        d[b - 1][a - 1] = c;
        w.push_back(make_pair(min(a, b) - 1, max(a, b) - 1));
    }
    for(k = 0; k < N; ++k){
        for(i = 0; i < N; ++i){
            for(j = 0; j < N; ++j){
                if(d[i][k] + d[k][j] < d[i][j]){
                    d[i][j] = d[i][k] + d[k][j];
                    t[i][j] = t[i][k];
                }
            }
        }
    }
    vector<pair<long long int, long long int> >::iterator y, z, be = w.begin(), en = w.end();
    for(i = 0; i < N; ++i){
        for(j = 0; j < N; ++j){
            //cout << i << " " << t[i][j] << " ";
            y = find(be, en, make_pair(min(i, t[i][j]), max(i, t[i][j])));
            //cout << y - be << " " << z - y << endl;
            u[y - be] = true;
        }
    }
    cout << count(u, u + M, false) << endl;
    return 0;
}


Measured memory_bytes: 384
/* ex5-3
    nnasy */

#include <stdio.h>

int main(void) {
    // 宣言と入力
    int row, col;
    scanf("%d%d", &row, &col);
    char matrix[row][col];
    int rowJudge[row], colJudge[col];

    // マス目の記号を入力
    for (int i=0; i<row; i++){
        for (int j=0; j<col; j++){
            scanf(" %c", &matrix[i][j]);
        }
    }

    // 取り除く行を調べる
    for (int i=0; i<row; i++){
        for (int j=0; j<col; j++){
            if (matrix[i][j] == '#'){
                rowJudge[i]=1;
            }
        }
    }

    // 取り除く列を調べる
    for (int j=0; j<col; j++){
        for (int i=0; i<row; i++){
            if (matrix[i][j] == '#'){
                colJudge[j]=1;
            }
        }
    }

    // 各Judgeを用いて出力
    for (int i=0; i<row; i++){
        if (rowJudge[i] == 1){
            for (int j=0; j<col; j++){
                if (colJudge[j] == 1){
                    printf("%c", matrix[i][j]);
                }
            }
        }
        printf("\n");
    }

    return 0;
}

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

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

    s = "#" + s;
    int maxi = max(c, d);

    for (int i = a; i < maxi; i++) {
        if (s.at(i) == '#' && s.at(i + 1) == '#') {
            cout << "No" << endl;
            return 0;
        }
    }

    if (c < d) {
        cout << "Yes" << endl;
        return 0;
    }

    for (int i = b; i <= d; i++) {
        if (s.at(i - 1) == '.' && s.at(i) == '.' && s.at(i + 1) == '.') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 772
import os
import sys
from functools import lru_cache

from scipy.misc import comb

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N, K = [int(sys.stdin.buffer.readline()) for _ in range(2)]
N = str(N)


@lru_cache(maxsize=None)
def solve(d, k):
    # 下d桁でk個選ぶ
    if d <= 0:
        return 0
    if k == 0:
        return 1
    n = int(N[-d])
    if d == 1:
        if k == 0:
            return 1
        elif k == 1:
            return n
        else:
            return 0
    if n == 0:
        return solve(d - 1, k)
    ret = 0
    # n を選ぶ
    ret += solve(d - 1, k - 1)
    # n より小さい数を選ぶ
    ret += comb(d - 1, k - 1, exact=True) * (n - 1) * 9 ** (k - 1)
    # 0 を選ぶ
    ret += comb(d - 1, k, exact=True) * 9 ** k
    return ret


ans = solve(len(N), K)
print(ans)


Measured memory_bytes: 22236
ans = []
while True:
    N, P = map(int, input().split())
    box, lists = P, [0 for i in range(N)]
    
    if not N and not P:
        break
    
    roop = True
    while roop:
        for i in range(N):
            if lists[i] == P:
                ans.append(i)
                roop = False
                break
                
            if box:
                lists[i] += 1
                box -= 1
            else:
                box = lists[i]
                lists[i] = 0
                
[print(i) for i in ans]  
              
   



Measured memory_bytes: 5596
#include <stdio.h>
#include <string.h>
#include <math.h>

int main() {

    int n;
    char s[101];

    scanf("%d %s", &n, s);

    int maxdata = 0;
    int x = 0;

    for (int i = 0; i < strlen(s); i++) {
        if (s[i] == 'I') {
            x++;
            maxdata = maxdata < x ? x : maxdata;
        } else {
            x--;
        }

    }
    printf("%d", maxdata);


} 

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>
#include <numeric>

using namespace std;
typedef long long int ll;
typedef long double ld;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }                   // 最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); };                      // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }                         // 桁数
ll digitSum(ll n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; } // 各桁の和
#define MOD 1e9 + 7
#define pb push_back
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repn(i, n) for (ll i = 1; i <= n; i++)
#define repi(i, a, b) for (ll i = ll(a); i < ll(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265359

template <typename T>
void printVector(string name, vector<T> vec)
{
    cout << name << ": ";
    rep(i, vec.size())
    {
        cout << vec[i] << " ";
    }
    cout << endl;
}

// 割る数の初期値
ll a = 2;
vector<ll> cal(ll n)
{
    vector<ll> rtn;

    while (n >= a * a)
    {
        // a で割り切れたら、a は素因数
        // そして、割られる数を a で割る
        // a で割り切れなかったら、 a を 1 増加させる
        if (n % a == 0)
        {
            rtn.pb(a);
            n /= a;
        }
        else
        {
            a++;
        }
    }

    // 最後に残った n は素因数
    rtn.pb(n);
    return rtn;
}

void Main()
{
    int a, b;
    cin >> a >> b;

    if (a <= 5)
    {
        cout << 0 << endl;
    }
    else if (a >= 13)
    {
        cout << b << endl;
    }
    else
    {
        cout << b / 2 << endl;
    }

    return;
}

signed main(void)
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int M = input.nextInt();
		int cnt = 0;
		for (int i = 0; i < N-1; i++) {
			for (int j = i+1; j < N; j++) {
				cnt++;
			}
		}
		for (int i = 0; i < M-1; i++) {
			for (int j = i+1; j < M; j++) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 23252
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <valarray>
using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back
#define div div228
#define prev prev228
#define free free228
#define close close228
#define int long long
typedef long double ld;
const int BINF = 9e18, LINF = 2e9, mod = 1e9 + 7;
const int MAXN = 1e5, LEN = 128;
int ASZ = 62;
int id[256];
string alp;
int ask(string s) {
    cout << "? " << s << endl;
    int ans;
    cin >> ans;
    return ans;
}
char ans[LEN + 1];
int len;
void go(int l, int r, valarray<int> cntl, valarray<int> cntr, valarray<int> cnt) {
    if (l == r) {
        for (int i = 0; i < ASZ; ++i)
            if (cnt[i])
                ans[l] = alp[i];
        return;
    }

    int m = (l + r) / 2;
    valarray<int> cnt0(ASZ), cnt1(ASZ);
    
    vector<char> cs;
    for (int i = 0; i < ASZ; ++i)
        if (cnt[i])
            cs.push_back(alp[i]);
    char z = cs.back();
    cs.pop_back();
    
    int sum = 0;
    for (char x : cs)
        sum += (cnt0[id[x]] = len - ask(string(m + 1, x) + string(len - m - 1, z)));
    sum += (cnt0[id[z]] = cntl[id[z]] + cntr[id[z]] + cnt[id[z]]);

    cs.push_back(z);

    for (char x : cs)
        sum -= cntl[id[x]];
    sum -= m - l + 1;
    sum /= cs.size();

    for (char x : cs)
        cnt0[id[x]] -= sum + cntl[id[x]];
    for (char x : cs)
        cnt1[id[x]] = cnt[id[x]] - cnt0[id[x]];

    go(l, m, cntl, cntr + cnt1, cnt0);
    go(m + 1, r, cntl + cnt0, cntr, cnt1);
}
void solve() {
    for (int i = 0; i < 26; ++i) {
        alp += 'a' + i;
        id['a' + i] = i;
    }
    for (int i = 0; i < 26; ++i) {
        alp += 'A' + i;
        id['A' + i] = i + 26;
    }
    for (int i = 0; i < 10; ++i) {
        alp += '0' + i;
        id['0' + i] = i + 26 + 26;
    }

    len = 0;
    valarray<int> cnt(ASZ);
    for (int i = 0; i < ASZ; ++i)
        len += (cnt[i] = LEN - ask(string(LEN, alp[i])));
    go(0, len - 1, valarray<int>(ASZ), valarray<int>(ASZ), cnt);
    cout << "! " << ans << endl;
    return;
}
signed main() {
    ios_base::sync_with_stdio(false);
    //cout.precision(40);

    int t;
    //cin >> t;
    t = 1;
    for (int i = 0; i < t; ++i)
        solve();

    return 0;
}
//0121

Measured memory_bytes: 3804
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cstdlib>
using namespace std;

int main(){
    long long n, k ,sum = 0;
    cin >> n >> k;
    double ans = 0;
    long long dp[31];
    for(int i = 0; i < 30;i++){
        if(i == 0) dp[i] = 1;
        else{
            dp[i] = dp[i-1] * 2;
        }
    }
    int j = 0;
    int maxj = 1;
    for(int i = 1; i <= n; i++){
            while(dp[j] * i < k){
                j++;
            }
            if(i == 1) maxj = j;
            sum += dp[maxj-j];
        j = 0;
    }
    ans = (double)sum/(double)(dp[maxj]*n);
    printf("%.20f\n",ans);
    return 0;
}

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


int a, b, c;
int five, seven;

int main(){
    cin>>a>>b>>c;
    five=2;
    seven=1;
    if(a==5) five=five-1;
    else if(a==7) seven=seven-1;
    if(b==5) five=five-1;
    else if(b==7) seven=seven-1;
    if(c==5) five=five-1;
    else if(c==7) seven=seven-1;
    if (seven==0 && five==0) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


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

long long mod = 1000000007;

int main() {
    int n;
    cin >> n;
    long long a[n];
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    long long sum = 0;
    long long acc = 0;
    for (int i = 0; i < n; ++i) {
        sum += (a[i] * acc) % mod;
        acc = (acc + a[i]) % mod;
    }
    cout << sum % mod << "\n";
    return 0;
}


Measured memory_bytes: 5140
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

struct tree{
    size_t n,r,md;
    vector<vector<int>> e;
    vector<bool> c;
    explicit tree(int n_){
        n=n_;
        e.resize(n);
    }
    void add(int a,int b){
        e[a].emplace_back(b);
        e[b].emplace_back(a);
    }
    void r_dfs(int i,int p=-1,bool D=false){
        c[i]=D;
        for(auto j:e[i]) if(j!=p) r_dfs(j,i,!D);
    }
    void r_i(int r_=0){
        c.resize(n);r=r_;
        r_dfs(r);
    }
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    int n,a,b;
    in>>n;
    tree t(n);
    fr(i,n-1){
        in>>a>>b;
        t.add(--a,--b);
    }
    t.r_i();
    int T{},F{};
    fr(i,n){
        if(t.c[i]) ++T;
        else ++F;
    }
    vector<int> ans(n);
    vector<bool> v(n+1);
    if(T*3<=n){
        int s{1};
        fr(i,n){
            if(t.c[i]){
                ans[i]=3*s;
                v[3*s]=true;
                ++s;
            }
        }
        s=1;
        fr(i,n) if(!t.c[i]){
            if(v[s]) ++s;
            ans[i]=s;
            ++s;
        }
    }
    else if(F*3<=n){
        int s{1};
        fr(i,n){
            if(!t.c[i]){
                ans[i]=3*s;
                v[3*s]=true;
                ++s;
            }
        }
        s=1;
        fr(i,n) if(t.c[i]){
                if(v[s]) ++s;
                ans[i]=s;
                ++s;
            }
    }
    else{
        int s=1;
        fr(i,n){
            if(s>n) break;
            if(t.c[i]){
                ans[i]=s;
                v[i]=true;
                s+=3;
            }
        }
        s=2;
        fr(i,n){
            if(s>n) break;
            if(!t.c[i]){
                ans[i]=s;
                v[i]=true;
                s+=3;
            }
        }
        s=3;
        fr(i,n) if(!v[i]){
            ans[i]=s;
            s+=3;
        }
    }
    fr(i,n) cout<<ans[i]<<" ";
    cout<<endl;
}

Measured memory_bytes: 14208
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1111111111;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template <class T>
const pair<T, T> operator+(const pair<T, T> &l,const pair<T, T> &r) { 
	return { l.first + r.first,l.second + r.second }; 
}

template<class T>
inline bool chmin(T &a, T b) { return a > b && (a = b, true); }

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int H, W;
	cin >> H >> W;

	int blk = 0;
	vector<vector<char>> grid(H, vector<char>(W));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> grid[i][j];
			if(grid[i][j] == '#') blk++;
		}
	}

	auto ingrid = [&](pair<int,int> p) {
		return 0 <= p.first&&p.first < H && 0 <= p.second&&p.second < W;
	};

	vector<vector<int>> memo(H, vector<int>(W, INF));
	queue<pair<int,int>> que;
	memo.front().front() = 0;
	que.emplace(0, 0);

	while (!que.empty()) {

		auto now = que.front();
		que.pop();

		for (const auto &del : vector <pair<int, int>>{ {0, 1}, {1, 0}, {-1, 0}, {0, -1} }) {
			auto next = now + del;
			if (ingrid(next) && grid[next.first][next.second] != '#' &&
				chmin(memo[next.first][next.second], memo[now.first][now.second] + 1)) que.emplace(next);
		}

	}

	DMP(memo);

	if (memo.back().back() == INF) cout << -1 << "\n";
	else cout << H * W - blk - memo.back().back() - 1 << "\n";

	return 0;
}

Measured memory_bytes: 256
def hoge(p):
    ret = {}
    pp = 2
    while pp * pp <= p:
        while p % pp == 0:
            ret[pp] = ret[pp]+1 if pp in ret else 1
            p //= pp
        pp += 1
    if p != 1: ret[p] = 1
    return ret

N,P=map(int,input().split())
if N==1:
    print(P)
elif P==1:
    print(1)
else:
    ans = 1
    ret = hoge(P)
    for p,e in ret.items():
        ans *= max(1, p**(e//N))
    print(ans)    


Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc139_a
{
    namespace ConsoleApp
    {
        class Program
        {
            static void Main(string[] args)
            {
                var S = Console.ReadLine();
                var T = Console.ReadLine();
                int Gatti = 0;

                if (S[0] == T[0])
                {
                    Gatti++;
                }
                if (S[1] == T[1])
                {
                    Gatti++;
                }
                if (S[2] == T[2])
                {
                    Gatti++;
                }

                Console.WriteLine(Gatti);
                Console.Read();
            }
        }
    }
}


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

int n, x[24], y[24], r[24], c[24], memo[1<<24], d[24][24], cd[4][6], cn[4], mx;

int check(int p) {
  if (memo[p] != -1) return memo[p];
  int ans = 0, temp[6], tn;
  for (int i = 0; i < 4; i++) {
    tn = 0;
    for (int j = 0; j < cn[i]; j++) {
      int num = cd[i][j];
      if (p & (1 << num)) continue;
      bool flag = true;
      for (int k = 0; k < num; k++) if (d[num][k] && !(p & (1 << k))) { flag = false; break; }
      if (flag) temp[tn++] = num;
    }
    for (int j = 0; j < tn; j++) for (int k = j+1; k < tn; k++) {
      ans = max(ans, 2 + check(p | (1 << temp[j]) | (1 << temp[k])));
      if (ans == mx) return ans;
    }
  }
  return memo[p] = ans;
}

int main() {
  while (scanf("%d", &n), n) {
    mx = (n / 2) * 2;
    for (int i = 0; i < 4; i++) cn[i] = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d%d%d%d", &x[i], &y[i], &r[i], &c[i]);
      c[i]--;
      cd[c[i]][cn[c[i]]++] = i;
    }
    for (int i = 0; i < 4; i++) sort(cd[i], cd[i] + cn[i]);
    for (int i = 0; i < (1<<n); i++) memo[i] = -1;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < i; j++) {
        int xy2 = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
        int r2 = (r[i] + r[j]) * (r[i] + r[j]);
        if (xy2 < r2) d[i][j] = 1;
        else d[i][j] = 0;
      }
    }
    printf("%d\n", check(0));
  }
}



Measured memory_bytes: 68204
<>=~$";@V=glob<>;for$i(-1..$#V){$-=$'-(@_=sort{$a-$b}@V[0..$i,$_..$#V])+1and$\+=$-=${$x=0;$x+=/-/&&--$-?0:$_ for@_;x}-$\for$i+1..@V}print

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

const int MAX_N = 100;

int main() {
    vector<int> G[MAX_N];
    int N; cin >> N;
    for(int i = 0; i < N; i++) {
        int u, k; cin >> u >> k; u--;
        while(k--) {
            int v; cin >> v; v--;
            G[u].push_back(v);
        }
    }

    vector<int> dist(N, -1);
    queue<int> Q;
    Q.push(0);
    dist[0] = 0;

    while(!Q.empty()) {
        int u = Q.front(); Q.pop();
        for(int i = 0; i < (int)G[u].size(); i++) {
            int v = G[u][i];
            if(dist[v] != -1) continue;
            dist[v] = dist[u] + 1;
            Q.push(v);
        }
    }
    for(int i = 0; i < N; i++) cout << i + 1 << ' ' << dist[i] << endl;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,l;
  cin>>n>>l;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    a[i]=l+i;
  }
  int s=0;
  for(int i=0;i<n;i++){
    s+=a[i];
  }
  int ans=0;
  for(int i=0;i<n;i++){
    int t=s-a[i];
    if(abs(t-s)<abs(ans-s)) ans=t;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3640
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define N 1000002
const int p=1e9+7;
int n,a[N],b[N];
int inv[N],f[N],finv[N],dp[5002][5002];
inline void getinv()
{f[1]=finv[1]=inv[1]=1;
	for(register int i=2;i<=1000000;i++)
	{
		inv[i]=1ll*(p-p/i)*inv[p%i]%p;
		f[i]=1ll*f[i-1]*i%p;
		finv[i]=1ll*finv[i-1]*inv[i]%p;
	}
}
inline int C(int nn,int mm)
{
	if(mm==0||nn==mm)return 1;
	else if(nn<mm)return 0;
	return 1ll*f[nn]*finv[mm]%p*finv[nn-mm]%p;
}
int main()
{
	scanf("%d",&n);getinv();
	for(int i=1;i<=n;i++)scanf("%d%d",&a[i],&b[i]);
	for(int i=1;i<=n;i++)dp[2000-a[i]][2000-b[i]]++;
	for(int i=0;i<=4000;i++)for(int j=0;j<=4000;j++)
	{
		if(i)dp[i][j]=(dp[i][j]+dp[i-1][j])%p;
		if(j)dp[i][j]=(dp[i][j]+dp[i][j-1])%p;
	}
	int ans=0;
	for(int i=1;i<=n;i++)ans=(ans+dp[a[i]+2000][b[i]+2000])%p;
	for(int i=1;i<=n;i++)ans=(ans-C(2*a[i]+2*b[i],2*a[i])+p)%p;
	ans=1ll*ans*500000004ll%p;
	printf("%d\n",ans);
}


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

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

    int data[101][101][101];

    for(int x = 0 ; x <= 100 ; x++){
        for(int y = 0 ; y <= 100 ; y++){
            for(int z = 0 ; z <= 100 ; z++){
                data[x][y][z] = -1;
            }
        }
    }

    //n = 10000;
    for(int i = 1 ; i <= n ; i++){
        int max = sqrt(i);
        int cnt = 0;
        for(int x = 1 ; x <= max ; x++){
            for(int y = 1 ; y <= max ; y++){
                for(int z = 1 ; z <= max ; z++){
                    int temp = 0;
                    if(data[x][y][z] == -1){
                        temp = (x * x + y * y + z * z + x * y + y * z + z * x);
                        data[x][y][z] = temp;
                    }else{
                        temp = data[x][y][z];
                    }
                    if(temp == i){
                        cnt++;
                    }else if(temp > i){
                        break;
                    }
                }
            }
        }
        cout << cnt << endl;
    }
}

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

int main(){
    while(1){
        int h, w;
        cin >> h >> w;

        if(h==0 && w==0){
            break;
        }
        int c = h*h+w*w;
        int ah, aw;
        int ac = 1000000;
        for(int hh=1;hh<150;hh++){
            for(int ww=hh+1;ww<150;ww++){
                int cc = hh*hh + ww*ww;
                if(cc < c) continue;
                if(cc == c && hh <= h) continue;
                if(cc < ac){
                    ah = hh;
                    aw = ww;
                    ac = cc;
                } else if(cc == ac) {
                    if(hh < ah){
                        ah = hh;
                        aw = ww;
                        ac = cc;
                    }
                }

            }
        }
        cout << ah << " " << aw << endl;
    }
}

Measured memory_bytes: 3020
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) //for文マクロ
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P; //ペア　タイプでふ
int main()
{
    int a, b, c;
    cin >> a;
    if (a == 1)
    {
        cout << "Hello World";
    }
    else
    {
        cin >> b >> c;
        cout << b + c;
    }
}

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

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: u64 = itr.next().unwrap().parse().unwrap();
    let k: u64 = itr.next().unwrap().parse().unwrap();

    let mut ans: u64 = 0;
    for b in k + 1..n + 1 {
        let div = n / b;
        ans += div * (b - k);
        if div * b + k <= n {
            ans += n - (div * b + k) + 1;
        }
    }
    if k == 0 {
        ans -= n;
    }
    println!("{}", ans);
}


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

typedef long long ll;

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

    int a[n], rev[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
        rev[a[i]-1] = i;
    }

    set<int> pos;
    
    // sentinel
    pos.insert(-1);
    pos.insert(n);

    ll ans = 0;
    for(int i = 0; i < n; i++){
        set<int>::iterator l = pos.lower_bound(rev[i]);
        set<int>::iterator r = l;
        l--;
        ans += (ll)(rev[i]-(*l)) * ((*r)-rev[i]) * (i+1);
        pos.insert(rev[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 11136
#include <stdio.h>
#include <cmath>
#include <bits/stdc++.h>



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

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



int main(void){

	char c; scanf("%c", &c);

	char vowel[5] = {'a', 'i', 'u', 'e', 'o'};

	bool ans = false;
	REP(i,5) if(vowel[i] == c) ans = true;

	if(ans == true) printf("vowel\n");
	else printf("consonant\n");


	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>

ll n;

int main(){
    cin>>n;
    ll ans=0;
    ll cnt=0;

    for(;;){

        ll tmp=pow(2,cnt);
        ans+=tmp;
        n/=2;
        cnt++;
        if(n==0)break;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define li long
int main(){

    li n,m,ac=0,wa=0;
      cin>>n>>m;
      string s1="AC";
      vector<pair<long,long> >v(n+7);

      for(li i=0; i<m; i++){
        li k;
        string s;
        cin>>k>>s;
          if(v[k].second!=1){
            if(s==s1)
            { v[k].second=1;
                ac++;
            }
            else
                v[k].first+=1;
          }


      }
      for(int i=1; i<n+1; i++){
        if(v[i].second==1)
            wa+=v[i].first;
      }
         cout<<ac<<" "<<wa;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <climits>
typedef long long ll;
using namespace std;

int main(void){
  int a,b;

  cin>>a>>b;
  if(a<10&&b<10){
    cout<<a*b<<endl;
  }
  else{
    cout<<-1<<endl;
  }

  return 0;
}


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

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

using namespace std;

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

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

template<typename T> bool chmin(T &a,const T b){if(a>b){a=b; return true;}return false;}
template<typename T> bool chmax(T &a,const T b){if(a<b){a=b; return true;}return false;}


int main(){
    vi time(5);
    for(int i=0; i<5; i++) cin >> time[i];
    vi ord(5);
    for(int i=0; i<5; i++) ord[i]=i;
    int ans=INF;
    do{
        int sum=0;
        for(int i=0; i<5; i++){
            if(i == 4) sum+=time[ord[i]];
            else sum+=(time[ord[i]]+9)/10*10;
        }
        chmin(ans, sum);
    }while(next_permutation(all(ord)));
    cout << ans << endl;
    return 0;
}

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

//入力
int h, w;
//DPテーブル
int dp[1400][1400]; //dp[h][w]　現在の位置を右下とした正方形の最大の面積
//タイルの汚れの有無
int G[1400][1400];


int main() {

  //input
  cin >> h >> w;
  for(int i = 1; i <= h; ++i ){
    for(int j = 1; j <= w; ++j )cin >> G[i][j];
  }


  //DPの初期化
  REP(i,h) dp[i][0] = 0;
  REP(i,w) dp[0][i] = 0;
  int maxlenge = 0;  //最大のサイズ

  //DPループ

  for(int i = 1; i <= h; ++i){
    for(int j = 1; j <= w; ++j){
      if(G[i][j]){
        dp[i][j] = 0;
      }            //タイルが汚れている場合は強制的に０
      else{
        dp[i][j] = min({dp[i-1][j-1], dp[i-1][j], dp[i][j-1]})+1;//タイルがきれいな場合
        maxlenge = max(maxlenge, dp[i][j]);
      }
    }
  }
  cout << maxlenge*maxlenge << endl;

}



Measured memory_bytes: 18400
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
ll dp[1 << 14][14];
int main(){
	int n;
	while (cin >> n, n) {
		//iの次にjをつなげる時にカットされるコスト
		int d[14][14];
		vector<string> a;
		rep(i, n) {
			string in; cin >> in;
			a.push_back(in);
		}
		bool del[14];
		fill(del, del + 14, false);
		//a[i]がa[j]に吸収されるか？
		rep(i, n) {
			rep(j, n) {
				if (i == j)continue;
				int n1 = a[i].length();
				int n2 = a[j].length();
				if (n1 > n2)continue;
				rep(k, n2 - n1 + 1) {
					if (a[i] == a[j].substr(k, n1))del[i] = true;
				}
			}
		}
		per(i, n) {
			if (del[i]) {
				a.erase(a.begin() + i);
			}
		}
		n = a.size();
		ll sum = 0;
		rep(i, n) {
			sum += a[i].length();
		}
		rep(i, n) {
			rep(j, n) {
				if (i == j)continue;
				int n1 = a[i].length();
				int n2 = a[j].length();
				int m = min(n1,n2);
				int ma1 = 0;
				rep1(k, m) {
					if (a[i].substr(n1 - k, k) == a[j].substr(0, k))ma1 = k;
				}
				d[i][j] = ma1;
			}
		}
		rep(i, 1 << n) {
			rep(j, n) {
				dp[i][j] = 0;
			}
		}
		rep(i, 1 << n) {
			rep(j, n) {
				if (i&(1 << j)) {
					int k = i ^ (1 << j);
					rep(l, n) {
						if (l == j)continue;
						if (!(i&(1 << l)))continue;
						dp[i][j] = max(dp[i][j], dp[k][l]+d[l][j]);
					}
				}
			}
		}
		ll ma = 0;
		rep(i, n) {
			ma = max(ma, dp[(1 << n) - 1][i]);
		}
		cout << sum - ma << endl;
	}
	return 0;
}


Measured memory_bytes: 4928