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

typedef long long ll;
typedef unsigned long long ull;
/*
int main(){
    bool isPrime[55556*5];
    for(int i=1;i<=55555*5;i++){
        isPrime[i] = true;
    }
    isPrime[1] = false;
    for(int i=2;i<=55555*5;i++){
        if(isPrime[i]){
            for(int j=2;j*i<=55555*5;j++) isPrime[i*j] = false;
        }
    }
    set<int> prime;
    for(int i=1;i<=55555*5;i++){
        if(isPrime[i]) prime.insert(i);
    }

    int count = 0;
    for(auto it=prime.begin();it!=prime.end();it++){
        if(*it > 55555) break;
        count++;
    }
    cout << count << endl;

    vector<int> ans;
    unordered_set<int> sum[5];
do{
    ans.clear();
    for(int i=0;i<5;i++) sum[i].clear();
    unsigned int seed = clock();

    for(auto it=prime.begin();;it++){
        int p=*it;
        if(p!=2 && rand_r(&seed)>RAND_MAX/2) continue;
        if(p>55555) break;
        for(int x:sum[4]){
            if(isPrime[x+p]) goto next;
        }
        ans.push_back(p);
        for(int x:sum[3]) sum[4].insert(x+p);
        for(int x:sum[2]) sum[3].insert(x+p);
        for(int x:sum[1]) sum[2].insert(x+p);
        sum[1].insert(p);
next:   ;
    }
}while(ans.size()<55);

    cout << ans.size() << endl;
    count = 0;
    for(int x:ans){
        cout << x << ", ";
        count++;
        if(count>=55) break;
    }
    
    return 0;
}
*/

int main(){
    int ans[]={2, 7, 11, 23, 37, 67, 97, 157, 307, 337, 367, 487, 547, 577, 787, 877, 1297, 1447, 1567, 1657, 1747, 1777, 1867, 1987, 2017, 2287, 2467, 2557, 2647, 2797, 2857, 2887, 2917, 3067, 3217, 3307, 3457, 3517, 3637, 3697, 3847, 4057, 4177, 4297, 4357, 4447, 4567, 4597, 4657, 4957, 5077, 5107, 5197, 5227, 5347};
    int N;
    cin >> N;
    for(int i=0;i<N;i++){
        cout << ans[i] << " \n"[i==N-1];
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<pair<int, int>> vp(n);
	rep(i, n){
		int a, b;
		cin >> a >> b;
		vp.at(i) = make_pair(b, a);
	}
	sort(vp.begin(), vp.end());
	int now = 0;
	rep(i, n){
		now += vp.at(i).second;
		if(now > vp.at(i).first){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 1920
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:(input())

"""========main code==============="""
t=ii()
a=ll()
a.sort()
ans=a[0]
for i in range(1,t):
    ans=(ans+a[i])/2
print(ans)    

Measured memory_bytes: 38256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] s = sc.next().split("");
        int minPeople = 0;
        for (int i = 1; i < n; i++) {
            if ("E".equals(s[i])) {
                minPeople++;
            }
        }

        int beforeCount = minPeople;
        for (int i = 1; i < n; i++) {
            int count = beforeCount;
            if ("W".equals(s[i - 1])) {
                count++;
            }
            if ("E".equals(s[i])) {
                count--;
            }
            beforeCount = count;
            if (count < minPeople) {
                minPeople = count;
            }
        }
        System.out.println(minPeople);
    }

}


Measured memory_bytes: 55400
#include <iostream>
#include <algorithm>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REP1(i, n) for (int i = 1; i <= n; i++)
using namespace std;
static const int Nil = -1;
static const int Inf = 1 << 30;

int main()
{
    int X,A,B;
    cin >> X >> A >> B;
    cout << (X-A)%B <<endl;
    return 0;
}

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

using namespace std;
typedef long long ll;

int main(void) {
	const ll INF = 1LL << 32;
	int v, e, i, j, k, s, t;
	ll dp[100][100];

	cin >> v >> e;

	for (i = 0;i < v;i++) {
		for (j = 0;j < v;j++) {
			dp[i][j] = INF;

		}
		dp[i][i] = 0;
	}

	for (i = 0;i < e;i++) {
		cin >> s >> t;
		cin >> dp[s][t];
	}

	for (k = 0;k < v;k++) {
		for (i = 0;i < v;i++) {
			if (dp[i][k] == INF)continue;
			for (j = 0;j < v;j++) {
				if (dp[k][j] == INF)continue;
				dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
			}
		}
	}

	for (i = 0;i < v;i++) {
		if (dp[i][i] < 0) {
			cout << "NEGATIVE CYCLE" << endl;
			return 0;
		}
	}

	for (i = 0;i < v;i++) {
		for (j = 0;j < v - 1;j++) {
			if (dp[i][j] == INF) {
				cout << "INF" << " ";
			}
			else {
				cout << dp[i][j] << " ";
			}
		}

		if (dp[i][j] == INF) {
			cout << "INF" << endl;
		}
		else {
			cout << dp[i][j] << endl;
		}
	}

	return 0;
}



Measured memory_bytes: 3176
use proconio::*;
use proconio::marker::*;

fn run() {
    input! {
        n: usize,
        mut k: usize,
        p: [Usize1; n],
        c: [i64; n],
    }
    let mut s = vec![];
    for (p, c) in p.into_iter().zip(c.into_iter()) {
        s.push((p, c, c));
    }
    let mut t = s.clone();
    type T = (usize, i64, i64);
    let mul = |a: &[T], b: &[T]| -> Vec<T> {
        let mut c = vec![(0, std::i64::MIN, std::i64::MIN); n];
        for (c, &(p, q, r)) in c.iter_mut().zip(a.iter()) {
            let (x, y, z) = b[p];
            c.0 = x;
            c.1 = y + q;
            c.2 = std::cmp::max(r, q + z);
        }
        c
    };
    k -= 1;
    while k > 0 {
        if k & 1 == 1 {
            t = mul(&t, &s);
        }
        s = mul(&s, &s);
        k >>= 1;
    }
    let ans = t.into_iter().map(|p| p.2).max().unwrap();
    println!("{}", ans);
}

fn main() {
    run();
}


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

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

int h, w;
string s[10];

vector<string> generate(int sx, int sy, int dir)
{
	int x = sx, y = sy;
	string str = "";
	vector<string> res;
	
	while (true){
		str += s[x][y];
		res.push_back(str);
		x = (x + dx[dir] + h) % h;
		y = (y + dy[dir] + w) % w;
		if (sx == x && sy == y) break;
	}
	
	return res;
}

string solve()
{
	map<string, int> mp;
	
	for (int i = 0; i < h; i++){
		for (int j = 0; j < w; j++){
			for (int d = 0; d < 8; d++){
				vector<string> vs = generate(i, j, d);
				for (auto &s : vs){
					mp[s]++;
				}
			}
		}
	}
	
	string res = "0";
	for (auto &p : mp){
		if (p.second < 2) continue;
		if (res.size() > p.first.size()) continue;
		if (res.size() < p.first.size()){
			res = p.first;
		}
		else res = min(res, p.first);
	}
	
	return res;
}

int main()
{
	while (cin >> h >> w, h){
		for (int i = 0; i < h; i++){
			cin >> s[i];
		}
		cout << solve() << endl;
	}
}

Measured memory_bytes: 35732
//============================================================================
// Name        : ATcoder.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cctype>
#include <string>
#include<algorithm>
using namespace std;
typedef long long ll;
int main() {


	int m;
	cin>>m;
	cout<<48-m<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define F first
#define S second
#define PB push_back
#define MP make_pair

using namespace std;

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m, k;
    cin >> n >> m >> k;
    vector<ll> a(n), b(m);
    vector<ll> sa(n), sb(m);
    cin >> a[0];
    sa[0] = a[0];
    for (int i = 1; i < n; i++)
    {
        cin >> a[i];
        sa[i] = a[i] + sa[i - 1];
    }
    cin >> b[0];
    sb[0] = b[0];
    for (int i = 1; i < m; i++)
    {
        cin >> b[i];
        sb[i] = b[i] + sb[i - 1];
    }
    int ans = 0;
    auto p = lower_bound(sb.begin(), sb.end(), k);
    if (p == sb.end())
    {
        ans = m;
    }
    else
    {
        int len = p - sb.begin();
        if (*p > k)
        {
            ans = len;
        }
        else
        {
            ans = len + 1;
        }
    }
    // cout << "i " << ans << "\n";
    for (int i = 0; i < n; i++)
    {
        ll rem = k - sa[i];
        if (rem < 0)
        {
            break;
        }
        auto pos = lower_bound(sb.begin(), sb.end(), rem);
        if (pos == sb.end())
        {
            ans = max(ans, i + 1 + m);
        }
        else
        {
            if (*pos > rem)
            {
                int len = pos - sb.begin();
                ans = max(ans, i + 1 + len);
            }
            else
            {
                int len = pos - sb.begin();
                ans = max(ans, i + 2 + len);
            }
        }
        // cout << ans << ",";
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 9500
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
    ll n,k;
    cin>>n>>k;
    int co = 0;
    for(;;){
        if(n/k==0){
            co++;
            break;
        }else{
            n = n/k;
            co++;
        }
    }
    cout<<co<<endl;
}

Measured memory_bytes: 256
from sys import stdin


def fetch_one_line():
    return stdin.readline().rstrip()


def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]


def fetch_inputs(times):
    return [fetch_one_line() for _ in range(times)]


def fetch_int_inputs(times):
    return [[int(s) for s in fetch_one_line()] for _ in range(times)]

def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

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

a, b = fetch_int_input()
print(lcm(a, b))




Measured memory_bytes: 38256
#include<stdio.h>
int main(){
  int kazu[3],i,j,esc;
  for(i=0;i<3;i++){
    scanf("%d",&kazu[i]);
  }
  for(i=0;i<3;i++){
    for(j=i+1;j<3;j++){
      if(kazu[i]>kazu[j]){
        esc=kazu[i];
        kazu[i]=kazu[j];
        kazu[j]=esc;
      }
    }
  }
  printf("%d %d %d\n",kazu[0],kazu[1],kazu[2]);
  return 0;
}


Measured memory_bytes: 2140
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<long long> A(n);
    for(int i=0;i<n;i++) cin>>A[i];
    int x=0;
    if(A[0]!=0) x=1;
    for(int i=1;i<n;i++) {
        if(A[i-1]+1<A[i]) x=1;
    }
    long long ans=0;
    for(int i=0;i<n;i++){
        if(A[i]>0) ans++;
    }
    for(int i=1;i<n;i++){
        if(A[i]!=0&&A[i]!=1&&A[i-1]!=A[i]-1) ans=ans+A[i]-1;
    }
    if (x==1) cout<<-1;
    else cout<<ans;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;
#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define F  first
#define S  second
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
#define all(c) c.begin(),c.end()
#define str string
#define edl "\n"
#define add insert
#define cot continue
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;
const double PI = acos(-1);
const ll LINF = LLONG_MAX;

vec q(300001,0);
int main() 
{

 fast();
  

  ll n;
  cin>>n;
  f(i,0,n)
  {
    cin>>q[i];
  }
  ll ma=-1;
  ll q1=q[0];
  ll c=0;
  f(i,1,n)
  {

    if(q[i]<=q1)
    {
      c++;
      q1=q[i];
    }
    else
    {
      q1=q[i];
      ma=max(ma,c);
      c=0;
    }
  }
  ma=max(ma,c);
  cout<<ma;


 
  cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
    return 0;
}
 

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

int main(){
 int n,x,min = 1000000,max = -1000000,i;
 long long sum = 0;

 cin >> n;

 for(i = 0; i < n; i++){
  cin >> x;
  if(x < min)
   min = x;
  if(x > max)
   max = x;
  sum += x;
 }

 cout << min << " " << max << " " << sum << endl;

 return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
#define fastIO std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0)
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
//mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
const int INF = 0x3f3f3f3f;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

const int maxn = 2e5 + 10; 

int main()
{
	//fastIO;
	string s;
	cin >> s;
	if(s[2] == s[3] && s[4] == s[5]) puts("Yes");
	else puts("No");	
	return 0;
}

Measured memory_bytes: 256
# Algorithms and Data Structures 1
# Fibonacci Numbers
# Name: Ryuya Asada
# ID: s1260064


def fibonacci(n) -> int:
    a = 0
    b = 1
    c = 0
    for i in range(1, n+1):
        c = a + b
        a = b
        b = c
    
    return c


def main():
    n = int(input())
    print(fibonacci(n))
    pass


if __name__ == "__main__":
    main()



Measured memory_bytes: 5596
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());
            long[] s = ReadLine().Split(' ').Select(long.Parse).ToArray();

            long tmp = Gcd(s[0], s[1]);
            for (int i = 2; i < n; i++)
            {
                tmp = Gcd(tmp, s[i]);
            }
            WriteLine(tmp);
        }

        static long Gcd(long a, long b)
        {
            var v = new[] { a, b };
            while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
            return v[0];
        }
    }
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;     //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;        //大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


int INF = 1e9;
int NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
double EPS = 1e-9;
double PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}
//-----------------------------------------

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

    ll h, w, d;
    cin >> h >> w >> d;
    vpll pai(h*w);
    REP(i,h){
        REP(j,w){
            ll a;
            cin >> a;
            a--;
            pai[a] = MP(i,j);
        }
    }
    vvll sum(d,vll(1,0));
    for(ll i=0;i<d;i++){
        ll cnt = 0;
        for(ll j=i;j<=h*w-1-d;j+=d){
            ll ax = pai[j].FI;
            ll ay = pai[j].SE;
            ll bx = pai[j+d].FI;
            ll by = pai[j+d].SE;
            sum[i].PB(sum[i][cnt]+abs(ax-bx)+abs(ay-by));
            cnt++;
        }
    }
    ll q;
    cin >> q;
    REP(i,q){
        ll l, r;
        cin >> l >> r;
        l--;
        r--;
        ll k = l%d;
        l /= d;
        r /= d;
        cout << sum[k][r] - sum[k][l] <<endl;
    }




    
    return 0;
}



Measured memory_bytes: 9336
import itertools
import sys
a,b,c,d = map(int,input())
#print(a,b,c,d)
ll = list(itertools.product([0,1], repeat=3))
#[(0, 0, 0), (0, 0, 1), (0, 1, 0), (0, 1, 1), (1, 0, 0), (1, 0, 1), (1, 1, 0), (1, 1, 1)]
for l in ll:
    tmp = a
    tmp_st = str(a)
    for i,num in enumerate(l):
        if num == 0:
            if i == 0:
                tmp -= b
                tmp_st += '-' + str(b)
            elif i == 1:
                tmp -= c
                tmp_st += '-' + str(c)
            else:
                tmp -= d
                tmp_st += '-' + str(d)
        if num == 1:
            if i == 0:
                tmp += b
                tmp_st += '+' + str(b)
            elif i == 1:
                tmp += c
                tmp_st += '+' + str(c)
            else:
                tmp += d
                tmp_st += '+' + str(d)
    if tmp == 7:
        tmp_st += '=7'
        print(tmp_st)
        sys.exit()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

struct mint {
    const int mod = 1e9 + 7;
    long long x;
    
    mint (long long x = 0) : x((x % mod + mod) % mod) {
        
    }
    
    mint& operator=(const long long a) {
        x = a % mod;
        return *this;
    }
    
    mint& operator=(const mint a) {
        x = a.x % mod;
        return *this;
    }
    
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    
    mint& operator-=(const mint a) {
        if ((x += (mod - a.x)) >= mod) x -= mod;
        return *this;
    }
    
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    
    mint inv() const {
        return pow(mod - 2);
    }
    
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    int n;
    cin >> n;
    vector<int> c(n);
    rep(i, n) cin >> c[i];
    map<int, int> before;
    vector<mint> dp(n);
    dp[0] = 1;
    before[c[0]] = 0;
    reps(i, 1, n) {
        if (before.count(c[i]) == 0) {
            dp[i] = dp[i - 1];
        }
        else if (before[c[i]] == (i - 1)) {
            dp[i] = dp[i - 1];
        }
        else {
            dp[i] = dp[i - 1] + dp[before[c[i]]];
        }
        before[c[i]] = i;
    }
    cout << dp[n - 1].x << endl;
    return 0;
}


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

using namespace std;

int main() {
    int A, B;
    cin >> A >> B;

    if (A <= 5)
    {
        cout << 0;
    } else if (A <= 12)
    {
        cout << B / 2;
    } else {
        cout << B;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9;
int main() {
	string S, T;
	cin >> S >> T;
	bool flag1;
	bool flag2 = false;
	for (int i = S.size() - T.size(); i >= 0; --i) {
		flag1 = true;
		if (S[i] == '?' || S[i] == T[0]) {
			for (int j = i; j < i + T.size(); ++j) {
				if (S[j] == '?' || S[j] == T[j - i]) {
					continue;
				}
				else {
					flag1 = false;
					break;
				}
			}
			if (flag1) {
				for (int j = i; j < i + T.size(); ++j) {
					S[j] = T[j - i];
				}
				flag2 = true;
				i -= 100;//脱出
			}
		}
	}
	if (flag2) {
		for (int i = 0; i < S.size(); ++i) {
			if (S[i] == '?') {
				S[i] = 'a';
			}
		}
		cout << S << endl;
	}
	else {
		cout << "UNRESTORABLE" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(3*n);
  rep(i, 3*n) cin >> a.at(i);
  priority_queue<int> q;
  vector<ll> fr(n+1);
  ll frs = 0;
  rep(i, n){
    q.push(a.at(i)*-1);
    frs += a.at(i);
  }
  fr.at(0) = frs;
  rep2(i, n, n*2){
    q.push(a.at(i)*-1);
    frs += a.at(i);
    int mn = q.top();
    q.pop();
    frs += mn;
    fr.at(i-n+1) = frs;
  }

  q = priority_queue<int>();
  vector<ll> re(n+1);
  ll res = 0;
  rrep2(i, 2*n, 3*n){
    q.push(a.at(i));
    res += a.at(i);
  }
  re.at(n) = res;
  rrep2(i, n, 2*n){
    q.push(a.at(i));
    res += a.at(i);
    int mx = q.top();
    q.pop();
    res -= mx;
    re.at(i-n) = res;
  }

  ll ans = -1e18;
  rep(i, n+1){
    ll add = fr.at(i) - re.at(i);
    ans = max(ans, add);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6784
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
x = 0
a,b = map(int, input().split())

if a == 0 or a == 1:
    pass
else:
    x += combinations_count(a,2)
if b == 0 or b == 1:
    pass
else:
    x += combinations_count(b,2)
print(x)

Measured memory_bytes: 3060
x,X,y,Y;main(i,a,b,c){for(;~scanf("%d%d%d",&a,&b,&c);)--i?c-1||(x=x<a?a:x),c-2||(X=X<a?X:a),c-3||(y=y<b?b:y),c-4||(Y=Y<b?Y:b):(X=a,Y=b);printf("%.f",fdim(X,x)*fdim(Y,y));}

Measured memory_bytes: 128
N = int(input())
S = input()

# 変更後は (0個以上の.)+(0個以上の#) という形になっていればよい。
# ###～###から始めて、.##～###、..#～###、、、...～...までのすべてのパターンについて
# そうなるために変更する必要のある石の個数をカウントし、その最小値を求める。
ans = S.count('.')
tmp = ans
for i in range(N):
  if S[i] == '.':
    tmp -= 1
  else:
    tmp += 1
  ans = min(ans,tmp)
print(ans)

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

int N, A[2000005], M[2000005], C[2000005];
string s;

void init(){
  
  for(int i=0;i<N;i++){
    if( s[i] == 'M' ) M[i] = 1;
    if( s[i] == 'C' ) C[i] = 1;
  }
  
  for(int i=1;i<N;i++){
    M[i] += M[i-1];
    C[i] += C[i-1];
  }
  
  int sum = 0;
  
  for(int i=N-1;i>=0;i--){
    
    if( s[i] == 'C' ) sum++;
    
    if( s[i] == 'M' ) A[i] = sum;
    
  }
  
  for(int i=N-2;i>=0;i--) A[i] += A[i+1];
  
}

int getM(int l, int r){
  
  if( l >= N ) return 0;
  
  if( r >= N ) r = N-1;
    
  int res = M[r];
  
  if( l ) res -= M[l-1];

  return res;
}

int getC(int l, int r){
  
  if( l >= N ) return 0;
  
  if( r >= N ) r = N-1;
  
  int res = C[r];
  
  if( l ) res -= C[l-1];
  
  return res;
}

signed main(){
  
  cin>>N;
  
  cin>>s;
  
  init();
  
  int q;
  cin>>q;

  while(q--){
    
    int k;
    cin>>k;
    
    int sum = 0;
    
    for(int i=0;i<N;i++){
      
      if( s[i] == 'D'){
	
	int cal = A[i] - A[i+k];
	
	cal -= getM( i, i + k - 1 ) * getC( i + k, N - 1 );
	
	sum += cal;
	
      }
      
    }
    
    cout<<sum<<endl;
    
  }
  
  return 0;
}


Measured memory_bytes: 29956
#include <stdio.h>
#define INF 1000000
#define SIZE 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int G[SIZE][SIZE];
int dis[SIZE];
int n;

int min(int a, int b){

  return (a>b ? b : a);
}

void dijkstra(int u){
  int mincost,i,j;
  int color[SIZE];

  for(i=0; i<n; i++){
    dis[i] = INF;
    color[i] = WHITE;
  }

  dis[u] = 0;
  color[u] = GRAY;

  while(1){
    int ver = -1;
    mincost = INF;

    for(i=0; i<n; i++){
      if(color[i] == GRAY && dis[i] < mincost){
        mincost = dis[i];
        ver = i;
      }
    }

    if(ver == -1) break;

    color[ver] = BLACK;

    for(i=0; i<n; i++){

      if(color[i] != BLACK && G[ver][i] < INF){
        color[i] = GRAY;
        dis[i] = min(dis[i],dis[ver]+G[ver][i]);
      }
      
    }

    
  }
  
}

int main(){
  int i,j;
  scanf("%d",&n);

  for(i=0; i<n; i++){
    for(j=0; j<n; j++){
      G[i][j] = INF;
    }
  }

  for(i=0; i<n; i++){
    int u,k;
    scanf("%d %d",&u,&k);

    for(j=0; j<k; j++){
      int v,c;
      scanf("%d %d",&v,&c);
      G[u][v] = c;
    }
  }

  dijkstra(0);

  for(i=0; i<n; i++){
    printf("%d %d\n",i,dis[i]);
  }

  

  return 0;
  
}



Measured memory_bytes: 2112
import sys
input = sys.stdin.readline
import math


def read():
    N, K = map(int, input().strip().split())
    A = list(map(int, input().strip().split()))
    return N, K, A


def solve(N, K, A):
    d = [0 for i in range(N+1)]

    for k in range(K):
        for i in range(N):
            d[i] = 0
        
        for i in range(N):
            l = max(0, i-A[i])
            r = min(N, i+1+A[i])
            d[l] += 1
            d[r] -= 1
        
        terminate = True
        v = 0
        for i in range(N):
            v += d[i]
            A[i] = v
            if terminate and A[i] < N:
                terminate = False
        if terminate:
            break         
    print(*[a for a in A])


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


Measured memory_bytes: 115084
import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    val list = mutableListOf<Int>()
    for (i in 0 until n) {
        list.add(scanner.nextInt())
    }

    val m = scanner.nextInt()
    val pxList = mutableListOf<Pair<Int, Int>>()
    for (i in 0 until m) {
        pxList.add(scanner.nextInt() to scanner.nextInt())

    }

    pxList.forEach { pair ->
        var basevalue = 0
        list.forEachIndexed { index, value ->
            if (index + 1 == pair.first) {
                basevalue = list[index]
                list[index] = pair.second
            }
        }
        println(list.sum())
        list[pair.first -1] = basevalue
    }
}



Measured memory_bytes: 29604
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <map>
#include <queue>
#define rep(i,n) for (int i=0;i<(n);i++)

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0;i < n;i++) {
		cin >> a[i];
	}
	long long ans = 0;
	map<int, int> m{};
	for (int i = 0;i < n;i++) {
		if (i - a[i] > 0)ans += m[i - a[i] + 1];
		m[a[i] + i + 1]++;
	}

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


Measured memory_bytes: 14196
#include<stdio.h>
int main()
{
    int a,b;
    int sum = 0;
    char s[101];
    // 整数の入力
    scanf("%d", &a);
    scanf("%d", &b);
    // スペース区切りの整数の入力
//    scanf("%d %d",&b,&c);
    // 文字列の入力
//    scanf("%s",s);

    if ( a > b) {
        sum = a;
        a--;
    }
    else {
        sum = b;
        b--;
    }

    if ( a > b) {
        sum += a;
        a--;
    }
    else {
        sum += b;
        b--;
    }

    // 出力
    printf("%d\n", sum);
//    printf("%d %s\n",a+b+c,s);
    return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    cout << fixed << setprecision(10);

    int w, h; cin >> w >> h;
    
    while (w != 0 && h != 0) {
        vector<vector<int>> hrzd(h, vector<int>(w-1)), vtcd(h-1, vector<int>(w));
        rep(i, h*2-1) {
            if (i % 2 == 0) {
                rep(j, w-1) cin >> hrzd[i/2][j];
                // cout << "hrzd; " << i << endl; 
            } else {
                rep(j, w) cin >> vtcd[i/2][j];
                // cout << "vtcd; " << i << endl;
            }
        }
        queue<P> q;
        q.emplace(make_pair(0, 0));
        vector<vector<int>> dl(h, vector<int>(w));
        dl[0][0] = 1;

        while(!q.empty()) {
            P pp = q.front(); q.pop();
            int nh, nw;
            // 横方向の移動
            // 右に動く場合
            nh = pp.first, nw = pp.second + 1;
            if (nh >= 0 && nw >= 0 && nh < h && nw < w && hrzd[nh][nw-1] == 0 && dl[nh][nw] == 0) {
                q.emplace(make_pair(nh, nw));
                dl[nh][nw] = dl[pp.first][pp.second] + 1;
            }

            // 左に動く場合
            nh = pp.first, nw = pp.second - 1;
            if (nh >= 0 && nw >= 0 && nh < h && nw < w && hrzd[nh][nw] == 0 && dl[nh][nw] == 0) {
                q.emplace(make_pair(nh, nw));
                dl[nh][nw] = dl[pp.first][pp.second] + 1;
            }

            // 上に動く場合
            nh = pp.first - 1, nw = pp.second;
            if (nh >= 0 && nw >= 0 && nh < h && nw < w && vtcd[nh][nw] == 0 && dl[nh][nw] == 0) {
                q.emplace(make_pair(nh, nw));
                dl[nh][nw] = dl[pp.first][pp.second] + 1;
            }

            // 下に動く場合
            nh = pp.first + 1, nw = pp.second;
            if (nh >= 0 && nw >= 0 && nh < h && nw < w && vtcd[nh-1][nw] == 0 && dl[nh][nw] == 0) {
                q.emplace(make_pair(nh, nw));
                dl[nh][nw] = dl[pp.first][pp.second] + 1;
            }
        }
        cout << dl[h-1][w-1] << endl;

        cin >> w >> h;
    }
    return 0;
}


Measured memory_bytes: 3144
#include <cstdio>
#include <cstring>
#define ri register int
const int N=5e5+5;
char s[N]; 
int pnxt[N],snxt[N];
int main(){
	ri n,i,j,ans;
	scanf("%s",s+1);
	n=strlen(s+1);
	for(i=2;i<=n;++i){
		j=pnxt[i-1];
		while(j&&s[j+1]!=s[i]) j=pnxt[j];
		if(s[j+1]==s[i]) pnxt[i]=j+1;
	}
	if(!pnxt[n]||n%(n-pnxt[n])) // 不是循环串
		return puts("1\n1"),0;
	else if(pnxt[n]==n-1) // 所有字母都相等
		return printf("%d\n1\n",n),0; 
	snxt[n]=n+1;
	for(i=n-1;i;--i){
		j=snxt[i+1];
		while(j!=n+1&&s[j-1]!=s[i]) j=snxt[j];
		if(s[j-1]==s[i]) snxt[i]=j-1;
		else snxt[i]=n+1;
	}
	ans=0;
	for(i=1;i^n;++i)
		if((!pnxt[i]||i%(i-pnxt[i]))&&(snxt[i+1]==n+1||(n-i)%(n-i-(n-snxt[i+1]+1)))) ++ans;
	printf("2\n%d\n",ans);
	return 0;
}

Measured memory_bytes: 4608
//============================================================================
// Name        : abc141d.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;

int main() {
	int N, M;
	cin >> N >> M;
	priority_queue<long long> A;
	for (int i = 0; i < N; ++i) {
		long long a;
		scanf("%lld", &a);
		A.push(a);
	}

	for(int i = M; 0 < i; --i){
		long long a;
		a =	A.top();
		A.pop();
		A.push(a / 2);
	}

	long long value = 0;
	for (int i = 0; i < N; ++i) {
		value += A.top();
		A.pop();
	}
	cout << value << endl;

	return 0;
}


Measured memory_bytes: 1400
import java.util.Map.Entry;
import java.io.*;
import java.util.*;

public class Main {
	
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		
		int N = sc.nextInt();
		int min = Integer.MAX_VALUE;
		
		for(int i = 0; i <= N; i++){
			int count = 0;
			int price6 = i;
			int price9 = N - i;
			
			while(true){
				count += price6 % 6;
				price6 /= 6;
				if(price6 == 0) break;
			}
			
			while(true){
				count += price9 % 9;
				price9 /= 9;
				if(price9 == 0) break;
			}
			min = Math.min(min, count);
		}
		System.out.println(min);
	}
}

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}


Measured memory_bytes: 21332
#include <stdio.h>
#include <math.h>


int main(int argc, char const *argv[])
{
    int p;
    scanf("%d", &p);
    int q;
    scanf("%d", &q);
    int r;
    scanf("%d", &r);


    int max = p;

    if (max < q)
        max = q;
    if (max < r)
        max = r;
    
    printf("%d\n", p+q+r - max);
    

    
    return 0;
} 


Measured memory_bytes: 128
package main

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

func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	
	a := make([]int, n, n)
	m1 := 0
	for i := 0; i < n; i++ {
		sc.Scan()
		tmp, _ := strconv.Atoi(sc.Text())
		a[i] = tmp
		if a[i] > m1 {
			m1 = a[i]
		}
	}

	c := 0
	m2 := 0
	for i := 0; i < n; i++ {
		if a[i] == m1 {
			c++
		}
		if a[i] > m2 && a[i] < m1 {
			m2 = a[i]
		}
	}

	for i := 0; i < n; i++ {
		if a[i] == m1 && c == 1 {
			fmt.Println(m2)
		} else {
			fmt.Println(m1)
		}
	}
}

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

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

    int ans = t / a;
    ans *= b;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main(int argc, char const* argv[])
{
	int h,w;
	std::cin >> h >> w;
	while (!(h==0&&h==w)) {
		for (int i = 0; i < h; i++) {
			for (int i = 0; i < w; i++) {
				std::cout << "#" ;
			}
			std::cout << std::endl;
		}
		std::cout << std::endl;
		std::cin >> h >> w;
	}

	return 0;
}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  string ans;
  if (n == 0) ans = "0";
  while (true) {
    if (n == 0) break;
    int t = 0;
    t = n % -2;
    n /= -2;
    if (t == -1) {
      n++;
      t = 1;
    }
    if (t) {
      ans += "1";
    } else {
      ans += "0";
    }
  }
  //cout << 1 / -2 << endl;
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}

Measured memory_bytes: 256
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    n = kwargs["n"]
    d = kwargs["d"]
    X = kwargs["X"]
    Y = kwargs["Y"]
    res = 0
    for i in range(n):
        if X[i] ** 2 + Y[i] ** 2 <= d ** 2:
            res += 1
    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    kwargs["n"], kwargs["d"] = [int(i) for i in cin]

    kwargs["X"] = []
    kwargs["Y"] = []
    for i in range(kwargs["n"]):
        cin = input().split()
        x, y = [int(i) for i in cin]
        kwargs["X"].append(x)
        kwargs["Y"].append(y)

    cout = main(kwargs)
    print(cout)

Measured memory_bytes: 46664
n=int(input())
mod=10**9+7

#内包表記の時は小さい成分から作っていく（新しい次元から）ls[i][j][k]←ココ
dp=[[[[0 for i in range(4)] for j in range(4)] for k in range(4)] for l in range(n+1)]

dp[0][3][3][3]=1

#後ろから3文字を見るからn-3文字が最大
#forを回す時は一番新しい次元から作っていくls[i][j][k]←ココ
for length in range(n):
  for c1 in range(4):
    for c2 in range(4):
      for c3 in range(4):
        if dp[length][c1][c2][c3]==0: #もともと0なら打ち切り
          continue
        for a in range(4):
          if a==2 and c1==1 and c2==0:
            continue
          if a==2 and c1==0 and c2==1:
            continue
          if a==1 and c1==2 and c2==0:
            continue
          if a==2 and c1==1 and c3==0:
            continue
          if a==2 and c2==1 and c3==0:
            continue
          dp[length+1][a][c1][c2]+=dp[length][c1][c2][c3]
          dp[length+1][a][c1][c2]%=mod

ans=0
for c1 in range(4):
  for c2 in range(4):
    for c3 in range(4):
       ans+=dp[n][c1][c2][c3]
       ans%=mod
print(ans)

#dpで覚えておくべきindexの話
#①内包表記は先に入れたものが一番小さい箱
#②forを回す時は一番内側のループから値が入る
# a=[[[[0]*1 for i in range(2)] for i in range(3)] for i in range(4)]
# for i in range(4):
#   for j in range(3):
#     for k in range(2):
#       for l in range(1):
#         a[i][j][k][l]=i
#         print(a)




Measured memory_bytes: 3312
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

int main(){
    ll a,b,c,d;cin>>a>>b>>c>>d;
    cout << a*b-(a*d+b*c-c*d) << ednl;
}


Measured memory_bytes: 256
package main

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

var scanner = bufio.NewScanner(os.Stdin)

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

	n, m := nextInt(), nextInt()

	sum := (100*(n-m) + 1900*m) * int(math.Pow(2, float64(m)))
	fmt.Println(sum)
}

func next() string {
	scanner.Scan()
	return scanner.Text()
}
func nextInt() int {
	i, err := strconv.Atoi(next())
	if err != nil {
		fmt.Println(err)
	}
	return i
}


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

int main()
{
    string s;
    cin >> s;
    int n = s.size();

    auto palindrome = [](string t){
        int m = t.size();
        rep(i,(m+1)/2) {
            if(t[i] != t[m-1-i])
                return false;
        }

        return true;
    };
    
    if(!palindrome(s) || !palindrome(s.substr(0, (n-1)/2)) || !palindrome(s.substr((n+3)/2-1)))
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
//#define int ll

const int md = 1000000007;
const int INF = 1<<30;

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

    bool f = false;
    rep(i,a,b+1){
        if(i%k == 0) f = true;
    }
    if(f) cout << "OK" << endl;
    else cout << "NG" << endl;
}


Measured memory_bytes: 3644
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
--import Data.Array
import Data.Array.IArray
--import Data.Array.Unboxed
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
-- import System.IO.Unsafe
 
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnBin :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
fnBin op f g x = op (f x) $ g x
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
modifyArray :: (Ix i, MArray a e m) => a i e -> i -> (e -> e) -> m ()
modifyArray arr ix f = readArray arr ix >>= writeArray arr ix . f
dictCompare :: [a -> a -> Ordering] -> a -> a -> Ordering
dictCompare [] _ _ = EQ
dictCompare (f:fs) x y = let c = f x y in if c==EQ then dictCompare fs x y else c
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
-- end of templete


main = getLine >>= putStrLn . ("2018"++) . drop 4

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

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint=vector<int>;
using vvint=vector<vint>;
using pint=pair<int, int>;
using vpint=vector<pint>;
template<typename T> using priority_queue_rev=priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028L;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T1, typename T2> bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> bool chmin(T1 &a, const T2 &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int Q;
signed main() {
    cin >> Q;
    int m = 0;
    priority_queue<int> left;
    priority_queue_rev<int> right;
    left.push(LLONG_MIN), right.push(LLONG_MAX);
    rep(i, Q) {
        int type;
        cin >> type;
        if (type == 1) {
            int a, b;
            cin >> a >> b;
            if (left.top() <= a && a <= right.top()) {
                left.push(a), right.push(a);
                m += b;
            }
            if (left.top() > a) {
                left.push(a), left.push(a);
                m += left.top() - a + b;
                right.push(left.top());
                left.pop();
            }
            if (a > right.top()) {
                right.push(a), right.push(a), m += a - right.top() + b;
                left.push(right.top());
                right.pop();
            }
        } else {
            cout << left.top() << " " << m << endl;
        }
    }
}


Measured memory_bytes: 4588