akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
// make pair, tuple
// __gcd(int, int)
// bool isPrime(int n){
//       if(n <= 1)return false;
//       if(n <= 3)return true;
//       if(n % 2 == 0 || n % 3 == 0)return false;
//       for(int i = 5;i * i <= n;i += 6){
//             if(n % i == 0 || n % (i + 2) == 0)return false;
//       }
//       return true;
// }
// int countSubString(string s, string temp){
//       int ans = 0;
//       size_t f = s.find(temp);
//       while(f != string::npos){
//             ans++;
//             f = s.find(temp, f + 1);
//       }
//       return ans;
// }

double dist(pair<int, int> p1, pair<int, int> p2){
    return sqrt(pow(p1.first - p2.first, 2) + pow(p1.second - p2.second, 2));
}

int main(){
    int n;cin >> n;
    double ans = 0;
    int arr[n + 5];
    int fac = 0;
    vector<pair<int, int>> vp;
    for(int i = 1;i <= n;i++)arr[i - 1] = i;
    for(int i = 0;i < n;i++){
        int a,b;cin >> a >> b;
        vp.push_back({a, b});
    }
    do{
        fac++;
        pair<int, int> curr = vp[arr[0] - 1];
        for(int i = 1;i < n;i++){
            ans += dist(vp[arr[i] - 1], curr);
            curr = vp[arr[i] - 1];
        }
    }while(next_permutation(arr, arr + n));
    printf("%.10f", ans / fac);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
const int M = 1000000007;

int main() {
    string s;
    cin >> s;
    if (s[0] == '9' || s[1] == '9') {
        cout << "Yes\n";
    }
    else {
        cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 256
while(x,y = gets.split)

a = x.to_i
b = y.to_i

if a == 0 and b == 0
  break
end

if a > b  
    puts"#{b} #{a}"
elsif a < b
    puts"#{a} #{b}"
else 
    puts"#{a} #{b}"
    end
end


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

#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>

int N, M;
int A[100010], B[100010];
vector<pii> V;

signed main()
{
    cin >> N >> M;
    rep(i, N)
    {
        cin >> A[i];
        V.push_back({A[i], 1});
    }
    rep(i, M)
    {
        int b, c;
        cin >> b >> c;
        V.push_back({c, b});
    }

    sort(V.rbegin(), V.rend());

    int ans = 0;
    for(auto ele : V)
    {
        if(ele.second <= N)
        {
            ans += ele.second * ele.first;
            N -= ele.second;
        }
        else
        {
            ans += N * ele.first;
            N = 0;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 8180
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,K;
  cin>>N>>K;
  vector<double>E(N);
  for(int i=0;i<N;i++){
  double p;
    cin>>p;
    double q=(1+p)/2;
    E.at(i)=q;
   }
  
  double Max=0;
  for(int i=0;i<K;i++)
    Max+=E.at(i);
  double ans=Max;
  for(int i=K;i<=N-1;i++){
  Max+=(E.at(i)-E.at(i-K));
    if(ans<=Max)
      ans=Max;
  }
  cout<<fixed<<setprecision(8)<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  lint r,d,x;
  cin>>r>>d>>x;
  REP(i,10){
    x=r*x-d;
    cout<<x<<endl;
  }
  return 0;
}


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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;

const long long INF = 1LL << 60;

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

    vector<ll> X(M), sum(X);
    rep(i, M) cin >> X[i];

    sort(X.begin(), X.end());

    rep(i, M - 1) {
        sum[i] = abs(X[i] - X[i + 1]);
    }

    sort(sum.begin(), sum.end());
    reverse(sum.begin(), sum.end());

    ll ans = 0;
    repd(i, N - 1, M - 1) {
        ans += sum[i];
    }

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

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

int main(){
    string s;
    cin >> s;
    int cnt = 0;
    int move = 1000;
    for(char x = 'a'; x <= 'z'; x++){  //a~zまで総当たり
        string ans = {};
        string k = s;
        cnt = 0;

        for(int i = 0; i < s.size(); i++){ //終了条件の文字を作成
            ans += x;
        }
        if(s == ans){
            cout << 0 << endl;
            return 0;
        }

        while(true){
            if(k == ""){
                cnt = 0;
                break;
            }
            string n = {}; //ここに長さが1減少した文字列を用意
            cnt++; //カウントを＋１
            ans.pop_back(); //終了条件の文字数－１
            for(int i = 0; i < k.size()-1;i++){
                if(k[i] == x || k[i+1] == x){ //対応文字があったら優先
                    n += x;
                }else{ //ほかはそのまま
                    n += k[i];
                }
            }
            //cout << n << endl;
            if(n == ans){
                    move = min(move,cnt);
                    cnt = 0;
                    break;
            }
            k = n;
        }
    }

    cout << move << endl;
    return 0;
}

Measured memory_bytes: 256
x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
sam = []
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ba,bb,bc = 0,0,0
print(a[0] + b[0] + c[0])
used = set()
for K in range(k - 1):
    if ba < x - 1 and (ba + 1,bb,bc) not in used:
        sam.append([a[ba + 1] + b[bb] + c[bc],ba + 1,bb,bc])
        used.add((ba + 1,bb,bc))
    if bb < y - 1 and (ba,bb + 1,bc) not in used:
        sam.append([a[ba] + b[bb + 1] + c[bc],ba,bb + 1,bc])
        used.add((ba,bb + 1,bc))
    if bc < z - 1 and (ba,bb,bc + 1) not in used:
        sam.append([a[ba] + b[bb] + c[bc + 1],ba,bb,bc + 1])
        used.add((ba,bb,bc + 1))
    big = max(sam)
    sam.remove(big)
    print(big[0])
    ba,bb,bc = big[1],big[2],big[3]

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

int main() {
  int n;
  char s[21];
  cin >> s;
  for (n=0;s[n]!=0;n++);
  for (int i=0;i<n;i++) {
    cout << s[n-i-1];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3064
MX = 401

N, Ma, Mb = map(int, input().split())
A = [0]*N
B = [0]*N
C = [0]*N
for i in range(N):
    a, b, c = map(int, input().split())
    A[i] = a
    B[i] = b
    C[i] = c
INF = 10**18
dp = [[[INF]*MX for i in range(MX)] for i in range(N+1)]
dp[0][0][0] = 0
for i in range(1, N+1):
    for j in range(0, MX):
        for k in range(0, MX):
            dp[i][j][k] = dp[i-1][j][k]
            if j < A[i-1] or k < B[i-1]: continue
            dp[i][j][k] = min(dp[i][j][k], dp[i-1][j-A[i-1]][k-B[i-1]]+C[i-1])
ans = INF
for i in range(1, MX):
    if Ma*i > MX-1 or Mb*i > MX-1: break
    ans = min(ans, dp[N][Ma*i][Mb*i])
if ans == INF:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 94428
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] x = new int[n];
        int[] y = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = in.nextInt();
            y[i] = x[i];
        }

        Arrays.sort(y);
        int medLeft = y[n / 2 - 1];
        int medRight = y[n / 2];
        
        for (int i = 0; i < n; i++) {
            if (x[i] <= medLeft) {
                System.out.println(medRight);
            } else {
                System.out.println(medLeft);
            }
        }
    }
}

Measured memory_bytes: 66700
//be naame khodaa

#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <cstdio>
#include <algorithm>
#include <set>
#include <cassert>
#include <iomanip>
#include <cstring>
#include <sstream>
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

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

int in(){ int x; scanf("%d", &x); return x; }

const int maxn = 100 * 1000 + 5;

int a[maxn];
int par[maxn];
vector <int> v[maxn];
vector <int> V;

int find(int x){ return (par[x] < 0 ? x : par[x] = find(par[x])); }

void merge(int x, int y){
	x = find(x), y = find(y);
	if (x == y) return;
	if (par[x] < par[y]) swap(x, y);
	par[y] += par[x];
	par[x] = y;
}

int main()
{
	ios::sync_with_stdio(false);
	int n = in(), m = in();
	for (int i = 0; i < n; i++){
		a[i] = in();
		par[i] = -1;
	}
	for (int i = 0; i < m; i++){
		int x = in(), y = in();
		merge(x, y);
	}
	for (int i = 0; i < n; i++)
		v[find(i)].pb(a[i]);
	ll cur = 0;
	int cnt = 0;
	for (int i = 0; i < n; i++){
		if (v[i].size() == 0) continue;
		sort(v[i].begin(), v[i].end());
		cnt++;
		cur += v[i][0];
		for (int j = 1; j < v[i].size(); j++)
			V.pb(v[i][j]);
	}
	if (cnt == 1){
		cout << 0 << endl;
		return 0;
	}
	if (V.size() < cnt-2)
		return (cout << "Impossible\n"), 0;
	sort(V.begin(), V.end());
	for (int i = 0; i < cnt-2; i++)
		cur += V[i];
	cout << cur << endl;
	return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10

int main() {
	int N, K;
	bool dk[10] = { 0 }; // [0~9] 1:bad 0:safe
	cin >> N >> K;
	for (int i = 0; i < K; i++) {
		int iptin;
		cin >> iptin;
		dk[iptin] = 1;
	}

	string s;
	bool flag = false;
	while (true) {
		flag = false;
		s = to_string(N);
		for (int i = 0; i < s.size(); i++) {
			if (dk[int(s[i]) - 48] == 1) {
				flag = true;
				break;
			}
		}
		if (flag) {
			N++;
		}
		else break;
	}
	cout << N << endl;








	return 0;
}

Measured memory_bytes: 256
N = int(input())

pn=[2];A=1000
for L in range(3,A):
  chk=True
  for L2 in pn:
    if L%L2 == 0:chk=False
  if chk==True:pn.append(L)

mul = [1 for i in range(1001)]
for i in range(1,N+1):
  for j in pn:
    if j > i:
      break
    temp = i
    while True:
      if temp%j == 0:
        temp /= j
        mul[j] += 1
        continue
      else:
        break

ans = 1
for i in range(1001):
  ans *= mul[i]
  
print(ans%(7+10**9))

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Text;


namespace ConsoleApplication7
{
    class Program
    {
        static void Main(string[] args)
        {
            //??\?????????????????????????????????
            string s = Console.ReadLine();

            //??????????????´??°????????°????????????
            int x = int.Parse(s);


            //???????????????????????????????????????
            Console.WriteLine(x * x * x);
           

        }
    }
}

Measured memory_bytes: 5596
import itertools
import pprint

a = int(input())
b = int(input())
c = int(input())
x = int(input())

a_list = [i for i in range(a + 1)]
b_list = [i for i in range(b + 1)]
c_list = [i for i in range(c + 1)]

ans = 0
for a_num, b_num, c_num in itertools.product(a_list, b_list, c_list):
    # print(500 * a_num + 100 * b_num + 50 * c_num)
    if x == 500 * a_num + 100 * b_num + 50 * c_num:
        ans += 1
print(ans)

Measured memory_bytes: 9940
#include<bits/stdc++.h>
using namespace std;
int w[108],n;
long long int dp[105][100008]={0},v[108];
long long int solve(int i, int c)
{
    long long int ans1,ans2;
    //ans1=0;ans2=0;
    if(i==n+1){return 0;}
    if(dp[i][c]!=-1)
    {return dp[i][c];}
    ans1=solve(i+1,c);
    if((c-w[i])>=0){ans2=solve(i+1,c-w[i])+v[i];}
    else{return ans1;}
    dp[i][c]=max(ans1,ans2);
    return max(ans1,ans2);
 
}
int main()
{
    int i,W;
    //long long int a;
    cin>>n>>W;
    for(i=0;i<=101;i++)
        for(int j=0;j<=100004;j++)
            dp[i][j]=-1;
        
    for(i=1;i<=n;i++)
    {
        cin>>w[i]>>v[i];
        //cout<<dp[1][i];
    }
    //a=solve(1,W,N);
    cout<<solve(1,W);
}

Measured memory_bytes: 80128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stdio.h>
#include <string>
#include <ctype.h>

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

using namespace std;
int main() {
	string s1;
	cin >> s1;
	string s2;
	cin >> s2;

	bool okay = false;
	if (s1[0] == s2[2] && s1[1] == s2[1] && s1[2] == s2[0])okay = true;
	if (okay) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}


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

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

  int64_t sum3 = (n/3)*(n/3+1)/2*3;
  int64_t sum5 = (n/5)*(n/5+1)/2*5;
  int64_t sum15 = (n/15)*(n/15+1)/2*15;

  int64_t sum = n*(n+1)/2;

  cout<<sum-sum3-sum5+sum15<<endl;

  return 0;
}

Measured memory_bytes: 3620
#include <iostream>
using namespace std;
int main( void )
{
	double weight;
	while ( cin >> weight )
	{
		if ( weight <= 48.0 )
			cout << "light fly" << endl;
		else if ( weight <= 51.0 )
			cout << "fly" << endl;
		else if ( weight <= 54.0 )
			cout << "bantam" << endl;
		else if ( weight <= 57.0 )
			cout << "feather" << endl;
		else if ( weight <= 60.0 )
			cout << "light" << endl;
		else if ( weight <= 64.0 )
			cout << "light welter" << endl;
		else if ( weight <= 69.0 )
			cout << "welter" << endl;
		else if ( weight <= 75.0 )
			cout << "light middle" << endl;
		else if ( weight <= 81.0 )
			cout << "middle" << endl;
		else if ( weight <= 91.0 )
			cout << "light heavy" << endl;
		else
			cout << "heavy" << endl;
	}
	return 0;
}

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

#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define vll vector<long long>
#define vin(v, n) for (ll i = 0ll; i < n; i++) cin >> v[i];
#define vout(v) for (auto i=v.begin();i!=v.end(); i++) cout << (*i) << " ";cout << nl
#define fill(a,val) memset(a,val,sizeof(a))
#define all(x) x.begin(), x.end()
#define sortall(x) sort(x.begin(), x.end())
#define arrSort(x,n) sort(x,x+n)
#define rarrSort(x,n) sort(x,x+n,greater<ll>())
#define rsortall(x) sort(x.begin(), x.end(),greater<ll>())
#define ll long long
#define ld long double
#define sp " "
#define nl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define maxv(v) *(max_element(v.begin(),v.end()))
#define minv(v) *(min_element(v.begin(),v.end()))
#define prec(n) fixed<<setprecision(n)
#define llsetBits(x) __builtin_popcountll(x)            //counts number of set bits in ll x
#define llcountTz(x) __builtin_ctzll(x)                 //counts trailing zeroes in ll x
#define debug(x) cout << #x << " " << x << "\n"; 
#define debug2(x,y) cout << #x << " " << x << " " << #y << " " << y << "\n";
#define debug3(x,y,z) cout << #x << " " << x << " " << #y << " " << y << " " << #z << " " << z << "\n";
#define PI 3.14159265358979323846264338327950l;

ll gcd(ll a, ll b){if(b==0) return a; return gcd(b,a%b);}
ll lcm(ll a, ll b){return (a*b)/gcd(a,b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
bool isPrime(ll n);

const ll mod = 1e9+7ll;

void solve(ll testCaseNo)
{
	ll n,k;
	cin >> n >> k;
	ll h[n];
	ll dp[n];
	vin(h,n);
	dp[0]=0ll;
	dp[1ll]=abs(h[1]-h[0]);
	for(ll i=2ll;i<n;i++)
	{
		ll temp=INT_MAX;
		for(ll j=1ll;j<=min(i,k);j++)
		{
			temp=min(temp,dp[i-j]+abs(h[i-j]-h[i]));
		}
		dp[i]=temp;
	}
	cout << dp[n-1ll];
}

int main()
{
	fio()
	ll t=1ll;
	//cin >> t;
	ll tTemp=1ll;
	while (tTemp<=t) {solve(tTemp);tTemp++;}
	return 0;
}
bool isPrime(ll n)
{
	for(int i=2;i<=sqrt(n);i++)
	{
		if(n%i==0)
		{
			return false;
		}
	}
	return true;
} 


Measured memory_bytes: 5164
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1 LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)


int main() {
    int N;cin >> N;
    vector<int> d(N);
    rep(i,N)cin >> d[i];

    sort(all(d));
    int ans = 0;
    ans = d[N/2] - d[N/2 - 1];
    cout << ans << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
using namespace std;
int main(){
  int N; cin >> N;
  vector<int>A(N);
  rep(i,N) cin >> A[i];
  sort (A.begin(), A.end());
  A.erase(unique(A.begin(), A.end()), A.end());
  if (A.size() == N) cout << "YES" << endl;
  else cout << "NO" << endl;
}

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

int solve(int n) {
  int cnt=0;
  for(int i=1; i*i<=n; i++) {
    if(n%i==0) {
      int j=n/i;
      if(i!=n) cnt+=i;
      if(j!=n && i!=j) cnt+=j;
    }
  }
  return cnt;
}
 
int main() {
  int n;
  while(cin >> n && n) {
    int c=solve(n);
    if(n==c) cout << "perfect number" << endl;
    else if(c<n) cout << "deficient number" << endl;
    else cout << "abundant number" << endl;
  }
  return 0;
}


Measured memory_bytes: 1156
#include<iostream>
#include<string>
using namespace std;
int main()
{
  string s;
  cin >> s;
  bool b=true;
  for(int i = 0; i < s.length()-1 && b; i++)
  {
    if(s[i]==s[i+1])
    {
      cout << "Bad";
      b=false;
    }
  }
  if(b)
    cout << "Good";
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		int n=N/2;
				
		int	SetO[]=new int [n];
		int SetE[]=new int [n];
				
		for(int i=0;i<n;i++) {
			SetO[i]=sc.nextInt();
			SetE[i]=sc.nextInt();
		}
				
		int [] maxO=new int[4];
		maxO=max(SetO,n);
		int [] maxE=new int[4];
		maxE=max(SetE,n);
				
		if(maxO[0]==maxE[0]) {
			if((n - maxO[1] + n - maxE[3]) < (n - maxE[1] + n - maxO[3])) // 條件是這樣
				System.out.println(n - maxO[1] + n - maxE[3]);
			else
				System.out.println(n - maxO[3] + n - maxE[1]);
		}
		else
			System.out.println(n - maxO[1] + n - maxE[1]);
					
	}
			
			
	public static int[] max (int [] set,int n) {
		int max=0;
		int maxv=0;
		int maxS=0;
		int maxSv=0;		
		int [] re=new int[4];
				
		int count[]=new int [100001];
		/* JAVA 裡陣列初始值已經是 0
		for(int i=0;i<100001;i++) {
			count[i]=0;
		}
		*/

		for(int j=0;j<n;j++) {
			/*
			for(int f=1;f<10001;f++) {
				if(set[j]==f)
					count[f]++;
			}
			*/
			//等同於直接這樣寫
			count[set[j]]++;
		}
			
		//直接找最多次的值
		for(int i=0;i<=100000;i++) {
			if(count[i]>count[maxv])
				maxv=i;
		}
		//選出出現最多次的值
		/*
			for(int f=0;f<100000;f++) {
				if(count[f]==max)
					maxv=f;
			}
		*/
			
		//直接找次多的值
		for(int i=0;i<=100000;i++) {
			if(count[i]>count[maxSv] && i != maxv)
				maxSv=i;
		}
				
		//選出次數第二多的值
		/*
		for(int i=0;i<100000;i++) {
			if(count[i]==maxS)
				maxSv=i;
		}
		*/
		re[0]=maxv;
		re[1]=count[maxv];
		re[2]=maxSv;
		re[3]=count[maxSv];
		return re;
	}	
}




Measured memory_bytes: 50832
#include "bits/stdc++.h"
using namespace std;
#define LL long long

void join() {
     LL x,y,z;
     cin>>x>>y>>z;
     
     LL d=z-x-y;
     
     if(4*x*y < d*d and d > 0) cout<<"Yes"<<"\n";
     else cout<<"No"<<"\n";
}


int main()
{
    join();

    return 0; 
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}

int main(){
	int M,N_min,N_max;
	while(1){
		cin>>M>>N_min>>N_max;
		if(M==0)break;
		vector<int> p(M);
		for(int i=0;i<M;i++)cin>>p[i];
		int gap=-1,ans=0;
		for(int i=N_max;i>=N_min;i--){
			int tmp=p[i-1]-p[i];
			if(gap<tmp){
				gap=tmp;
				ans=i;
			}
		}
		cout<<ans<<endl;
	}
}


Measured memory_bytes: 3100
#include<bits/stdc++.h> 
using namespace std; 
#define ll long long
#define MOD 1000000007

const ll inf = 1e18L + 5;

void min_self(ll& a, ll b ){
    a = min(a, b);
}

ll n,m,x;
vector<ll> cost;

ll solve(vector<vector<ll> > &A, vector<ll> &M, int ind ) {
    if( ind == n ) {
        for( int i = 0; i < m; i++ ) {
            if( M[i] < x ){
                return INT_MAX;
            }
        }
        return 0;
    }

    ll ret = INT_MAX;
    //Include
    for( int i = 0; i < m; i++ ) {
        M[i] += A[ind][i];
    }
    min_self(ret, cost[ind] + solve(A, M, ind+1));
    for( int i = 0; i < m; i++ ) {
        M[i] -= A[ind][i];
    }

    min_self(ret, solve(A, M, ind+1));

    return ret;
}

int main() {
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    cin>>n>>m>>x;

    vector<vector<ll> > A(n, vector<ll>(m,0));

    ll k = 0;
    for( int i = 0; i < n; i++ ) {
        for( int j = -1; j < m; j++ ) {
            cin>>k;
            if( j == -1 ) {
                cost.push_back(k);
                continue;
            }
            A[i][j] = k;
        }
    }

    ll isSumX = 0;
    for( int j = 0; j < m; j++ ) {
        isSumX = 0;
        for( int i = 0; i < n; i++ ) {
            isSumX += A[i][j];
        }
        if( isSumX < x ) {
            cout<<"-1";
            return 0;
        }
    }

    vector<ll> M(m, 0);

    // for( int i = 0 ; i < n ; i++ ) {
    //     cout<<cost[i]<<" ";
    // }
    // cout<<endl;
    // for( int i = 0 ; i < n ; i++ ) {
    //     for( int j = 0; j < m; j++ ) {
    //         cout<<A[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }
    // cout<<endl;

    ll res = solve(A, M, 0);

    cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 3552
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

int dp[100001][2];
const int INF = 1 << 20;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    while (cin >> n) {
        vi a(n);
        rep(i, n)cin >> a[i];
        
        rep(i, n + 1)rep(j, 2)dp[i][j] = INF;

        dp[0][0] = dp[0][1] = 1;

        for (int i = 1; i < n; ++i) {
            rep(j, 2)rep(k, 2)smin(dp[i][k], dp[i - 1][j] + 1);
            if (a[i - 1] <= a[i])smin(dp[i][0], dp[i - 1][0]);
            if (a[i - 1] >= a[i])smin(dp[i][1], dp[i - 1][1]);
        }
        int ans = min(dp[n - 1][0], dp[n - 1][1]);
        cout << ans << endl;
    }
}


Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long LL;
const int N = 1e5 + 5;
int f[N], lct[N], n;
LL cstA, cstB;
int F (int x) {
	return f[x] == x ? x : f[x] = F(f[x]);
}
void scan() {
	scanf("%d %lld %lld", &n, &cstA, &cstB);
	for (int i = 0; i < n; i++) {
		scanf("%d", &lct[i]);
		f[i] = i;
	}
}
void srch() {
	for (int i = 1; i < n; i++) {
		if (cstA * 1LL * (lct[i] - lct[i - 1]) <= cstB) {
			f[F(i)] = F(i - 1);
		}
	}
}
LL ans() {
	int pre;
	LL ret = 0;
	pre = F(0);
	for (int i = 1; i < n; i++) {
		if (F(i) == pre) {
			ret += 1LL * (lct[i] - lct[i - 1]) * cstA;
		}
		else {
			ret += cstB;
			pre = F(i);
		}
	}
	return ret;
}
int main() {
	scan();
	srch();
	printf("%lld\n", ans());
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
typedef long long ll;
typedef long double ld;
#define rep(i,a)  for(ll i=0; i< a; i++)
#define pb push_back
#define vl vector<ll>
#define trace(x)  cerr << #x << ": " << x << endl;
int main()
{
	fast;
	ll n,k;cin>>n>>k;
	vector<ll> a(n);for(ll i=0;i<n;i++)cin>>a[i];
	ll prod=1;
	for(ll i=k;i<n;i++)
	{
		if(a[i]>a[i-k])
		{
			cout<<"Yes\n";
		}
		else cout<<"No\n";
	}
}


Measured memory_bytes: 4764
n = int(input())
a = list(map(int,input().split()))
mod = 10**9 + 7

c = [n]*61
for i in range(n):
    b = str(bin(a[i]))[2:]
    b = b[::-1]
    for j, x in enumerate(b):
        if x == "1":
            c[j] -= 1

ans = 0
for i in range(60):
    ans += c[i]*(n-c[i])*pow(2,i,mod)
    ans %= mod
print(ans)


Measured memory_bytes: 124504
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

int main() {
  int a, b, c;
  ll k;
  scanf("%d %d %d %lld", &a, &b, &c, &k);
  int ans = a - b;
  if (k % 2 == 1) {
    ans *= (-1);
  }
  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 888
/*
貪欲
後ろから見る
DP
順位表をチェック
二分探索


*/
#pragma GCC optimize("Ofast")
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include<tuple>
using namespace std;
#define INF 3e18+7
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<double,int> P;
//typedef pair<pair<int,int>,int> p;
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());

int ans[210000];
int C[210000];

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

    int N,x;
    cin>>N>>x;
    if(N==2 && x==2){
        cout<<"Yes"<<endl;
        for(int i=1;i<=3;i++){
            cout<<i<<endl;
        }
    }else if(x==1 || x==2*N-1){
        cout<<"No"<<endl;
    }else{
        if(x==2){
            ans[N]=x; C[x]++;
            ans[N-1]=x+1; C[x+1]++;
            ans[N+1]=x-1; C[x-1]++;
            ans[N+2]=x+2; C[x+2]++;
        }else{
            ans[N]=x; C[x]++;
            ans[N-1]=x-1; C[x-1]++;
            ans[N+1]=x+1; C[x+1]++;
            ans[N+2]=x-2; C[x-2]++;
        }
        int now=1;
        for(int i=1;i<=2*N-1;i++){
            while(C[now]!=0){
                now++;
            }
            if(ans[i]==0){
                ans[i]=now;
                now++;
            }
        }
        cout<<"Yes"<<endl;
        for(int i=1;i<=2*N-1;i++){
            cout<<ans[i]<<endl;
        }
    }

}

Measured memory_bytes: 2304
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long k = sc.nextLong();
		int ans = 1;
		for(long i = 0; i < k; i++){
			int tmp = Integer.parseInt(s.substring((int)i,(int)i+1));
			if(tmp != 1){
				ans = tmp;
				break;
			}
		}
		System.out.print(ans);
	}
}


Measured memory_bytes: 22996
/* ex 7_3
   アカウント名 */

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


int main(void){
    int i, j, k, row, column;
    scanf("%d %d\n", &row, &column);
    int row_flag[row], column_flag[column];
    for(i = 0; i < row; i++){
        row_flag[i] = 0;
    }
    for(i = 0; i < column; i++){
        column_flag[i] = 0;
    }
    char matrix[row][column];
    for(i = 0; i < row; i++){
        for(j = 0; j < column; j++){
            scanf(" %c", &matrix[i][j]);
            if(matrix[i][j] == '#'){
                row_flag[i] = 1;
                column_flag[j] = 1;
            }
        }
    }

    for(i = 0; i < row; i++){
        k = 0;
        for(j = 0; j < column; j++){
            if(row_flag[i] == 1 && column_flag[j] == 1){
                printf("%c", matrix[i][j]);
                k = 1;
            }
        }
        if(k == 1){
            printf("\n");
        }
    }

    return 0;
}

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

int main(void) {
  int N;
  cin >> N;
  vector<int> p(N);
  for (int i = 0; i < N; i++) {
    cin >> p[i];
  }
  sort(p.begin(), p.end());
  p[N - 1] /= 2;
  int sum = 0;
  for (int i = 0; i < N; i++) {
    sum += p[i];
  }
  cout <<sum << endl;

  return 0;
}

Measured memory_bytes: 256
//author rhythmicankur
                                                                  //god_is_almighty
#pragma GCC optimize("O3")
#pragma GCC target ("sse4")
#include<bits/stdc++.h>
#define f 		first
#define s 		second
#define int     long long
#define ll      int
#define ld 		long double
#define pb 		push_back
#define eb 		emplace_back
#define mk 		make_pair
#define vi 		vector<int>
#define pii 		pair<int,int>
#define pip             pair<int,pii>
#define vpi 		vector<pii>
#define sbcount(x) __builtin_popcountll(x)
#define REP(i,n) for (int i = 1; i <= n; i++)
#define trav(a, x)      for(auto& a : x)
#define all(x)          x.begin(), x.end()
#define fill(a,val)	memset(a,val,sizeof(a))
#define 	PI acos(-1)
#define coud(a,b) cout<<fixed << setprecision((b)) << (a)
#define M1 	998244353
#define M2 	1000000007
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;

template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); } 
#define test4(x,y,z,a) 		    cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<"  |  "<<#a<<": "<<a<<endl;
#define test1(x)                cerr<<#x<<": "<<x<<endl
#define test2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define test3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
ll power(ll a,ll b,ll m=M2){ll answer=1;while(b){if(b&1)answer=(answer*a)%m;b/=2;a=(a*a)%m;}return answer;}
using namespace std;
void ctrl(){cout<<"Control"<<endl;}
int make_num(string p){stringstream geek(p); int x = 0; geek >> x;return x;}
string make_str(int x){ostringstream str1; str1 << x; string geek = str1.str(); return geek;}
int h,w,k;


signed main()
{	ios::sync_with_stdio(0);
	cin.tie(0); 
	cin.exceptions(cin.failbit);
	
    cin>>h>>w>>k;

    string p[h];
    int ans=0;
    for(int i=0;i<h;i++)cin>>p[i];

    for(int i=0;i<(1<<(h+w));i++)
    {
        string temp[h];
        for(int j=0;j<h;j++)
        temp[j]=p[j];

        for(int j=0;j<h+w;j++)
        {
            int val = (1<<j);

            val=val&i;
            if(val)
            {
                if(j<h)
                {
                    for(int k=0;k<w;k++)
                    temp[j][k]='R';
                }
                else
                {
                    int jt = j-h;
                    for(int k=0;k<h;k++)
                    temp[k][jt] = 'R';
                }
            
                
            }
        }
            int cnt=0;
                for(int i1=0;i1<h;i1++)
                {
                    for(int i2=0;i2<w;i2++)
                    {
                        if(temp[i1][i2]=='#')
                        cnt++;
                    }
                }
                if(cnt==k)
                ans++;
    }
    cout<<ans;


return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int n, x, tot = 0, remain = 0;
  cin >> n >> x;
  vector<int> m(n);
  rep(i, n) {
    cin >> m[i];
    tot += m[i];
  }

  sort(m.begin(), m.end());
  int ans = n + (x - tot) / m[0];
  cout << ans << endl;
  return 0;
}


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

using namespace std;

using State = pair<pair<int, int>, int>;

int MX = 81*2*81 + 9;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, m;
    cin >> n >> m;
    //n = 80; m = 80;
    vector<vector<int>> a(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
            //a[i][j] = (i+j)%81;
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            int v;
            cin >> v;
            //v = (81+i-j)%81;
            a[i][j] -= v;
        }
    }
    vector<vector<vector<bool>>> was(n, vector<vector<bool>>(m));
    vector<State> q;
    q.reserve(n*m*MX);
    auto add = [&] (int i, int j, int c) {
        if (i < 0 || i >= n || j < 0 || j >= m) {
            return;
        }
        auto &vec = was[i][j];
        if (vec.size() == 0) {
            vec.assign(2*MX + 1, false);
        }
        for (int mul = -1; mul <= 1; mul += 2) {
            int nxtC = c + mul*a[i][j];
            int code = nxtC + MX;
            if (!vec[code]) {
                q.push_back({{i, j}, nxtC});
                vec[code] = true;
            }
        }
    };
    add(0, 0, 0);
    int ans = 1e9;
    for (int qi = 0; qi < q.size(); qi++) {
        auto cur = q[qi];
        int i = cur.first.first;
        int j = cur.first.second;
        int c = cur.second;
        if (i == n-1 && j == m-1) {
            ans = min(ans, abs(c));
        }
        add(i+1, j, c);
        add(i, j+1, c);
    }
    cout << ans << endl;
}


Measured memory_bytes: 491256
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 100005;
const int inf = 1e9 + 5;
int n;
string s;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n >> s;
    s = ' ' + s;
    int red = 0;
    for(int i=1;i<=n;i++)red += (s[i] == 'R');
//    cout << "red: " << red << endl;
    if(!red)return cout << 0, 0;
    int beli = 0;
    int rez = inf;
    for(int i=1;i<=n;i++){
        if(s[i] == 'W')beli++;
        int kol = 0;
        if(i >= red)kol = i - red;
        else kol = red - i;
//        cout << max(0, i - red) << endl;
//        cout << beli << endl;
        rez = min(rez, kol + beli);
//        cout << endl;
    }
    cout << rez << endl;
    return 0;
}


Measured memory_bytes: 3864
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
using namespace std;


typedef long long ll;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)

const int mod = 1000000007;


int main(){
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n);
  vector<vector<int> > dp(n, vector<int>(3));
  rep(i, n) cin >> a[i] >> b[i] >> c[i];

  dp[0][0] = a[0];
  dp[0][1] = b[0];
  dp[0][2] = c[0];

  for(int i = 1; i < n; ++i){
    vector<int> now(3);
    dp[i][0] = a[i] + max(dp[i - 1][1], dp[i - 1][2]);
    dp[i][1] = b[i] + max(dp[i - 1][0], dp[i - 1][2]);
    dp[i][2] = c[i] + max(dp[i - 1][0], dp[i - 1][1]);
  }

  int ans = max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2]));
  cout << ans << endl;

}


Measured memory_bytes: 6912
def main():
    N, *A = map(int, open(0).read().split())

    B = sorted(A)
    l, r = 0, N
    m, c = N // 2, N * (N + 1) // 2

    def check(x):
        b, r, y = N, 0, 0
        D = [0] * (2 * N + 1)
        for a in A:
            D[b] += 1
            if a < x:
                r += D[b]
                b += 1
            else:
                b -= 1
                r -= D[b]
            y += r
        return y

    while True:
        if check(B[m]) <= c // 2:
            if m == N - 1 or check(B[m + 1]) > c // 2:
                break
            l, m = m, (m + r) // 2
        else:
            m, r = (m + l) // 2, m + 1

    print(B[m])


if __name__ == '__main__':
    main()


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

typedef long long ll;

#define int ll
#define all(v) v.begin(), v.end()
#define reps(__i, a, b) for (int __i = a; i < b; i++)
#define rep(__i, n) reps(__i, 0, n)

const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;

signed main()
{
    int n, m;
    int a[100000];
    cin >> n >> m;
    for (int i = 0; i < m; i++)
        cin >> a[i];

    set<int> s;

    for (int i = 0; i < m; i++)
        s.insert(a[i]);
    queue<int> q;
    for (auto itr = s.begin(); itr != s.end(); itr++)
        q.push(*itr);

    int dp[100001] = {1};
    if (q.front() == 1)
        q.pop();
    else
        dp[1] = 1;

    for (int i = 2; i <= n; i++)
    {
        if ((q.size() && i != q.front()) || q.empty())
            dp[i] = (dp[i - 1] + dp[i - 2]) % MOD;
        else
            q.pop();
    }

    // for (int i = 0; i <= n; i++)
    //     cout << dp[i] << " ";
    // cout << endl;

    cout << dp[n] << endl;
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
#define MAX_N 100005

int n;
char s[MAX_N];
bool t[11][(1<<10)];
bool dp[11][(1<<10)];

bool check(int S){
  memset(dp,false,sizeof(dp));
  dp[0][0]=true;
  int a=1;
  for(int i=0;i<10;i++){
    if(~S>>i&1)continue;
    for(int j=0;j<(1<<10);j++){
      if(!t[i][j])continue;
      int k=(1<<10)-1-j;
      while(1){
        dp[a][j+k]|=dp[a-1][k];
        if(dp[a][j+k] && ((j+k)&S)==S )return true;
        if(k==0)break;
        k=(k-1)&(~j);
      }
    }
    a++;
  }
  return false;
}

bool solve(){
  for(int bit=0;bit<(1<<10);bit++)
    if(check(bit))return true;
  return false;
}

int main(){
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    memset(t,false,sizeof(t));
    scanf("%s",s);
    int bit=0;
    for(int i=0;i<n;i++){
      if(s[i]=='u')bit=0;
      if('0'<=s[i]&&s[i]<='9'){
        int num=s[i]-'0';
        t[ num ][ bit ] = true;
        bit|=(1<<num);
      }
    }
    if(solve())printf("UNSAFE\n");
    else printf("SAFE\n");
  }
  return 0;
}

Measured memory_bytes: 1216
W, H = map(int, input().split())
PQ = [[int(input()), 'x'] for w in range(W)]
PQ += [[int(input()), 'y'] for h in range(H)]
PQ.sort()

_W = W + 1; _H = H + 1
ans = 0
for v, z in PQ:
  if z == 'x':
    if _W > 1:
      ans += _H * v
      _W -= 1
  else: # z == 'y'
    if _H > 1:
      ans += _W * v
      _H -= 1
  
  if _W == _H == 1:
    break

print(ans)

Measured memory_bytes: 32108
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		long tot = (N - M) * 100 + M * 1900;
		for(int i=0;i<M;i++) tot *= 2;
		Console.WriteLine(tot);
		
		
	}
	long N,M;
	public Sol(){
		var d = rla();
		N = d[0]; M = d[1];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13140
import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import Data.Array.IArray
import qualified Data.Set as Set

solve :: Array Int Int -> Int
solve a = f 1 Set.empty
  where
    f n s = case n of
                2 -> Set.size s
                _  | Set.member n s -> -1
                   | otherwise -> f (a!n) (Set.insert n s)

main :: IO ()
main = do
    n <- readLn :: IO Int
    a <- map (fst . fromJust . BS.readInt) . BS.lines <$> BS.getContents
    print . solve $ listArray (1,n) a


Measured memory_bytes: 28028
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int map_cur[10][10];
int map_next[10][10];

int map_cur_check(int x, int y){
	if(x < 0 || y < 0 || x >= 10 || y >= 10){
		return 0;
	}
	return map_cur[x][y];
}

int main(){
	
	int px, py;
	
	while(true){
		cin >> px >> py;
		if(px == 0 && py == 0){
			break;
		}
		int n;
		cin >> n;
		
		for(int i = 0; i < 10; i++){
			for(int j = 0; j < 10; j++){
				map_next[i][j] = 0;
			}
		}
		
		map_next[px][py] = 1;
		
		int x, y;
		
		for(int loop = 0; loop < n; loop++){
			cin >> x >> y;
			for(int i = 0; i < 10; i++){
				for(int j = 0; j < 10; j++){
					map_cur[i][j] = map_next[i][j];
				}
			}
			for(int i = 0; i < 10; i++){
				for(int j = 0; j < 10; j++){
					bool flag1 = false;
					bool flag2 = false;
					for(int k = -1; k <= 1; k++){
						if(map_cur_check(i - 2, j + k) == 1 || map_cur_check(i + 2, j + k) == 1 || map_cur_check(i + k, j - 2) == 1 || map_cur_check(i + k, j + 2) == 1){
							flag1 = true;
						}
					}
					if(abs(i - x) <= 1 && abs(j - y) <= 1){
						flag2 = true;
					}
					if(flag1 && flag2){
						map_next[i][j] = 1;
					}else{
						map_next[i][j] = 0;
					}
				}
			}
		}
		bool ans = false;
		for(int i = 0; i < 10; i++){
			for(int j = 0; j < 10; j++){
				if(map_next[i][j] == 1){
					ans = true;
				}
			}
		}
		if(ans){
			cout << "OK" << endl;
		}else{
			cout << "NA" << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 2984
#include <iostream>
#include <string>
#include <vector>

using namespace std;

bool canFill(string sub, string t) {
  for(int i = 0; i < t.size(); i++) {
    if(sub[i] == t[i] || sub[i] == '?') continue;
    else return false;
  }
  return true;
}

int main() {
  string S,T;
  cin >> S >> T;

  //Sは複数の?を持っている．それらのうち，Tを含む辞書順で最小のものを出力する．
  //辞書順で最小=aで置き換わってる
  //つまり最後尾から順にTを入れてみて，いけたら残りをaで埋めれば良い
  if(S.size() < T.size()) goto err;
  for(int i = 0; i <= S.size() - T.size(); i++) {
    string sub = S.substr(S.size() - T.size() - i, T.size());
    if(canFill(sub,T)) {
      S.replace(S.size() - T.size() - i, T.size(), T);
      for(auto& x: S) {
        if(x == '?') x = 'a';
      }

      cout << S << endl;
      return 0;
    }
  }

 err:
  cout << "UNRESTORABLE" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <utility>
#define INF (LLONG_MAX>>2)
using namespace std;

typedef long long ll;

class edge{
public:
  int to;
  int weight;
  edge(int to, int weight){
    this->to = to;
    this->weight = weight;
  }
};

ll prim(int, vector<edge>*);
ll primWithPQ(int, vector<edge>*);

int main(){
  int v, e;
  cin >> v >> e;

  vector<edge> graph[v];

  int from, to, weight;
  for(int i=0; i<e; i++){
    cin >> from >> to >> weight;

    //無向グラフなので、両方枝をプッシュ
    graph[from].push_back(edge(to, weight));
    graph[to].push_back(edge(from, weight));
  }

  ll ans = primWithPQ(v, graph);

  cout << ans << endl;

  return 0;
}

ll prim(int v, vector<edge>* graph){
  ll minCost[v];
  bool used[v];

  for(int i=0; i<v; i++){
    minCost[i] = INF;
    used[i] = false;
  }

  minCost[0] = 0;
  ll res = 0;
  while(true){
    int minv=-1;
    for(int u=0; u<v; u++){
      if(!used[u] && (minv==-1 || minCost[u]<minCost[minv])){
        minv = u;
      }
    }
    if(minv==-1) break;

    used[minv] = true;
    res += minCost[minv];

    //minCost更新
    for(int i=0; i<v; i++){
      for(int k=0; k<graph[i].size(); k++){
        minCost[i] = min(minCost[i], 1LL*graph[i][k].weight);
      }
    }
  }

  return res;
}

ll primWithPQ(int v, vector<edge>* graph){
  ll minCost[v];
  bool used[v];
  for(int i=0; i<v; i++){
    minCost[i] = INF;
    used[i] = false;
  }

  priority_queue<pair<ll, int>, vector<pair<ll, int> >, greater<pair<ll, int> > > pq;
  minCost[0] = 0;
  pq.push(make_pair(0, 0));//とりあえず頂点0をプッシュ

  ll res=0;
  while(!pq.empty()){
    pair<ll, int> nowPair = pq.top(); pq.pop();
    ll nowDist = nowPair.first; int nowNode = nowPair.second;
    if(used[nowNode]) continue;

    res += nowDist;
    used[nowNode] = true;

    for(int i=0; i<graph[nowNode].size(); i++){
      edge e = graph[nowNode][i];
      if(e.weight < minCost[e.to]){
        minCost[e.to] = e.weight;
        pq.push(make_pair(minCost[e.to], e.to));
      }
    }
  }

  return res;
}



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

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

typedef long long ll;
const ll MOD = 1e9 + 7;

int main() {
  int N, A, B, C, D;
  std::string S;

  std::cin >> N >> A >> B >> C >> D >> S;
  --A; --B; --C; --D;

  for(int i = B + 1; i < D - 1; ++i) {
    if(S[i] == '#' and S[i + 1] == '#') {
      std::cout << "No" << '\n';
      return 0;
    }
  }
  for(int i = A + 1; i < C - 1; ++i) {
    if(S[i] == '#' and S[i + 1] == '#') {
      std::cout << "No" << '\n';
      return 0;
    }
  }
  if(C < D) {
    std::cout << "Yes" << '\n';
    return 0;
  } else {
    for(int i = B; i <= D; ++i) {
      if(S[i - 1] == '.' and S[i] == '.' and S[i + 1] == '.') {
        std::cout << "Yes" << '\n';
        return 0;
      }
    }
    std::cout << "No" << '\n';
  }
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <ctime>
#include <climits>
#include <cfloat>
#include <cstdint>
#include <cstddef>
#include <cinttypes>
#include <memory>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <array>
#include <valarray>
#include <string>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <bitset>
#include <queue>
#include <complex>
#include <tuple>
#include <utility>
#include <functional>
#include <algorithm>
#include <numeric>

using namespace std;

const double EPS = 1e-10;
const int64_t INF = 1e9;

typedef long long ll;

int main()
{
	ll a[2], c[2];
	scanf("%lld%lld%lld%lld", &a[0], &a[1], &c[0], &c[1]);
	ll mx = a[0] * c[0];
	for (int i = 0; i < 2; ++i)
		for (int j = 0; j < 2; ++j)
			if (mx < a[i] * c[j])
				mx = a[i] * c[j];

	printf("%lld\n", mx);

	return 0;
}



Measured memory_bytes: 3260
#include<stdio.h>
int main() {
long long a,b,c;
int x[8]={0,1,2,3,5,7,8,9};
while(scanf("%d",&a),a) {
c=1;b=0;
while(a) {
b+=x[a&7]*c;
c*=10;a=a>>3;
}
printf("%lld\n",b);
}
}

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

using namespace std;

int main()
{
    set<int> s;
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    s.insert(a);
    s.insert(b);
    s.insert(c);
    printf("%d\n", s.size());
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <complex>
#include <cmath>
using namespace std;

void koch_curve(int depth, const complex<double> &left, const complex<double> &right) {
	if(depth==0) {
		printf("%.8f %.8f\n",left.real(),left.imag());
		return;
	} else {
		complex<double> v1,v2,v3,rot={cos(M_PI/3),sin(M_PI/3)};
		v1=(2.0*left+right)/3.0;
		v3=(left+2.0*right)/3.0;
		v2=v1+(v3-v1)*rot;
		koch_curve(depth-1,left,v1);
		koch_curve(depth-1,v1,v2);
		koch_curve(depth-1,v2,v3);
		koch_curve(depth-1,v3,right);
	}
}

int main() {
	int n;
	scanf("%d",&n);
	complex<double> v1={0.0,0.0},v2={100.0,0.0};
	koch_curve(n,v1,v2);
	printf("%.8f %.8f\n",v2.real(), v2.imag());
	return 0;
}

Measured memory_bytes: 2728