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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// assign avl ncm dijkstra geo2 kruskal graph uf lca BIT
// matrix dinic next_combination topcoder lcm

signed main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    Int(n);
    vi cnt(100010, 0);
    rep(i, n) {
        Int(tmp);
        cnt[tmp]++;
        cnt[tmp+1]++;
        cnt[tmp+2]++;
    }
    int ans = 0;
    rep(i, cnt.size()) {
        if (cnt[ans] < cnt[i]) {
            ans = i;
        }
    }
    std::cout << cnt[ans] << std::endl;



    return 0;
}


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

int main()
{
    int i;
    int n;
    int ac = 0, wa = 0, tle = 0, re = 0;
    char buf[4];

    scanf("%d", &n);

    for (i = 0; i < n; i++) {
        scanf("%s", buf);
        if (strcmp(buf, "AC") == 0)
            ac++;
        else if (strcmp(buf, "WA") == 0)
            wa++;
        else if (strcmp(buf, "TLE") == 0)
            tle++;
        else if (strcmp(buf, "RE") == 0)
            re++;
    }

    printf("AC x %d\n", ac);
    printf("WA x %d\n", wa);
    printf("TLE x %d\n", tle);
    printf("RE x %d\n", re);

    return 0;
}

Measured memory_bytes: 1732
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1'000'000'007;
template <class T> bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; }
template <class T> bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; }

int main() {
    ll n, k;
    cin >> n >> k;
    vl a(n), b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
    }
    map<ll, ll> m;
    for (int i = 0; i < n; ++i) {
        m[a[i]] += b[i];
    }
    ll ret;
    for (auto mm : m) {
        k -= mm.second;
        if (k <= 0) {
            ret = mm.first;
            break;
        }
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 5760
#include <iostream>
#include <vector>
#include <string>
using namespace std;
#define rep(i,s,e) for(int i = (s);i <= (e);i++)

int n;
string s;

int top[100000];

int main()
{
	cin >> s;
	n = s.size();
	int cou = 0;
	rep(i,0,n - 1)
	{
		if(s[i] == 'p')
		{
			top[i] = 1;
			cou--;
		}
		else
		{
			cou++;
		}
	}
	cou = max(0,cou);

	cout << cou / 2 << endl;
	return 0;
}



Measured memory_bytes: 896
import java.io.*;
import java.util.*;

public class  Main{
    public static void main(String[] args) throws Exception{
        //MScanner sc = new MScanner("chess.in");
        MScanner sc = new MScanner(System.in);
        PrintWriter pw=new PrintWriter(System.out);
        int n=sc.nextInt();
        int sum=0;
        int[]in=new int[n];
        for(int i=0;i<n;i++) {
        	in[i]=sc.nextInt();
        	sum+=in[i];
        }
        int ans=1000000000;
        int pref=0;
        for(int i=0;i<n;i++) {
        	pref+=in[i];int o=sum-pref;
        	ans=Math.min(ans,Math.abs(o-pref));
        }
        pw.println(ans);
        pw.flush();
    }
    static class MScanner {
		StringTokenizer st;
		BufferedReader br;
 
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Measured memory_bytes: 22612
using System;
    class Program
    {
        static void Main(string[] args)
        {
            // get a int n
            int n = Convert.ToInt16(Console.ReadLine());
            string[] v_s = Console.ReadLine().Split(' ');
            string[] c_s = Console.ReadLine().Split(' ');

            int maxima = 0;

            for (int i = 0; i < n; i++)
            {
                int value = Convert.ToInt16(v_s[i]) - Convert.ToInt16(c_s[i]);
                if (value > 0)
                    maxima += value;    
            }

            Console.Write(maxima);
        }
    }

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

int main(){
    int N;
    cin >> N;
    vector<int64_t> A(N), S(N+1);
    for(int i=0; i<N; i++){
        cin >> A[i];
        S[i+1] = S[i] + A[i];
    }

    int64_t ans = 1e18;

    int pt1 = 1, pt2 = 3;
    for(int s=2; s<N-1; s++){
        int64_t S1 = S[s], S2 = S[N] - S[s];
        while(pt1 < s && 2*S[pt1] < S1) pt1++;
        while(pt2 < N && 2*(S[pt2] - S[s]) < S2) pt2++;
        int64_t mx1 = min(S[pt1], S1 - S[pt1-1]);
        int64_t mn1 = S1 - mx1;
        int64_t mx2 = min(S[pt2] - S[s], S2 - (S[pt2-1] - S[s]));
        int64_t mn2 = S2 - mx2;
        int64_t res = max(mx1, mx2) - min(mn1, mn2);
        ans = min(ans, res);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3328
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
using static System.Math;
//using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    void chmax<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? b : a; }
    void chmin<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? a : b; }

    void solve()
    {
        var T = cin.scanint;
        if (Abs(T[0] - T[2]) <= T[3] || (Abs(T[0] - T[1]) <= T[3] && Abs(T[1] - T[2]) <= T[3]))
        {
            WriteLine("Yes");
        }
        else
        {
            WriteLine("No");
        }
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 11092
import java.util.*;
public class Main{
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int M1, M2 ,D1,D2;
		M1 = sc.nextInt();
		D1 = sc.nextInt();
		M2 = sc.nextInt();
		D2 = sc.nextInt();
		int data[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
		if(data[M1]==D1) {
			System.out.println("1");
		}else {
			System.out.println("0");
		}
		
		
		
		
		
	}
}

	


Measured memory_bytes: 23892
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
const int maxn=1e5+111;
int main(){
    ll a,b,n;
	scanf("%lld%lld%lld",&a,&b,&n);
	ll x=min(n,b-1);
	printf("%lld\n",(a*x)/b-a*(x/b));
    return 0;
}

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

int main(){
  string s;  cin >> s;
  int flag = 0;
  for(auto c : s)
    if(c == 'C')  flag |= 1;
    else if(c == 'F' && flag&1)  flag |= 2;
  
  string ans = "No";
  if(flag == 3)  ans = "Yes";

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



Measured memory_bytes: 3624
import sys
input=sys.stdin.readline
n=int(input())
BIT=[[0]*n for i in range(26)]
w=[ord(x)-ord("a") for x in input()]
for i in range(n):
	k=i+1
	while k<=n:
		BIT[w[i]][k-1]+=1
		k=k+(k&-k)
q=int(input())
for i in range(q):
	a,b,c=input().split()
	if a=="1":
		k=int(b)
		while k<=n:
			BIT[ord(c)-ord("a")][k-1]+=1
			k=k+(k&-k)
		k=int(b)
		while k<=n:
			BIT[w[int(b)-1]][k-1]-=1
			k=k+(k&-k)	
		w[int(b)-1]=ord(c)-ord("a")
	else:
		b=int(b);c=int(c)
		ans=0
		for i in range(26):
			cnt=0
			k=c
			while k!=0:
				cnt+=BIT[i][k-1]
				k=k-(k&-k)
			k=b-1
			while k!=0:
				cnt-=BIT[i][k-1]
				k=k-(k&-k)
			if cnt>0:
				ans+=1
		print(ans)

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

using namespace std;
typedef long long ll;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);


        int n,W;
        cin>>n>>W;
        int max_v=0;
        vector<pair<int,int>> sack(n+1);
        for(int i=1;i<=n;i++){
            int a,b;
            cin>>a>>b;
            sack[i].first=a;
            sack[i].second=b;
            max_v+=b;
        }

        vector<vector<ll>> dp(n+1,vector<ll>(max_v+1,1e18));

        for(int i=0;i<=n;i++)
            dp[i][0]=0;
        int ans=0;
        for(int i=1;i<=n;i++){
            for(int j=1;j<=max_v;j++){
                if(sack[i].second<=j){
                    dp[i][j]=min(dp[i-1][j],dp[i-1][j-sack[i].second]+sack[i].first);
                }else{
                    dp[i][j]=dp[i-1][j];
                }
                if(dp[i][j]<=W)
                    ans=max(ans,j);
            }
        }
        cout<<ans;


    return 0;
}


Measured memory_bytes: 83112
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e6+23;

int a[maxn];
int main(){
    int n;
    cin>>n;
    int ans=0;
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        if((a[i]&1)&&(i&1)) ans++;
    }
    cout<<ans;
}

Measured memory_bytes: 3680
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)

struct INIT{
    INIT(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(0);
        cout << fixed << setprecision(13);
    }
}INIT;

template<class  T> struct SegmentTree {
private:
    int n;
    vector<T> node;
public:
    SegmentTree(vector<T> v) {
        int sz = v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, 0);
        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        for(int i=n-2; i>=0; i--) node[i] = max(node[2*i+1], node[2*i+2]);
    }
 
    void update(int x, T val) {
        x += (n - 1);
        node[x] = val;
        while(x > 0) {
            x = (x - 1) / 2;
            node[x] = max(node[2*x+1], node[2*x+2]);
        }
    }
    //[a,b)の最小値を求める
    T getmax(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        if(r <= a || b <= l) return 0;
        if(a <= l && r <= b) return node[k];
 
        T vl = getmax(a, b, 2*k+1, l, (l+r)/2);
        T vr = getmax(a, b, 2*k+2, (l+r)/2, r);
        return max(vl, vr);
    }
};

int n;
int h[202020];
int a[202020];


int main(){
    cin >> n;
    REP(i, n)cin >> h[i];
    REP(i, n)cin >> a[i];
    
    SegmentTree<LL> seg(vector<LL>(n + 1, 0));

    REP(i, n){
        LL maxl = max(seg.getmax(h[i], h[i] + 1), seg.getmax(0, h[i]) + a[i]);
        seg.update(h[i], maxl);
    }
    cout << seg.getmax(0, n + 1) << endl;
}

Measured memory_bytes: 7552
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int x, a, b; cin >> x >> a >> b;
  x -= a;
  cout << x % b << endl;
  return 0;
}

Measured memory_bytes: 3180
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {

		Main m = new Main();
		m.run();
	}

	Scanner sc = new Scanner(System.in);

	void run() {
		for (;;) {
			int r0 = sc.nextInt();
			int w0 = sc.nextInt();
			int c = sc.nextInt();
			int r = sc.nextInt();

			if ((r0 | w0 | c | r) == 0) {
				break;
			}
			System.out.println(solve(r0, w0, c, r));
		}
	}

	// find min X s.t. (R0 + X R) / (W0 + Y) = c
	long solve(int r0,int w0,int c,int r){
		long x = 0;
		for(; r0 + x*r < w0 *c;x++){}
		return x;
	}

}


Measured memory_bytes: 26448
#include <stdio.h>
 
int main (void) {
    int n, m, k = 0;
    scanf("%d", &n);

    m = n;
    while ( m > 0 ) {
        k += m%10;
        m /= 10;
    }
    if ( n % k == 0 ) printf("Yes\n");
    else { printf("No\n");}
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define repi(i, a, b) for (long long i = (long long)(a); i < (long long)(b); i++)
#define drep(i, n) for (long long i = n - 1; i > 0; i--)
#define pb push_back
#define pb push_back
#define all(x) (x).begin(), (x).end()

using namespace std;

int main()
{
    string s;
    int c_count = 0;
    cin >> s;
    int end_2 = (int)s.length() - 2;
    int min_sum = 0;
    if (s[0] == 'A')
    {
        for (int i = 2; i <= end_2; i++)
        {
            if (s[i] == 'C')
            {
                c_count++;
            }
        }
        if (c_count == 1)
        {
            for (int i = 0; i < (int)s.length(); i++)
            {
                if (s[i] >= 'a' && s[i] <= 'z')
                {
                    min_sum++;
                }
            }
            if (min_sum == (int)s.length() - 2)
            {
                cout << "AC" << endl;
                return 0;
            }
        }
    }
    cout << "WA" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int main(void){
    char S[10];
    int count = 0,max = 0;
    scanf("%s",S);
//    printf("%c",S[9]);
    for(int i=0;i<10;i++){
        if(S[i]!='A'&&S[i]!='C'&S[i]!='G'&S[i]!='T'){
//            printf("S[%d]=%c\n",i,S[i]);
            if(max<count) max = count;
            count = 0;
        }else{
//        printf("SS[%d]=%c\n",i,S[i]);
            count ++;
        }
    }
    if(max<count) max = count;
    printf("%d",max);
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <algorithm>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
using namespace std;

const int fx[4]={0,0,1,-1},fy[4]={1,-1,0,0};
int n,m,k,d[810][810],q[640100][2],head,tail,ans;
char a[810][810];

void bfs(int x,int y)
{
    memset(d,255,sizeof(d)),d[x][y]=0;
    q[0][0]=x,q[0][1]=y;
    for (; head<=tail; ++head)
    {
        x=q[head][0],y=q[head][1];
        if (d[x][y]<=k)
            ans=min(ans,(min(min(x-1,y-1),min(n-x,m-y))+k-1)/k+1);
        repu(i,0,3)
            if (x+fx[i] && x+fx[i]<=n && y+fy[i] && y+fy[i]<=m
            && a[x+fx[i]][y+fy[i]]!='#' && d[x+fx[i]][y+fy[i]]==-1)
            {
                d[x+fx[i]][y+fy[i]]=d[x][y]+1;
                q[++tail][0]=x+fx[i],q[tail][1]=y+fy[i];
            }
    }
}

int main()
{
    scanf("%d%d%d",&n,&m,&k);
    repu(i,1,n)
        scanf("%s",a[i]+1);
    repu(i,1,n)
        repu(j,1,m)
            if (a[i][j]=='S')
                ans=1<<30,bfs(i,j);
    printf("%d\n",ans);
    return 0;
}

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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<" --- "<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
const ll mod=1e9+7;
ll dp[2005][2005];
int s;

int main(){
	io;
	cin>>s;
	for(int i=3;i<=s;i++)dp[1][i]=1;
	for(int i=2;i*3<=s;i++){
		ll x=0;
		for(int j=i*3;j<=s;j++){
			x+=dp[i-1][j-3];x%=mod;
			dp[i][j]=x;
		}
	}
	ll xx=0;
	for(int i=1;i<=s;i++){ xx+=dp[i][s];xx%=mod; }
	cout<<xx<<endl;
}

Measured memory_bytes: 11128
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <memory>
#include <math.h>

using namespace std;
const unsigned long long MAXV = 1000000000000000000ULL;

int main()
{
    unsigned long N;
    unsigned long C;
    cin >> N;

    
    unsigned long long ans = 0;
    unsigned long long tmp = 0;
    cin >> ans;

    for (unsigned long i = 1; i < N; i++)
    {
        cin >> tmp;
        C = MAXV/ans;

        if (tmp == 0 || ans == 0) {ans = 0; break;}
        else if (C < tmp) {ans = MAXV+1;continue;}
        else if (MAXV < ans) {continue;}
        ans *= tmp;
    }

    if (MAXV < ans) {
        cout << -1 << endl;
    }
    else {
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3640
# -*- coding:utf-8 -*-
N = int(input())
a = list(map(int,input().split()))

L = {}

for i in range(N):
    L[i] = a[i]

sort_L = sorted(L.items(), key=lambda x:x[1])

for j in sort_L:
    print(j[0]+1, end =" ")


Measured memory_bytes: 29816
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	ll a,b; cin>>a>>b;
	ll c=pow(2,b);
	cout<<(100*(a-b)+1900*b)*c<<endl;;
	
	return 0;
}

Measured memory_bytes: 4012
#include<bits/stdc++.h>
#define fastIO ios::sync_with_stdio(false);cin.tie(0);
#define ll long long
#define f(i, l, r) for(i = l; i < r; i++)
#define fd(i, l, r) for(i = l; i > r; i--)
#define mod 1000000007
#define pb push_back
using namespace std;
typedef pair <int, int> pi;

int main(){
	fastIO
    int test = 1;
    // cin >> test;
    while(test--){
        int n; cin >> n;
        int arr_a[n], arr_b[n], arr_c[n];
        int i, j, k;
        f(i,0,n) cin >> arr_a[i] >> arr_b[i] >> arr_c[i];
        int pleasure[n][3];
        pleasure[0][0] = arr_a[0];
        pleasure[0][1] = arr_b[0];
        pleasure[0][2] = arr_c[0];
        f(i,1,n){
            pleasure[i][0] = arr_a[i] + max(pleasure[i-1][1], pleasure[i-1][2]);
            pleasure[i][1] = arr_b[i] + max(pleasure[i-1][0], pleasure[i-1][2]);
            pleasure[i][2] = arr_c[i] + max(pleasure[i-1][1], pleasure[i-1][0]);
        }
        cout << max(pleasure[n-1][0], max(pleasure[n-1][1], pleasure[n-1][2]));
    }
    return 0;
}


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

int n, m;
int memo[310][310][310];
const int MOD = 1000000007;

long long dp(int i, int ma, int all){
    if(i == m) return ma == n ? 1 : 0;
    if(memo[i][ma][all] != -1) return memo[i][ma][all];

    return memo[i][ma][all] = (dp(i+1, all, all)*ma%MOD + dp(i+1, ma, all)*(all-ma)%MOD + dp(i+1, ma, all+1)*(n-all)%MOD) % MOD;
}

signed main(){
    cin >> n >> m;
    memset(memo, -1, sizeof(memo));
    cout << dp(0, 1, 1) << endl;
    return 0;
}

Measured memory_bytes: 116608
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

char s[99];
int main(){
	scanf("%s",s);
	s[3]='8';
	puts(s);
}

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
template <class T>
T GCD(T a, T b)
{
    T r;
    while (a)
        r = b, b = a, a = r % a;
    return b;
}
template <class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repe(i, n) for (ll i = 0; i <= (n); i++)
#define repd(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<ll> vl;
#define ERASE(x) x.erase(unique(ALL(x)), x.end()); // erase same elements
#define VEC(type, c, n)     \
    std::vector<type> c(n); \
    for (auto &i : c)       \
        std::cin >> i;

// input
#define INIT                          \
    std::ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define VAR(type, ...) \
    type __VA_ARGS__;  \
    MACRO_VAR_Scan(__VA_ARGS__);
template <typename T>
void MACRO_VAR_Scan(T &t)
{
    std::cin >> t;
}
template <typename First, typename... Rest>
void MACRO_VAR_Scan(First &first, Rest &... rest)
{
    std::cin >> first;
    MACRO_VAR_Scan(rest...);
}

// output
template <typename T>
void MACRO_OUT(const T t) { std::cout << t; }

#define OUT(...) MACRO_OUT(__VA_ARGS__);
#define SP std::cout << " ";
#define TAB std::cout << "\t";
#define BR std::cout << "\n";
#define ENDL std::cout << std::endl;

#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define yes() printf("yes\n")
#define no() printf("no\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
    cout << a;
    ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
    cout << a << ' ';
}

ll ans = 0;
bool check = 0;
bool boo = 0;
string s, t;
int N = 3;
vector<int> v(N);
int a, b, c, d, n, m, k = 0;
int x = 0, y = 0;
int sum;
char ch;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// cout << (conditon ? (result:  == 1 ): (==0)) << endl; <- output result of if
// long long 型が表せる値の上限はおよそ 9 × 10＾18 です．
int main()
{
    INIT;

    // 18
    cin >> a >> b >> k;
    vi p(GCD(a, b));

    FOR(i, 1, GCD(a, b))
    {
        if (a % i == 0 && b % i == 0)
        {

            p[ans] = i;
            ans++;
        }
    }
    sort(ALL(p));
    pr(p[p.size() - k]);
    return 0;
}


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

#define fr(i,n) _back
#define pb	push_back
#define eb	emplace_back
#define mk	make_pair
#define fi	first
#define se	second
#define endl	'\n'

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int T = 1e5 + 5;

int pai[T];
int peso[T];
bool ok[T];

void init(int n) {
    for(int i = 1; i <= n; i++) {
        pai[i] = i;
        peso[i] = 1;
    }
}

int find(int x) {
    return (pai[x] == x? x : pai[x] = find(pai[x]));
}

void join(int x, int y) {
    x = find(x);
    y = find(y);

    if(x == y) return;
    if(peso[x] < peso[y]) swap(x,y);

    pai[y] = x;
    peso[x] += peso[y];
}

int main() {
    ios_base::sync_with_stdio(false);
    int n,m; cin >> n >> m;
    int ans = 0;
    init(n);

    while(m--) {
        int a,b,z; cin >> a >> b >> z;
        join(a,b);
    }

    for(int i = 1; i <= n; i++) if(!ok[find(i)]) ans++, ok[find(i)] = 1;
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 1152
#include <iostream>
#include <string>

using namespace std;

// -------------------------------------------
// 移動不可能マスが見つかるまで再帰的にカウントする
// 何連続で移動可能マスがあったのかを返す
// -------------------------------------------
void movableCheck(int *_movableNum, int _startPoint, bool _canMove[])
{

	if (_canMove[_startPoint + 1] == true)
	{
		*_movableNum += 1;
		movableCheck(_movableNum, _startPoint + 1, _canMove);
	}
	else
	{
		return;
	}
}


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

	const int MAX_N = 100000;

	bool canMove[MAX_N] = {};
	int preH = 0;
	int nowH = 0;
	// 各マスが右隣に移動可能なマスであるかを調べる
	for (int i = 0; i < n; i++)
	{
		cin >> nowH;

		if (i != 0)
		{
			if (preH >= nowH)
				canMove[i - 1] = true;
			else
				canMove[i - 1] = false;
		}

		preH = nowH;
	}

	int maxMove = 0;
	// 移動可能マスの最大連結数を調べる
	for (int i = 0; i < n; i++)
	{
		if (canMove[i] == true)
		{

			int movable = 1;
			movableCheck(&movable, i, canMove);

			if (movable > maxMove)
				maxMove = movable;

			i += movable;
		}
	}

	cout << maxMove;

	return 0;
}


Measured memory_bytes: 896
/***************************************************
 * Problem Name : C.cpp
 * Problem Link :
 * OJ           :
 * Verdict      : Trying
 * Date         : 2020-02-20
 * Problem Type :
 * Author Name  : Saikat Sharma
 * University   : CSE, MBSTU
 ***************************************************/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <cstdlib>
#include <deque>
#include <stack>
#include <bitset>
#include <cassert>
#include <map>
#include <set>
#include <cassert>
#include <iomanip>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;

#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define __FileRead freopen ("input.txt", "r", stdin)
#define __FileWrite freopen ("output.txt", "w", stdout)
#define SET(a,v) memset(a,v,sizeof(a))
#define SZ(v) (int)v.size()
#define pii pair<int,int>
#define pil pair <int, ll>
#define pli pair <ll, int>
#define pll pair <ll, ll>
#define debug cout <<"######\n"
#define debug1(x) cout <<"### " << x << " ###\n"
#define debug2(x,y) cout <<"# " << x <<" : "<< y <<" #\n"
#define nl cout << "\n";
#define sp cout << " ";
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pf(n) scanf("%d", n)
#define pfl(n) scanf("%lld", n)
#define all(v) v.begin(), v.end()
#define rall(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define r_srt(v) sort(v.rbegin(), v.rend())
#define rev(v) reverse(v.begin(), v.end())
#define Sqr(x) ((x)*(x))
#define Mod(x, m) ((((x) % (m)) + (m)) % (m))
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define pb push_back
#define mk make_pair
#define MAX 100005
#define INF 1000000009
#define MOD 1000000007

template<class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;
template<typename T>
using ordered_set  = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

template <typename T> string toString ( T Number ) {
    stringstream ss;
    ss << Number;
    return ss.str();
}
template<typename T> int toInt (T str) {
    stringstream ss;
    ss << str;
    int num;
    ss >> num;
    return num;
}
ll lcm (ll a, ll b) {
    return a * b / __gcd (a, b);
}
/************************************ Code Start Here ******************************************************/
int main () {
    //~ __FastIO;
    //~ cout << setprecision (10);
    //~ cout << fixed;
    int n;
    cin >> n;
    set<int>st;
    for(int i = 0;i<n; i++){
		int x;
		cin >> x;
		st.insert(x);
	}
	if((int)st.size() != n)cout << "NO\n";
	else cout << "YES\n";
    return 0;
}


Measured memory_bytes: 9600
N,A,B,C = map(int,input().split())
L = [int(input()) for i in range(N)]
ans = 1e9
a = list()
b = list()
c = list()
for i in range(1<<N):
	for j in range(1<<N):
		res = 0
		a.clear()
		b.clear()
		c.clear()
		for k in range(N):
			if i&(1<<k):
				if j&(1<<k):
					a.append(L[k])
				else:
					b.append(L[k])
			elif j&(1<<k):
				c.append(L[k])
		if len(a)==0 or len(b)==0 or len(c)==0:
			continue
		res += 10*(len(a)-1)+abs(A-sum(a))+10*(len(b)-1)+abs(B-sum(b))+10*(len(c)-1)+abs(C-sum(c))
		ans = min(ans,res)

print(ans)

Measured memory_bytes: 3064
def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]
def zeros(n): return [0]*n

INF = 10**18

class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                w = cmt + ': ' + str(x)
            else:
                w = str(x)
            print(w)
        return x


def prob():
    d = Debug()
    d.off()
    C = zeros(2)
    C[0], C[1], K = getIntList()
    d.dmp((C,K), "C,K")
    for i in range(K):
        n = i % 2
        if C[n] % 2 == 1:
            C[n] -= 1
        C[1-n] += C[n] // 2
        C[n] //= 2
        d.dmp((C,i,n), "C,i,n")
    print(C[0],C[1])

ans = prob()


Measured memory_bytes: 3064
///#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
///#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,popcnt,avx,avx2,tune=native")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

/*
    zet:
        find_by_order(k): k-stat [k > 0]
        order_of_key(k) : {el < k}

    gp_hash_table<key, val, custom_hash>

    rope<T>:
        iterators: mutable_begin, ..
        methods  : erase, insert, substr, ..
*/

#define all(x) (x).begin(), (x).end()
#define size(x) (int)((x).size())
#define em_back emplace_back

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<typename T>
using zet = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

mt19937 eng(chrono::steady_clock::now().time_since_epoch().count());

const ll INF = 1e18;

ll n, a;

ll mult(ll x, ll y) {
    if ((ld)INF / y < x) {
        return INF;
    }
    return x * y;
}

ll tmult(ll s, int k) {
    ll t1 = s / k + 1;
    ll t2 = s / k;

    ll res = 1;
    for (int i = 0; i < s % k; ++i) {
        res = mult(res, t1);
    }
    for (int i = 0; i < k - s % k; ++i) {
        res = mult(res, t2);
    }

    return res;
}

ll calc(int k) {
    ll res = a * (k - 1);

    ll l = 0, r = 1e18;
    while (l + 1 < r) {
        ll m = (l + r) >> 1;
        if (tmult(m, k) < n) {
            l = m;
        } else {
            r = m;
        }
    }

    return res + r;
}

void solve() {
    cin >> n >> a;

    ll res = 1e18;
    for (int k = 1; k < 44; ++k) {
        res = min(res, calc(k));
    }

    cout << res << "\n";
}

int main() {
    ios::sync_with_stdio(0);
    cout.tie(0), cin.tie(0);

    int z = 1;
    /// cin >> z;

    while (z--) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3640
H, W = map(int, input().split())
S = [list(input()) for i in range(H)]
A = [['#' for i in range(W)] for j in range(H)]
for i in range(H):
    for j in range(W):
        if S[i][j] == '.':
            a = 0
            if i > 0 and j > 0:
                if S[i - 1][j - 1] == '#':
                    a += 1
            if i > 0:
                if S[i - 1][j] == '#':
                    a += 1
            if i > 0 and j < W - 1:
                if S[i - 1][j + 1] == '#':
                    a += 1
            if j > 0:
                if S[i][j - 1] == '#':
                    a += 1
            if j < W - 1:
                if S[i][j + 1] == '#':
                    a += 1
            if i < H - 1 and j > 0:
                if S[i + 1][j - 1] == '#':
                    a += 1
            if i < H - 1:
                if S[i + 1][j] == '#':
                    a += 1
            if i < H - 1 and j < W - 1:
                if S[i + 1][j + 1] == '#':
                    a += 1
            A[i][j] = a
for i in range(H):
    ans = [str(a) for a in A[i]]
    ans = ''.join(ans)
    print(ans)

Measured memory_bytes: 8996
N = int(input())
import collections
import math
cnt = 0
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
c = collections.Counter(prime_factorize(N))
v = c.values()
for i in v:
	cnt += math.floor((math.sqrt(8*i+1)-1)/2)
print(cnt)

Measured memory_bytes: 9492
N = int(input())
IN = list(map(int,input().split()))
c = 0
flag = 1
while flag:
    flag = 0
    for j in range(N-1,0,-1):
        if IN[j] < IN[j-1]:
            temp = IN[j-1]
            IN[j-1] = IN[j]
            IN[j] = temp
            flag = 1
            c +=1
print(*IN)
print(c)


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

int main(){
	int N, T, c[120], t[105];
	cin >> N >> T;
	
	for(int i=0; i<N; i++){
		cin >> c[i] >> t[i];
	}
	int ans = 99999;
	
	for(int i=0;i<N;i++){
		if(t[i] <= T){
			if(c[i]  <= ans){
				ans = c[i];
			}
		}
	}
	if(ans < 99999){
		cout << ans << endl;
	}
	else{
		cout << "TLE" << endl;
	}
	return 0;
    }

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    string s;
    int r_cnt = 0;

    cin >> s;

    for ( int i = 0; i < 3; i++ )
    {
        if ( s[ i ] == 'R' )
        {
            r_cnt++;
        }
        else if ( r_cnt != 0 )
        {
            break;
        }
    }

    cout << r_cnt << '\n';

    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <stack>
#include <bitset>
#include <utility>
#include<iomanip>
// #include <numeric>
using namespace std;



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector<vector<ll>> vvint;
typedef vector<string> vstring;
typedef vector<vector<string>> vvstring;
typedef vector<char> vchar;
typedef vector<vector<char>> vvchar;
typedef vector<long double> vdouble;
typedef vector<vector<long double>> vvdouble;
typedef vector<vector<vector<long double>>> vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define INT_MAX 2147483647
#define LLONG_MAX 9223372036854775807
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define DIVIDER 1000000007


//
// struct Node{
//   vint children;
//   ll index;
//   ll prop;
// };
// struct edge{ll to; ll cost;};



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

// ll X,Y,Z,K;
// ll pmax = 30000000000;
// vint A,B,C;




// int binary_search(int key){
//  //isOKを満たす要素のうち最小のインデックスを返す。（要ソート）
//   int left = -1;
//   int right = N;
//
//   while(right - left > 1){
//     int mid = left + (right - left)/2;
//
//     if(isOK(mid, key)) right=mid;
//     else left=mid;
//   }
//
//   return right;
// }

// ll gcd(ll m, ll n){
//   if(m<n) swap(m,n);
//   if(n==0) return m;
//   return gcd(n, m%n);
// }

// ll get_pow(ll x, ll y){
//   ll ret=0;
//   ll temp = y;
//   while(true){
//     if(x<=temp) break;
//     ret++;
//     temp *= 2;
//   }
//   return ret;
// }






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


  ll A,B,C;cin>>A>>B>>C;
  ll ans;

  if(A%2==1 && B%2==1 && C%2==1){
    ans = min(min(A*B,B*C), C*A);
  }else{
    ans = 0;
  }

  cout << ans << endl;
}

















//


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100000
int par(int);
int lef(int);
int rig(int);

int par(int i){
  int a;
  a=i/2;
  return a;
}
int lef(int i){
  int a;
  a=2*i;
  return a;
}
int rig(int i){
  int a;
  a=2*i+1;
  return a;
}

int main()
{
  int H,i,A[MAX+1];

  scanf("%d",&H);
  for(i=1;i<=H;i++)scanf("%d",&A[i]);
  for(i=1;i<=H;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if( par(i) >=1)printf("parent key = %d, ",A[par(i)]);
    if( lef(i) <=H)printf("left key = %d, ",A[lef(i)]);
    if( rig(i) <=H)printf("right key = %d, ",A[rig(i)]);
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 2120
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <iostream>
#define MAXN 105
using namespace std;
char star[MAXN];
int main()
{
    cin >> star;
    int ans = 0, len = strlen(star);
    for(int i = 0; i < len; i++)
    {
        if(star[i] == 'C') ans = 1;
        else if(ans && star[i] == 'F')
        {
            ans = 2;
            break;
        }
    }
    if(ans == 2) puts("Yes");
    else
        puts("No");
    return 0;
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define log_2(a) (log((a)) / log(2))
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int N;
    cin >> N;
    string s;
    cin >> s;
    map<string, bool> mp;
    mp[s] = true;

    for(int i = 1; i < N; ++i) {
        string t;
        cin >> t;
        if(s[s.size() - 1] != t[0] || mp[t]) {
            cout << "No" << endl;
            return 0;
        }
        mp[t] = true;
        s = t;
    }

    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3632
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    sps <- map ((\(x:y:_) -> (x, (read y :: Int))) . words) <$> replicateM n getLine
    mapM_ print . map (\(_, k) -> k) . sortOn (fst . fst) . reverse . sortOn (snd . fst) $ zip sps [1..n]

Measured memory_bytes: 1020
import sys

if sys.subversion[0] == "PyPy":
    import io, atexit

    sys.stdout = io.BytesIO()
    atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

    sys.stdin = io.BytesIO(sys.stdin.read())
    input = lambda: sys.stdin.readline().rstrip()
RS = raw_input
RA = lambda x=int: map(x, RS().split())
RN = lambda x=int: x(RS())


def solve():
    max = 0
    ans = 0
    for i in range(n):
        if max > a[i]:
            ans += max - a[i]
        else:
            max = a[i]
    print(ans)
    return






n = RN()
a = RA()
solve()

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

long long n,m,a,c;
bool b;

int main(){
    cin>>n;
    vector<int>v(n,0);
    for (int i=0; i<n; i++){
        cin>>v[i];
    }
    for (int i=0; i<n; i++){
        for (int j=i+1; j<n; j++){
            a+=v[i]*v[j];
        }
    }
    cout<<a<<endl;
}


Measured memory_bytes: 3572
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#define ll long long
using namespace std;

int main(void){
    char a,b;
    cin >> a >> b;
    if(a==b){
        cout << 'H' << endl;
    }else{
        cout << 'D' << endl;
    }
    

    
    return 0;
}

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

typedef long long ll;
const ll INF = 1LL<<60, MOD = 1e9 + 7;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const ll dx[] = {1,0,-1,0};
const ll dy[] = {0,1,0,-1};
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define all(v) (v).begin(), (v).end()
#define m_p make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    double a,b,x;
    cin >> a >> b >> x;
    double s = x/a,rad;
    if(s>=a*b/2){
        double h = (a*b-s)*2/a;
        rad = atan2(h,a);
    }else{
        double w = s*2/b;
        rad = atan2(b,w);
    }
    double deg = (rad/PI) * 180;
    printf("%.10f\n",deg);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n,m;
char c[101][101];
bool ok,b[101];
int main()
{ cin>>n>>m;
  for(int i=1;i<=n;i++)
  { ok=0;
    for(int j=1;j<=m;j++)
    { cin>>c[i][j];
      if(c[i][j]=='#')
         ok=1,b[j]=1;
    }
    if(!ok)
       i--,n--;
  }
  for(int i=1;i<=n;i++)
  { for(int j=1;j<=m;j++)
    { if(b[j])
         cout<<c[i][j];
    }
    cout<<'\n';
  }
  return 0;
}


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

#define INF 1000000000

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    int k, n, af, ap, a, ans = INF;
    cin >> k >> n >> ap;
    af = ap;
    for (int i = 1; i < n; ++i) cin >> a, ans = min(ans, k - (a - ap)), ap = a;
    cout << min(ans, ap - af) << endl;
    return 0;
}


Measured memory_bytes: 764
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/25 15:27:00 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>

/* #include <boost/multi_array.hpp> */
/* #include <boost/optional.hpp> */
/* #include <boost/range/irange.hpp> */
/* #include <boost/range/algorithm.hpp> */
/* #include <boost/range/adaptors.hpp> */
/* #include <boost/multiprecision/cpp_int.hpp> */
/* #include <boost/algorithm/string/classification.hpp> // is_any_of */
/* #include <boost/algorithm/string/split.hpp> */
/* #include <boost/algorithm/string/join.hpp> */
/* #include <boost/algorithm/string/replace.hpp> */
/* #include <boost/math/tools/minima.hpp> */
/* namespace adaptor = boost::adaptors; */
/* using boost::math::tools::brent_find_minima; */
/* using boost::irange; */
/* using boost::algorithm::join; */
/* using boost::algorithm::split; */
/* using boost::algorithm::replace_all; */
/* using boost::multiprecision::cpp_int; */

#define MOD 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

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

// TOP
void	Main()
{
	double	n, p;
	cin >> n >> p;
	double	odd;
	double	even;
	odd = even = 0;
	rep(i, n)
	{
		ll	x;
		cin >> x;

		if (x % 2)
			odd++;
		else
			even++;
	}
	if (odd == 0)
	{
		if (p == 1)
			cout << 0 << endl;
		else
			cout << pow(2.0, even) << endl;
		return ;
	}
	cout << pow(2.0, even) * pow(2.0, (odd - 1) * 1.0) << endl;
}
// END

int		main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(0);
	Main();
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
static const int MAX=100;
int main(void)
{
	int n;
	string N[MAX];
	char front;
		
	cin >> n;
	cin >> N[0];
	front=N[0][N[0].size()-1];
	
	for(int i=1;i<n;i++)
	{
		cin >> N[i];
	}
	for(int i=1;i<n;i++){
		char mas=N[i][0];
		if(mas!=front){
			cout << "No" << endl;
			return 0;
		}
		for(int j=0;j<i;j++)
		{
			if(N[i]==N[j]){
				cout << "No" << endl;
				return 0;
			}
		}
		front=N[i][N[i].size()-1];
	}
	cout << "Yes" << endl;
	return 0;
	
	return 0;
}

Measured memory_bytes: 256