akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MOD=1e9+7;
static const ll MAX=101010;

/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/

ll dp[66], ep[3333];

int main(void) {
  ll i, j, k, l;
  
  
  ll A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;
  
  dp[0]=1;
  for(i=0; i<33; i++) {
    chmax(dp[i+A], dp[i]);
    chmax(dp[i+B], dp[i]);
  }
  
  ep[0]=1;
  for(i=0; i<3030; i++) {
    chmax(ep[i+C], ep[i]);
    chmax(ep[i+D], ep[i]);
  }
  
  
  P res=P(0, 0);
  for(i=0; i<33; i++) {
    for(j=0; j<3030; j++) {
      if(i*100+j>F) continue;
      if(i*E<j) continue;
      if(!dp[i]||!ep[j]) continue;
      
      if(res.second*(i*100+j)<=(res.first+res.second)*j) {
        res=P(i*100, j);
      }
        
    }
  }
  
  pt(res.first+res.second<<" "<<res.second);
  
}




Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
import itertools
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    s = input()
    
    ans = s[0]
    end = s[-1]
    cnt = len(s) - 2
    
    print(ans + str(cnt) + end)
    
    
if __name__ == "__main__":
	main()


Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;

/*
*/

ll n,x,l[110],d=0,ans=1;

void init(){
	cin>>n>>x;
	rep(i,n)cin>>l[i];
	rep(i,n){
		d+=l[i];
		if(d<=x)ans++;
	}
}

int main(void){
	init();
	cout<<ans<<endl;
	return 0;
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

inline li solve(li x) {
    li res = 2;
    while (x-- > 0) {
        res = res + 2 + res;
    }
    return res;
}

int main() {
    li x;
    cin >> x;
    cout << solve(x) << endl;

    return 0;
}

Measured memory_bytes: 256
/*input
9
*/
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define sz(a) int((a).size())
#define pb push_back
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())     
#define rep(i,j,n) for(ll i=j;i<n;i++)
#define mp make_pair
#define N 998244353
#define PI acos(-1.0)
//if (s.find('R') != std::string::npos)
//s.replace(s.find("10"), sizeof("10") - 1, "");
using namespace std;
bool comp(pair<string,ll>a,pair<string,ll>b){
  if(a.first==b.first) return a.second>b.second;
  return a.first<b.first;
}
int main()
{
  // added the two lines below 
  ios_base::sync_with_stdio (false); 
  cin.tie(NULL);
  cout.tie(0);
 
  string s;
  cin>>s;
  ll c=0,mx=INT_MIN;
  for(int i=0;i<s.size();i++){
    if(s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G') c++;
    else {
      mx=max(mx,c);
      c=0;
    }
  }
  mx=max(mx,c);
  cout<<mx;



}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
const ll MOD = 1e9 + 7;

int mainsolve(){

	ll n;
	cin >> n;

	ll res = 0;
	for(ll i = 1; i <= n; i++){

		if( i%3==0 && i%5==0) continue;
		else if(i%3==0) continue;
		else if(i%5==0) continue;

		res += i;
	}

	cout << res << endl;
	return 0;
}

int main(){

	return mainsolve();
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <numeric>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)

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

    int ans = a-2*b;
    if (ans <= 0) cout << 0 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 256
N= gets.to_i
as = gets.split.map(&:to_i)
bs = gets.split.map(&:to_i)

arr = []
rest = 0
ret = 0

i = 0
while i < N
  if as[i] < bs[i]
    rest += bs[i] - as[i]
    ret += 1
  else
    arr << as[i] - bs[i]
  end
  i += 1
end

arr.sort_by!{|a|-a}

arr.each do |a|
  if rest <= 0
    break
  end
  rest -= a
  ret += 1
end

if 0 < rest
  p -1
else
  p ret
end


Measured memory_bytes: 17588
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct UnionFind
{
    vector<ll> par;
    vector<ll> rank;
    vector<ll> sz;
    UnionFind(ll n) : par(n), rank(n), sz(n)
    {
        for(ll i = 0; i < n; i++)
        {
            par[i] = i;
            rank[i] = 0;
            sz[i] = 1;
        }
    }
    ll root(ll x)
    {
        if(par[x] == x) return x;
        else return par[x] = root(par[x]);
    }
    void unite(ll x, ll y)
    {
        x = root(x);
        y = root(y);
        if(x == y) return;
        if(rank[x] < rank[y])
        {
            par[x] = y;
            sz[y] += sz[x];
        }
        else
        {
            par[y] = x;
            sz[x] += sz[y];
            if(rank[x] == rank[y]) rank[x]++;
        }
    }
    bool same(ll x, ll y)
    {
        return root(x) == root(y);
    }
    ll size(ll x)
    {
        x = root(x);
        return sz[x];
    }
};

int main()
{
    ll n, m;
    cin >> n >> m;
    struct edge { ll from; ll to;};
    vector<edge> d(m);
    for(ll i = 0; i < m; i++)
    {
        ll a, b;
        cin >> d[i].from >> d[i].to;
    }


    vector<ll> ans;
    ll count = n * (n-1) / 2;
    ans.push_back(count);

    UnionFind tree(n+1);
    for(ll i = m -1; i >= 0; i--)
    {
        edge e = d[i];
        ll x = e.from;
        ll y = e.to;
        if(!tree.same(x, y))
        {
            ll px = tree.size(x);
            ll py = tree.size(y);
            tree.unite(x, y);

            count = count - (px+py)*(px+py-1L) / 2L + px * (px-1L) / 2L + py * (py-1L) / 2L;
        }

        ans.push_back(count);
    }
    for(ll i = m-1; i >=0; i--)
    {
        cout << ans[i] << endl;
    }
}


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

struct claims {
    int aa;
    int bb;

};

bool operator<(const claims& left, const claims& right)
{
    return left.bb < right.bb ;
}


int main() {
    int N, M;
    vector<claims> a;

    cin >> N >> M;
    int tmpa, tmpb;
    for (int i = 0; i < M; ++i) {
        a.emplace_back();
        cin >> a[i].aa >> a[i].bb;
    }

    sort(a.begin(), a.end());
    int ans = 1;

    int bridge = a[0].bb - 1;
    for (int i =1; i < M; ++i){
        if (bridge < a[i].aa) {
            ans ++;
            bridge = a[i].bb - 1;
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
#define fastio     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x)     (x).begin() , (x).end()
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
typedef long long int ll;
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}


const ll mod = 1e9+7;
const double eps = 1e-9;




int n;
string s;
void solve(){
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;++i)cin>>a[i];
    sort(a,a+n);
    int cnt=0;
    for(int i=0;i<k;++i)cnt+=a[i];
    cout<<cnt;
}





int main(){
    fastio
    int test=1;
    while(test--)
        solve();
    return 0;
}


Measured memory_bytes: 3664
#include<iostream>
#include<vector>
#include <cmath>
using namespace std;
int main()
{   
    // 整数の入力
    int a,b;

    cin >> a;

    if(a%2==0){
        b = a/2-1;
    }
    else{
        b = a/2;
    }

    // 出力
    cout <<b;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
typedef long long ll;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rrep(i,n,a) for(int i=n;i>=a;i--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define all(s) s.begin(),s.end()
#define lla(s) s.rbegin(),s.rend()
#define pcnt(b) __builtin_popcount(b)
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const ll INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a,b,c;
    cin>>a>>b>>c;
    if(a%2&&b%2&&c%2){
        cout<<min({a*b,b*c,c*a})<<endl;
    }
    else{
        cout<<0<<endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

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

        // input
        int a = scan.nextInt();
        int b = scan.nextInt();

        // calc
        int plus = a + b;
        int minus = a - b;
        int multiple = a * b;

        // answer
        System.out.println(Math.max(plus, Math.max(minus, multiple)));

    }
}

Measured memory_bytes: 21844
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from heapq import heappush,heappop
import math



N,M = map(int, input().split())
An = list(map(int, input().split()))

Hn = []
for a in An:
  heappush(Hn,-a)
for _ in range(M):
  h1 = -heappop(Hn)
  h1 = h1 >> 1
  heappush(Hn,-h1)
print(-sum(Hn))

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

int main()
{
  string s, t;
  cin >> s >> t;

  int a, b;
  cin >> a >> b;

  string u;
  cin >> u;
  if (u == s)
  {
    a--;
  }
  else
  {
    b--;
  }
  cout << a << ' ' << b << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, X;
  cin >> N >> X;
  int x[N + 1];
  x[0] = X;
  for (int i = 1; i < N + 1; i++) {
    cin >> x[i];
  }
  int prefix[N];
  for (int i = 0; i < N; i++) {
    prefix[i] = x[i + 1] - x[i];
  }
  int D = prefix[0];
  for (int i = 1; i < N; i++) {
    D = gcd(D, prefix[i]);
  }
  cout << abs(D);
  return 0;
}

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

int n;
char ch;
int x;
bool trump[4][13];

int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> ch >> x;
        if (ch == 'S') {
            trump[0][x - 1] = true;
        } else if (ch == 'H') {
            trump[1][x - 1] = true;
        } else if (ch == 'C') {
            trump[2][x - 1] = true;
        } else if (ch == 'D') {
            trump[3][x - 1] = true;
        }
    }
    
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 13; j++) {
            if (trump[i][j] == false) {
                switch (i + 1) {
                    case 1:
                        cout << "S " << j + 1 << endl;
                        break;
                    
                    case 2:
                        cout << "H " << j + 1 << endl;
                        break;
                        
                    case 3:
                        cout << "C " << j + 1 << endl;
                        break;
                        
                    case 4:
                        cout << "D " << j + 1 << endl;
                        break;
                        
                }
            }
        }
    }
    return 0;
}



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

int main()
{
  string s;
  cin >> s;
  int ab[26];
  for (int i = 0; i < 26; i++) ab[i] = 0;
  for (int i = 0; i < (int)s.size(); i++) ab[s[i] - 'a']++;
  for (int i = 0; i < 26; i++) if (ab[i] == 0) {
    cout << (char)('a' + i) << endl;
    return 0;
  }
  cout << "None" << endl;
}


Measured memory_bytes: 512
import java.util.ArrayDeque;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		ArrayDeque<String> stack = new ArrayDeque<String>();
		ArrayDeque<String> queue = new ArrayDeque<String>();
		while(scan.hasNext()) {
			String input = scan.next();
			if(input.equals("0")) {
				queue.add(stack.pop());
			}else if(input.equals("end")) {
				break;
			}else {
				stack.push(input);
			}
		}
		for(String value : queue) {
			System.out.println(value);
		}
		scan.close();
	}
}



Measured memory_bytes: 26088
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<string>s(n);
  for(int i=0;i<n;i++)
  {
    cin>>s[i];
  }
  vector<vector<int> >a(n);
  for(int i=0;i<n;i++)
  {
    a[i].resize(26);
    for(auto x:s[i])a[i][x-'a']++;
  }
  vector<int>c(26);
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<26;j++)
    {
      if(i==0)c[j]=a[i][j];
      else c[j]=min(c[j],a[i][j]);
    }
  }
  int count=0;
  for(int i=0;i<26;i++)count+=c[i];
  //cout<<count<<endl;
  
  string ans;
  if(count==0)
  {
    cout<<ans<<endl;
    return 0;
  }
  int maxlen=0;
  for(int i=0;i<n;i++)
  {
    vector<int>d(26);
    string t;
    for(auto x:s[i])
    {
      if(d[x-'a']<c[x-'a'])
      {
        t.push_back(x);
        d[x-'a']++;
      }
    }
    if(i==0)
    {
      ans=t;
      maxlen=t.length();
    }
    else if(t<ans && maxlen<=t.length())ans=t;
    d.clear();
    t='\0';
  }
  sort(ans.begin(),ans.end());
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#![allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}
fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main() {
    let n: usize = read();
    let mut ans = 0;
    for i in 1..n {
        ans += (n - 1) / i;
    }
    println!("{}", ans);
}


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

using namespace std;

int main() {

    int N; cin >> N;
    int T, A; cin >> T >> A;

    int ans = 0;
    double min_diff = 1000000;

    for (int i = 0; i < N; ++i) {
        int H;
        cin >> H;

        double t;
        t = T - H * 0.006;

        double diff;
        diff = abs(A - t);

        if (diff < min_diff) {
            min_diff = diff;
            ans = i + 1;
        }
    }

    cout << ans << endl;
}


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

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

const ll mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 1152921504606846976
const double PI = 3.1415926535897932;

int main()
{
    string s,t; cin >> s >> t;
    bool ok = true;
    rep(i,s.size()) if(s[i] != t[i]) ok = false;
    if(ok) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 3624
use itertools::iproduct;
use proconio::input;

fn main() {
    input! {
        k: u64,
    }

    let ans = iproduct!(1..=k, 1..=k, 1..=k)
        .map(|(a, b, c)| [a, b, c].iter().copied().fold(0, num::integer::gcd))
        .sum::<u64>();
    println!("{}", ans);
}


Measured memory_bytes: 2192
#include<bits/stdc++.h>
using namespace std;
int main(){
	string A;
	int k,n;
	cin >>k;
	cin >> A;
	n=A.length();
	k=min(k,n);
	for(int i=0;i<k;i++)
		cout << A[i];
	if(min(k,n)-n){
		cout << "...";
	}
	cout << endl;
}


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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const int mod = 1e9+7;
const ll INF = 1e18;
const int inf = 1e9;

void solve()
{
  int a,b,c,d; cin>>a>>b>>c>>d;
  cout << max(a*b, c*d) << endl;
}

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


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

int main() {
    string s,t;
    cin >> s >> t;
    sort(s.begin(),s.end());
    sort(t.begin(),t.end());
    reverse(t.begin(),t.end());
    if(s < t) cout <<"Yes"<<endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner sc=new Scanner(System.in);
		while(true) {

		int H=sc.nextInt();
		int W=sc.nextInt();
		if(H==0 && W==0) {
			break;
		}
		for(int i=1;i<=H;i++) {
			for(int j=1;j<=W;j++) {
				System.out.print("#");
			}
			System.out.print("\n");
		}
		System.out.print("\n");
		}
	}

}



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

int main(){
    string temp;
    string ans;
    getline(cin, temp);
    
    for(int i = 0; i < temp.size(); i++){
        if(islower(temp[i])){
            ans.push_back(toupper(temp[i]));
        }else if(isupper(temp[i])){
            ans.push_back(tolower(temp[i]));        
        }else{
            ans.push_back(temp[i]);        
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 3160
#include <iostream>
#include <cstdio>
using namespace std;
int main() {
	string s;
	cin >> s;
	if (s[0] == '7' || s[1] == '7' || s[2] == '7') {
		puts("Yes");
	} else {
		puts("No");
	}
	return 0;
}

Measured memory_bytes: 3624
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		boolean result = false;
		for (int i = 0; i <= N/4; i++) {
			for (int j = 0; j <= N/7; j++) {
				int total = i*4 + j*7;
				if (total==N) {
					result = true;
					break;
				}
			}
			if (result) {
				break;
			}
		}
		System.out.println(result ? "Yes" : "No");
	}
}

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

int main() {
    int n, q;
    cin >> n >> q;
    vector<pair<pair<int, int>, int> > v;
    for (int i = 0; i < n; i++) {
        int s, t, x;
        cin >> s >> t >> x;
        s -= x;
        t -= x;
        v.push_back({{s, t}, x});
    }
    sort(v.begin(), v.end());

    /*
    for (int i = 0; i < n; i++) {
        cout << v[i].first.first << " " << v[i].first.second << " " << v[i].second << endl;
    }
    */

    int id = 0;
    priority_queue<pair<int, int> > w;
    for (int i = 0; i < q; i++) {
        int d;
        cin >> d;

        //追加
        while (id < n && v[id].first.first <= d) {
            w.push({-v[id].second, v[id].first.second});
            id++;
        }
        //削除
        while (!w.empty() && w.top().second <= d) w.pop();

        if (!w.empty()) cout << -w.top().first << endl;
        else cout << -1 << endl;
    }

    return 0;
}

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

/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define isin(a, b, c) (b <= a && a <= c)
#define println cout << "\n";
#define sz(v) (int)v.size()


/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;

/* constant */
const int inf = 1LL << 62;
const int mod = 1e9 + 7;
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 string alphabet = "abcdefghijklmnopqrstuvwxyz";

/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T, class U, class V> void printx(tuple<T, U, V> t){cout << "{" << get<0>(t) << "," << get<1>(t) <<"," << get<2>(t) << "}" << endl;}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}


/* general_method */
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; }
template<class T>T cut(T &a, int l, int r){return T(a.begin()+l, a.begin()+r);}

/* main */
int n;
int arr[21][21];
int dp[21][(1 << 21)];
void in(){
    cin >> n;
    rep(i,0,n){
        rep(j,0,n){
            arr[i][j] = input();
        }
    }
    memset(dp, -1, sizeof(dp));
}

int dfs(int i, int s){

    if(i == n) return 1;

    if(dp[i][s] > -1) return dp[i][s];

    int ans = 0;
    rep(j,0,n){
        if(!(s & (1 << j)) && arr[i][j]){
            ans += dfs(i + 1, s + (1 << j));
            ans %= mod;
        }
    }

    return dp[i][s] = ans % mod;

}

void solve(){

    print(dfs(0, 0));

}

signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    in();
    solve();
    
}


Measured memory_bytes: 344448
#include <cstdio>

int sum(int num)
{
	int ret = 0;
	while (num)
		ret += num % 10, num /= 10;

	return ret;
}
int main()
{
	int n;
	scanf("%d", &n);

	int val, ans = 123456789;
	for (int i = 1; i <= n / 2; ++i)
	{
		val = sum(i) + sum(n - i);
		ans = ans > val ? val : ans;
	}

	printf("%d", ans);

	return 0;
}

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

using namespace std;
const int _max = 200010;
typedef long long ll;
int dir[4][2] = {{1,  0},{-1, 0},{0,  1},{0,  -1}};
struct Node {
    int x;
    int y;
};
int a[_max];
int biao[3000000];
int haxi[(int)2e6];

int main() {
    int n;
    cin>>n;
    int count=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        haxi[a[i]]++;
    }
    sort(a+1,a+n+1);
    int max=a[n];
    for(int i=1;i<=n;i++){
        for(int j=2;a[i]*j<=max;j++){
            haxi[j*a[i]]=0;
        }
    }
    for(int i=1;i<=n;i++){
        if(haxi[a[i]]==1){
            count++;
        }
    }
    cout<<count<<endl;

    return 0;
}


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

using namespace std;

const int N = 105;

int ans[N][N];

int main() {
    
    int A, B;
    scanf("%d %d", &A, &B);
    printf("100 100\n");
    for (int i = 51; i <= 100; i++) {
        for (int j = 1; j <= 100; j++) {
            ans[i][j] = 1;
        }
    }
    
    A--;
    B--;
    
    for (int i = 1; i <= 100; i += 2) {
        for (int j = 1; j <= 100; j += 2) {
            if (B == 0) break;
            ans[i][j] = 1;
            B--;
        }
    }
    
    for (int i = 52; i <= 100; i += 2) {
        for (int j = 1; j <= 100; j += 2) {
            if (A == 0) break;
            ans[i][j] = 0;
            A--;
        }
    }
    
    for (int i = 1; i <= 100; i++) {
        for (int j = 1; j <= 100; j++) {
            printf("%c", (ans[i][j] ? '#' : '.'));
        }
        printf("\n");
    }
    
    return 0;
}

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

using namespace std;

int main(void){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0;i < n;i++){
          cin >> a[i];
    }
    long ans = 0;
    for(int i = 0;i < n;i++){
          if(i == a[a[i] - 1] - 1)ans++;
    }
    ans /= 2;
    cout << ans << endl;
}


Measured memory_bytes: 3776
#include <stdio.h>
int main() {
  int l, r, d, ans = 0;
  scanf("%d %d %d", &l, &r, &d);
  
  while(l <= r) {
    if (l%d == 0)
      ans++;
    l++;
  }
  
  printf("%d", ans);
  return (0);
}

Measured memory_bytes: 1720
class UnionFind:
  def __init__(self, size):
    self.table = [-1 for _ in xrange(size)]

  def find(self, x):
    while self.table[x] >= 0: x = self.table[x]
    return x

  def union(self, x, y):
    s1 = self.find(x)
    s2 = self.find(y)
    if s1 != s2:
      if self.table[s1] >= self.table[s2]:
        self.table[s1] += self.table[s2]
        self.table[s2] = s1
      else:
        self.table[s2] += self.table[s1]
        self.table[s1] = s2
      return True
    return False

def hash(n, s, g):
  return n*s+g

def dehash(n, hs):
  return [(hs-hs%n)/n, hs%n]

def kruskal(n, path):
  path = sorted(path.items(), key=lambda x:x[1])
  selected = {}
  union = UnionFind(n)
  for i in xrange(len(path)):
    k,v = path[i]
    s,g = dehash(n, k)
    if union.union(s, g):
      selected[k] = v
  return selected

# main
while True:
  s,d = map(int, raw_input().split())
  if s==d==0:
    break
  path = {}
  n = 1 + d
  # distance between springs and districts
  for i in xrange(s):
    ipt = raw_input().split()
    for j in xrange(d):
      if ipt[j] != "0":
        if hash(n, 0, 1+j) in path:
          path[hash(n, 0, 1+j)] = min(path[hash(n, 0, 1+j)], int(ipt[j]))
        else:
          path[hash(n, 0, 1+j)] = int(ipt[j])

  # distance betweend districts
  for i in xrange(d-1):
    ipt = raw_input().split()
    for j in xrange(d-i-1):
      if ipt[j] != "0":
        path[hash(n, 1+i, i+j+2)] = int(ipt[j])

  result = kruskal(n, path)
  sumcost = 0
  for v in result.values():
    sumcost += v
  print sumcost

Measured memory_bytes: 6496
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };




signed main() {
	int i, j;
	int n, k;
	vector<int>list;


	cin >> n >> k;

	for (i = 0; i < n; i++) {
		int num;
		cin >> num;
		list.push_back(num);
	}

	sort(list.begin(), list.end(), greater<int>());

	int minn = 999999999;

	for (i = 0; i < n - (k - 1); i++) {
		minn = min(minn, list[i] - list[i + (k - 1)]);
	}
	cout << minn << endl;












	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 892
while True:
    H,W=map(int,input().split())
    if(H==0 and W==0):
        break
    for i in range(H):
        for j in range(W):
            if(i%2 == 0):
                if(j%2 == 0):
                    print("#",end="")
                else:
                    print(".",end="")
            else:
                if(j%2 == 0):
                    print(".",end="")
                else:
                    print("#",end="")
        print()
    print()


Measured memory_bytes: 7000
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int main(){
    ll H, W;
    cin >> H >> W;
    if(H==1 || W == 1){
        cout << 1 << endl;
    }else{
        cout << H*W/2+(H*W%2) << endl;
    }
}

Measured memory_bytes: 256
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    int d, c;

    d = sc.nextInt(); c = sc.nextInt();
    out.println(d * c);

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

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

using namespace std;

int main()
{
    int a[100];
    
    for(int i=0 ; i<10 ; i++)
        cin >> a[i];
    
    sort(a,a+10);
    
    for(int i=9 ; i>6 ; i--)
        cout << a[i] << endl;
    
    return 0;
}

Measured memory_bytes: 1176
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <unordered_map>

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

using namespace std;

int main()
{
  int n, m;
  int x[100000];
  int y[100000];

  cin >> n >> m;
  REP(i, m)
  {
    cin >> x[i];
  }

  if (n >= m)
  {
    cout << 0 << endl;
    return 0;
  }
  sort(x, x + m);
  REP(i, m - 1)
  {
    y[i] = x[i + 1] - x[i];
  }
  sort(y, y + m - 1);
  int result = 0;
  REP(i, m - n)
  {
    result += y[i];
  }

  cout << result << endl;
}


Measured memory_bytes: 1024
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

char in[1<<21];
char const*o;

inline void init_in() { 
  o = in;
  in[fread(in,1,sizeof(in)-4,stdin)] = 0;
}

int readInt(){ 
  unsigned u = 0, s = 0;
  while(*o && *o <= 32){
    ++o;
  }
  if (*o == '-'){
    s = ~s, ++o;
  } else if (*o == '+'){
    ++o;
  }
   
  while(*o>='0' && *o<='9'){
    u = (u<<3) + (u << 1) + (*o++ - '0');
  }

  return static_cast<int>((u^s) + !!s) ;
}

int cnt[202020];
template<typename T> void fastout(T &n) {
  T N = n, rev, count = 0;
  rev = N;
  if (N == 0) {
    putchar_unlocked('0');
    putchar_unlocked('\n');
    return;
  }
  while ((rev % 10) == 0) { 
    ++count; rev /= 10;
  }
  rev = 0;
  while (N != 0) { 
    rev = (rev << 3) + (rev << 1) + N % 10;
    N /= 10;
  }
  while (rev != 0) { 
    putchar_unlocked(rev % 10 + '0');
    rev /= 10;
  }
  while (count--) putchar_unlocked('0');
  putchar_unlocked('\n');
}
int main(){
  init_in();
  int n = readInt(); int k = readInt();
  
  for (int i = n - 1; i >= 0; --i) {
    int x = readInt();
    ++cnt[x];
  }
  
  sort(cnt, cnt + n + 1 , greater<int>());

  n -= accumulate(cnt, cnt + k, int());

  fastout(n);

  return 0;
}


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

using namespace std;

int main()
{
  int n;
  cin >> n;
  
  for (int i = 1; i <= n; i++) {
    int c = 0;
    for (int x = 1; x <= i; x++) {
      if (x * x >= i)
        break;
      for (int y = x; y <= i; y++) {
          if (y * y >= i)
            break;
          for (int z = y; z <= i; z++) {
            if (z * z >= i)
              break;
            if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
              if (x == y && y == z) {
	              c++;
              } else if (x != y && y != z) {
                c += 6;
              } else {
                c += 3;
              }
            }
          }
      }
    }
    cout << c << endl;
  }
}

Measured memory_bytes: 3420
#include<stdio.h>
#define MAX 40
void A(int,int);
int baby;
int killme;
int n,i,P[40],I[40],O[40];
int main(){
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&P[i]);
  for(i=0;i<n;i++)scanf("%d",&I[i]);
  A(0,n-1);
  printf("%d",O[0]);
  for(i=1;i<n;i++)printf(" %d",O[i]);
  printf("\n");
  return 0;
}
void A(int a,int b){
  int i=killme++;
  int t;
  for(t=0;I[t]!=P[i];t++);
  if(a<b){
    if(a!=t)A(a,t-1);
    if(b!=t)A(t+1,b);
  }
  O[baby++]=I[t];
}



Measured memory_bytes: 2056
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#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> // dequef
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int x,y,z,k;
  cin >> x >> y >> z >> k;
  vector<ll> a(x), b(y), c(z);
  rep(i, x) cin >> a[i];
  rep(i, y) cin >> b[i];
  rep(i, z) cin >> c[i];
  sort(all(a)); reverse(all(a));
  sort(all(b)); reverse(all(b));
  sort(all(c)); reverse(all(c));
  priority_queue<vector<ll>> que;
  que.push({a[0] + b[0] + c[0], 0, 0, 0});
  map<vector<ll>, bool> check;
  rep(i, k){
    vector<ll> t = que.top();
    que.pop();
    cout << t[0] << endl;
    if(t[1] + 1 < x && !check[{t[1] + 1, t[2], t[3]}]){
      que.push({a[t[1] + 1] + b[t[2]] + c[t[3]], t[1] + 1, t[2], t[3]});
      check[{t[1] + 1, t[2], t[3]}] = true;
    }
    if(t[2] + 1 < y && !check[{t[1], t[2] + 1, t[3]}]){
      que.push({a[t[1]] + b[t[2] + 1] + c[t[3]], t[1], t[2] + 1, t[3]});
      check[{t[1], t[2] + 1, t[3]}] = true;
    }
    if(t[3] + 1 < z && !check[{t[1], t[2], t[3] + 1}]){
      que.push({a[t[1]] + b[t[2]] + c[t[3] + 1], t[1], t[2], t[3] + 1});
      check[{t[1], t[2], t[3] + 1}] = true;
    }
  }
}

Measured memory_bytes: 4700
# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

def pd(str)
  p str if $debugFlag
end

def printd(str)
  print str if $debugFlag
end

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if false
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

# body
if $debugFlag
end

rr = inputs[0][0]

puts rr*rr


Measured memory_bytes: 1788
#include<stdio.h>
int main(){
	int h,w;
	scanf("%d%d",&h,&w);
	while(h!=0&&w!=0){
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				if((i+j)%2==0)printf("#");
				else printf(".");
			}
			printf("\n");
		}
		printf("\n");
		scanf("%d%d",&h,&w);
	}
	return 0;
}


Measured memory_bytes: 2044
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;

int main(){
	int N,K;
	cin>>N>>K;
	vector<long long int> h(N), v(N-1);
	
	for(int i=0;i<N;i++){
		cin>>h[i];
	}
	sort(h.begin(),h.end());

//	cout<<endl;
	long long int ans=1e9,tmp;
	for(int i=0;i+K<=N;i++){
	//	cout<<h[i+K-1]<<" - "<<h[i]<<"=";
		tmp=h[i+K-1]-h[i];
	//	cout<<tmp<<endl;
		ans=min(ans,tmp);
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

const int M = 2020;
const int mod = 924844033;

int add(int x, int y) {
  x += y;
  if (x >= mod)
    x -= mod;
  return x;
}

int sub(int x, int y) {
  x -= y;
  if (x < 0)
    x += mod;
  return x;
}

int mul(ll x, ll y) {
  return x * y % mod;
}

int n, k;
int h[M][4], d[M][4], f[M];
int t[M], a[M];
int c[M][M];

void pre() {
  f[0] = 1;
  for (int i = 1; i < M; ++i)
    f[i] = mul(i, f[i - 1]);

  for (int i = 0; i < M; ++i)
    c[i][0] = 1;
  for (int i = 1; i < M; ++i)
    for (int j = 1; j < M; ++j)
      c[i][j] = add(c[i - 1][j - 1], c[i - 1][j]);
}

void ini() {
  h[0][0] = 1;
}

void read() {
  cin >> n >> k;
}

void step(bool left, bool right) {
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j < 4; ++j)
      d[i][j] = 0;

  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 4; ++j) {
      int bit = (j & 1) << 1;

      d[i][bit] = add(d[i][bit], h[i][j]);


      if ((j & 2) == 0 && left)
        d[i + 1][bit] = add(d[i + 1][bit], h[i][j]);

      if (right)
        d[i + 1][bit | 1] = add(d[i + 1][bit | 1], h[i][j]);
    }
  }

  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j < 4; ++j) {
      h[i][j] = d[i][j];
    }
  }
}

void add(int len) {
  if (len == 1)
    return;

  step(false, true);
  for (int i = 1; i < len - 1; ++i) {
    step(true, true);
  }
  step(true, false);

  for (int i = 0; i <= n; ++i) {
    for (int j = 1; j < 4; ++j) {
      h[i][0] = add(h[i][0], h[i][j]);
      h[i][j] = 0;
    }
  }
}


void kill() {
  ini();
  for (int i = 0; i < k; ++i) {
    int len = 1 + (n - i - 1) / k;
    add(len);
  }

  for (int i = 0; i <= n; ++i)
    t[i] = mul(h[i][0], f[n - i]);
  
  for (int i = n; i >= 0; --i) {
    a[i] = t[i];
    for (int j = i + 1; j <= n; ++j)
      a[i] = sub(a[i], mul(c[j][i], a[j]));
  }

  cout << a[0] << endl;
}

int main() {
  pre();
  cout.precision(20);
  cout << fixed;
  ios_base::sync_with_stdio(false);
  read();
  kill();
}


Measured memory_bytes: 16256
#include<iostream>
#include<cstring>
using namespace std;
int main(){
	char a[101];
	int sum=0;
	cin>>a;
	for (int i=0;i<strlen(a);++i){
		if (a[i]=='C'){
			for (int j=i;j<strlen(a);++j){
				if (a[j]=='F') {
					cout<<"Yes"<<endl;
					return 0;	
				}
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

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

using namespace std;
using ll = long long;

const int MOD = 1e9+7;

int main()
{
    int N;cin >> N;
    string s;
    cin >> s;
    s.erase(unique(s.begin(), s.end()), s.end());
    cout<<s.size()<<endl;
}


Measured memory_bytes: 640
using System;
class Qsort
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        string[] str = Console.ReadLine().Split(' ');
        int[] w = new int[n];
        for(int i = 0; i < n; i++)
        {
            w[i] = int.Parse(str[i]);
        }
        int sum1 = w[0];
        int sum = 0;
        for(int i = 0; i < n; i++)
        {
            sum += w[i];
        }
        int min = 0;
        if (sum - 2 * sum1 > 0)
            min = sum - 2 * sum1;
        else
            min = 2 * sum1 - sum;
        for (int i = 1; i < n; i++)
        {
            sum1 += w[i];
            int tmpmin = 0;
            if (sum - 2 * sum1 > 0)
                tmpmin = sum - 2 * sum1;
            else
                tmpmin = 2 * sum1 - sum;
            if(tmpmin<min)
                min=tmpmin; 
        }
        Console.WriteLine(min);
    }


}

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

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define ROF(i,b,a) for (int i=(b);i>(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,n-1,-1)

typedef int i32;
typedef long long int i64;
typedef unsigned long long int ui64;
typedef float f32;
typedef double f64;
typedef long double f128;
typedef pair<int,int> P;

constexpr int INF = 1e9 + 7;


int main(){
    string S;cin>>S;
    int w;cin>>w;
    string ans = "";
    REP(i,S.size()){
        if(i%w==0) ans.push_back(S[i]);
    }
    cout << ans;
}

Measured memory_bytes: 384
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))   //最大値を求める
#define MIN(x) *min_element(ALL(x))   //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007      //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

signed main()
{
    int S = 0;
    string N;
    cin >> N;
    //cout << N << endl;
    for (auto &&x : N)
    {

        S += x - '0';
        //cout << S << endl;
    }
    
    if(stoi(N)%S == 0)
        cout << "Yes" << endl;
    else
    {
        cout << "No" << endl;
    }
    

}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int m;
long cnt,*G;

void insertionSort(long *A, long n, long g) {
  long i,j,v;
  for(i = g; i < n; i++) {
    v = A[i];
    j = i - g;
    while(j >= 0 && A[j] > v) {
      A[j+g] = A[j];
      j = j - g;
      cnt++;
    }
    A[j+g] = v;
  }
}
void shellSort(long *A, long n) {
  int i;
  cnt = 0;
  m = (int)ceil(log(n)/log(2));
  if(m == 0) m = 1;
  G = (long*)malloc(sizeof(long)*m);
  for(i = 0; i < m; i++) {
    G[i] = (long)pow(2,m-1-i);
    insertionSort(A, n, G[i]);
  }
}

int main() {
  long i,n;
  scanf("%ld", &n);
  long A[n];
  for(i = 0; i < n; i++) scanf("%ld", A+i);
  shellSort(A, n);

  printf("%d\n",m);
  for(i = 0; i < m-1; i++) printf("%ld ", G[i]);
  printf("%ld\n%ld\n", G[i], cnt);
  for(i = 0; i < n; i++) printf("%ld\n", A[i]);

  free(G);
  return 0;
}

Measured memory_bytes: 8476
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

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



int main(){
    int n, d;
    cin >> n >> d;
    int now = 0, res = 0;
    while(now < n){
        now += d;
        res++;
        now += d + 1;
    }
    cout << res << endl;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int main(void){
  int N,W[105],S1,S2,i,T;
  scanf("%d",&N);
  T=0;
  for(i=0;i<N;i++){
    scanf("%d",&W[i]);
    T+=W[i];
  }
  S1=T-W[N-1];
  S2=W[N-1];
  T=abs(S1-S2);
  for(i=N-2;i>=0;i--){
    S1-=W[i];
    S2+=W[i];
    if(T>abs(S1-S2)){T=abs(S1-S2);}
  }
  printf("%d\n",T);

  return 0;
}


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

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
#define SZ(a) int((a).size())
#define _REP(_1,_2,_3,_4,name,...) name
#define _REP4(i,b,e,s) for(decltype(e) _b=(b),_e=(e),i=_b+(0<(s)?0:(s));(0<(s)?i<_e:_e<=i);i+=(s))
#define _REP3(i,b,e) for(decltype(e) _b=(b),_e=(e),i=(_b<_e?_b:_b-1);(_b<_e?i<_e:_e<=i);(_b<_e?i++:i--))
#define _REP2(i,n) for(decltype(n) i=0,_n=(n);i<_n;i++)
#define _REP1(n) for(decltype(n) _i=0,_n=(n);_i<_n;_i++)
#define REP(...) _REP(__VA_ARGS__,_REP4,_REP3,_REP2,_REP1)(__VA_ARGS__)
#define FOR(it,c) for(auto&& it=begin(c);it!=end(c);it++)
#define ROF(it,c) for(auto&& it=rbegin(c);it!=rend(c);it++)
#define EB emplace_back
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define INT(n) int n;assert(0<scanf("%d",&n))
#define AI(a,size,n) array<int,size> a;REP(i,n){assert(0<scanf("%d",&a[i]));}
#define STR(s) string s;cin>>s

int main(){
  STR(s); STR(t);
  int n = SZ(s), m = SZ(t);
  int idx = -1, cnt = 0;
  ll ans = 0;
  vector<vector<int>> v(26);
  REP(i, n){
    v[s[i] - 'a'].PB(i);
  }
  REP(i, m){
    int j = t[i] - 'a';
    if (v[j].empty()){
      ans = -1; break;
    }
    auto it = lower_bound(v[j].begin(), v[j].end(), idx + 1);
    if (it == v[j].end()){
      cnt++;
      idx = v[j][0];
    } else {
      idx = *it;
    }
  }
  if (ans == 0){
    ans = (ll) cnt * n + idx + 1;
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 1216
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		sc.close();
		System.out.println(fact(n));
	}
	static long fact(long n) {
		if(n == 1) return 1;
		return n * fact(n - 1);
	}
}


Measured memory_bytes: 26040