akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	int pn = 1;
	if (ci - cn + 16 > cm) {
		if ((ct = getcha()) == '-') { pn = -1; ct = getcha(); }
		A = ct - '0';
		while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';;
		return pn * A;
	}
	else {
		if ((ct = *ci++) == '-') { pn = -1; ct = *ci++; }
		A = ct - '0';
		while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';;
		return pn * A;
	}
}

int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int N = getint(), K = getint(), A[100000];
	ll naka = 0;
	ll haji = 0;
	rep(i, K) {
		A[i] = getint();
		naka += A[i];
	}
	for (int i = K; i < N; i++) {
		A[i] = getint();
		haji += max(A[i], 0);
	}
	ll kotae = max(naka, 0ll) + haji;
	rep(i, N - K) {
		haji += max(A[i], 0);
		haji -= max(A[i + K], 0);
		naka -= A[i];
		naka += A[i + K];
		chmax(kotae, max(naka, 0ll) + haji);
	}
	printf("%lld\n", kotae);

	Would you please return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  	int N;
    cin >> N;
  	int sum = 0;
    int M = N;
        
      for(int i = 0;i < 8;i++){
        int dig;
        dig = M%10;
        sum = sum+dig;
        M = M/10;
      } 
  	if(N%sum==0)
  		cout << "Yes" << endl; 
  	else
    	cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    ll n, k , q, ans = 0;
    cin >> n >> k >> q;
    vector<ll> p(n, k - q);
    for(int i = 0; i < q; i++){
        int a;
        cin >> a;
        p[a - 1]++;
    }
    for(int i = 0; i < n; i++){
        cout << (p[i] > 0? "Yes" : "No") << endl;
    }
    return 0;
}


Measured memory_bytes: 1408
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(ll i=0; i<(n); i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define ALL(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T CHMAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T CHMIN(T & a, const T b) { return a = (a > b) ? b : a; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
const long long MOD = 1000000007;

ll sum[200010];

int main(void){
    ll n;
    ll k;
    ll ans = 0;

    cin >>n;
    cin >>k;

//    cout << endl;

    for(ll i=1; i<=n+1; i++){
        
        sum[i] = sum[i-1] + (n-(i-1));
//        cout << sum[i] << " " << i << endl;
    }

//    cout << endl;

    for(ll i=k; i<=n+1; i++){
        ll tmp1=0;
        if(i == 1){
            tmp1 = 0;
        }else if(i == 2){
            tmp1 = 1;
        }else{
            tmp1 = 0.5*(i)*(i-1);
        }

        ans += (sum[i] - tmp1) +1;
        ans %= MOD;
//        cout << sum[i]  << "-" << tmp1 << " " <<  i << endl;
    }

    cout << ans << endl;
    return 0;
}


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

using namespace std;
int val=0;

int func(int N, int x){
	int ret=1;
	while(N>=ret*x){
		ret=ret*x;
	}
	return ret;
}

int calc(int N, int cnt){
	
	if(N<=0){
		return cnt;
	}
	return min(calc(N-func(N,9),cnt+1),calc(N-func(N,6),cnt+1));
}

int main(){
	int N;
	cin>>N;
	int ans=0;
	int tmp9=0,tmp6=0;
	
	cout<<calc(N,0)<<endl;

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

public class Program
{
	public static void Main()
	{
		int N = int.Parse(Console.ReadLine());
		var U = new List<string>();
		for (int i = 0; i < N; i++)
		{
			U.Add(Console.ReadLine());
		}
		int M = int.Parse(Console.ReadLine());
		var result = new[]{"Opened", "Closed"};
		int id = 0;
		for (int i = 0; i < M; i++)
		{
			var T = Console.ReadLine();
			if (U.Contains(T))
			{
				Console.WriteLine("{0} by {1}", result[id], T);
				id = (id + 1) % 2;
			}
			else
			{
				Console.WriteLine("Unknown {0}", T);
			}
		}
	}
}

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

int main() {
	int n,r;
	int p,c;
	int a[50];
	int b[50];
	while(1)
	{
		cin>>n>>r;
		if(n==0||r==0)
		{
			break;
		}
		int i=1;
		for(i=0;i<n;i++)
		{
			a[i]=n-i;
			b[i]=0;
		}
		i=0;
		while(r!=i)
		{
			cin>>p>>c;
			int j;
			for(j=0;j<c;j++)
			{
				b[j]=a[j+(p-1)];
			}
			for(j=0;j<p-1;j++)
			{
				b[c+j]=a[j];
			}
			for(j=0;j<(p-1)+c;j++)
			{
				a[j]=b[j];
			}
			i++;
		}
		cout<<a[0]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
N = input()

#print(N[-1])
if N[-1] == "2" or N[-1] =="4" or N[-1] =="5" or N[-1] =="7" or N[-1] =="9":
    print("hon")
elif N[-1] == "0" or N[-1] =="1" or N[-1] =="6" or N[-1] =="8":
    print("pon")
elif N[-1] == "3":
    print("bon")

Measured memory_bytes: 9152
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, n) for(int i = 1; i <= (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define srep(i, from, to) for(int i = from; i < (int)(to); i++)
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  rep(i, n) {
    cin >> p[i];
    p[i]--;
  };

  rep(i, n) {
    if(i != p[i]) {
      int pi = p[i];
      p[i] = p[pi];
      p[pi] = pi;
      break;
    }
  }

  bool ans = true;
  rep(i, n) {
    if(i != p[i]) {
      ans = false;
      break;
    }
  }

  if(ans) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedInputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scan = new Scanner(new BufferedInputStream(System.in));
		List<String> output = new ArrayList<String>();
		while (scan.hasNext()) {
			String input = scan.nextLine();
			String[] in = input.split(" ");
			int H = Integer.parseInt(in[0]);
			int W = Integer.parseInt(in[1]);
			if (H == 0 && W == 0) {
				break;
			} else {
				if (H >= 1 && H <= 300 && W >= 1 && W <= 300) {
					for (int i = 1; i <= H; i++) {
						String result = "";
						for (int j = 1; j <= W; j++) {
							result += "#";
						}
						output.add(result);
					}
					output.add("");
				}
			}
		}
		for (String out : output) {
			System.out.println(out);
		}
	}
}

Measured memory_bytes: 54456
H,W,D,*r=`dd`.split.map &:to_i
d=[0]*(D+1);x=[]
(0..H*W-1).each{|e|x[r[e]]=e}
(D+1..H*W).each{|i|d[i]=d[i-D]+(x[i]/W-x[i-D]/W).abs+(x[i]%W-x[i-D]%W).abs}
r[H*W+1..-1].each_slice(2){|a,b|puts d[b]-d[a]}

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

struct UnionFind {
    vector<int> par;
    vector<int> sz;
    int64_t ans;

    UnionFind(int n=0){
        if(n>0) initialize(n);
    }

    void initialize(int n){
        par.resize(n);
        sz.resize(n);
        for(int i=0; i<n; i++){
            par[i] = i;
            sz[i] = 1;
        }

        ans = (int64_t) n * (n-1) / 2;
    }

    int find(int x){
        if(par[x] == x){
            return x;
        }else{
            return par[x] = find(par[x]);
        }
    }

    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return;

        ans -= (int64_t) sz[x] * sz[y];

        if(sz[x] < sz[y]){
            par[x] = y;
            sz[y] += sz[x];
        }else{
            par[y] = x;
            sz[x] += sz[y];
        }
    }

    bool same(int x, int y){
        return find(x) == find(y);
    }
};

int main(){
    int N, M, A[100000], B[100000];
    cin >> N >> M;
    for(int i=0; i<M; i++){
        cin >> A[i] >> B[i];
        A[i]--; B[i]--;
    }

    UnionFind uf(N);
    int64_t ans[100000];
    for(int i=M-1; i>=0; i--){
        ans[i] = uf.ans;
        uf.unite(A[i], B[i]);
    }

    for(int i=0; i<M; i++) cout << ans[i] << endl;
    return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    cin >> N;
    unordered_map<ll, ll> m, n;
    ll count = 0;
    rep(i, N) {
        ll temp;
        cin >> temp;
        m[i + 1 + temp]++;
        n[i + 1 - temp]++;
    }
    iter(i, m) count += n[i.first] * i.second;
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 26240
#include<stdio.h>
#define N 10000
#define Q 500
int main(){
    
    int n,q,i,j,k,u = 0,cnt = 0,flg = 0;
    int a[N],b[Q],c[Q];

    scanf("%d",&n);
    for( i = 0; i < n; i++){
        scanf("%d",&a[i]);
    }
    scanf("%d",&q);
    for( i = 0; i < q; i++){
        scanf("%d",&b[i]);
    }
    for(k = 0; k < q; k++){
        c[k] = -1;
    }
    for(i = 0; i < n; i++){
        for(j = 0; j < q; j++){
            flg = 0;
            for(k = 0; k < u; k++){
                if(c[k] == a[i]) flg++;
            }
            if( a[i] == b[j] && flg == 0 ){
                cnt++;
                c[u++] = b[j];
            }
        }
    }
    printf("%d\n",cnt);
    
    return 0;
}


Measured memory_bytes: 2108
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <random>
#include <cassert>
#include <numeric>
#define ll long long int
#define LL unsigned long long
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
using namespace std;

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};
const int MOD = 1000000007;

ll y[10000005];

int main() {
    string s; cin >> s;
    ll k; cin >> k;
    vector<ll> l;

    ll cnt = 1;
    rep(i,s.size()-1){
        if(s[i]==s[i+1]) cnt++;
        else{
            l.pb(cnt);
            cnt = 1;
        }
    }l.pb(cnt);
    

    ll ans = 0,ha = 0;
    if(s[0] == s[s.size()-1] && l.size() > 2){
        ha += l[0] / 2 + l[l.size()-1] / 2;
        l[0] += l[l.size()-1];
        l[l.size()-1] = 0;
        ans += l[0]/2 * (k-1);
        ll s = 0;
        for(int i = 1; i < l.size(); i++){
            s += l[i] / 2ll;
        }
        //cout << ans << endl;
        cout << ha + ans + s * k << endl;
        return 0;
    }
    if(l.size() == 1){
        cout << l[0] * k / 2ll << endl;
        return 0;
    }

    ll n = 0;
    rep(i,l.size()){
        n += l[i] / 2ll;
    }
    cout << n * k << endl;
}


Measured memory_bytes: 3660
D,G=map(int,input().split())
p=[]
c=[]
compScore=[]
checkBits=[]
for i in range(D):
    x,y =map(int,input().split())
    p.append(x)
    c.append(y)
    compScore.append(x*(i+1)*100+y)
    checkBits.append(2**i)
    
ans = sum(p)
for bit in range(2**D):
    score = 0
    ansCand = 0
    notCompleted=set(range(D))
    for i in range(D):
        checkBit = checkBits[i]
        if (bit & checkBit) == checkBit:
            score += compScore[i]
            ansCand += p[i]
            notCompleted.remove(i)
    if score >= G:
        ans = min(ans,ansCand)
        #print(bit,"complete",ansCand)
    else:
        if notCompleted:
            halfFilled = max(notCompleted)
            #print(30,score,(p[halfFilled]-1)*(halfFilled+1)*100,(G-score)//((halfFilled+1)*100))
            if score + (p[halfFilled]-1)*(halfFilled+1)*100 >= G:
                ansCand += (G-score)//((halfFilled+1)*100)
                if (G-score)%((halfFilled+1)*100)!=0:
                    ansCand += 1
                ans = min(ans,ansCand)
            #print(36,bit,halfFilled,ansCand)
#for i in range(D):
#    print(compScore[i])

print(ans)


Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public class Main {

    public static void main(String[] args) throws Exception {
	    String input = Io.read();
	    Character[] arr = new Character[input.length()];

	    for (int i = 0; i < input.length(); i++) {
	        arr[i] = input.charAt(i);
        }

	    Set<Character> charSet = toSet(arr);

	    String ans = "Yes";
	    for (char c : charSet) {
            long cnt = Arrays.stream(arr).filter(x -> x.equals(c)).count();
            if ((cnt & 1) == 1) {
                ans = "No";
                break;
            }
        }
        Io.write(ans);
    }

    private static Set<Character> toSet(Character[] arr) {
        Set<Character> charSet = new HashSet<>();

        for (char c : arr) {
            charSet.add(c);
        }

        return charSet;
    }
}

class Io {

    /**
     * 標準入力から1行ずつ受け取る
     * @return
     * @throws IOException
     */
    public static String read() throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        br.close();
        return line;
    }

    /**
     * 標準出力
     * @param answer
     */
    public static void write(String answer)
    {
        System.out.println(answer);
    }
}

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

int main(void){
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	for(int i = 0; i < n;++i){
		if(i==k-1){
			cout << (char)tolower(s[i]);
		}else{
			cout << s[i];
		}
	}
	cout << endl;
	return 0;
}

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

int main(){
    int n,l; cin>>n>>l;
    vector<string> s(n);
    for(int i=0; i<n; i++){
        cin >> s.at(i);
    }
    sort(s.begin(), s.end());
    for(int i=0; i<n; i++){
        cout << s.at(i);
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 2000000000
#define InfLL 4000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	char c;
	cin >> c;
	char ans = ((c >= 'A') && (c <= 'Z')) ? 'A' : 'a';
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define mp make_pair
#define enld endl

int main() {
	lint N;
	cin >> N;
	vector<lint>T(N);
	rep(i, N) {
		cin >> T[i];
	}
	lint M;
	cin >> M;
	vector<lint>P(M);
	vector<lint>X(M);
	rep(i, M) {
		cin >> P[i] >> X[i];
	}
	lint sum = 0;
	rep(i, N) {
		sum += T[i];
	}
	rep(i, M) {
		cout << sum - T[P[i] - 1] + X[i] << endl;
	}
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define int long long

#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, long long m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }
 
const int N=1e5+5;
const int LG=20;

int32_t main()
{
    IOS;
    int n, m;
    cin>>n>>m;
    int time=1900*m + 100*(n-m);
    time*=pow(2LL, m, (long long)1e18);
    cout<<time;
    return 0;
}  

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

int main() {
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	int n,d;
	cin>>n>>d;
	int ans=0;
	while(n>0) {
		ans++;
		n-=d;n-=d;n-=1;
	}
	cout<<ans<<endl;
	return 0;
}


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

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 ll = long long;
using lb = long double;
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

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

int main() {
  ll N,M;
  cin>>N>>M;
  vector<ll> a(N),b(M);
  rep(i,N) cin>>a[i];
  rep(i,M) cin>>b[i];
  auto c = convolution(a,b);
  for(auto x:c) cout<<x<<" ";
  cout<<endl;
}

Measured memory_bytes: 27236
def match1(str1, str2):
    match_count = 0
    for i in range(len(str1)):
        if str1[i] == str2[i]:
            match_count += 1

    return match_count

S = input()
T = input()

max_match = 0
for i in range(0, len(S) +1 -len(T)):
    subS = S[i:i+len(T)]
    max_match = max(max_match, match1(T, subS))
    if max_match == 0:
        for j in range(len(T)):
            if T[j] == subS[j]:
                max_match = 1

print(len(T)-max_match)

Measured memory_bytes: 9084
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

maxdist = max(a, b, c, d, e)
mindist = min(a, b, c, d, e)

if maxdist - mindist <= k:
    print('Yay!')
else:
    print(':(')


Measured memory_bytes: 3060
var lines = []; var X = []; var flag = false;
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    X = lines[0].split("").map(i => Number(i));
    dfs(0, []);
});

function dfs(n, comb) {
    if (n === 3) { calc(comb) }
    else {
        for (var i = 0; i < 2; i++) {
            comb[n] = i;
            dfs(n + 1, comb);
        }
    }
}

function calc(comb) {
    if (flag === true) { return (0) }

    else {
        var sum = X[0]; var ans = X[0].toString();
        for (var i = 0; i < 4; i++) {
            switch (comb[i]) {
                case 0: sum += X[i + 1]; ans = ans + "+" + X[i + 1]; break;
                case 1: sum -= X[i + 1]; ans = ans + "-" + X[i + 1]; break;
            }
        }

        if (sum === 7) { console.log(ans + "=7"); flag = true; }

        return (0);
    }
}

Measured memory_bytes: 7500
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(ll i=a;i<b;++i)
#define REPN(i,a,b) for(ll i=a;i<=b;++i)
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define ll long long
const int M=1e9+7;
const int MAXN=17;


int main()
{/*
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#*/
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
  int n;
  cin>>n;
  int A[n];
  set<int> s;
  REP(i,0,n)
  {
  	cin>>A[i];
  	s.insert(A[i]);
  }
  if(s.size()==n)
  cout<<"YES\n";
  else cout<<"NO\n";

    return 0;
}

Measured memory_bytes: 10368
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int n; cin >> n;
    vector<int> Num(n);
    int sum = 0;
    REP(i, n){
        cin >> Num[i];
        sum += Num[i];
    }
    vector<int> Ruiseki(n);
    Ruiseki[0] = Num[0];
    FOR(i, 1, n) Ruiseki[i] = Ruiseki[i - 1] + Num[i];
    int ans = INF;
    FOR(i, 1, n) ans = min(ans, abs((sum - 2 * Ruiseki[i - 1])));
    cout << ans << endl;
}

Measured memory_bytes: 256
n, m = map(int, input().split())

# 1の場合
# 2の場合
# 3以上の場合
#  最外でない場合は、9回処理されるので裏返る
#  最外でコーナーの場合は、4回処理されるのでそのまま
#  最外でコーナー以外の場合は、6回処理されるのでそのまま

if n == 2 or m == 2:
    print(0)
elif n ==1 and m == 1:
    print(1)
elif n == 1 or m == 1:
    w = m if n == 1 else n
    print(w - 2)
else:
    print((n - 2) * (m - 2))


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var x = sc.nextLong();
		sc.close();

		var m = 100L;
		var y = 0;
		while (m < x) {
			y++;
			m = (long)(m * 1.01);
		}

		System.out.println(y);
	}
}

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

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;

const int MAX = 20;
string mat[MAX], buffer[MAX];
bool used[MAX];
int n, m;

void die(string s) {
	cout << s << '\n';
	exit(0);
}

vector<int> state;

bool palindrome(const string &s) {
	return equal(s.begin(), s.end(), s.rbegin());
}

bool valid(const vector<int> &perm) {
	fori(i, 0, n) {
		buffer[i] = mat[i];
	}

	multiset<string> S;
	fori(i, 0, n) {
		fori(j, 0, m) {
			buffer[i][j] = mat[i][perm[j]];
		}

		S.insert(buffer[i]);
	}

	while(S.size() > 1) {
		string first = *S.begin(); S.erase(S.begin());

		string revF = first;
		reverse(revF.begin(), revF.end());

		if(S.count(revF)) {
			S.erase(S.find(revF));	
		}
		else {
			string other = *S.begin(); S.erase(S.begin());
			S.insert(first);

			revF = other;
			reverse(revF.begin(), revF.end());
			
			if(S.count(revF)) {
				S.erase(S.find(revF));
			}
			else {
				return false;
			}
		}
	}


	if(S.size() == 1) {
		string f = *S.begin();
		
		if(!palindrome(f)) {
			return false;
		}
	}

	return true;
}

void gen(int index) {
	if(2 * index >= m - 1) {
		if(valid(state)) {
			die("YES");
		}
		return;
	}

	fori(i, 0, m) {
		if(!used[i]) {
			used[i] = true;
			state[index] = i;

			fori(j, i + 1, m) {
				if(!used[j]) {
					used[j] = true;
					state[m - index - 1] = j;

					gen(index + 1);

					used[j] = false;
				}
			}

			used[i] = false;

			break;
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);

	cin >> n >> m;

	state.resize(m, 0);

	fori(i, 0, n) {
		cin >> mat[i];
	}

	if(m & 1) {
		fori(i, 0, m) {
			state[m / 2] = i;
			used[i] = true;
			gen(0);
			used[i] = false;
		}
	}
	else {
		gen(0);
	}

	die("NO");

	return 0;
}


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


int main() {
    int n;
    cin>>n;
    int x=n%10;
    if(x==2||x==4||x==5||x==7||x==9) cout<<"hon"<<endl;
    if(x==3) cout<<"bon"<<endl;
    if(x==0||x==1||x==6||x==8) cout<<"pon"<<endl;
}

Measured memory_bytes: 3648
"use strict";
function Main(input) {
    let lines = input.split("\n");
    let N = lines[0] - 0;
    let Hs = lines[1].split(/\s/).map((v) => v - 0);

    Hs.unshift(0);
    let dp = new Array(N+1).fill(Number.MAX_SAFE_INTEGER);
    dp[1] = 0;
    for (let n = 2; n <= N; n++) {
        dp[n] = Math.min(dp[n], dp[n-1] + Math.abs(Hs[n - 1] - Hs[n]));
        dp[n] = Math.min(dp[n], dp[n-2] + Math.abs(Hs[n - 2] - Hs[n]));
    }
    console.log(dp[N]);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 27340
//11
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  for(int n,k;cin>>n>>k,n|k;){
    int f[101][101];
    fill_n(f[0],101*101,-1);
    while(k--){
      int l;
      cin>>l;
      if(l){
	int c,d,e;
	cin>>c>>d>>e;
	f[c][d]=f[d][c]=(f[d][c]==-1)?e:min(e,f[d][c]);
      }else{
	int a,b;
	cin>>a>>b;
	int d[101];
	fill_n(d,101,1<<29);
	d[a]=0;
	bool u[101]={};
	while(!u[b]){
	  int mu=1<<29;
	  int v;
	  for(int i=1;i<=n;i++){
	    if(!u[i]&&d[i]<mu){
	      mu=d[i];
	      v=i;
	    }
	  }
	  if(mu==1<<29)break;
	  u[v]=true;
	  for(int i=1;i<=n;i++){
	    if(f[v][i]!=-1){
	      d[i]=min(d[i],d[v]+f[v][i]);
	    }
	  }
	}
	if(u[b]){
	  cout<<d[b]<<endl;
	}else{
	  cout<<-1<<endl;
	}
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1200
# https://atcoder.jp/contests/abc164/tasks/abc164_d


S = input()

res = 0

x = 0
p = 1
MOD = 2019
reminder = [0]*2019
reminder[0] = 1
for s in reversed(S):
    """ 累積和 """
    x = (int(s)*p + x)%MOD
    p = p*10%MOD
    res += reminder[x]
    reminder[x] += 1

print(res)

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

int main(){
    int n;
    cin >> n;
    cout << 111+999-n << endl;
    return 0;
}

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

const long NUM = 500000;
long n, S[NUM], c = 0;

void merge(long A[], long left, long mid, long right) {
  long L[NUM/2+2], R[NUM/2+2], n1 = mid - left, n2 = right - mid;

  for (int i = 0; i < n1; i++)
    L[i] = A[left+i];
  for (int i = 0; i < n2; i++)
    R[i] = A[mid+i];

  L[n1] = R[n2] = numeric_limits<long>::max();

  long i = 0, j = 0;

  for (long k = left; k < right; k++) {
    if (L[i] <= R[j]) A[k] = L[i++];
    else {
      A[k] = R[j++];
      c += n1 - i;
    }
  }
}

void mergeSort(long A[], long left, long right) {
  if (left+1 < right) {
    long mid = (left+right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

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

  mergeSort(S, 0, n);

  cout << c << endl;
  return 0;
}

Measured memory_bytes: 5560
#include <iostream>
using namespace std;
#include <math.h>
 
int main()
{
    double x1, y1, x2, y2, x3, y3, x, y;
    double ax, ay, bx, by;
    double z1, z2, z3; // ????????????A??¨????????????B????????????z??????
     
    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x >> y) {
        ax = x2 - x1;
        ay = y2 - y1;
        bx = x - x1;
        by = y - y1;
        z1 = ax * by - ay * bx;
         
        ax = x3 - x2;
        ay = y3 - y2;
        bx = x - x2;
        by = y - y2;
        z2 = ax * by - ay * bx;
         
        ax = x1 - x3;
        ay = y1 - y3;
        bx = x - x3;
        by = y - y3;
        z3 = ax * by - ay * bx;
         
        if ( ( (z1 > 0) && (z2 > 0) && (z3 > 0) ) || ( (z1 < 0) && (z2 < 0) && (z3 < 0) ) )
            cout << "YES\n";
        else
            cout << "NO\n";
    }
    return 0;
}

Measured memory_bytes: 1188
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<deque>
#include<iomanip>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
using namespace std;
typedef long long ll;
typedef long double ld;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>

const double PI=acos(-1.0);
const double eps=1e-6;
const ll mod=1e9+7;
const int inf=0x3f3f3f3f;
const int maxn= 3e3+10;
const int maxm=100+10;
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);


ll dp[maxn][maxn];
int main()
{
    int n;
    cin>>n;
    for(int i = 3; i<=n; i++)
    {
        dp[1][i] = 1;
    }
    dp[1][0] = 1;
    for(int i = 2; i<=n; i++)
    {
        ll tmp = 0;
        for(int j = 3; j<=n-3; j++)
        {
            tmp = (tmp+dp[i-1][j])%mod;
            dp[i][j+3] = (tmp + dp[i][j+3])%mod;
        }
        dp[i][n] = tmp;
    }
    ll ans = 0;
    for(int i = 1; i<=n; i++)
    {
       // cout<<dp[i][n]<<endl;
        ans = (ans+dp[i][n])%mod;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 42712
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include <unordered_map>
//#include"testlib.h"
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define sz(s)    (int)(s.size())
#define PI acos(-1)
#define EPS 1e-8
#define watch(x) cout << (#x)<<" = "<<x<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
	//freopen("street.in", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}

int main() {
	file();
	fast();
	string str; cin >> str;
	if (str.back() != 's')
		str.push_back('s');
	else str+="es";
	cout << str << endl;
	return 0;
}


Measured memory_bytes: 3664
from bisect import bisect_left
MOD = 998244353

n = int(input())
robot = []
pos = []

for i in range(n):
    x, d = map(int, input().split())
    robot.append([x, x+d])
    pos.append(x)

robot = sorted(robot, key=lambda y: y[0])
pos = sorted(pos)


def init(init_val):
    for i in range(n):
        MI[i+num-1] = init_val[i]
        MA[i+num-1] = init_val[i]
    for i in range(num-2, -1, -1):
        MI[i] = min(MI[2*i+1], MI[2*i+2])
        MA[i] = max(MA[2*i+1], MA[2*i+2])


def update(k, x):
    k += num-1
    MI[k] = x
    MA[k] = x
    while k+1:
        k = (k-1)//2
        MI[k] = min(MI[k*2+1], MI[k*2+2])
        MA[k] = max(MA[k*2+1], MA[k*2+2])


def rangemin(p, q):
    if q <= p:
        return 1 << 100
    p += num-1
    q += num-2
    res = 1 << 100
    while q-p > 1:
        if p & 1 == 0:
            res = min(res, MI[p])
        if q & 1 == 1:
            res = min(res, MI[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = min(res, MI[p])
    else:
        res = min(min(res, MI[p]), MI[q])
    return res


def rangemax(p, q):
    if q <= p:
        return -1
    p += num-1
    q += num-2
    res = -1
    while q-p > 1:
        if p & 1 == 0:
            res = max(res, MA[p])
        if q & 1 == 1:
            res = max(res, MA[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = max(res, MA[p])
    else:
        res = max(max(res, MA[p]), MA[q])
    return res


# n:リスト長
num = 2**(n-1).bit_length()
MI = [1 << 100]*2*num
MA = [-1]*2*num

r = []
for x, d in robot:
    r.append(bisect_left(pos, d))

init(r)

s = [0]*n

for x in range(n-1, -1, -1):
    right_max = rangemax(x, r[x])
    s[x] = right_max
    update(x, right_max)

dp = [0]*(n+1)
dp[-1] = 1

for i in range(n-1, -1, -1):
    dp[i] = dp[i+1]+dp[s[i]]
    dp[i] %= MOD

print(dp[0])


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

using namespace std;

int main() {
    int n, c = 0;
    long long ans = 0;
    cin >> n;
    int a[100001], abs[100001];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if(a[i] < 0) {
            c++;
            abs[i] = (-1) * a[i];
        }
        else abs[i] = a[i];
    }
    for (int i = 0; i < n; i++) {
        ans += abs[i];
    }
    
    sort(abs, abs+n);
    if(c % 2) {
        ans -= 2 * abs[0];
    }
    cout << ans << endl;
	return 0;
}



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

#define MAX 10000

void CountingSort(int *, int *, int);

int main()
{
  int *A, *B;
  int i;
  int n;  

  scanf("%d", &n);

  A = malloc(sizeof(int)*(n + 1));
  B = malloc(sizeof(int)*(n + 1));
  
  for( i = 1 ; i <= n ; i++ )
    scanf("%d", &A[i]);
  
  CountingSort(A, B, n);

  for( i = 1 ; i <= n ; i++ ){
    if( i > 1 ) printf(" ");
    printf("%d", B[i]);
  }
  
  printf("\n");

  free(A);
  free(B);
  
  return 0;
}
  
void CountingSort(int A[], int B[], int n)
{
  int i, j;
  int C[MAX+1];
  
  for( i = 0 ; i <= MAX ; i++ )
    C[i] = 0;
  
  for( j = 1 ; j <= n ; j++ )
    C[A[j]]++;

  for( i = 1 ; i <= MAX ; i++ )
    C[i] = C[i] + C[i-1];

  for( j = n ; j > 0 ; j-- ){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
}
  

Measured memory_bytes: 16056
#include<bits/stdc++.h>
using namespace std;
#define Set(a,b) memset(a,b,sizeof(a))
template<class T>inline void init(T&x){
	x=0;char ch=getchar();bool t=0;
	for(;ch>'9'||ch<'0';ch=getchar()) if(ch=='-') t=1;
	for(;ch>='0'&&ch<='9';ch=getchar()) x=(x<<1)+(x<<3)+(ch-48);
	if(t) x=-x;return;
}typedef long long ll;
const int N=1e5+10;
const int mod=1e9+7;
template<class T>inline void Inc(T&x,int y){x+=y;if(x>=mod) x-=mod;}
char s[N];
int f[N][2];
int main()
{
	scanf("%s",s+1);
	int n=strlen(s+1);
	f[0][1]=1;
	for(int i=1;i<=n;++i) {
		if(s[i]=='0') {
			f[i][1]=f[i-1][1];
			f[i][0]=(ll)f[i-1][0]*3%mod;
		}else{
			f[i][1]=2*f[i-1][1]%mod;
			f[i][0]=f[i-1][1];
			Inc(f[i][0],(ll)f[i-1][0]*3%mod);
		}
	}
	int ans=f[n][0];
	Inc(ans,f[n][1]);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/

signed main(){
  int n,a,b;
  cin>>n>>a>>b;
  int ans;
  ans=n/(a+b)*a;
  ans+=min(n-n/(a+b)*(a+b),a);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

ll rep_pow(ll a, ll b){//繰り返し2乗法
    if(b==0) return 1;
    else if(b%2==0){
        ll memo = rep_pow(a, b/2);
        return memo*memo%mod;
    }else{
        return rep_pow(a, b-1)*a%mod;
    }
}

ll nCr(ll n, ll r){//mod逆元使ったnCr
    ll ret=1;
    rep(i,r){
        ret *= n-i;//分子
        ret %= mod;
        ret *=rep_pow(r-i, mod-2);//mod逆元によりr!で割ると同値
        ret %= mod;
    }
    return ret;
}
ll gcd(ll a, ll b){ if(b==0) return a; return gcd(b, a%b);}

int counter(int x){
    if(x==0) return 0;
    return counter(x>>1)+(x&1);
}


int main(){
    fast_io

    int h,w,n;
    cin>>h>>w>>n;
    int ans;
    if(n/h < n/w){
        if(n%h==0) ans=n/h;
        else ans=n/h+1;
    }else{
        if(n%w==0) ans=n/w;
        else ans=n/w+1;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
let n = Scanf.scanf " %d" (+) 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let f ans j =
  let s, c = ref 0, ref 0 in
  for i = 0 to n - 1 do
    s := !s + a_s.(i);
    if i mod 2 = j then (if !s <= 0 then (c := !c + 1 - !s; s := 1))
    else (if !s >= 0 then (c := !c + !s + 1; s := -1)) done;
  min ans !c
let _ = List.fold_left f max_int [0; 1] |> Printf.printf "%d\n"

Measured memory_bytes: 5504
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>

using namespace std;

#define MAX 100000
typedef long long llong;
int n, k;
llong T[MAX];
int check(llong p)
{
	int i = 0;
	for (int j = 0; j < k; j++)
	{
		llong s = 0;
		while (s+T[i]<=p)
		{
			s += T[i];
			i++;
			if (i == n)
				return n;
		}
	}
	return i;
}

int solve()
{
	llong left = 0;
	llong right = 100000 * 10000;
	llong mid = 0;
	while (right-left>1)
	{
		mid = (left + right) / 2;
		int v = check(mid);
		if (v < n)
			left = mid ;
		else
			right = mid ;
	}
	return right;
}


int main()
{
	cin >> n >> k;
	for (int i = 0; i < n; i++)
	{
		cin >> T[i];
	}
	llong ans = solve();
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3900
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int[] num = new int[n];
		int cnt = 0;
		for(int i=0; i<n; i++){
			a[i] = sc.nextInt();
			if(a[i]>n)cnt++;
			else num[a[i]-1]++;
		}
		for(int i=0; i<n; i++){
			if(num[i]<i+1)cnt += num[i];
			else if(num[i]>i+1)cnt += num[i]-i-1;
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 60500
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(void){
    // Your code here!
    int h,w;
    cin>>h>>w;
    ll sum = 0;
    if(h==1 || w==1){ cout<<1<<endl;
    return 0;}
    for(int i=0;i<h;i++){
        if(i%2==0) sum += (w+1)/2;
        else sum += w/2;
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define pll pair<ll,ll>
#define sqr(x) (x)*(x)
#define mod 1000000007
#define pi acos(-1.0)

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(),cout.tie();
    ll r;
    cin>>r;
    double ans=(double)2.0*pi*r;
    cout<<setprecision(10)<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3800
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    double R;
    cin >> R;
    printf("%.12lf\n", 2 * R * PI);
}


Measured memory_bytes: 3792
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int64_t N, C;
  cin >> N >> C;
  vector<int64_t> X(N);
  vector<int64_t> V(N);
  rep(i, N) { cin >> X[i] >> V[i]; }

  vector<int64_t> RXV(N + 1);
  RXV[0] = 0;
  int64_t sumRV = 0;
  rep(i, N) {
    sumRV += V[i];
    RXV[i + 1] = sumRV - X[i];
    RXV[i + 1] = max(RXV[i + 1], RXV[i]);
  }

  vector<int64_t> LXV(N + 1);
  LXV[0] = 0;
  int64_t sumLV = 0;
  rep(i, N) {
    sumLV += V[N - (i + 1)];
    LXV[i + 1] = sumLV - (C - X[N - (i + 1)]);
    LXV[i + 1] = max(LXV[i + 1], LXV[i]);
  }

  // pattern 1 clockwise
  // pattern 2 unticlockwise
  int64_t answer = max(RXV[N], LXV[N]);

  rep(i, N) {
    // pattern 3 clockwise -> back to start -> unticlockwise
    int64_t tmp0 = RXV[i + 1] - X[i] + LXV[N - i - 1];
    // pattern 4 unticlockwise -> back to start -> clockwise
    int64_t tmp1 = LXV[i + 1] - (C - X[N - (i + 1)]) + RXV[N - i - 1];
    answer = max(answer, max(tmp0, tmp1));
  }
  cout << answer << endl;
  return 0;
}

Measured memory_bytes: 6364
/* author   : mpily :-()
title : Competing.cpp
time :Sun Nov 24 15:02:47 2019

*/
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	if(s == "SUN")cout<<7;
	if(s=="MON")cout<<6;
	if(s == "TUE")cout<<5;
	if(s == "WED")cout<<4;
	if(s == "THU")cout<<3;
	if(s == "FRI")cout<<2;
	if(s == "SAT")cout<<1;
	cout<<"\n";
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int Prime(int);

int main(void){

  int A[10000];
  int n,i,j,k,x=0;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  for(i=0;i<n;i++){
    k = Prime(A[i]);
    if(k == 1){
      x++;
    }
  }
  printf("%d\n",x);
  return 0;
}

int Prime(int a){

  int i;

  if(a < 2){
    return 0;
  }

  else if(a == 2){
    return 1;
  }

  if(a % 2 == 0){
    return 0;
  }

  for(i=3;i<=a/i;i+=2)
    if(a % i == 0)
      return 0;
  return 1;
}

Measured memory_bytes: 632
#include<bits/stdc++.h>
#define dd(x) cout<<#x<<" = "<<x<<" "
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define sz(x) int(x.size())
#define All(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef priority_queue<int> BQ;
typedef priority_queue<int,vector<int>,greater<int> > SQ;
const int maxn=3e5+10,mod=1e9+7,INF=0x3f3f3f3f;

int main()
{
	int n;
	cin>>n;
	int r=n%10;
	if (n%10==3)
		cout<<"bon";
	else if (r==0||r==1||r==6||r==8)
		cout<<"pon";
	else
		cout<<"hon"; 
	return 0;
}


Measured memory_bytes: 3636
import Data.Maybe

main :: IO ()
main = do
    digits <- map (read . return) <$> getLine :: IO [Int]
    putStrLn . (++"=7") . tail . fromJust $ genFormula 0 "" digits

genFormula :: Int -> String -> [Int] -> Maybe String
genFormula n s [] = if n == 7 then Just s else Nothing
genFormula n s (x:xs) = let
    a = genFormula (n+x) (s++"+"++show x) xs
    b = genFormula (n-x) (s++"-"++show x) xs
    in case (isJust a, isJust b) of
        (True  ,    _) -> a
        (_     , True) -> b
        (False, False) -> Nothing


Measured memory_bytes: 508
#include <iostream>
 
using namespace std;
 
int main()
{
    int n;
    cin>>n;
    long long sum=0;
    for(int i=1;i<=n;i++){
        if(i%3>0){
            if(i%5>0){
                sum+=i;
            }
        }
    }
    cout<<sum;
    return 0;
}

Measured memory_bytes: 3588
fun main(args: Array<String>) {
    val s = readInputLine().toCharArray()
    
    val N = s.size
    
    var score = 0
    
    for (i in 0 until N) {
        if (i + 1 > (N + N % 2) / 2) {
            if (s[i] == 'g') {
                score++
            }
        } else {
            if (s[i] == 'p') {
                score--
            }
        }
    }
    
    println(score)
}

fun readInputLine(): String {
    return readLine()!!
}


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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int n,m,now,memo[100000],z;
vector<int> v,ans;
map<int,int> ma;
string s;

signed main() {
    rep(i,100000) memo[i] = INF;
    cin >> n >> m >> s;
    reverse(all(s));
    rep(i,n+1) if (s[i] == '0') v.pb(i);
    v.pb(INF);
    while(now != n) {
        int tmp = *(--upper_bound(all(v), now+m));
        if (now == tmp) {
            cout << -1 << endl;
            return 0;
        }
        ans.pb(tmp-now);
        ma[tmp-now]++;
        memo[now] = z;
        z++;
        now = tmp;
    }
    memo[now] = z;
    int cnt=1;
    repm(i,n) {
        if(memo[i] != INF) {
            cout << cnt << " ";
            cnt = 0;
        }
        cnt++;
    }
    cout << endl;
}





Measured memory_bytes: 3444