akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main(void){
    int H,W;
    cin >> H >> W;

    vector<string> s(H);
    for(int i=0;i<H;i++) cin >> s[i];

    int shapenum = 0;
    for(int i=0;i<H;i++) for(int j=0;j<W;j++) if(s[i][j]=='#') shapenum++;


    queue<pair<int,int>> q;
    vector<vector<int>> dist(50,vector<int>(50,-1));
    q.push(make_pair(0,0));
    dist[0][0] = 1;

    const int dh[4] = {0,1,0,-1};
    const int dw[4] = {1,0,-1,0};

    while(!q.empty()){
        pair<int,int> p = q.front();
        q.pop();

        int h = p.first, w = p.second;
        for(int i=0;i<4;i++){
            int nh = h+dh[i];
            int nw = w+dw[i];

            if(nh<0||nh>=H||nw<0||nw>=W) continue;
            if(dist[nh][nw]!=-1) continue;
            if(s[nh][nw]=='#') continue;

            q.push(make_pair(nh,nw));
            dist[nh][nw] = dist[h][w]+1;
        }
    }

    /*
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++) cout << dist[i][j] << ' ';
        cout << endl;
    }
    */
    if(dist[H-1][W-1]==-1) cout << -1 << endl;
    else cout << H*W-dist[H-1][W-1]-shapenum << endl;
    return 0;
}

Measured memory_bytes: 3640
n=int(input())
#n,p=map(int,input().split())
#hl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
#素因数分解した結果を2次元配列にして返す

dic={}
ans=0
for i in range(n):
    s=list(input())
    s.sort()
    st="".join(s)
    v=dic.get(st,0)
    ans+=v
    dic[st]=v+1
print(ans)


Measured memory_bytes: 17808
package main

import (
	"fmt"
	"math"
)
func main(){
	var X int
	fmt.Scan(&X)
	now := 100.0
	year := 0

	for ;;{
      year++
		now *= 1.01
		now = math.Floor(now) 
		if(int(now)>=X){
			fmt.Println(year)
			return
		}
	}

}

Measured memory_bytes: 1756
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
   
//#include <x86intrin.h>
#include <bits/stdc++.h>   
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
     
#define F first
#define S second           
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair                                     
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define al 0x3F3F3F3F
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)1e5 + 123;
const ll inf = (ll)1e18 + 1;

const double pi = acos (-1.0);
const double eps = 1e-7;                  
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

int dp[N][2];
string s;

inline int add (int a, int b) {
   a += b;
   if (a >= mod) a -= mod;
   return a;
}
                                                
int calc (int pos = 0, int sa = 1) {
   if (pos == sz (s)) return 1;
   int &res = dp[pos][sa];
   if (res != -1) return res;
   res = 0;
   for (int i = 0; i < 2; i ++)
      for (int j = 0; j < 2; j ++) {
         if (i == 1 && j == 1) continue;
         if (sa && (i + j) > s[pos]) continue;
         res = add (res, calc (pos + 1, (sa & ((i + j) == s[pos]))));
      }
   return res;
}

inline void boost () {                    
   ios_base :: sync_with_stdio (NULL);
   cin.tie (NULL), cout.tie (NULL);          
}                                                     

inline void Solve () {
   cin >> s;
   for (int i = 0; i < sz (s); i ++) s[i] -= '0';
   memset (dp, -1, sizeof dp);
   cout << calc ();
}

main () {                                       
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
   //cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}
                         

Measured memory_bytes: 9040
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int n,m;

  map<string,int> b,r,d;

  cin >> n;

  rep(i,n)
  {
    string s;
    cin >> s;
    b[s]++;
    d[s] = 1;
  }

  cin >> m;

  rep(i,m)
  {
    string s;
    cin >> s;
    r[s]++;
    d[s] = 1;
  }

  int ans = 0;

  for(auto itr = d.begin();itr != d.end(); itr++)
  {
    int x = b[itr->first] - r[itr->first];

    if(ans < x) ans = x;
  }

  cout << ans << endl;

  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<char,char> P;
const LL mod=1000000007;
const LL LINF=1LL<<62;
const LL INF=1<<17;



int main(){
    int n;cin >> n;
    string s;cin >> s;
    int t=0;
    for (int i = 0; i < n; i++) {
        if(s[i]=='R') t++;
        else t--;
    }
    if(t>0) puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;


void solve(long long N, std::vector<long long> A){
    mll rec;
    ll total=0;
    REP(i, N) rec[A[i]] ++;
    for(auto x: rec) total += x.second*(x.second-1)/2;
    for(auto a: A){
        cout<< total - rec[a]*(rec[a]-1)/2 + (rec[a]-1)*(rec[a]-2)/2<<endl;;
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 11008
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
const int N = 1 * 1e7 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
const double E = 1e-9;
int v[N];
int main(){
    //freopen("in","r",stdin);
    //freopen("out","w",stdout);
    fast;
    int n;
    cin >> n;
    fore(i, 1, n + 1){
        if(i % 3 == 0 && i % 5 == 0)
            v[i] = 1;
        else if(i % 3 == 0)
                v[i] = 1;
        else if(i % 5 == 0)
                v[i] = 1;
    }
    ll ans = 0;
    fore(i, 1, n + 1){
        if(!v[i]){
            //cout << i << '\n';
            ans += (ll)i;
        }
    }
    cout << ans << '\n';
    return 0;
}   


Measured memory_bytes: 7512
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
using namespace std;
int main(){
    int N, M; cin >> N >> M;
    vector<int> a(N),b(N),c(M),d(M);
    for (int i=0;i<N;i++) cin >> a[i] >> b[i];
    for (int j=0;j<M;j++) cin >> c[j] >> d[j];
    
    for (int i=0;i<N;i++) {
        int min_dis=400000010,min_point=0;
        for (int j=0;j<M;j++){
            int tmp = abs(c[j]-a[i]) + abs(d[j]-b[i]);
            if (tmp<min_dis){
                min_dis = tmp;
                min_point = j+1;
            }
        }
        cout << min_point << endl;
    }

}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		ArrayList<Integer> x = new ArrayList<Integer>();
		ArrayList<Integer> y = new ArrayList<Integer>();
		while(true){
			int t = in.nextInt();
			if(t==0) break;
			x.add(0);
			y.add(0);
			for(int i=0; i<t-1; i++){
				int n = in.nextInt();
				int d = in.nextInt();
				switch(d){
				case 0:
					x.add(x.get(n)-1);
					y.add(y.get(n));
					break;
				case 1:
					x.add(x.get(n));
					y.add(y.get(n)+1);
					break;
				case 2:
					x.add(x.get(n)+1);
					y.add(y.get(n));
					break;
				case 3:
					x.add(x.get(n));
					y.add(y.get(n)-1);
					break;
				}
			}
			int max_x=0;
			int min_x=0;
			int max_y=0;
			int min_y=0;
			for(int i=0; i<t; i++){
				if(max_x<x.get(i)) max_x = x.get(i);
				if(min_x>x.get(i)) min_x = x.get(i);
				if(max_y<y.get(i)) max_y = y.get(i);
				if(min_y>y.get(i)) min_y = y.get(i);
			}
			System.out.println((max_x-min_x+1)+" "+(max_y-min_y+1));
			x.clear();
			y.clear();
		}
	}
}

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

using namespace std;

int n, m;
vector<int> G[100005];
int deg[100005];
int used[100005];

int id = 1;
void dfs(int v, int p)
{
	used[v] = id++;
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i] == p) continue;
		if(used[G[v][i]]){
			if(used[G[v][i]] < used[v]){
				deg[v]++;
				cout << v << " " << G[v][i] << endl;
			}
		}
		else dfs(G[v][i], v);
	}
	if(p != -1){
		if(deg[v]%2) cout << v << " " << p << endl;
		else cout << p << " " << v << endl, deg[p]++;
	}
}

int main(void)
{
	cin >> n >> m;
	int u, v;
	for(int i = 1; i <= m; i++){
		cin >> u >> v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	if(m%2){
		cout << -1 << endl;
		return 0;
	}
	
	dfs(1, -1);
	
	return 0;
}

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

int main(){
 
  int N, i;
  double Sum = 0;
  cin >> N;
  double A;
  
  
  for (i = 0; i < N; i++){
    
    cin >> A;
    Sum += 1 / A;
  }
  
  cout << 1 / Sum << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

#define REP(k, n) for (ll k = 0; k < (ll)(n); ++k)
#define REPREV(k, n) for (ll k = (ll)(n)-1; k >= 0; --k)
#define FOR(k, a, b) for (ll k = (ll)(a); k < (ll)(b); ++k)
#define FORREV(k, a, b) for (ll k = (ll)(b)-1; k >= (ll)(a); --k)
#define FOREACH(e, v) for (auto& e : v)

#define TGET(t, i) get<i>(t)
#define TSET(t, i, a) get<i>(t) = a
// MinHeap - priority_queue<ll, vll, greater<ll>> pq;

#define EVEN(n) ((n)&1) == 0
#define ODD(n) ((n)&1) == 1

#define SORT(v) sort(v.begin(), v.end())
#define SORTREV(v) sort(v.rbegin(), v.rend())
#define SHUFFLE(v) random_shuffle(v.begin(), v.end())
//srand(unsigned(time(0)));

#define REMOVEAT(v, i) v.erase(v.begin() + i)
#define REVERSE(v) reverse(v.begin(), v.end())

ll MOD(ll x, ll m) {
    ll r = x % m;
    if (r < 0) {
        r += m;
    }
    return r;
}

ostream& operator<<(ostream& str, const pll& p) {
    str << p.first << " " << p.second;
    return str;
}

template <typename T>
void join(T& arr, string sep) {
    bool first = true;
    for (auto t : arr) {
        if (first) {
            first = false;
            cout << t;
        } else {
            cout << sep << t;
        }
    }
    cout << "\n";
}

#define POS "POSSIBLE"
#define IMPOS "IMPOSSIBLE"

// #define INF LLONG_MAX
// #define MINF LLONG_MIN
#define INF 9e18
#define MINF -INF

void solve() {
    char c;
    cin >> c;
    if (c >= 'A' && c <= 'Z') {
        cout << "A\n";
    } else {
        cout << "a\n";
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tt = 1;
    // cin >> tt;
    for (int t = 1; t <= tt; t++) {
        // cout << "Case #" << t << ": ";
        solve();
    }

    return 0;
}

Measured memory_bytes: 3648
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
ans = 0
for _ in range(n):
  now = c
  tmp = list(map(int,input().split()))
  for i in range(m):
    now += b[i] * tmp[i]
  if now > 0:
    ans += 1
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define LL long long
int a[100], b[100], c[100];
int main() {
    // ios_base::sync_with_stdio(false);
    // cin.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) cin >> b[i];
    for (int i = 1; i <= n-1; i++) cin >> c[i];
    int sum = 0;
    for (int i = 1; i <= n; i++) sum += b[i];
    for (int i = 1; i <= n-1; i++) {
        if (a[i+1] == a[i] + 1) sum += c[a[i]];
    }
    cout << sum << '\n';
    return 0;
}

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

int n, k, lt, rt, md, ans, a[5005];

int f(int p) {
	int i;
	bitset<5005> bs=1;
	if(a[p] >= k) return 1;
	for(i=0; i<n; i++) {
		if(i!=p) bs |= (bs << a[i]);
	}
	for(i=k-a[p]; i<k; i++) if(bs[i]) return 1;
	return 0;
}

int main() {
	cin >> n >> k;
	for(int i=0; i<n; i++) cin >> a[i];
	sort(a, a+n);
	rt = n;
	while(lt < rt) {
		md = (lt + rt) / 2;
		if(f(md)) rt= md;
		else lt = md+1;
	}
	cout << lt;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cstring>
#include <cmath>
int main(){
	char s[19]={0};
	scanf("%s", s);
	//printf("%d", strlen(s));
	for(int i=0;i<19;i++)
	{
		if(s[i]!=',')
			printf("%c", s[i]);
		else
			printf(" ");
	}
	return 0;
} 

Measured memory_bytes: 128
#include <iostream>
#define llint long long

using namespace std;

llint Q;
llint a, b;

int main(void)
{
	cin >> Q;
	for(int q = 0; q < Q; q++){
		cin >> a >> b;
		llint x = a*b;
		llint ub = 1e9+7, lb = 0, mid;
		while(ub-lb>1){
			mid = (ub+lb)/2;
			if(mid*mid <= x-1) lb = mid;
			else ub = mid;
		}
		llint ans;
		if(lb*(lb+1) < x) ans = 2*lb;
		else ans = 2*lb-1;
		if(a <= lb || b <= lb) ans--;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
PROGRAM-ID.                      ABC_044_B.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 N       PIC 9(5).
    01 K       PIC 9(5).
    01 X       PIC 9(5).
    01 Y       PIC 9(5).
    01 minK    PIC 9(5).
    01 tmp     PIC 9(9).
    01 A       PIC 9(18).
    01 ans     PIC X(18).
    01 ZS      PIC Z(10).
    01 DUMMY   PIC X(1).

PROCEDURE                        DIVISION.
    ACCEPT N.
    ACCEPT K.
    ACCEPT X.
    ACCEPT Y.

    COMPUTE minK = FUNCTION MIN(N, K).
    COMPUTE tmp = X * minK + Y * (N - minK).

    MOVE tmp TO ZS.

    PERFORM UNANS.

    DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans)).
    STOP RUN.

UNANS                            SECTION.
    UNSTRING
        ZS DELIMITED BY ALL SPACE
        INTO DUMMY ans
    END-UNSTRING.


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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

using namespace std;
using ll = long long;
using pii = pair<int, int>;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i = 0; i < n; ++i){
        cin >> p[i];
        --p[i];
    }
    vector<int> a(n), b(n);
    for(int i = 0; i < n; ++i){
        a[i] = b[n-i-1] = i*n + 1;
    }
    for(int i = 0; i < n-1; ++i){
        b[p[i+1]] = a[p[i]] + b[p[i]] + 1 - a[p[i+1]];
    }
    cout << a[0];
    for(int i = 1; i < n; ++i){
        cout << " " << a[i];
    }
    cout << "\n";
    cout << b[0];
    for(int i = 1; i < n; ++i){
        cout << " " << b[i];
    }
    cout << "\n";
    return 0;
}

Measured memory_bytes: 896
#include <stdio.h>

int main(){
    int n;
    scanf("%d",&n);
    int masu[n];
    int i;
    for(i = 0;i<n;i++){
        scanf("%d",&masu[i]);
    }
    int prev = 0;
    int margin = 0;
    for (i = 1; i < n; i++)
    {
        int ret;
        if ((ret = masu[i] - masu[i - 1]) < 0)
        {
            margin += ret;
        }
        else if (ret > 0)
        {
            margin++;
            
        }
        if(margin < 0 || ret < -2 || (ret < 0 && prev < 0)){
            printf("No");
            return 0;
        }
        if (ret != 0)
        {
            prev = ret;
        }
    }
    printf("Yes");
    return 0;
}

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

namespace AtCoder
{
    class Abc164C
    {
        public static void Main()
        {
            var n = int.Parse(Console.ReadLine());
            var hash = new HashSet<string>();
            for (int i = 0; i < n; i++)
                hash.Add(Console.ReadLine());
            Console.WriteLine(hash.Count);
        }
    }
}


Measured memory_bytes: 43200
#include <stdio.h>
#include <stdlib.h>
int head=0;
int data[100];
int main (){
  char tmp,x[6];
  int y,i=0;
  while(1){
    scanf("%c",&tmp);
    if('\n'==tmp)break;
    else if('+'==tmp){
      data[head-2]=data[head-2]+data[head-1];
      head--;
    }
    else if('-'==tmp){
      data[head-2]=data[head-2]-data[head-1];
      head--;
    }
    else if('*'==tmp){
      data[head-2]=data[head-2]*data[head-1];
      head--;
    }
    else if(' '==tmp){  
      if(x[0]!='\0'){
	y=atoi(x);
	data[head]=y;
	head++;
	for(i=0;i<6;i++){
	  x[i]='\0';
	}
      }
      i=0;
    }
    else{
      x[i]=tmp;
      i++;
    }
  }
  printf("%d\n",data[0]);
  return 0;
}



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

constexpr unsigned long MOD = 998244353;
constexpr unsigned long mx = 1000001;
constexpr unsigned long R = 4294967296, MODinv = 998244351, R2 = 932051910, mask = R - 1, R_bitsize = 32;

constexpr unsigned long montgomery_reduction(unsigned long a){
    return (a + (mask & a * MODinv) * MOD) >> R_bitsize;
}

template<unsigned long maxsize, unsigned long MOD, unsigned long primesize>
class divisor_convolution_coefficients{
    unsigned long sieve[maxsize];
public:
    unsigned long prime[primesize];
    unsigned long coef[maxsize];
    constexpr divisor_convolution_coefficients() : coef(), sieve(), prime(){
        coef[1] = 1;
        for(unsigned long i = 2; i < maxsize; ++i){
            coef[i] = i;
            sieve[i] = 1;
        }
        for(unsigned long i = 2, c = 0; i < maxsize; ++i)if(sieve[i]){
                prime[c++] = i;
                for(unsigned long j = i; j < maxsize; j += i){
                    sieve[j] = 0;
                    (coef[j] *= MOD + 1 - i) %= MOD;
                }
            }
    }
};

constexpr divisor_convolution_coefficients<mx, MOD, 78498> coef{divisor_convolution_coefficients<mx, MOD, 78498>()};

int main(){
    using namespace std;

    unsigned long N;
    cin >> N;

    unsigned long ans{0};
    unsigned long max_size{0};
    vector<unsigned long> hoge(mx);
    for(unsigned long _ = 0, i; _ < N; ++_){
        cin >> i;
        max_size = max(i, max_size);
        ++hoge[i];
    }
    ++max_size;

    for(const auto& i : coef.prime)for(unsigned long j = max_size / i; j; --j)hoge[j] += hoge[j * i] * i;
    for(auto& i : hoge)i %= MOD;

    ans = MOD - hoge[1];
    for(unsigned long i = 1; i < max_size; ++i)if(hoge[i])ans += hoge[i] * hoge[i] % MOD * coef.coef[i] % MOD;
    (ans += (ans & 1) * MOD) >>= 1;
    cout << ans % MOD << endl;

    return 0;
}

Measured memory_bytes: 8188
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Hauptteil

(defun main ()
  (let* ((n (read))
         (sum 0d0))
    (dotimes (i n)
      (let ((x (read))
            (u (read)))
        (if (eql u 'JPY)
            (incf sum x)
            (incf sum (* x 380000)))))
    (println sum)))

#-swank(main)


Measured memory_bytes: 15844
#include <string>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
#include<math.h>
#include <ctype.h>
#include <algorithm> // sort
#include <map> // pair
using namespace std;

int main() {
  int n,a,b;
  cin >> n >> a >>b;
  cout << min(n*a,b) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>

using namespace std;

double memo[101][101];
bool flag[101][101];
bool isLose[101];
bool isBack[101];

int N, T, L, B;

double dfs(int pos, int t) {
    if (pos == N) return 1.;
    if (t >= T) return 0.;
    if (flag[pos][t]) return memo[pos][t];
    double ans = 0;
    for (int d = 1; d <= 6; ++d) {
        int to = pos + d > N ? N - (pos + d - N) : pos + d;
        int tn = t + 1;
        if (isBack[to]) to = 0;
        else if (isLose[to]) tn++;

        ans += 1. / 6 * dfs(to, tn);
    }
    flag[pos][t] = true;
    memo[pos][t] = ans;
    return ans;
}

int main() {
    while (1) {
        cin >> N >> T >> L >> B;
        if (N == 0) break;
        for (int i = 0; i < 101; ++i) {
            isLose[i] = false;
            isBack[i] = false;
            for (int j = 0; j < 101; ++j){
                memo[i][j] = -1;
                flag[i][j] = false;
            }
        }
        
        for (int i = 0; i < L; ++i) {
            int li;
            cin >> li;
            isLose[li] = true;
        }

        for (int i = 0; i < B; ++i) {
            int bi;
            cin >> bi;
            isBack[bi] = true;
        }

        printf("%.6f\n", dfs(0, 0));
    }
}


Measured memory_bytes: 3176
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
using Pair = System.Tuple<int, int>;
using Edge = System.Tuple<int, int, long>;
//using Debug;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var nt = Input.ar;
        var imos = new int[nt[1] + 1];
        for(var i = 0;i< nt[0]; i++)
        {
            var lr = Input.ar;
            imos[lr[0]]++;
            imos[lr[1]]--;
        }
        for (var i = 1; i <= nt[1]; i++)
            imos[i] += imos[i - 1];
        WriteLine(imos.Max());
    } 
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(v => read.ToCharArray()).ToArray();
    public static int[][] twodim(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] twodimL(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 20384
n, k = map(int, input().split())
As = list(map(int, input().split()))

idx = As.index(min(As))
left = idx

n_l = (left + k - 2) // (k - 1)

right = n - ((n_l) * (k-1)) - 1

n_r = (right + k - 2) // (k - 1)

print(n_l + n_r)

Measured memory_bytes: 14008
#include<stdio.h>
int f(int p){
  if(p<=60)
    return 600;
  else if(p<=80)
    return 800;
  else if(p<=100)
    return 1000;
  else if(p<=120)
    return 1200;
  else if(p<=140)
    return 1400;
  else if(p<=160)
    return 1600;
  else
    return -1;
}
int g(int p){
  if(p<=2)
    return 600;
  else if(p<=5)
    return 800;
  else if(p<=10)
    return 1000;
  else if(p<=15)
    return 1200;
  else if(p<=20)
    return 1400;
  else if(p<=25)
    return 1600;
  else
    return -1;
}
int main(){
  int i;
  int n,x,y,h,w,s;
  for(;;){
    scanf("%d",&n);
    if(n==0)
      break;
    s=0;
    for(i=0;i<n;i++){
      scanf("%d%d%d%d",&x,&y,&h,&w);
      if(f(x+y+h)!=-1&&g(w)!=-1)
	s+=f(x+y+h)>g(w)?f(x+y+h):g(w);
    }
    printf("%d\n",s);
  }
  return 0;
}

Measured memory_bytes: 0
import sys
sys.setrecursionlimit(10**7)
N=int(input())
L=[[] for _ in range(N)]
for i in range(N-1):
  u,v,w=map(int,input().split())
  w=w%2
  L[u-1].append([v,w])
  L[v-1].append([u,w])
  

col=[-1]*N
def dfs(p):
  for i in L[p-1]:
    if col[i[0]-1]!=-1:
      pass
    else:
      col[i[0]-1]=abs(i[1]-col[p-1])
      dfs(i[0])

col[0]=0
dfs(1)

for i in col:
  print(i)

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

struct Edge{
	int to, cost;
};

const int INF = 1 << 24;
int n, m;
int d[2][100];
std::vector<Edge> es[100];

void dijkstra(int s){
	int used[2][100];
	for(int i=0;i<2;i++){
		for(int j=0;j<n;j++){
			used[i][j] = 0;
			d[i][j] = INF;
		}
	}

	d[0][s] = 0;

	while(true){
		int u = -1, v;
		for(int i=0;i<2;i++){
			for(int j=0;j<n;j++){
				if(!used[i][j] && (u == -1 || d[i][j] < d[u][v])){
					u = i;
					v = j;
				}
			}
		}

		if(u == -1)break;
		used[u][v] = 1;

		for(int i=0;i<es[v].size();i++){
			Edge e1 = es[v][i];
			d[u][e1.to] = std::min(d[u][e1.to], d[u][v]+e1.cost);
			for(int j=0;j<es[e1.to].size();j++){
				Edge e2 = es[e1.to][j];
				if(v != e2.to && u == 0){
					d[1][e2.to] = std::min(d[1][e2.to], d[0][v]);
				}
			}
		}
	}
}

int main(){
	while(std::cin >> n >> m, n){
		for(int i=0;i<n;i++){
			es[i].clear();
		}
		for(int i=0;i<m;i++){
			int a, b, c;
			std::cin >> a >> b >> c;
			es[a-1].push_back({b-1, c});
			es[b-1].push_back({a-1, c});
		}

		dijkstra(0);

		std::cout << std::min(d[0][n-1], d[1][n-1]) << std::endl;
	}
}

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

int main(){
 int i;
 string O;
 string E;
 string ans;
 cin>>O>>E;
 for(i=0;i<O.size();i++){
 	ans=ans+O[i];
	if(i+1==O.size() && i+1>E.size()){
		break;
	}
	ans=ans+E[i];
 }
 cout<<ans<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

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

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

    long long tmp = -1;
    long long ans = 0;
    for(auto it=m.rbegin(); it!=m.rend(); ++it){
        if(it->second >= 4){
            if(tmp == -1)
                ans = it->first * it->first;
            else
                ans = tmp * it->first;
            break;
        }
        else if(it->second >= 2){
            if(tmp != -1){
                ans = tmp * it->first;
                break;
            }
            tmp = it->first;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 6528
/*
power code taken from geeks for geeks
*/

#include <bits/stdc++.h>
#define MODD 1000000007LL
#define MAX 1000000000LL
#define MAX_N 200001
using namespace std;
typedef long long ll;
typedef long double ld;
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
double modd(double a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return a % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;
 
    ll P = power(k, p/2LL);
    P = (P * P) % MODD;
 
    if (p % 2 == 1)
        P = (P * k) % MODD;
 
    return P;
}

ll gcd(ll a, ll b){
    if(b==0){
        return a;
    }
    return gcd(b, a%b);
}

bool comp(ll a, ll b){
    return a>b;
}


void solve(){
    ll n,m;
    cin>>n>>m;
    ll a[n];
    for(ll i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a, a+n, comp);
    ld sum=0.0;
    for(ll i=0;i<n;i++){
        sum+=a[i]*1.0;
    }
    ld th=sum/m*0.25;
    for(ll i=0;i<m;i++){
        if(a[i]<th){
            cout<<"No"<<endl;
            return;
        }
    }
    cout<<"Yes"<<endl;
}
int main(){




    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    

    return 0;
}


Measured memory_bytes: 256
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>

using namespace std;

int main()
{
    std::string S;

    std::cin >> S;

    int y = 700;
    if (S[0]=='o') {
        y += 100;
    }
    if (S[1]=='o') {
        y += 100;
    }
    if (S[2]=='o') {
        y += 100;
    }

    std::cout << y << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

typedef long long ll;

ll X[100005];

int main(){

	int N;
	ll A,B;

	scanf("%d %lld %lld",&N,&A,&B);

	int i;

	for(i=0;i<N;i++){
	scanf(" %lld",&X[i]);
	}

	ll ans=0ll;
	for(i=1;i<N;i++){
	ll move_cost=A*(X[i]-X[i-1]);
	if(move_cost>B){ans+=B;}
	else{ans+=move_cost;}
	}
	printf("%lld\n",ans);


	return 0;
}

Measured memory_bytes: 896
fun main() {
    val n = readInt()
    val a = readInts().map { it.toLong() }
    var prev = 201L
    var index = 0
    var money = 1000L
    var stocks = 0L
    while (index < n) {
        while (index < n && a[index] <= prev) {
            prev = a[index]
            index++
        }
        if (index < n) {
            stocks = money/prev
            money -= stocks * prev
        }
        while (index < n && a[index] >= prev) {
            prev = a[index]
            index++
        }
        if (stocks > 0) {
            money += stocks * prev
            stocks = 0
        }
    }
    println(money)
}

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

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


Measured memory_bytes: 36652
k = input()
s = input()
length = len(s)
# print(k)
# print(s)
# print(length)

k = int(k)
if length <= k:
    print(s)
else:
    string = ''
    for i in range(k):
        string += s[i]
    string += '...'
    print(string)


Measured memory_bytes: 9172
// ABC055B - 

#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;

#define MOD 1000000007

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

	ull ans = 1;
	for (ull i = 1; i <= N; i++) {
		ans = ans * i % MOD;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import sys

a, b = map(int, input().split())
cnt = 0
if a <= 0 and 0 < b:
    print('Zero')
    sys.exit()

if b <= 0:
    cnt = abs(a - b) + 1

ans = ''
if cnt % 2 == 0:
    ans = 'Positive'
else:
    ans = 'Negative'

print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>


using namespace std;

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


int main() {
	ll n;
	cin >> n;
	ll a[n];
	rep(i , n) {
		cin >> a[i];
	}

	sort(&a[0], &a[n]);

	ll from = 0;
	ll total = a[0];
	for (int i = 1; i < n; i++) {
		if (total * 2 < a[i]) {
			from = i;
		}
		total += a[i];

	}
	//cout << "total:" << total << " from:" << from << endl;
	ll a_i = a[from];
	ll cur = from;
	while(cur > 0) {
		if (a[from] != a[cur - 1]) {
			break;
		}
		cur--;
		cur = from;
	}
	//cout << "cur:" << cur << endl;
 
 	cout << n - cur << endl;


	
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod=1000000007;
const int MAXN=100010, LOG=20;

int n, m, k, u, v, x, y, t, a, b, ans;
int deg[MAXN];
bool mark[MAXN];
vector<int> G[MAXN];

void dfs(int node){
	mark[node]=1;
	for (int v:G[node]) if (!mark[v]) dfs(v);
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n>>m;
	while (m--){
		cin>>u>>v;
		G[u].pb(v);
		G[v].pb(u);
		deg[v]++;
		deg[u]++;
	}
	for (int i=1; i<=n; i++) if (deg[i]&1) kill("No")
	for (int i=1; i<=n; i++) if (deg[i]>2){
		if (deg[i]>=6) kill("Yes")
		ans++;
	}
	if (ans<=1) kill("No")
	if (ans>2) kill("Yes")
	for (int root=1; root<=n; root++) if (deg[root]==4){
		mark[root]=1;
		dfs(G[root].back());
		for (int i=1; i<=n; i++) if (!mark[i]) kill("Yes")
		kill("No")
	}
	
	return 0;
}


Measured memory_bytes: 7808
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
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;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    debug("debug test\n");
    int n,m;cin>>n>>m;
    cout << (3*n+m)/2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
         int a,b,m,sum,sum2,mins,ans;
         cin>>a>>b>>m;
         int x[a],y[b],m0,m1,d,i,j,min1,min2,mad1,mad2;
         for(i=0;i<a;i++)
         {
                  cin>>x[i];
         }
         for(i=0;i<b;i++)
         {
                  cin>>y[i];
         }
         mad1=1;
         mad2=1;
         min1=x[0];
         min2=y[0];
         for(i=0;i<a;i++)
         {
                  if(x[i]<min1)
                  {
                           min1=x[i];
                           mad1=i+1;
                  }
         }
          for(i=0;i<b;i++)
         {
                  if(y[i]<min2)
                  {
                           min2=y[i];
                           mad2=i+1;
                  }
         }
         sum=min1+min2;
         ans=sum;
         for(i=0;i<m;i++)
         {
                  cin>>m0>>m1>>d;
                  sum2=x[m0-1]+y[m1-1]-d;
                  if(sum2<ans)ans=sum2;

         }
         cout<<ans<<endl;

}


Measured memory_bytes: 1024
N,M=map(int,input().split())
wa=[0]*N
pen=[0]*N
ac=[0]*N
for x in range(M):
  P,S=input().split()
  if S=="WA" and ac[int(P)-1]==0:
    wa[int(P)-1] += 1
  elif S=="AC" and ac[int(P)-1]==0:
    ac[int(P)-1] += 1
    pen[int(P)-1] = wa[int(P)-1]
print(f"{sum(ac)} {sum(pen)}")

Measured memory_bytes: 11188
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#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;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#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 INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

int main(void){
    string s;
    cin >> s;
    int min_v = MAXR;
    int n = s.size();
    REP(i, n-2) {
        int x = abs(753 - ((s[i]-'0')*100 + (s[i+1]-'0')*10 + s[i+2]-'0'));
        min_v = min(min_v, x);
    }
    cout << min_v << endl;
    return 0;
}

Measured memory_bytes: 256
a, b, x = map(int, input().split())
import math
if x >= a*a*b/2:
    s = a*b - x/a
    t = 2*s/(a*a)
    print(math.atan(t)*180/math.pi)
else:
    t = a*b*b/(2*x)
    print(math.atan(t)*180/math.pi)

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

Measured memory_bytes: 2584
#include <stdio.h>

int main(void){

  long b,c,N,K;

  scanf("%ld", &N);
  scanf("%ld", &K);
  c = 0;
  for(b=K+1; b <= N; b++){
    long a_num = 0;
    a_num += (b-K)*(N/b);
    if( N%b - K +1 > 0){
      a_num += N%b - K+1;		/* 残余 */
    }

    if( K == 0){
      a_num -= 1;		/* 最初a=0は対象外なので */
    }
    c += a_num;


  }

  printf("%ld", c);

}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>

using namespace std;
typedef long long ll;

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

int main() {

    string S,T;
    cin >> S >> T;
    string out = "Yes";
    rep(i,S.length()){
        if(S[i]!=T[i]){
            out = "No";
            break;
        }
    }
    cout << out << endl;
    return 0;
}


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

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;

const int  INF =  1e9;
const ll LINF = 1e18;
const ll MOD = 1e9+7;
const int SIZE = 100;

template<class T>
inline T gcd(T a, T b){return b ? gcd(b, a % b) : a;}

template<class T>
inline T lcm(T a, T b){return a / gcd(a, b) * b;}
 
ll fac[SIZE], inv[SIZE], facinv[SIZE];
void make() {
	fac[0] = fac[1] = 1; inv[1] = 1; facinv[0] = facinv[1] = 1;
	for (ll i = 2; i < SIZE; i++) {
		fac[i] = (fac[i-1] * i) % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		facinv[i] = facinv[i-1] * inv[i] % MOD;
	}
}
ll combi(ll a, ll b) {
	if (a < b) return 0;
	return fac[a] * (facinv[b] * facinv[a-b] % MOD) % MOD;
}

int main() {
	ll n, k;
	ll ans = 0;
	scanf ("%lld %lld", &n, &k);
	vl l(n);
	for (ll i = 0; i < n; i++) {
		scanf ("%lld", &l[i]);
	}
	sort(l.begin(), l.end(), greater<ll>());
	for (ll i = 0; i < k; i++) {
		ans += l[i];
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
import numpy as np
from collections import defaultdict

def cross(a, b):
    return a[0]*b[1]-a[1]*b[0]

n = int(input())
H = [np.array([int(j) for j in input().split()]) for i in range(n)]

convex = [min(H, key=lambda x:x[1])]

for i in range(n):
    a = H[0] if (H[0] != convex[-1]).any() else H[-1]
    for b in H:
        ac = a-convex[-1]
        bc = b-convex[-1]
        cross_ = cross(ac, bc)
        if cross_ < 0 or (cross_ == 0 and np.linalg.norm(ac) < np.linalg.norm(bc)):
            a = b
    if (a == convex[0]).all():
        break
    convex.append(a)

ans = defaultdict(float)

for c, a, b in zip([convex[-1]]+convex[:-1], convex, convex[1:] + [convex[0]]):
    ca = c-a
    ba = b-a
    i = np.inner(ca, ba)
    n = np.linalg.norm(ca) * np.linalg.norm(ba)
    ans[tuple(a)] = (np.pi - np.arccos(np.clip(i/n, -1, 1))) / (2*np.pi)

for i in H:
    print(ans[tuple(i)])


Measured memory_bytes: 13320
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)

	result := -1
	for i := 1000; i > 0; i-- {
		e := int(float64(i) * 0.08)
		t := int(float64(i) * 0.1)
		if e == a && t == b {
			result = i
		}
	}
	fmt.Println(result)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};

int main() {
    int n,m; cin >> n >> m;
    int G[n][n];
    rep(i,n)rep(j,n) G[i][j] = 0;
    int u,v;
    rep(i,m) {
        cin >> u >> v;
        u--; v--;
        G[u][v] = G[v][u] = 1;
    }

    int ans = 0;
    vector<int> a(n-1);
    rep(i,n-1) a[i] = i+1;

    do {
        bool check = true;
        rep(i,n-1) {
            if (i==0) {
                if (G[0][a[0]] != 1) {
                    check = false;
                    break;
                }
            }
            else if (G[a[i-1]][a[i]] != 1) {
                check = false;
                break;
            }
        }
        if (check) ans++;
    } while (next_permutation(all(a)));

    cout << ans << endl;
}

Measured memory_bytes: 3564
#include <stdio.h>
#define N 101
int main(){
  char a[N][N]={};
  int h,w,i,j,hf[N]={},wf[N]={};
  scanf("%d%d",&h,&w);
  for(i=0;i<h;i++){
    scanf("%s",a[i]);
  }
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      if(a[i][j]=='#'){
        hf[i]=1;
        wf[j]=1;
      }
    }
  }
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      if(hf[i]==1 && wf[j]==1){
        printf("%c",a[i][j]);
      }
    }
    if(hf[i]==1){
      printf("\n");
    }
  }
  return 0;
}


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

int main(){
	int N;
	cin >> N;
	int f = 0;
	int n = N;
	while (n > 0) {
		f += n % 10;
		n /= 10;
	}
	if (N%f == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    
	int ab = a + b;
    int bc = b + c;
    int ca = c + a;
    
    if (ab == c || bc == a || ca == b) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

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

int main()
{

int a,b,c ;
cin>>a>>b>>c;
int s,d,w ;
s=a+b ;
w=a+c ;
d=b+c ;
  if(s<=w&&s<=d){cout<< s ;}
  else if(w<=s&&w<=d){cout<< w ;}
  else if(d<=s&&d<=w){cout<< d ;}


	return 0;
}


Measured memory_bytes: 256