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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    string S;
    cin >> S;

    ll A = S[0]-'0';
    ll B = S[1]-'0';
    ll C = S[2]-'0';
    ll D = S[3]-'0';

    for(ll i=-1; i<2; i=i+2){
        for(ll j=-1; j<2; j=j+2){
            for(ll k=-1; k<2; k=k+2){
                if(A + B*i + C*j + D*k == 7){
                    char c1, c2, c3;
                    if(i==1){
                        c1 = '+';
                    }
                    else{
                        c1 = '-';
                    }
                    if(j==1){
                        c2 = '+';
                    }
                    else{
                        c2 = '-';
                    }
                    if(k==1){
                        c3 = '+';
                    }
                    else{
                        c3 = '-';
                    }
                    cout << A << c1 << B << c2 << C << c3 << D << '=' << 7 << endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = [int(x) for x in input().split()]

s = sum(a)
s1 = 0
for i in range(1,len(a)):
    if i % 2 == 1:
        s1 += a[i]
x = s - 2*s1
ans = [x]
for i in range(len(a)-1):
    ans.append(2*a[i] - x)
    x = 2*a[i] - x
print(*ans)

Measured memory_bytes: 14024
#include <bits/stdc++.h>
typedef long long int lli;
using namespace std;
#pragma region DEBUG
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#pragma endregion DEBUG
#define MOD 1000000007
#define MAX 5000005
#define endl "\n"
lli arr[MAX];
lli n,k;
bool evaluate(lli mid){
    lli ctr = 0;
    for(lli i = 0; i<n; i++){
        lli a = arr[i]%mid ? arr[i]/mid + 1: arr[i]/mid;
        ctr += (a-1);
    }
    return ctr <=k;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    
    lli t;
    t = 1;
    while(t--){
        lli hi = 1000000005;
        lli low = 0;
        cin>>n>>k;
        for(lli i = 0; i<n; i++){
            cin>>arr[i];
        }
        while(hi-low > 1){
            lli mid = (hi+low)/2;
            if(mid == 0){
                hi = 1; 
                break;
            }
            if(evaluate(mid)){
                hi = mid;
            }
            else{
                low = mid;
            }
        }
        cout<<hi<<endl;
    }
}

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

int main()
{
  int n; cin >> n;
  vector<vector<int> > a(n);
  for (size_t i = 1; i < n; i++)
  {
    int tmp; cin >> tmp;
    tmp--;
    a[tmp].push_back(i);
  }
  for (auto &&i : a)
  {
    cout << i.size() << endl;
  }
  
  
}

Measured memory_bytes: 13980
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    long long int n;
    int m = 1000010;

    cin >> n;

    for (long long int i = 1; i <= sqrtl(n); i++) {
        if (n % i == 0) {
            if (m > max(to_string(n/i).size(), to_string(i).size())) {
                m = max(to_string(n/i).size(), to_string(i).size());
            }
        }
    }

    cout << m << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <queue>
#include <set>
using namespace std;

int main() {
  int num;
  cin >> num;
  vector< vector< pair<int, int> > > vec(num);
  for(int i=0; i<num; i++){
    int numnum;
    cin >> numnum;
    for(int j=0; j<numnum; j++){
      int a, b;
      cin >> a >> b;
      vec[i].push_back(make_pair(a-1, b));
    }
  }
  int n = num;
  int biggest = 0;

  for (int bit = 0; bit < (1 << n); bit++) {
    vector<int> numbers;

    for (int i = 0; i < n; i++) {
      if (bit & (1 << i)) {
        numbers.push_back(i);
      }
    }
    queue<int> que;
    vector<int> already(num, 0);
    for(int i=0; i<numbers.size();i++){
      que.push(numbers[i]);
      already[numbers[i]] = 1;
    }
    while(!que.empty()){
      for(int i=0; i<vec[que.front()].size(); i++){
        if(vec[que.front()][i].second == 1 && already[vec[que.front()][i].first] == 0){ 
          que.push(vec[que.front()][i].first);
          numbers.push_back(vec[que.front()][i].first);
          already[vec[que.front()][i].first] = 1;
        }
      }
      que.pop();
    }
    
	vector<int> truePeople;
    for(int i=0; i<numbers.size(); i++){
      truePeople.push_back(numbers[i]);
    }
    vector<int> falsePeople;
    for (int i = 0; i < numbers.size(); i++) {
		for(int j=0; j<vec[numbers[i]].size(); j++){
         	if(vec[numbers[i]][j].second == 1){
              //truePeople.insert(vec[numbers[i]][j].first);
            }else{
              falsePeople.push_back(vec[numbers[i]][j].first);
            }
        }
    }
    bool right = true;
    for(int i=0; i<truePeople.size(); i++){
      for(int j=0; j<falsePeople.size(); j++){
       	if(truePeople[i] == falsePeople[j]) right = false;
      }
    }
    if(right){
      biggest = max(biggest, (int)numbers.size());
    }
  }
  cout << biggest;
  return 0;
}

Measured memory_bytes: 256
// be my baby doll
#include<bits/stdc++.h>
#define int long long
#define ld long double
using namespace std;
int n,k;
int arr[200005],pre[200005],suff[200005];
map<pair<int,int>,int> mp,vis;
int solve(int curr,int state){
	if(curr==n) return 0;
	if(curr==n-1) return 1;
	if(vis[{curr,state}]==1) return mp[{curr,state}];
	vis[{curr,state}]=1;
	int res=1;
	// solve curr+1 k stages
	// curr+1 k-1 stages reaming or delete this
	if(state==0){
		int ans=solve(curr+1,state);
		res=max(ans,suff[curr]);
	}else{
		int ans=solve(curr+1,state);
		res=max(ans,suff[curr]);
		if(curr!=0 && curr!=n-1){
			// if curr is zero then it is not beneficial to delete it 
			ans=solve(curr+1,state-1);
			res=max(ans,pre[curr-1]+suff[curr+1]);
		}
	}
	mp[{curr,state}]=res;
	return res;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n; cin>>n;
    int y=0;
    int curr=100;
    while(curr<n){
    	++y;
    	curr+=curr/100;
    }
    cout<<y;
    return 0;
}


// shakira your hips do not lie

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n) ;i++)

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

int main() {
  int r;
  cin >> r;
  cout << r*r << endl;

  return 0;

}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <regex>
using namespace std;
typedef long long ll;

#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define SIZE(array) (sizeof(array) / sizeof(array[0]))

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

#define MAX_V 100000

#define MOD 1000000007L
#define INF 100000000000

signed main() {
	int n;
	cin >> n;
	vector<int> v(n + 1);
	for (size_t i = 2; i <= n; i++) {
		int t = i;
		for (size_t j = 2; j <= i; j++) {
			while (t % j == 0) {
				v[j]++;
				t /= j;
			}
		}
	}
	long sum = 1;
	for (size_t i = 2; i <= n; i++) {
		// cout << v[i] << ", ";
		sum = (sum * (v[i] + 1)) % MOD;
	}
	cout << sum << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
using namespace std;

typedef long long ll;
typedef pair<ll, int> pli;

struct st {
  int to;
  int yen;
  int snu;
};

int main() {
  int n, m, s, t; scanf("%d%d%d%d", &n, &m, &s, &t); s--; t--;
  vector<st> e[n];
  for (int i = 0; i < m; ++i) {
     int u, v, a, b; scanf("%d%d%d%d", &u, &v, &a, &b); u--; v--;
     e[u].push_back((st){v, a, b});
     e[v].push_back((st){u, a, b});
  }

  ll dists[2][n]; memset(dists, 0x3f, sizeof(dists));
  for (int i = 0; i < 2; ++i) {
    ll* dist = dists[i];
    priority_queue<pli> q;
    q.push(make_pair(-0LL, (i == 0 ? s : t)));
    dist[(i == 0 ? s : t)] = 0;
    while(q.size()) {
      ll cost = -q.top().first;
      int pos = q.top().second;
      q.pop();

      for (const st& edge : e[pos]) {
        ll next_cost = cost + (i == 0 ? edge.yen : edge.snu);
        int next_pos = edge.to;
        if (dist[next_pos] <= next_cost) continue;
        dist[next_pos] = next_cost;
        q.push(make_pair(-next_cost, next_pos));
      }
    }
  }

#if 0
  for (int i = 0 ; i < n; ++i) {
    printf("%lld %lld\n", dists[0][i], dists[1][i]);
  }
#endif

  ll ans[n];
  ans[n-1] = dists[0][n-1] + dists[1][n-1];
  for (int i = n - 2; i >= 0; --i) {
    ans[i] = min<ll>(ans[i + 1], dists[0][i] + dists[1][i]);
  }
  for (int i = 0; i < n; ++i) {
    printf("%lld\n", 1000LL * 1000 * 1000 * 1000 * 1000 - ans[i]);
  }
}



Measured memory_bytes: 10748
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		while(true){
			String tmpArray[] = br.readLine().split(" ");
			
			int n = Integer.parseInt(tmpArray[0]);
			int q = Integer.parseInt(tmpArray[1]);
			
			if(n == 0 && q == 0){
				break;
			}
						
			Era[] eraArray = new Era[n];
			for(int i = 0; i < n; i++){
				tmpArray = br.readLine().split(" ");
				
				String name = tmpArray[0];
				int ebYear = Integer.parseInt(tmpArray[1]);
				int wesYear = Integer.parseInt(tmpArray[2]);

				eraArray[i] = new Era(wesYear - ebYear + 1, wesYear, name);
			}
			
			Arrays.sort(eraArray);
			
			for(int i = 0; i < q; i++){
				int query = Integer.parseInt(br.readLine());
				
				int eraIndex = -1;
				for(int j = 0; j < n; j++){
					if(eraArray[j].start <= query && eraArray[j].end >= query){
						eraIndex = j;
						break;
					}
				}
				
				if(eraIndex >= 0){
					System.out.println(eraArray[eraIndex].name+" "+(query - eraArray[eraIndex].start + 1));
				}
				else {
					System.out.println("Unknown");
				}
			}
		}
	}

}

class Era implements Comparable<Era>{
	int start;
	int end;

	String name;
	
	Era(int start, int end, String name){
		this.start = start;
		this.end = end;
		this.name = name;
	}

	@Override
	public int compareTo(Era e1) {
		return this.start - e1.start;
	}
}


Measured memory_bytes: 50544
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
#define INF (1<<30)-1
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int n; cin >> n;
  vi c(n-1),s(n-1),f(n-1);
  rep(i,n-1) cin >> c[i] >> s[i] >> f[i];

  vi ans(n);
  rep(i,n-1){
    rep(j,i+1){
      if(s[i] < ans[j]){
        int t = ans[j];
        while (t%f[i] != 0) t++;
        ans[j] = c[i]+t;
      }else{
        ans[j] = c[i]+s[i];
      }
    }
  }
  rep(i,n) cout << ans[i] << endl;
  cout << "\n";
  return 0;
}


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

int main() {
	string o, e;
	cin >> o >> e;

	for (int i = 0; i < e.size(); i++) {
		cout << o[i];
		cout << e[i];
	}

	if (o.size() > e.size())
		cout << o[o.size() - 1];

	cout << endl;
}


Measured memory_bytes: 256
package main

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

func main() {
	sc.Split(bufio.ScanWords)

	var n int
	fmt.Scan(&n)
	a := scanInts(n)
	b := scanInts(n)
	c := scanInts(n)
	sort.Ints(a)
	sort.Ints(c)

	ans := 0
	for i := 0; i < n; i++ {
		// j := sort.SearchInts(a, b[i])
		// k := sort.SearchInts(c, b[i]+1)
		j := lowerBound(a, b[i])
		k := upperBound(c, b[i])
		ans += j * (n - k)
	}
	fmt.Println(ans)
}

func scanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}
	return a
}

func lowerBound(a []int, x int) int {
	lb, ub := -1, len(a)
	for ub-lb > 1 {
		mid := (lb + ub) / 2
		if x <= a[mid] {
			ub = mid
		} else {
			lb = mid
		}
	}
	return ub
}

func upperBound(a []int, x int) int {
	lb, ub := -1, len(a)
	for ub-lb > 1 {
		mid := (lb + ub) / 2
		if a[mid] <= x {
			lb = mid
		} else {
			ub = mid
		}
	}
	return ub
}

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 5888
N = gets.to_i

ans = 10 ** 5
0.upto(N){|n|
  wk = n.to_s(6).chars.map(&:to_i).inject(:+) + (N-n).to_s(9).chars.map(&:to_i).inject(:+)
  ans = wk if ans > wk
}

puts ans


Measured memory_bytes: 1788
#include "bits/stdc++.h"
using namespace std;
int main(){
    string a, b;
    cin >> a;
    cin >> b;
    if(a.size() < b.size())
    cout << "LESS" << endl;
    else if(a.size() > b.size())
    cout << "GREATER" << endl;
    else{
    if(a < b)
    cout << "LESS" << endl;
    else if(a > b)
    cout << "GREATER" << endl;
    else 
    cout << "EQUAL" << endl;
    }
    return 0; 
}

Measured memory_bytes: 256
x1, x2, x3, x4, x5 = map(int, input().split())

if x1 == 0:
    print(1)
elif x2 == 0:
    print(2)
elif x3 == 0:
    print(3)
elif x4 == 0:
    print(4)
elif x5 == 0:
    print(5)


Measured memory_bytes: 9028
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		
		long input[] = new long[n];
		String[] tmpArray = br.readLine().split(" ");
		for(int i = 0; i < n; i++) {
			input[i] = Long.parseLong(tmpArray[i]);
		}
		
		long result = 0;
		
		long[] bits = new long[128];
		long mask = 1;
		
		for(int i = 0; i < 128; i++) {
			long ones = 0;
			for(int j = 0; j < n; j++) {
				if((mask & input[j]) != 0) {
					ones++;
				}
			}
			
			bits[i] += ones * (n - ones);
			int k = 1;
			long mask2 = 2;
			while(bits[i] > 1) {
				if((bits[i] & mask2) != 0) {
					bits[i + k]++;
					bits[i] -= mask2;
				}
				
				k++;
				mask2 <<= 1;
			}
			
			mask <<= 1;
		}
//		for(int i = 40; i >= 0; i--) {
//			System.out.print(bits[i]+" ");
//		}
//		System.out.println();
		for(int i = 0; i < 128 ; i++) {
			result += bits[i] * (Math.pow(2, i)%1_000_000_007);
		}
		
		System.out.println(result % 1_000_000_007);
		
	}
}


Measured memory_bytes: 95272
#include <bits/stdc++.h>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    int K;
    cin>>K;
    int acc = 0;
    const int MAX = 10000000;
    for (size_t i = 0; i < MAX; i++)
    {
        acc = ((10*acc)%K + 7 % K)%K;
        if(acc==0){
            cout<<i+1<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define mod ((ull)1e9+7)
#define MAX ((ull)1e9)

int main(){
	int h, w;
	cin >> h >> w;
	char a[h][w];
	ull d[h][w];
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			cin >> a[i][j];
			d[i][j]=0;
		}
	}

	d[0][0]=1;
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if(i>0) d[i][j]+=d[i-1][j];
			if(j>0) d[i][j]+=d[i][j-1];
			if(a[i][j]=='#') d[i][j]=0;
			d[i][j]%=mod;
		}
	}

	cout << d[h-1][w-1] << endl;
	return 0;
}

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

using namespace std;
using ll = long long;

int main()
{
  string S; cin >> S;
  int ans = 0;
  for (int i = 1; i < S.size(); ++i) {
    if (S[i-1] == S[i]) {
      ans++;
      S[i] = (S[i-1] == '0' ? '1' : '0');
    }
  }

  cout << ans << endl;
}

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

using namespace std;

typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int, int> tupl;
typedef pair<int, pair<int, int>> tripl;

int main() {
    int coin; scanf("%i", &coin);
    int happiness = 0;
    map<int,int> coinsValues = {{500,1000}, {5,5}};
    while (coin >= 0) {
        if (coin - 500 >= 0) {
            coin -= 500;
            happiness += 1000;
        } else if (coin - 5 >= 0) {
            coin -= 5;
            happiness += 5;
        } else {
            break;
        }
    }

    printf("%i", happiness);
}


Measured memory_bytes: 256
import sys
import numpy as np

N=int(input())
A=np.arange(N+1)
count = 0

for i in range(N+1):
    if A[i]%3 != 0 and A[i]%5 != 0 and A[i]%15 != 0:
        count = count + A[i]
print(count)


Measured memory_bytes: 34608
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/operators.hpp>
#include <boost/dynamic_bitset.hpp>

namespace adaptor = boost::adaptors;
using index_t = std::size_t;

void Main()
{
	int H, W;
	std::cin >> H >> W;
	int max = 0;
	boost::multi_array<bool, 2> maze(boost::extents[H + 2][W + 2]);
	for (auto i : boost::irange(1, H + 1))
	{
		for (auto j : boost::irange(1, W + 1))
		{
			char c;
			std::cin >> c;
			maze[i][j] = c == '.';
		}
	}
	for (auto i : boost::irange(1, H + 1))
	{
		for (auto j : boost::irange(1, W + 1))
		{
			if (!maze[i][j])
			{
				continue;
			}
			std::queue<std::tuple<int, int, int>> queue;
			boost::multi_array<bool, 2> flag(boost::extents[H + 2][W + 2]);
			queue.emplace(i, j, 0);
			while (queue.size())
			{
				int x, y, d;
				std::tie(x, y, d) = queue.front();
				queue.pop();
				if (flag[x][y])
				{
					continue;
				}
				flag[x][y] = true;
				max = std::max(max, d);
				if (maze[x + 1][y])
				{
					queue.emplace(x + 1, y, d + 1);
				}
				if (maze[x - 1][y])
				{
					queue.emplace(x - 1, y, d + 1);
				}
				if (maze[x][y + 1])
				{
					queue.emplace(x, y + 1, d + 1);
				}
				if (maze[x][y - 1])
				{
					queue.emplace(x, y - 1, d + 1);
				}
			}
		}
	}
	std::cout << max << std::endl;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007
#define all(n) (n).begin(),(n).end()
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}

int main(){
	ll n;
	cin >> n;
	ll a[110][110];
	FOR(i,110)a[0][i]=0;
	for(int i=1;i<=n;i++){
		FOR(j,110)a[i][j]=a[i-1][j];
		int num=i;
		for(int j=2;j*j<=i;j++){
			while(num%j==0){
				num/=j;
				a[i][j]++;
			}
		}
		a[i][num]++;
	}
	ll ans=0;
	ll c5=0,c3=0,c15=0,c25=0;
	for(int i=2;i<=110;i++){
		if(a[n][i]>=74)ans++;
		if(a[n][i]>=2)c3++;
		if(a[n][i]>=4)c5++;
		if(a[n][i]>=14)c15++;
		if(a[n][i]>=24)c25++;
	}
	ans+=max(c15*(c5-1),0ll);
	ans+=max(c25*(c3-1),0ll);
	ans+=max(c5*(c5-1)*(c3-2)/2,0ll);

	cout << ans << endl;
	

}

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

#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

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

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


Measured memory_bytes: 3596
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int n,k,q;
int a[112000];
int main()
{
	int t;
	cin>>n>>k>>q;
	for(int i=1;i<=n;i++)
	a[i]=k;
	for(int i=1;i<=q;i++)
	{
		cin>>t;
		a[t]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(a[i]-q>0) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}

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

int main(){
	while(1){
		int n;
		scanf(" %d", &n);
		if(n==0) break;
		
		long num[10000];
		int ct=0;
		
		for(int i=1; i<n; ++i){
			long p=(i*i)%n;	
			
			bool newin=true;
			for(int j=0; j<ct; ++j){
				if(num[j]==p){
					newin=false;
					break;
				}
			}
			if(newin) num[ct++]=p;
		}
		
		int count[5000];
		for(int i=0; i<5000; ++i) count[i]=0;
		
		for(int i=0; i<ct; ++i){
			for(int j=0; j<ct; ++j){	
				long tmp=num[i]-num[j];
				if(tmp<0) tmp+=n;
				if(tmp>(n-1)/2) tmp=n-tmp;
				
				count[tmp]++;
			}
		}
	
		for(int i=1; i<=(n-1)/2; ++i) printf("%d\n", count[i]);
	}
}

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

using namespace std;
//using ll = long long;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if((c > a && c<b)||(c < a && c > b)){
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
}

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

bool compared(string s, string t){
	FOR(i,t.length()) if(t[i]!=s[i] && t[i]!='?') return false;
	return true;
}

int main(){
	string s,t;
	cin >> s >> t;
	//bool flag=false;
	string ans;
	vi v;
	string ans1;
	int i;
	for(i=s.length()-t.length();i>=0;i--){
		if(compared(t,s.substr(i,t.length()))){
			v.PB(i);
		}
	}
	if(!v.empty()){
		for(auto i: v){
			ans1="";
			for(int k=0; k<i;k++) { 
				if(s[k]=='?')ans1+="a";
				else ans1+=s[k];
			}
			ans1=ans1+t;
			int k=i+t.length();
			while(k<s.length()){
				if(s[k]=='?')ans1+="a";
				else ans1+=s[k];
				k++;
			}
			//cout << ans1<<"\n";
			ans=(ans.length()==0)?ans1: min(ans,ans1);
		} 
		cout << ans;
	}
	else cout << "UNRESTORABLE";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin >> A >> B;
  if((A%3==0)||(B%3==0)||((A+B)%3==0)){
    cout << "Possible" << endl;
  }
  else{
    cout << "Impossible" << endl;
  }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

from queue import Queue

def main():
     h, w = map(int, input().split())
     maze = list()
     ans = -1

     for i in range(h):
          maze.append(list(input()))
     # print(maze)

     for i in range(h):
          for j in range(w):
               ans = max(ans, solver(maze, h, w, i, j))
     
     print(ans)

def solver(maze, h, w, i, j):
     # スタート地点が壁の場合、return
     if maze[i][j] == '#':
          return -1

     # スタート地点が道の場合、探索
     solve = [['inf' for x in range(w)] for y in range(h)]
     check = [[False for x in range(w)] for y in range(h)]
     q = Queue()

     # スタート地点をキューに登録
     solve[i][j] = 0
     q.put((i, j))
     check[i][j] = True

     # スタート地点から探索
     while(not q.empty()):
          # baseを取り出す
          point = q.get()
          # print(point)
          # up:
          if point[0] - 1 >= 0:
               target = (point[0] - 1, point[1])
               if maze[target[0]][target[1]] == '.':
                    solve[target[0]][target[1]] = checker(solve[target[0]][target[1]], solve[point[0]][point[1]] + 1)
                    if not check[target[0]][target[1]]:
                         q.put(target)
                         check[target[0]][target[1]] = True

          # down
          if point[0] + 1 < h:
               target = (point[0] + 1, point[1])
               if maze[target[0]][target[1]] == '.':
                    solve[target[0]][target[1]] = checker(solve[target[0]][target[1]], solve[point[0]][point[1]] + 1)
                    if not check[target[0]][target[1]]:
                         q.put(target)
                         check[target[0]][target[1]] = True

          # left
          if point[1] - 1 >= 0:
               target = (point[0], point[1] - 1)
               if maze[target[0]][target[1]] == '.':
                    solve[target[0]][target[1]] = checker(solve[target[0]][target[1]], solve[point[0]][point[1]] + 1)
                    if not check[target[0]][target[1]]:
                         q.put(target)
                         check[target[0]][target[1]] = True

          # right
          if point[1] + 1 < w:
               target = (point[0], point[1] + 1)
               if maze[target[0]][target[1]] == '.':
                    solve[target[0]][target[1]] = checker(solve[target[0]][target[1]], solve[point[0]][point[1]] + 1)
                    if not check[target[0]][target[1]]:
                         q.put(target)
                         check[target[0]][target[1]] = True

     # print(solve)
     # print(check)

     ret = 0
     for i in range(h):
          line = [x for x in solve[i] if type(x) == int]
          if not len(line) == 0:
               ret = max(ret, max(line))

     return ret


def checker(now, new):
     if now == 'inf':
          return new
     else:
          return min(now, new)


if __name__ == "__main__":
    main()


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

#define mp(x, y) make_pair((x), (y))

typedef long long ll;

int n, m;
int e[42][42];
int ans;

int main()
{
	scanf("%d%d", &n, &m);
	for(int i=0; i<m; i++) {
		int u, v;
		scanf("%d%d", &u, &v);
		u--; v--;
		e[u][v]=1;
		e[v][u]=1;
	}
	vector<int> perm;
	for(int i=0; i<n; i++) {
		perm.push_back(i);
	}
	do {
		if(perm[0]!=0) continue;
		int ok=1;
		for(int i=1; i<n; i++) {
			if(!e[perm[i-1]][perm[i]]) ok=0;
		}
		ans+=ok;
	} while(next_permutation(perm.begin(), perm.end()));
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 256
loop do
  n = gets.to_i
  break if n == 0

  arr = n.times.map { gets.to_i }

  max = max_n = -100000
  r = 0

  arr.each do |a|
    max_n = [a, max_n].max
    r = [r + a, 0].max
    max = [r, max].max
  end
  puts max_n > 0 ? max : max_n
end

Measured memory_bytes: 8748
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
//#define mp make_pair
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
    #define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;


using ll = long long;

#define int ll


const int N = 2e5+33, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


typedef pair <int, int> pii;        // #include <ext/pb_ds/assoc_container.hpp>
typedef pair <ll, ll> pll;         // #include <ext/pb_ds/tree_policy.hpp>
typedef vector <int> vi;          // #include <ext/rope>
                // #include <ext/rope>
                                 // #include <ext/rope>
bool prime(int n) {             // template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
    for(int i=2;i<=sqrt(n);i++){
        if(n%i==0){return 0;}
    }return 1;}

void solve() {
    ll x;
    cin >> x;
    ll cur = 100 , cnt = 0;
    while(cur < x) {
        cur += cur/100;
        cnt ++;
    }
    cout << cnt;
}
/*
4 3
RLRL

*/

main() {
    ios;
    int tt = 1;
    //cin >> tt;
    while(tt --) {
        solve();
//        brute();
    }
    return 0;
}
/*
++>
+++>
<[<+>-]<
++++++++++++++++++++++++++++++++++++++++++++++++.

500000000000000000000000000000000000000000000000

1 1 2 3 6


*/


Measured memory_bytes: 3668
import java.util.*;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] aArr = new int[n];

        for (int i = 0; i < n; i++) {
            aArr[i] = sc.nextInt();
        }

        long[][][] dp = new long[n + 1][3][2];
        for (long[][] x : dp) {
            for (long[] x2 : x) {
                Arrays.fill(x2, Long.MIN_VALUE);
            }
        }
        dp[1][0][1] = aArr[0];
        dp[1][1][0] = 0;

        // dp[i][j][k] ... i番目までの整数列で、ひとつおきじゃないやつj個、(直前の数を使っていなければk = 0)の最大値
//        debug(dp);
        for (int i = 1; i < n; i++) {
            dp[i + 1][0][1] = dp[i][0][0] + aArr[i];
            dp[i + 1][1][1] = dp[i][1][0] + aArr[i];
            dp[i + 1][2][1] = dp[i][2][0] + aArr[i];
            dp[i + 1][0][0] = dp[i][0][1];
            dp[i + 1][1][0] = Math.max(dp[i][0][0], dp[i][1][1]);
            dp[i + 1][2][0] = Math.max(dp[i][1][0], dp[i][2][1]);
        }

        List<Long> list;
        if (n % 2 == 0) {
            // o x o x o x
            // x o x o x o
            // o x x o x o
            list = Arrays.asList(dp[n][1][1], dp[n][0][0]);
        } else {
            // x o x o x o x
            // o x x x o x o
            // x x o x o x o
            list = Arrays.asList(dp[n][1][0], dp[n][2][1]);

        }
//        debug(list);
        System.out.println(Collections.max(list));
    }


    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 83852
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;


const long long int mod = 1000000007;
const long long int INF = 1e18;


long long int N,M,t[20000];
priority_queue<pll,vector<pll>,greater<pll> >pq;
string S,T;
int main()
{
    cout << fixed << setprecision(18);
    cin>>S;
    for(long long int i=(S.size()-1)/2;i>=1;i--){
        if(S.substr(0,i)==S.substr(i,i)){
            cout<<2*i<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


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

    N = ii()
    A = [0] + il() + [0]
    sm = 0
    for n in range(1, N + 2):
        sm += abs(A[n - 1] - A[n])

    for n in range(1, N + 1):
        print(sm - (abs(A[n] - A[n - 1]) + abs(A[n] - A[n + 1])) + abs(A[n - 1] - A[n + 1]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 20296
while True:
    n, x = map(int, input().split())
    count = 0
    if n == x == 0:
        break
    for i in range(1, n + 1):
        for j in range(i + 1, n + 1):
            for k in range(j + 1, n + 1):
                if i + j + k == x:
                    count += 1
    print(count)



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

int H,N,ans;
char t[4][4][30];
char u[4][4][30];
char v[4][4][30];
char p[3][2][2][2];

void init(){
  for(int i=0;i<4;i++)
    for(int j=0;j<4;j++)
      for(int k=0;k<30;k++){
        t[i][j][k]='.';
        if(i==0||j==0||k==29)t[i][j][k]='#';
        if(i==3||j==3)t[i][j][k]='#';
      }
}

bool check(int id,int x,int y,int z){
  if(z==29)return false;
  for(int i=0;i<2;i++){
    for(int j=0;j<2;j++){
      for(int k=0;k<2;k++){
        if(p[id][i][j][k]=='#'&&
           t[x+i][y+j][z+k]=='#')return false;
      }
    }
  }
  return true;
}

int dx[3],dy[3];

void solve(){
  for(int i=0;i<4;i++)
    for(int j=0;j<4;j++)
      for(int k=0;k<30;k++)
        t[i][j][k]=v[i][j][k];
  
  int cnt=0;
  for(int T=0;T<N;T++){
    if(!check(T,dx[T],dy[T],0))return;
    int H=0;
    while( check(T,dx[T],dy[T],H+1) )H++;
      
    for(int i=0;i<2;i++)
      for(int j=0;j<2;j++)
        for(int k=0;k<2;k++)
          if(p[T][i][j][k]=='#'){
            assert(t[dx[T]+i][dy[T]+j][H+k]=='.');
            t[dx[T]+i][dy[T]+j][H+k]=p[T][i][j][k];
          }
    
    for(int i=0;i<4;i++)
      for(int j=0;j<4;j++)
        for(int k=0;k<30;k++)
          u[i][j][k]=t[i][j][k];

    init();
    
    int C=28;
    for(int k=28;k>=0;k--){
      int count=0;
      for(int i=1;i<=2;i++)
        for(int j=1;j<=2;j++)
          if(u[i][j][k]=='#')count++;
      if(count==4){
        cnt++;
        continue;
      }
      for(int i=1;i<=2;i++)
        for(int j=1;j<=2;j++)
          t[i][j][C]=u[i][j][k];
      C--;
    }
  }

  ans=max(ans,cnt);

}

void dfs(int cnt){
  if(cnt==N){
    solve();
  }else{
    for(int i=0;i<3;i++){
      for(int j=0;j<3;j++){
        dx[cnt]=i;
        dy[cnt]=j;
        dfs(cnt+1);
      }
    }
  }
}

int main(){
  while(1){
    cin>>H>>N;
    if(H==0&&N==0)break;
    init();
    for(int k=28;k>28-H;k--)
      for(int i=1;i<=2;i++)
        for(int j=1;j<=2;j++)
          cin>>t[i][j][k];

    for(int a=0;a<N;a++){
      for(int k=0;k<2;k++)
        for(int i=0;i<2;i++)
          for(int j=0;j<2;j++)
            cin>>p[a][i][j][1-k];
    }
    for(int i=0;i<4;i++)
      for(int j=0;j<4;j++)
        for(int k=0;k<30;k++)
          v[i][j][k]=t[i][j][k];
    ans=0;
    dfs(0);
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

int main() {
  int x;
  cin>>x;
  cout<<x/500*1000+(x%500)/5*5<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<algorithm>
using namespace std;
#define int long long
#define rep(i,n) for(int i = 0; i < n; i++)
#define INF (long long)(1e18)
#define MOD (int)(1e9+7)
#define min(a,b) (a>b?b:a)
#define max(a,b) (a>b?a:b)
#define yn(f) (f?"Yes":"No")
#define YN(f) (f?"YES":"NO")
#define pro "はいプロ　世界一○○が上手　○○界のtourist　○○時代の終焉を告げる者　実質○○　○○するために生まれてきた男"
#define Answer_to_the_Ultimate_Question_of_Life_the_Universe_and_Everything 42

signed main(){
	cout<<fixed<<setprecision(7);
	
	int N, M, time;
	
	cin>>N>>M;
	
	time = (M*1900+100*(N-M) )* pow(2,M);
	
	cout<<time<<endl;	
	
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int f[10000005],sum;
signed main() {
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		for(int j=1;i*j<=n;j++){
			f[i*j]++;
		}
	}
	for(int i=1;i<=n;i++){
		sum+=i*f[i];
	}
	cout<<sum;
	return 0;
}


Measured memory_bytes: 81708
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,c=0,n,j,p=0;
    cin>>n;
    string a;
    set<string>x;
    for(i=0; i<n; i++)
    {
        cin>>a;
        x.insert(a);
    }
    cout<<x.size()<<endl;
}


Measured memory_bytes: 19044
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func init() {
	sc.Split(bufio.ScanWords)
}

func upperBound(a []int, x int) int {
	return sort.Search(len(a), func(i int) bool { return a[i] > x })
}

func lowerBound(a []int, x int) int {
	return sort.Search(len(a), func(i int) bool { return a[i] >= x })
}

func main() {
	n := scanInt()
	A := make([]int, n)
	for i := range A {
		A[i] = scanInt()
	}

	B := make([]int, n)
	for i := range B {
		B[i] = scanInt()
	}

	C := make([]int, n)
	for i := range C {
		C[i] = scanInt()
	}

	sort.Ints(A)
	sort.Ints(C)

	total := 0
	for _, b := range B {
		cntA := lowerBound(A, b)
		cntC := n - upperBound(C, b)
		total += cntA * cntC
	}
	fmt.Println(total)
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> vec;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        vec.push_back(a);
    }

    int count;
    while (true)
    {
        for (int i = 0; i < vec.size(); i++)
        {
            if (vec[i] % 2 == 0)
            {
                vec[i] = vec[i] / 2;
            }
            else
            {
                cout << count << endl;
                exit(0);
            }
        }
        count++;
    }

    cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn = 300010;
const int maxm = 800010;
const int inf  = 0x3f3f3f3f;

int n,m,tol,head[maxn];
struct edge
{
    int to,cost,next;
}es[maxm];

void addedge( int u , int v , int w )
{
    es[tol].to = v;
    es[tol].cost = w;
    es[tol].next = head[u];
    head[u] = tol++;
}

struct mess
{
    int from,to,cost;
    friend bool operator<( const mess&a , const mess&b )
    {
        return a.cost<b.cost;
    }
}data[maxm>>2];

int dis[maxn],vis[maxn],used[maxm>>3],pre[maxm>>3],id[maxm>>3],sizes;

int Find( int x )
{
    if ( x!=pre[x] )
        pre[x] = Find( pre[x] );
    return pre[x];
}

void Build( int l , int r )
{
    for ( int i=l ; i<=r ; i++ )
    {
        int u = data[i].from;
        int v = data[i].to;
        used[u] = used[v] = 0;
        pre[u] = u,pre[v] = v;
        id[u] = id[v] = -1;
    }
    for ( int i=l ; i<=r ; i++ )
    {
        int u = data[i].from;
        int v = data[i].to;
        int fx = Find(u);
        int fy = Find(v);
        if ( fx!=fy )
            pre[fy] = fx;
    }
    for ( int i=l ; i<=r ; i++ )
    {
        int u = data[i].from;
        int v = data[i].to;
        int fx = Find( u );
        int fy = Find( v );
        if ( !used[u] )
        {
            if ( id[fx]==-1 )
                id[fx] = ++sizes;
            addedge( u , id[fx] , 1 );
            addedge( id[fx] , u , 1 );
        }
        if ( !used[v] )
        {
            if ( id[fy]==-1 )
                id[fy] = ++sizes;
            addedge( v , id[fy] , 1 );
            addedge( id[fy] , v , 1 );
        }
    }
}

struct node
{
    int pos,dis;
    friend bool operator<( const node&a , const node&b )
    {
        return a.dis>b.dis;
    }
};

void dijkstra()
{
    priority_queue<node>Q;
    node p;
    p.pos = 1;
    p.dis = 0;
    Q.push(p);
    for ( int i=1 ; i<=sizes ; i++ )
        dis[i] = inf,vis[i] = 0;
    dis[1] = 0;
    while ( !Q.empty() )
    {
        p = Q.top();
        Q.pop();
        int u = p.pos;
        if ( vis[u] )
            continue;
        vis[u] = 1;
        for ( int i=head[u] ; i!=-1 ; i=es[i].next )
        {
            int v = es[i].to,w = es[i].cost;
            if ( dis[v]>dis[u]+w )
            {
                dis[v] = dis[u]+w;
                p.pos = v;
                p.dis = dis[v];
                Q.push(p);
            }
        }
    }
}

int main()
{
    for ( ; scanf ( "%d%d" , &n , &m )==2 ; )
    {
        for ( int i=1 ; i<=m ; i++ )
            scanf ( "%d%d%d" , &data[i].from , &data[i].to , &data[i].cost );
        sort ( data+1 , data+m+1 );
        tol = 0;
        sizes = n;
        memset ( head , -1 , sizeof(head) );
        for ( int i=1 ; i<=m ; i++ )
        {
            int l=i,r=i;
            while ( r+1<=m&&data[r+1].cost==data[l].cost )
                r++;
            Build( l , r );
            i = r;
        }
        dijkstra();
        if ( dis[n]==inf )
            dis[n] = -2;
        printf ( "%d\n" , dis[n]>>1 );
    }
    return 0;
}


Measured memory_bytes: 17784
// Author : Siddhant Khare 

#include <bits/stdc++.h>

using namespace std;

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

  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;

  int ans = (h2 * 60 + m2 - k) - (h1 * 60 + m1);
  cout << ans << '\n';

  return 0;
}

Measured memory_bytes: 3668