akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define N 100010
int cnt[N];

int main(){
	string s;
	cin>>s;
	rep(i, s.size()) cnt[s[i]]++;
	for(char c = 'a'; c <= 'z'; c++){
		if(cnt[c]==0){
			cout<<c<<endl;
			return 0;
		}
	}
	cout<<"None"<<endl;
	return 0;
}


Measured memory_bytes: 512
judge :: String -> Bool
judge xs
  | s1 == s2  = True
  | otherwise = False
    where l = length xs `div` 2
          s1 = take l xs
          s2 = drop l xs

check :: String -> String
check [] = []
check xs
  | judge xs  = xs
  | otherwise = check (init $ init xs)

main = do
  str <- getLine
  let str' = if odd $ length str then init str else init $ init str
  putStrLn $ show $ length $ check str'


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
 
typedef long long int ll;
typedef pair<int, int> P;
 
const long long INF = 3e18 + 12;
const int inf = 1e9;
 
int calcNumOfCombination(int n, int r) {
  int num = 1;
  for (int i = 1; i <= r; i++) {
    num = num * (n - i + 1) / i;
  }
  return num;
}
int main() {
  int a, b;
  cin >> a >> b;
 
  int c = 0;
  if (a >= 2 && b >= 2) {
    c = calcNumOfCombination(a, 2) + calcNumOfCombination(b, 2);
  } else if (a >= 2 && b < 2) {
    c = calcNumOfCombination(a, 2);
  } else if (a < 2 && b >= 2) {
    c = calcNumOfCombination(b, 2);
  }
  cout << c << endl;
 
  return 0;
}

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

#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<(o)<<" ";}
#define dumpl(o) if(DBG){cerr<<#o<<" "<<(o)<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

signed main() {
	int N; cin >> N;
	int C[110][110];
	rep(i, 0, N)rep(j, 0, N) {
		cin >> C[i][j];
	}
	int ans = 0;
	rep(i, 0, N)rep(j, 0, i) {
		ans += min(C[i][j], C[j][i]);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3180
#include <bits/stdc++.h>
#define long long long
#define ull unsigned long long
#define up(i,a,b) for (int i=a; i<=b; i++)
#define down(i,a,b) for (int i=a; i>=b; i--)
#define endl '\n'
#define pb push_back
#define X first
#define Y second
#define II pair<int, int>
#define III pair<int, pair<int, int> >
#define V vector
#define debug(X) cerr<< #X << " = " <<X << endl
#define debug2(X,Y) cerr<< #X << " = " <<X << ","<<#Y<<" = "<<Y<<endl
#define show(X,a,b) {cerr << #X << " = "; up(__,a,b) cerr << X[__] << ' '; cerr << endl;}
#define gc getchar
#define pc putchar

using namespace std;

inline void read(int &x)
{
    register int c = gc();
    x = 0;
    int neg = 0;
    for (;((c<48 || c>57) && c != '-') ;c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}
inline void writeln(int x){

         char buffor[21];
         register int i=0;
         int neg=0; if (x<0) {neg=1; x= -x;}
         do{
               buffor[i++]=(x%10)+'0';
               x/=10;
            } while(x);
           i--;
           if (neg) pc('-');
           while(i>=0) pc(buffor[i--]);
           pc('\n');
       }
int n,m;
int fav[301][301],a[301],cnt[301];
bool use[301];

bool cmp(int i,int j)
{
	return a[i]> a[j];
}
void input()
{
    cin>>n>>m;
    up(i,1,n)
    {

        up(j,1,m) cin>>fav[i][j];

        //show(fav[i],1,m);
    }
}

void solve()
{

    int res= n;
	fill(use+1,use+1+m,true);
    up(i,1,n) a[i]= 1;//pointer
    up(del,1,m)
    {
        //calculate no of people each sport
		fill(cnt+1,cnt+1+m,0);
		up(i,1,n)
		{
			while (!use[fav[i][a[i]] ]) a[i]++;
			cnt[fav[i][a[i]] ]++;
		};
		int sportmx; int mxp= 0;
		up(i,1,m)
		 if (mxp< cnt[i])
		 {
		 	mxp= cnt[i]; sportmx= i;
		 }
		res= min(res,mxp);
        use[sportmx]= false;

    }

    cout<<res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);// don't use when interactive
    #define TASK "agc018_b"
  //  freopen(TASK".inp","r",stdin);
  //  freopen(TASK".out","w",stdout);

    input();
    solve();

    return 0;
}


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

int main(){
  int n;
  cin>>n;
  long long a,b,c,d;
  int count=0;
  vector<long long> st;
  lp(i,n){
    cin>>d>>b>>c;
    a=b*10000+c*100000000+d;
    int check=0;
    for(int j=0;j<st.size();j++){
      if(st[j]==a){
	check=1;
	break;
      }
    }
    if(check==1) count++;
    if(check==0){
      st.push_back(a);
      a=b*10000+d*100000000+c;
      st.push_back(a);
      a=c*10000+b*100000000+d;
      st.push_back(a);
      a=c*10000+d*100000000+b;
      st.push_back(a);
      a=d*10000+c*100000000+b;
      st.push_back(a);
      a=d*10000+b*100000000+c;
      st.push_back(a);
    }
  }
  cout<<count<<endl;
  return 0;
}



Measured memory_bytes: 3264
from heapq import heappush, heappop

N, M = map(int, input().split())
INF = 10**10
edge_idx = {}
graph = [[] for i in range(N)]
for i in range(M):
  a, b, c = map(int, input().split())
  a -= 1; b -= 1
  graph[a].append((b, c))
  graph[b].append((a, c))
  edge_idx[(a, b)] = edge_idx[(b, a)] = i

used = set()
def dijkstra(node):
  global used
  dist = [INF] * N
  dist[node] = 0
  e = []
  for child, cost in graph[node]:
    heappush(e, (cost, child, node))
  while e:
    cost, node, par = heappop(e)
    if dist[node] < INF:
      if dist[node] == cost:
        used.add(edge_idx[(node, par)])
      continue
    dist[node] = cost
    used.add(edge_idx[(node, par)])
    for child, c in graph[node]:
      if dist[child] < INF:
        continue
      heappush(e, (cost+c, child, node))

for i in range(N):
  dijkstra(i)

print(M - len(used))

Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    string s;
    cin >> s;
    int p = s.size();
    if (s.front() == s.back()) p++;
    p %= 2;
    cout << (p ? "First" : "Second") << endl;
    return 0;
}

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

int main() {
  int H,W,N;
  cin >> H >> W >> N;
  vector<int> ans(H*W);
  int now = 0;
  int x;
  for (int i=0; i<N; i++) {
    cin >> x;
    for (int j=0; j<x; j++) {
      ans[now] = i+1;
      now++;
    }
  }
  
  vector<int> ansl(W);
  for (int i=0; i<H; i++) {
    if (i % 2 == 0) {
      for (int j=0; j<W-1; j++) {
        cout << ans[i*W + j] << ' ';
      }
      cout << ans[i*W + W - 1] << endl;
    }
    else {
      for (int j=0; j<W; j++) {
        ansl[W-1-j] = ans[i*W+j];
      }
      for (int j=0; j<W-1; j++) {
        cout << ansl[j] << ' ';
      }
      cout << ansl[W-1] << endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 384
AC = []
WA = []
TLE = []
RE = []

for _ in range(int(input())):
  s = input()

  if s == "AC":
    AC.append(s)
  elif s == "WA":
    WA.append(s)
  elif s == "TLE":
    TLE.append(s)
  elif s == "RE":
    RE.append(s)

print("AC", "x", len(AC))
print("WA", "x", len(WA))
print("TLE", "x", len(TLE))
print("RE", "x", len(RE))


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

int vis[105]={0};

int main()
{
	int x,n;
	cin>>x>>n;
	for(int i=1;i<=n;i++){
		int p;
		cin>>p;
		vis[p]=1;
	}
	for(int i=x-1,j=x;;i--,j++){
		if(vis[j]==0){
			cout<<j<<endl;
			return 0;
		}
		if(vis[i]==0){
			cout<<i<<endl;
			return 0;
		}
	}
	return 0;
}

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

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define _A_ 1

using namespace std;

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

int len;
//string parse;
const int MAX = 2000010;
char parse[MAX];
int pos;

ll expression();
  
ll fact(){
  if( parse[pos] == 'S' ) {
    pos+=2; // S<xx>
    ll p = expression();
    if( pos >= len ) return -1LL;
    pos++;
    return ( ( p % MOD ) * ( p % MOD ) ) % MOD;
  } else {
    if( pos >= len || !isdigit(parse[pos]) ) return -1LL;
    ll p = 0;
    while( '0' <= parse[pos] && parse[pos] <= '9' ){
      p *= 10LL;
      p += (ll)(parse[pos] - '0');
      pos++;
    }
    return p;
  }
}

ll expression(){

  ll p = fact();

  if( p == -1LL ) return -1LL;

  //

  while( parse[pos] == '>' && ( pos + 1 < len && parse[pos+1] == '>' ) ){
    int temp = pos;
    ll  temp_v = p;      
    pos += 2;
    
    ll q = fact();
    if( q == -1LL ) {
      pos = temp;
      return temp_v;
    }
    for(ll i=0;i<q;i++) {
      p >>= 1LL;
      if( p == 0LL ) break;
    }
    
  }
  return p;
}


int main(){
  string s;
  while( _A_ ){
    getline(cin,s);
    if( s == "#" ) break;
    string temp = "";
    len = 0;
    rep(i,(int)s.size()) if( s[i] != ' ' ) {
      parse[len] = s[i];
      len++;
    }
    pos = 0;
    parse[len] = '\0';
    assert( len < MAX );
    //cout << expression() << endl;
    printf("%lld\n",expression());
  }
  return 0;
}

Measured memory_bytes: 2992
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
int main(){
    ll n;cin>>n;
    vector<ll>t(n+1);
    vector<ll>l(n+2);
    vector<ll>r(n+2);
    vector<ll>v(n+2);
    rep(i,n)cin>>t[i+1];
    rep(i,n)cin>>v[i];
    REP(i,1,n+1){
        t[i]+=t[i-1];
    }
    rep(i,n){
        l[i]=t[i];
        r[i]=t[i+1];
    }
    l[n+1]=t[n];
    r[n+1]=t[n];
    double now=0.0;
    double last=0.0;
    double ans=0.0;
    while(now<t[n]){
        now+=0.5;
        double mi=inf;
        rep(i,n+2){
            double res;
            if(now<=l[i])res=v[i]+(double)l[i]-now;
            if(now>=l[i]&&now<=r[i])res=v[i];
            if(now>=r[i])res=v[i]+now-(double)r[i];
            mi=min(mi,res);
        }
        ans+=(last+mi)*0.25;
        last=mi;
    }
    cout<<fixed<<setprecision(8)<<ans<<endl;
}

Measured memory_bytes: 256
import collection.mutable

object Main {
  def main(args: Array[String]): Unit = {
    val Array(n, m) = io.StdIn.readLine.split(" ").map(_.toInt)
    val graph: mutable.Map[Int, mutable.Set[Int]] = mutable.Map.empty.withDefaultValue(mutable.Set.empty)
    (1 to m).foreach { _ =>
      val Array(a, b) = io.StdIn.readLine.split(" ").map(n => n.toInt)
      graph.getOrElseUpdate(a, mutable.Set.empty) += b
    }
    val originEdges = graph.getOrElse(1, mutable.Set.empty)
    if (graph(1).exists(b => graph(b)(n))) {
      println("POSSIBLE")
    } else {
      println("IMPOSSIBLE")
    }
  }
}


Measured memory_bytes: 108000
def main():
    n = int(input())
    i = 1
    answer = 0
    while i * i <= n:
        if (n - i) % i == 0 and n - i > i ** 2:
            answer += (n - i) // i
        i += 1
    print(answer)


if __name__ == '__main__':
    main()



Measured memory_bytes: 2940
def gcd(a,b):
    while b:
        a, b = b, a%b
    return a

def lcm(a,b):
    return a * b // gcd(a,b)



A,B,C,D = map(int,input().split())

if A % C ==0:
    c = (B//C) - (A//C) +1
else:
    c = (B//C) - (A//C)

if A % D ==0:
    d = (B//D) - (A//D) +1
else:
    d = (B//D) - (A//D)

E = lcm(C,D)

if A % E ==0:
    e = (B//E) - (A//E) +1
else:
    e = (B//E) - (A//E)

print(B-A+1-c-d+e)

Measured memory_bytes: 3064
/*
  Contest 086
  B - 1 21
  Rakesh Kumar --> 18/09/2020
 */

#include <bits/stdc++.h>

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0); std::cout.tie(0);

    int a = 0, b = 0;
    std::cin >> a >> b;
    int c = std::stoi(std::to_string(a) + std::to_string(b));
    double d = std::sqrt(c);
    if (d == std::floor(d))
        std::cout << "Yes" << std::endl;
    else
        std::cout << "No" << std::endl;

    return 0;
}


Measured memory_bytes: 3692
#include <iostream>
#include <string>
#include <cmath>
#include <math.h>
#include <stdio.h>
using namespace std;
int main(){
    double a,b,c,pi;
    cin >> a >> b >> c;
    pi = acos(-1);
    printf("%.8f\n",a*b*sin(c*pi/180)/2);
    printf("%.8f\n",sqrt(a*a+b*b-2*a*b*cos(c*pi/180))+a+b);
    printf("%.8f\n",b*sin(c*pi/180));
    
}


Measured memory_bytes: 3532
#import bisect
n = int(input())
v = list(map(int,input().split()))

#print(n, v)
v.sort()
#print(v)

while len(v)>1:
#  for i in range(51): 
    #a1 = (v[i:i+1])
    #a2 = (v[i+1:i+2])
    a1 =v.pop(0)
    a2 =v.pop(0)
    #print(a1,a2)
    a3 = (a1 + a2) /2
    v.append(a3)
    v.sort()

print(v[0])    

Measured memory_bytes: 3060
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

n = int(arr_data[0][0])


cnt=0

while n>0:
    
    cnt+=n
    n-=1
    
print(cnt)

Measured memory_bytes: 3064
/**
 *    author:  nasimnoob
**/

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

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


#define      PI                         3.141592654


int main()
{
    //string ;
    int a,b;
    cin>>a>>b;
    if(a>b)
        cout<<"safe"<<endl;
    else
        cout<<"unsafe"<<endl;
    return 0;
}




Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define int long long
using namespace std;



signed main()
{
 
ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   
 
#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif      

    int n;
    cin>>n;
    if(n>=30)
        cout<<"Yes";
    else
    cout<<"No";

}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
#define mod 1000000007
#define fi first
#define se second
#define pii pair<int,int>
//#define push_back emplace_back
//#define push emplace
//#define insert emplace
#define int long long
#define endl '\n'
#define pll pair<long long,long long>
#define LONGLONG_MAX 10000000000000000
using namespace std;
//template <typename T>
//using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
auto power(auto a,long long b){
    auto ans=1;
    //cout<<ans;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    ///cout<<ans<<" ";    
    return ans;
        
}
void maxi(auto &a,auto b){
	a=max(a,b);
}
void mini(auto &a,auto b){
	a=min(a,b);
}

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,a,b;
	cin>>n>>a>>b;
	cout<<min(n*a,b);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
typedef vector <int> V;
typedef long long ll;
V P[27];
int n,k,pos;
string str;

V add(V a,V b){
  V c(n);
  for(int i=0;i<n;i++) c[i]=a[b[i]];
  return c;
}

V vpow(ll num,V a){
  V res(n);
  for(int i=0;i<n;i++) res[i]=i; //単位元
  while(num){
    if(num%2) res= add(res,a);
    a = add(a,a);
    num/=2;
  }
  return res;
}

V formula();

V get_amd(){

  if('0'<=str[pos]&&str[pos]<='9') {
    ll num=0;
    while('0'<=str[pos]&&str[pos]<='9')num=num*10+str[pos]-'0',pos++;
    return vpow(num,get_amd());
  }
  if(str[pos]=='(') {
    pos++;
    V res=formula();
    pos++;
    return res;
  }
  return P[str[pos++]-'A'];
}

V formula(){
  V res=get_amd();

  while(1){
    if(pos==str.size())break;
    if(str[pos]==')')break;
    if(str[pos]=='+'){
      pos++;
      res = add(res,get_amd());
    }
  }
  return res;
}


int main(){

  cin>>n>>k;
  for(int i=0;i<k;i++){
    char ch;
    int h,a;
    cin>>ch>>h;
    ch-='A';
    for(int i=0;i<n;i++)P[(int)ch].push_back(i);
    for(int i=0;i<h-1;i++)
      for(int j=0;j<n-1;j++){
	cin>>a;
	if(a)swap(P[(int)ch][j],P[(int)ch][j+1]);
      }
  }
  int q;
  cin>>q;
  while(q--){
    cin >>str;
    pos=0;
    V ans=formula();
    for(int i=0;i<n-1;i++) cout << ans[i]+1<<" ";
    cout << ans[n-1]+1<<endl;
  }


  return 0;
}

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

int main()
{
    int N;
    cin >> N;
  int count=0;
    
    for(int i=1;i<10;i++){
      for(int j=1;j<10;j++){
        if(N==i*j){
          cout << "Yes" << endl;
          return 0;
        }
        else{
        count++;
        }
      }
    }
  if(count==81){
    cout << "No" << endl;
  }
  
    return 0;
}

Measured memory_bytes: 256
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
A=[]
for i in range(N):
    A.append(list(map(int,input().split())))
cnt=0
for i in range(N):
    total=0
    for j in range(M):
        total+=A[i][j]*B[j]
    if total +C > 0 :
        cnt+=1

print(cnt)

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

ll gcd(ll p, ll q){
    if(q==0){
        return p;
    }else{
        return gcd(q,p%q);
    }
}

int main(){
    ll a,b;
    cin >> a >> b;
    ll x;
    x = gcd(a,b);
    cout << a*b/x << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  int A, B, C;

  scanf("%d%d%d", &A, &B, &C);

  int x = C -(A-B);
  if(x>=0)
    printf("%d\n", x);
  else
    printf("0\n");
  

  return 0;
}


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

template <typename T>
void print(const T &v);

int main()
{
    ll H, W;
    cin >> H >> W;
    ll s1, s2, s3, s4, s5, s6;

    // s1
    ll a1, b1;
    a1 = H / 3;
    b1 = (H - a1 + 1) / 2;
    s1 = (abs(b1 - a1) * W);

    // s2
    ll a2, b2;
    a2 = W / 3;
    b2 = (W - a2 + 1) / 2;
    s2 = (abs(b2 - a2) * H);

    // s3
    ll a3, b3, c3;
    a3 = (H + 2) / 3;
    b3 = (H - a3) * (W / 2);
    c3 = (W * H) - (a3 * W) - b3;
    a3 *= W;
    s3 = max(max(abs(a3 - b3), abs(b3 - c3)), abs(c3 - a3));

    // s4
    ll a4, b4, c4;
    a4 = (W + 2) / 3;
    b4 = (W - a4) * (H / 2);
    c4 = (W * H) - (a4 * H) - b4;
    a4 *= H;
    s4 = max(max(abs(a4 - b4), abs(b4 - c4)), abs(c4 - a4));

    // s5
    ll a5, b5, c5;
    a5 = H / 3;
    b5 = (H - a5) * (W / 2);
    c5 = (W * H) - (a5 * W) - b5;
    a5 *= W;
    s5 = max(max(abs(a5 - b5), abs(b5 - c5)), abs(c5 - a5));

    // s6
    ll a6, b6, c6;
    a6 = W / 3;
    b6 = (W - a6) * (H / 2);
    c6 = (W * H) - (a6 * H) - b6;
    a6 *= H;
    s6 = max(max(abs(a6 - b6), abs(b6 - c6)), abs(c6 - a6));

    // cout << s1 << ':' << s2 << ':' << s3 << ':' << s4 << ':' << s5 << ':' << s6 << endl;
    ll ans = min(min(min(s1, s2), min(s3, s4)), min(s5, s6));
    cout << ans << endl;
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


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

int main() {
	long long n, m = 10, k, ans = 0;
	int x;
	cin >> n;
	for (int i = 0; i < 3; i++) {
		k = m / 10;
		if (n >= m) {
			ans += m - k;
		} 
		else if(n >= k){
			if (k == 1) {
				ans = n / k;
				break;
			}
			x = n / k;
			ans += n % k;
			ans++;
			if (x > 1) {
				ans += k * (x - 1);
			}
			break;
		}
		else {
			break;
		}
		m = m * 100;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int size=2e5;
const long inf=1e9;
int main(){
	int Q; cin>>Q;
	priority_queue<long> small; small.push(-inf);
	priority_queue<long> large; large.push(-inf);
    long A = 0,B = 0;
	long c = 0;
	int n; long a,b;
	rep(i,0,Q){
		cin>>n;
		if(n == 1){
			cin>>a>>b;
            if(-large.top() < a){
                if(small.size() == large.size()){
                    small.push(-large.top());
                    B += large.top();
                    A -= large.top();
                    large.pop();
                }
                large.push(-a);
                B += a;
            }else if(a < small.top()){
                if(small.size() > large.size()){
					large.push(-small.top());
                    B += small.top();
                    A -= small.top();
                    small.pop();
                }
                small.push(a);
                A += a;
			}else{
                if(small.size() > large.size()){ large.push(-a); B += a; }
				else{ small.push(a); A += a; }
			}
			c += b;
		}else{
            long k = small.top();
			long ans = B - A + (small.size() - large.size()) * k + c;
			cout<<k<<" "<<ans<<endl;
		}
	}
}

Measured memory_bytes: 3828
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#define ll long long

using namespace std;

int main(){
    int A,B,T;
    cin >> A >> B >> T;
    cout << (T/A)*B << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int avg, sum, count, n, i;
		while(true){
			avg = 0;sum = 0;count = 0;
			n = sc.nextInt();
			if(n == 0) break;
			int a[] = new int[n];
			for( i  = 0; i < n; i++) {
				a[i]= sc.nextInt();
				sum += a[i];
			}
			avg = sum / n;
			for( i  = 0; i < n; i++) {
				if(a[i] <= avg )	count++;
			}
			System.out.println(count);
		}
	}
}



Measured memory_bytes: 58932
#include<iostream>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm> 
using namespace std;
 
const int mod = 1e9+7;

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;

int main()
{
    int n;cin >> n ;
    int col[9]={};

    for(int i=0;i<n;i++){
        int tmp;cin >> tmp;

        if(tmp <= 399) col[0]=1;
        else if(tmp <= 799)  col[1]=1;
        else if(tmp <= 1199) col[2]=1;
        else if(tmp <= 1599) col[3]=1;
        else if(tmp <= 1999) col[4]=1;
        else if(tmp <= 2399) col[5]=1;
        else if(tmp <= 2799) col[6]=1;
        else if(tmp <= 3199) col[7]=1;
        else col[8]++;
    }

    int mi=col[0]+col[1]+col[2]+col[3]+col[4]+col[5]+col[6]+col[7];
    int ma=mi+col[8];
    cout << (mi==0?1:mi) << " " << ma << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, t, x, s;
  cin >> a >> b >> t;
  x = 0;
  s = 0;
  while(s+a<=t+0.5) {
    s = s + a;
  }
  cout << b*s/a << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    //
    vector<vector<int>> A(2, vector<int>(N));
    for(int i=0;i<2;i++){
        for(int j=0;j<N;j++){
            cin >> A[i][j];
        }
    }
    vector<vector<int>> dp(2, vector<int>(N));
    dp[0][0]=A[0][0];
    dp[1][0]=A[1][0] + dp[0][0];
    for(int i=1;i<N;i++){
        for(int j=0;j<2;j++){
            if(j==1){
                dp[1][i] = max( dp[1][i-1] , dp[0][i] ) + A[j][i];
            }
            else{
                dp[0][i] = dp[0][i-1] + A[0][i];
            }
        }
    }
    cout << dp[1][N-1] <<endl;
}

Measured memory_bytes: 3632
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"

	"math"
)

func main() {
	n := readi()
	k := readi()

	ans := 0.0
	for i := 1; i <= n; i++ {
		ans = ans + (1.0/float64(n))*math.Pow(0.5, float64(multiple(i, k)))
	}

	fmt.Println(ans)
}

func multiple(n, k int) int {
	c := 0
	for {
		if n >= k {
			return c
		}
		n = n * 2
		c++
	}
}

/*-------------------utilities-------------------*/

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func chmin(x *int, y int) bool {
	if *x > y {
		*x = y
		return true
	}
	return false
}

func chmax(x *int, y int) bool {
	if *x < y {
		*x = y
		return true
	}
	return false
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return (a * b) / gcd(a, b)
}

func comb(n, k int) int {
	if n < k {
		return 0
	}
	if n < 0 || k < 0 {
		return 0
	}
	return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD
}

func permutations(arr []int) [][]int {
	var helper func([]int, int)
	res := [][]int{}

	helper = func(arr []int, n int) {
		if n == 1 {
			tmp := make([]int, len(arr))
			copy(tmp, arr)
			res = append(res, tmp)
		} else {
			for i := 0; i < n; i++ {
				helper(arr, n-1)
				if n%2 == 1 {
					tmp := arr[i]
					arr[i] = arr[n-1]
					arr[n-1] = tmp
				} else {
					tmp := arr[0]
					arr[0] = arr[n-1]
					arr[n-1] = tmp
				}
			}
		}
	}
	helper(arr, len(arr))
	return res
}

func isPrime(n int) bool {
	if n == 1 {
		return false
	}
	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			return false
		}
	}
	return true
}

func divisor(n int) (res []int) {
	for i := 1; i*i <= n; i++ {
		if n%i == 0 {
			res = append(res, i)
			if i*i != n {
				res = append(res, n/i)
			}
		}
	}
	sort.Ints(res)
	return
}

/*-------------------init-------------------*/

const (
	INF = 1000000000000000000
	MOD = 1e9 + 7

	COMB_MAX = 510000
)

var (
	readString func() string
)

var (
	fac  = [COMB_MAX]int{}
	finv = [COMB_MAX]int{}
	inv  = [COMB_MAX]int{}
)

func init() {
	readString = newReadString(os.Stdin)
}

func combInit() {
	fac[0] = 1
	fac[1] = 1
	finv[0] = 1
	finv[1] = 1
	inv[1] = 1
	for i := 2; i < COMB_MAX; i++ {
		fac[i] = fac[i-1] * i % MOD
		inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD
		finv[i] = finv[i-1] * inv[i] % MOD
	}
}

/*-------------------inputs-------------------*/

func readi() int {
	return int(readi64())
}

func readi64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readf() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}


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

int main() {
  int n;
  cin >> n;
  vector<pair<string, pair<int, int> > > vec(n);
  for (int i = 0; i < n; i++) {
    int no, hyouka;
    string namae;
    no = i+1 ;
    cin >>  namae >> hyouka;
    // 点数が高い順にソートしたいので、kokugoとsugakuを前方に持ってきてマイナスにする
    vec[i] = make_pair(namae, make_pair(-hyouka, no));
  }

  sort(vec.begin(), vec.end()); // これで想定通りにソートされる

  for (int i = 0; i < vec.size(); i++)
    // 番号は3番目に入れたのでsecond2つでアクセスする
    cout << vec[i].second.second << endl;

  return 0;
}

Measured memory_bytes: 256
import math
import sys

MAX_V = 999999
prime = [1] * (MAX_V+1)
prime[0], prime[1] = [0, 0]
sum = [0] * (MAX_V+2)

for i in range(2, math.ceil(math.sqrt(MAX_V))+1):
    if prime[i]:
        for k in range(2*i, MAX_V+1, i):
            prime[k] = 0
for i in range(MAX_V+1):
    sum[i+1] = sum[i] + prime[i]
for line in sys.stdin.readlines():
    print(sum[int(line)+1])


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int> >;
using vii = vector<pair<int, int> >;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
int dx[4] = { 0,  0, 1, -1 };
int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

int main() {
	int  x, y; cin >> x >> y;
	int check[] = { -1,1,3,1,2,1,2,1,1,2,1,2,1 };
	x = check[x];
	y = check[y];
	if (x == y) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 384
A,B,C,D,E,F = gets.split.map(&:to_i)
W = Array.new(F + 1); W[0] = 0
S = Array.new(F + 1); S[0] = 0

(0 .. F).each do |w|
  W[w] = 1 if w - (100 * A) >= 0 && W[w - (100 * A)]
  W[w] = 1 if w - (100 * B) >= 0 && W[w - (100 * B)]
end

(0 .. F).each do |s|
  S[s] = 1 if s - C >= 0 && S[s - C]
  S[s] = 1 if s - D >= 0 && S[s - D]
end

q = 0.0
q0 = (E * 100).to_f / (100 + E)
ws = [100 * A, 0]

(0 .. F).each do |w|
  (0 .. F).each do |s|
    if W[w] && S[s] && s + w <= F
      v = (s * 100).to_f / (s + w)
      if v > q && v <= q0
        q = v
        ws[0] = s + w
        ws[1] = s
      end
    end
  end
end
puts ws.join(' ')


Measured memory_bytes: 1916
#include<iostream>
using namespace std;
int main(){
  int n;
  int q;
  long long array[100005]={0};
  long long sum=0;
  cin>>n;
  for(int i=0;i<n;i++){
    int data;
    cin>>data;
    array[data]++;
    sum+=data;
  }

  cin>>q;
  for(int i=0;i<q;i++){
    long long a,b;
    cin>>a>>b;
    sum-=array[a]*a;
    sum+=array[a]*b;
    array[b]+=array[a];
    array[a]=0;
    cout<<sum<<endl;
  }
  return(0);
}


Measured memory_bytes: 4452
def make_division(n:int):
	divisors = []
	for i in range(1,int(n**0.5)+1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n//i)
	divisors.sort()
	divisors.pop(-1)

	return sum(divisors)

if __name__ == '__main__':

	while True:
		n = int(input())
		if n == 0:
			break
		m = make_division(n)

		if n == m:
			print("perfect number")
		elif n > m:
			print("deficient number")
		else:
			print("abundant number")




Measured memory_bytes: 5652
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

/* define */
#define Yes(X) puts ( (X) ? "Yes" : "No")
#define YES(X) puts ( (X) ? "YES" : "NO")
#define FOR(i, a, b) for ( int i = (a); i < (b) ; i++)
#define REP(i, n) for ( int i = 0; i < (n) ; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))

/* const */
const int MOD = 1000000007;

/* alias */
typedef long long ll;
typedef unsigned  u;

/* function */
int cmp(const void *a, const void *b) {
	return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
	return *(int*)b - *(int*)a;
}
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
ll Lgcd(ll a, ll b) {
	if (b != 0) return Lgcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
ll Llcm(ll a, ll b) {
	return a / Lgcd(a, b) * b;
}

/* main */

int main() {
	int n, k, r = 1;
	scanf("%d%d", &n, &k);
	REP(i, n) {
		if (r * 2 < r + k)r *= 2;
		else r += k;
	}
	printf("%d", r);
	return 0;
}


Measured memory_bytes: 128
N,K = map(int,(input().split()))
d = [0]*K
a = [[] for _ in range(K)]
p = [0]*N
for i in range(K):
    d[i] == int(input())
    a[i] = list(map(int,(input().split())))
    for j in range(len(a[i])):
        p[a[i][j]-1] += 1
ans = 0
for i in range(N):
    if p[i] == 0:
        ans += 1

print(ans)

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

const int INF=1e9+5;
vector<int>dx={0,0,1,-1};
vector<int>dy={1,-1,0,0};

int main(){
    int h,w;
    cin>>h>>w;
    vector<string>grid(h);
    for(int row=0;row<h;row++){
        cin>>grid[row];
    }
    auto is_good=[&](int i,int j){
        if(i>=0 and i<h and j>=0 and j<w and grid[i][j]!='#')
            return 1;
        return 0;
    };
    int ans=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(is_good(i,j)){
                queue<pair<int,int>>q;
                vector<vector<int>>dis(h,vector<int>(w,INF));
                q.push({i,j});
                dis[i][j]=0;
                while(!q.empty()){
                    int u=q.front().first;
                    int v=q.front().second;
                    q.pop();
                    for(int x=0;x<4;x++){
                        if(is_good(u+dx[x],v+dy[x]) and dis[u+dx[x]][v+dy[x]]==INF){
                            q.push({u+dx[x],v+dy[x]});
                            dis[u+dx[x]][v+dy[x]]=dis[u][v]+1;
                            ans=max(dis[u][v]+1,ans);
                        }
                    }
                }
            }
        }
    }
    cout<<ans<<'\n';
    return 0;
}

Measured memory_bytes: 256
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
ll n, k;
vector<ll> a;
//約数列挙オーダー√n
vector<ll> divisor(ll n){
    vector<ll> res;
    for(ll i=1;i*i<=n;i++)
    if(n%i==0){
        res.push_back(i);
        if(i!=n/i)res.push_back(n/i);
    }
    return res;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>k;
    ll sumt=0;
    for (int i = 0; i < n; i++)
    {
        ll temp;
        cin >> temp;
        a.push_back(temp);
        sumt+=temp;
    }
    vector<ll> v=divisor(sumt);
    sort(v.rbegin(),v.rend());
    for(int i=0;i<v.size();i++){
        vector<ll> amari;
        for(int j=0;j<a.size();j++){
            amari.push_back(a[j]%v[i]);
            //cout<<a[j]%v[i]<<"\n";
        }
        sort(ALL(amari));
        vector<ll> sum, sumr;
        sum.push_back(0);
        sumr.push_back(0);
        ll suma=0;
        ll sumar=0;
        for(int j=0;j<n;j++){
            suma+=amari[j];
            sum.push_back(suma);
            if(amari[j]!=0)
            sumar+=v[i]-amari[j];
            sumr.push_back(sumar);
            //cout<<sumar<<"\n";
        }
        for(int j=0;j<=n;j++){
            //cout<<sum[j]<<" "<<sumr[n]-sumr[j]<<"\n";
            if(sum[j]==sumr[n]-sumr[j]){
                if(sum[j]<=k){
                    return cout<<v[i]<<"\n",0;
                }
            }
        }
    }
    cout<<-1<<"\n";
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e3 + 5;
typedef long long ll;
const ll mod = 1e9 + 7;
ll f[maxn];
int main()
{
	int s;
	cin >> s;
	f[0] = 1;
	for (int i = 0; i <= s; i++)
	{
		for (int j = 3; j + i <= s; j++)
		{
			f[i + j] = (f[i + j] + f[i]) % mod;
		}
	}
	cout << f[s] << endl;
	return 0;
}

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


using namespace std;

int main(void) {
    long n,x;
    long count=1;
    long sum=0;
    bool f = true;
    cin >> n >> x;

    for(long i=0; i<n; i++) {
        long tmp;
        cin >> tmp;
        if ( f && sum+tmp <= x) {
            sum += tmp;
            count++;
        } else f=false;
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <set>
 
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>
 
void print(T x)
{
	std::cout << x << " ";
}
template <typename T>
 
void println(T x)
{
	std::cout << x << "\n";
}
 
 
signed main(void) {
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; i*j <= n; j ++) {
			ans += i * j;
		}
	}
	print(ans);
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll n, z, w; cin >> n >> z >> w;
    vi a(n, 0);

    rep(i, n) cin >> a[i];
    if(n == 1) cout << abs(a[0]-w) << endl;
    else cout << max(abs(a[n-1]-w), abs(a[n-1]-a[n-2])) << endl;
}

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

const int N = 10;

int x[N], y[N], id[N];
double d[N][N];
int n;

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i ++) scanf("%d %d", &x[i], &y[i]);
	for (int i = 1; i <= n; i ++) for (int j = 1; j <= n; j ++) d[i][j] = sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
	iota(id+1, id+n+1, 1);
	double ans = 0;
	do {
		for (int i = 1; i < n; i++) ans += d[id[i]][id[i+1]];
	} while (next_permutation(id+1, id+n+1));
	for (int i = 1; i <= n; i ++) ans /= i;
	cout << fixed << setprecision(10) << ans << endl;
	return 0;
}


Measured memory_bytes: 3848
#include <iostream>
using namespace std;
int main()
{
  long health;
  cin>> health;
  long long result{0};
  long long count{1};
  while(health>0)
  {
    result+=count;
    count*=2;
    health/=2;
  }
  cout<<result<<endl;
  return 0;
}


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

VI prm;
vector<bool> prime(1001000);
void eratos ( int n){
	prime[2] = true; prime[0] = prime[1] = false;
	for(int i = 3; i <= n; i += 2) prime[i] = true, prime[i+1] = false;
	int limit = (int)sqrt((double)n) + 1;
	for(int i = 3; i <= limit; i += 2){
		if(!prime[i]) continue;
		for(int j = i * i, k = i * 2; j <= n; j += k) prime[j] = false;
	}
	rep(i, n+1) if(prime[i]) prm.push_back(i);
}
map<ll, int> fctm2( ll x ){
	map<ll, int> fmp;
	for(int i=0; (ll)prm[i]*prm[i]<=x; i++){
		for(int pz=prm[i]; x%pz==0 && x>=pz; x/=pz) fmp[pz]++;
	}
	if(x!=1) fmp[x]++;
	return fmp;
}
ll bin_pow(ll x, ll n, ll mod){
	ll res = 1LL;
	for(; n > 0; n >>=1, x = x*x %mod) if(n & 1) res = res * x %mod;
	return res;
}

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	VI a(n);
	rep(i, n) cin >>a[i];
	
	eratos(1000010);
	auto cm = fctm2(a[0]);
	rep2(i, 1, n){
		auto c = fctm2(a[i]);
		map<ll, int> gcdm;
		for(auto& x: cm){
			if(c.count(x.first)) x.second = max(x.second, c[x.first]);
		}
		for(auto& x: c){
			if(!cm.count(x.first)) cm[x.first] += x.second;
		}
	}
	
	ll lcms = 1, ans =0;
	for(auto& x: cm) rep(i, x.second) (lcms *= x.first) %=MD;

	rep(i, n) (ans +=  lcms * bin_pow(a[i], MD-2, MD) )%= MD;

	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 1400
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int price = 700;
        for (int i = 0; i < 3; i++) {
            if (s.charAt(i) == 'o') {
                price += 100;
            }
        }
        System.out.println(price);
    }
}



Measured memory_bytes: 23252
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n,m;
  cin>>n>>m;
  if(n==m) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll copy(ll x){return x;}
int main(){
	ll n,k;cin>>n>>k;
	vector<ll> a(n);
	for(int i = 0; i < n; i++) {
		cin>>a[i];
	}
	ll r = LINF;
	ll l = 0LL;
	while(r - l > 1){
		ll m = (r + l)/2;
		ll ans = 0;
		for(int i = 0; i < n; i++) {
			ll x = copy(a[i]);
			ans += ((x + m - 1) / m - 1);
			if (ans > k){
				break;
			}
		}
		if(ans <= k){
			// out = min(out,res);
			r = m;
		}
		else{
			l = m;
		}
	}
	cout << r<< endl;

	return 0;
}

Measured memory_bytes: 4848
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

ll power(ll x,ll n){
    if(n==0) return 1;
    ll res=power(x*x%mod,n/2);
    if(n&1) res=res*x%mod;
    return res;
}

int main(){
  int r1,c1,r2,c2;
  cin>>r1>>c1>>r2>>c2;
  ll a[r2+c2+2+1];
  a[0]=1;
  rep(i,1,r2+c2+2+1) a[i]=a[i-1]*i%mod;
  ll b[r2+c2+2+1];
  b[0]=1;
  rep(i,1,r2+c2+2+1) b[i]=power(a[i],1e9+5);
  ll x=a[r2+c2+2]*b[r2+1]%mod*b[c2+1]%mod;
  ll y=a[r2+c1+1]*b[r2+1]%mod*b[c1]%mod;
  ll z=a[r1+c2+1]*b[r1]%mod*b[c2+1]%mod;
  ll w=a[r1+c1]*b[r1]%mod*b[c1]%mod;
  ll ans=x-y-z+w;
  while(ans<0){
    ans+=mod;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 31488