akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
struct rect {
	int h;
	int w;
};
int main() {
	vector<pair<int, int>>ps;
	for (int y = 1; y <= 150; ++y) {
		for (int x =y+1; x <= 150; ++x) {
			ps.push_back(make_pair(y, x));
		}
	}
	sort(ps.begin(), ps.end(), [](const pair<int, int>&l, const pair<int, int>&r) {
		const int ldig = l.first*l.first + l.second*l.second;
		const int rdig = r.first*r.first + r.second*r.second;
		return ldig == rdig ? l.first < r.first : ldig < rdig;
	});
	while (1) {
		int h, w; cin >> h >> w;
		if (!h)break;
		pair<int, int>p(h, w);
		auto it = upper_bound(ps.begin(), ps.end(),p, [](const pair<int, int>&l, const pair<int, int>&r) {
			const int ldig = l.first*l.first + l.second*l.second;
			const int rdig = r.first*r.first + r.second*r.second;
			return ldig == rdig ? l.first < r.first : ldig < rdig;
		});
		cout << it->first << " " << it->second << endl;
	}
	return 0;
}

Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std;
using ll=long long;

ll T(ll n){
  return n*(n+1)/2;
}

int main(){
  int i,j,cnt=0;
  string s;
  cin>>s;
  if(s[0]=='>')s='<'+s;
  if(s[s.size()-1]=='<')s+='>';
  int n=s.size();
  ll p[n];
  for(i=0;i<n;i++)p[i]=1;
  for(i=1;i<n;i++){
    if(s[i]==s[i-1]){
      p[cnt]++;
    }else cnt++;
  }
  ll sum=0;
  for(i=0;2*i+1<=cnt;i++){
    sum+=T(max(p[2*i],p[2*i+1]))+T(min(p[2*i],p[2*i+1])-1);
  }
  cout<<sum;
}

Measured memory_bytes: 4760
# coding: utf-8

"""

o 999
o 2 3
x 2 0 2
o 2 1 2
x 2 1 2 1
o 2 1 3 1
o 2 1 3 2
o 3 1 3
x 3 2 3
o 3 2 2

- 0は両端のみ
- 偶奇の切り替わりが2回以下

0 zzoo
1 zzee
2 zzooee
3 zzeeoo
4 zzeeooee
5 zz
6 ???zz
"""

L = input()
A = [input() for _ in range(L)]

T = [L,L,L,L,L,0,L]
for a in A:
  P = T
  o = 1-a%2
  e = 1-o
  if a==0:
    e = 2
  T = [
    min(P[0]+o, P[5]+o),
    min(P[1]+e, P[5]+e),
    min(P[2]+e, P[0]+e),
    min(P[3]+o, P[1]+o),
    min(P[4]+e, P[3]+e),
    P[5]+a,
    min(P)+a,
  ]
  #print a, T
print min(T)



Measured memory_bytes: 15364
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import deque
# people on a line
n, m = map(int, input().split())

graph = {i: {} for i in range(1, n + 1)}


for _ in range(m):
    a, b, c = map(int, input().split())
    graph[a][b] = c
    graph[b][a] = -c



distance = ["inf" for i in range(n + 1)]

# グラフにおいて順に点を決めてって、矛盾がないかどうかを調べる
visited = [False for i in range(n + 1)]
visited[0] = True


def find(x):
    d = deque()
    visited[x] = True
    distance[x] = 0
    d.append(x)
    flag = True
    while d and flag:

        x = d.popleft()
        for node in graph[x]:
            if visited[node] == False:
                visited[node] = True
                d.append(node)
                if distance[node] == "inf":
                    distance[node] = distance[x] + graph[x][node]
                else:
                    if  distance[node] != distance[x] + graph[x][node]:
                        flag = False
                        break
            elif visited[node]==True:
                if distance[node]!=distance[x]+graph[x][node]:
                    flag=False
                    break
         
    if flag:
        return False
    else:
        return True

all_flag = True
not_visited = True
while not_visited and all_flag:
    judge = False
    for i in range(1, n + 1):
        if visited[i] == False:
            judge = True
            if find(i):
                all_flag = False
                break
            else:
                pass

    if not judge:
        not_visited = False

if all_flag:
    print("Yes")

else:
    print("No")


Measured memory_bytes: 72712
#include <iostream>
long long n,k,a,i,m=1e9+7;
main(){std::cin>>n>>k;for(i=k;n+1>=i;i++)a=(a+((n*(n+1)-(n-i+1)*(n-i)-i*(i-1))/2+1))%m;std::cout<<a<<"\n";}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n)for(unsigned long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const int MAX = 510000;


int main() {
  int n,k;
  cin >> n >> k;
  ll s;
  cin >> s;
  rep(i,k){
    cout << s <<" ";
  }
  rep(i,n-k){
    if(s!=1) cout << s-1 <<" ";
    else cout << 2 <<" ";
  }
  cout << endl;
}


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

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

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Robo[] r = new Robo[n];
		for(int i = 0 ; i < n ; i++) {
			r[i] = new Robo(sc.nextInt() ,sc.nextInt());
		}
		Arrays.sort(r);
		int count = 0;
		int now = Integer.MIN_VALUE;
		for(int i = 0 ; i < n ; i++) {
			Robo r2 = r[i];
			if(r2.x - r2.l >= now) {
				count++;
				now = r2.x + r2.l;
			}
		}

		sc.close();
		System.out.println(count);

	}
}
class Robo implements Comparable<Robo>{
	public Robo(int x , int l) {
		this.x = x;
		this.l = l;
	}
	int x,l;
	@Override
	public int compareTo(Robo r) {
		return (this.x + this.l) - (r.x + r.l);
	}
}



Measured memory_bytes: 62248
#include<stdio.h>
#define swap(a,b)({a ^= b; b ^= a; a ^= b;})
int main(){
    int n, i, j, a[101], count;

    scanf("%d", &n);
    for(i=0;i<n;i++){
        scanf("%d", &a[i]);
    }
    count=0;
    for(i = 0; i<n; i++){
        for(j = n-1; j>= i+1; j--){
            if(a[j] < a[j-1]){
                swap(a[j], a[j-1]);
                count++;
            }
        }
    }
    for(i=0;i<n-1;i++)printf("%d ", a[i]);printf("%d\n", a[i]);
    printf("%d\n", count);

return 0;
}



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

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

class Sol{
	public void Solve(){
		int N = ri();
        int[] LArray = ria();

        string ans = "No";
        int lengthSum = 0;
        int longestLIndex = 0;
        int longestLLength = 0;
        for (int i = 0; i < N; i++)
        {
            lengthSum += LArray[i];
            if(LArray[i] > longestLLength) {
                longestLIndex = i;
                longestLLength = LArray[i];
            }
        }

        if(LArray[longestLIndex] < lengthSum - LArray[longestLIndex]) ans = "Yes";

		Console.WriteLine(ans);
		Console.ReadLine();
	}

	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));}
    static int[] generateNums(int num, int N){return Enumerable.Repeat(num, N).ToArray();}
    static int[] generateSuretsu(int N){return Enumerable.Range(0, N).ToArray();}
}

public static class Combination {
	//使い方:int[][] Is = Combination.Enumerate(nums, k, withRepetition:false).ToArray();
    public static IEnumerable<T[]> Enumerate<T>(IEnumerable<T> items, int k, bool withRepetition) {
        if (k == 1) {
            foreach (var item in items)
                yield return new T[] { item };
            yield break;
        }
        foreach (var item in items) {
            var leftside = new T[] { item };

            // item よりも前のものを除く （順列と組み合わせの違い)
            // 重複を許さないので、unusedから item そのものも取り除く
            var unused = withRepetition ? items : items.SkipWhile(e => !e.Equals(item)).Skip(1).ToList();

            foreach (var rightside in Enumerate(unused, k - 1, withRepetition)) {
                yield return leftside.Concat(rightside).ToArray();
            }
        }
    }
}


Measured memory_bytes: 27524
[A,B,M] = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))

xyc = []
for i in range(M):
    xyc.append(list(map(int,input().split())))

#Not discount
Nd = min(a) + min(b)

#discount
out = Nd
for i in range(M):
    d = a[xyc[i][0] -1] + b[xyc[i][1] -1] - xyc[i][2]
    if d < out:
        out=d

print(out)


Measured memory_bytes: 82028
#include <iostream>
#include <string>
using namespace std;
int main(){
    string s;
    cin>>s;
    int n=s.size();
    for(int i=0;i<n;i++){
        if(i%2==0&&s[i]=='L'){
            cout<<"No"<<endl;
            return 0;
        }if(i%2==1&&s[i]=='R'){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
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; }
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	int cnt(0);
	vector<int> v(N); rep(i, 0, N) { cin >> v[i]; }
	int m = *min_element(all(v));
	int M = *max_element(all(v));
	if (M - m > 1) {
		cout << "No" << endl;
	}
	else if(M-m==0) {
		if (m <= N / 2 || m == N - 1)cout << "Yes" << endl;
		else cout << "No" << endl;
		
	}
	else {
		int p(0), q(0);
		rep(i, 0, N)if (v[i] == M)q++;
		p = N - q;
		if (p >= M )cout << "No" << endl;
		else if (M <= p + q / 2)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 640
let main () =
  let a, b, c = Scanf.scanf "%d %d %d\n" (fun a b c -> ref a, ref b, ref c) in
  let k = Scanf.scanf "%d\n" (fun a -> a) in
  for i = 0 to k - 1 do
    if a >= b && b >= c then a := !a * 2 else
    if a <= b && b >= c then b := !b * 2 else c := !c * 2
  done;
  Printf.printf "%d\n" (!a + !b + !c);;

let _ = main ()


Measured memory_bytes: 2432
A = list(map(int, input().split()))
A += list(map(int, input().split()))
A += list(map(int, input().split()))
flag=0
for a1 in range(101):
    for a2 in range(101):
        for a3 in range(101):
            b1=A[6]-a1
            b2=A[7]-a1
            b3=A[8]-a1
            if b1<0 or b2<0 or b3<0:
                break
            if a3+b1==A[0] and a3+b2==A[1] and a3+b3==A[2] and a2+b1==A[3] and a2+b2==A[4] and a2+b3==A[5]:
                flag=1
print("Yes" if flag==1 else "No")


Measured memory_bytes: 73504
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)


struct Forest_Uni {
	vector<UL> v;
	UL Sz;
	void init(UL n) {
		Sz = n;
		v.clear();
		rep(i, n) v.push_back(i);
	}
	void add() { v.push_back(v.size()); }
	UL root(UL p) {
		if (v[p] == p) return p;
		return v[p] = root(v[p]);
	}
	void unite(UL a, UL b) {
		UL A = root(a);
		UL B = root(b);
		if (A != B) {
			Sz--;
			v[A] = B;
		}
	}
};

struct Problem {

	void Solve() {
		UL N; cin >> N;
		vector<vector<UL>> E(N);
		rep(i, N - 1) {
			UL u, v; cin >> u >> v; u--; v--;
			E[u].push_back(v);
			E[v].push_back(u);
		}
		vector<UL> D(N);
		queue<UL> Q; Q.push(0); D[0] = 1;
		while (Q.size()) {
			UL p = Q.front(); Q.pop();
			for (UL e : E[p]) {
				if (D[e] != 0) continue;
				D[e] = 3 - D[p];
				Q.push(e);
			}
		}
		UL DS[2] = {};
		rep(i, N) DS[D[i] - 1]++;
		if (DS[0] < DS[1]) {
			rep(i, N) D[i] = 3 - D[i];
			swap(DS[0], DS[1]);
		}
		vector<UL> ans(N, -1);
		if (DS[1] <= N / 3) {
			vector<UL> used(N);
			UL p = 2;
			rep(i, N) if (D[i] == 2) {
				ans[i] = p; used[p] = 1;
				p += 3;
			}
			p = 0;
			rep(i, N) if (D[i] == 1) {
				while (used[p]) p++;
				ans[i] = p; used[p] = 1;
			}
		}
		else {
			vector<UL> used(N);
			UL p = 1;
			rep(i, N) if (D[i] == 2) {
				ans[i] = p; used[p] = 1;
				p += 3;
				if (p >= N) break;
			}
			p = 0;
			rep(i, N) if (D[i] == 1) {
				ans[i] = p; used[p] = 1;
				p += 3;
				if (p >= N) break;
			}
			p = 0;
			rep(i, N) if (ans[i] == -1) {
				while (used[p]) p++;
				ans[i] = p; used[p] = 1;
			}
		}

		rep(i, N) {
			if (i) cout << " ";
			cout << (ans[i] + 1);
		} cout << endl;

	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}

Measured memory_bytes: 15340
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define endl '\n'
#define all(x) (x).begin(),(x).end()
const int INF=1000000000+5;
const int N=10000+5;
const ll oo=1e18+5;
const ll mod=998244353;

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

int h,w,k;
vector<vector<vector<pair<int,int>>>> nxt;
vector<string> a;
vector<vector<int>> dp;

pair<int,int> go(int x,int y,int dir){
	int new_x=nxt[x][y][dir].first;
	int new_y=nxt[x][y][dir].second;
	if(new_x<0||new_y<0||new_x>=h||new_y>=w) return nxt[x][y][dir];
	if(a[new_x][new_y]=='@') return nxt[x][y][dir];
	if(dp[new_x][new_y]<INF) return nxt[x][y][dir]=go(new_x,new_y,dir);
	return nxt[x][y][dir];
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>h>>w>>k;
	nxt.resize(h);
	for(int i=0;i<h;++i){
		nxt[i].resize(w);
		for(int j=0;j<w;++j){
			nxt[i][j].resize(4);
			for(int dir=0;dir<4;++dir){
				nxt[i][j][dir]=make_pair(i+dx[dir],j+dy[dir]);
			}
		}
	}
	int x1,y11,x2,y2;
	cin>>x1>>y11>>x2>>y2;
	--x1;
	--y11;
	--x2;
	--y2;
	a.resize(h);
	for(int i=0;i<h;++i) cin>>a[i];
	dp.resize(h,vector<int>(w,INF));
	dp[x1][y11]=0;
	queue<pair<int,int>> Q;
	Q.push({x1,y11});
	while(!Q.empty()){
		int x=Q.front().first;
		int y=Q.front().second;
		Q.pop();
		for(int dir=0;dir<4;++dir){
			int xx=x;
			int yy=y;
			while(1){
				pair<int,int> cur=go(xx,yy,dir);
				int new_x=cur.first;
				int new_y=cur.second;
				if(new_x<0||new_y<0||new_x>=h||new_y>=w) break;
				if(a[new_x][new_y]=='@') break;
				int dist=abs(x-new_x)+abs(y-new_y);
				if(dist>k) break;
				xx=new_x;
				yy=new_y;
				if(dp[x][y]+1<dp[xx][yy]){
					dp[xx][yy]=dp[x][y]+1;
					Q.push({xx,yy});
				}
			}
		}
	}
	if(dp[x2][y2]==INF) cout<<-1;
	else cout<<dp[x2][y2];
	return 0;
}


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

int main(){

	int x,n,i,Max,Min;
	long long Sum;

	cin >> n;
    cin >> x;

    Max = x;
    Min = x;
    Sum = (long long)x;

	for( i=1; i<n; i++){
        
        cin >> x;		
		Sum += (long long)x;
		
		if( Max - x < 0 ) Max = x;
		if( Min - x > 0 ) Min = x;

	}

	cout << Min << " " << Max << " " << Sum << endl;


	return 0;   

} 

Measured memory_bytes: 3068
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        char[] N = sc.next().toCharArray();
        int res=0;
        
        for(int i=0; i<N.length; i++){
            res = (res + Character.getNumericValue(N[i]))%9;
        }
        
        if(res%9==0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
        
        
        
        }
    }

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define D()
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

int main(void) {
    long int K,A,B,ans;
    cin >> K >> A >> B; 

for(int i = A; i <= B; ++i){
    if(i % K == 0){
        printf("OK\n");
        return 0;
    }
}
printf("NG\n");
  return 0;
}

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

using namespace std;

#define INF (1<<29)
#define INFF 0x7fffffff
#define LINF (1ll<<60)
#define LINFF 0x7fffffffffffffff
#define PI 3.14159265359

#define _fi(n) for(int i = 0;i < n;i++)
#define _fj(n) for(int j = 0;j < n;j++)
#define _fk(n) for(int k = 0;k < n;k++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define prec(x) cout << fixed << setprecision(x)

#define hash sodnf9843bsd
#define ll long long
#define pqueue priority_queue
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define endl '\n'

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll a, ll b){return uniform_int_distribution<ll>(a, b)(rng);}

const ll mod = 1e9+7;
char arr[1010][1010];

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


    int n, m;cin>>n>>m;
    _fi(n)_fj(m) cin>>arr[i][j];

    ll dp[1010][1010] = {};
    for(int i = 0;i < n;i++) {
        if (arr[i][0] == '#') break;
        dp[i][0] = 1;
    }
    for(int j = 0;j < m;j++){
        if (arr[0][j] == '#') break;
        dp[0][j] = 1;
    }

    for(int i = 1;i < n;i++){
        for(int j = 1;j < m;j++){
            if (arr[i][j] == '#') continue;
            dp[i][j] = (dp[i-1][j]+dp[i][j-1]) % mod;
        }
    }

    cout << dp[n-1][m-1] << endl;


    return 0;
}


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;



int main() {
    li a, b, c, k;
    cin >> a >> b >> c >> k;
    if (k % 2 > 0) {
        cout << b - a << endl;
    } else {
        cout << a - b << endl;
    }

    return 0;
}

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

#ifndef MAX
#define MAX 400000
#endif

//Range Update Query+Range Minimum Query
template<class T>
class RUQ_RMQ {
public:
	int n;
	T dat[MAX], lazy[MAX], DEFAULT;
	bool(*cmp)(T, T);
	void init(int n_,
		bool(*c)(T, T) = [](int a, int b) {return a < b; }, T d = INT_MAX) {
		cmp = c;
		DEFAULT = d;
		n = 1; while (n < n_)n <<= 1;
		for (int i = 0; i < 2 * n - 1; i++) {
			dat[i] = lazy[i] = DEFAULT;
		}
	}
	inline void push(int k) {
		if (lazy[k] == DEFAULT)return;
		dat[k] = lazy[k];
		if (k < n - 1) {
			lazy[k * 2 + 1] = lazy[k];
			lazy[k * 2 + 2] = lazy[k];
		}
		lazy[k] = DEFAULT;
	}
	inline void update_node(int k) {
		if (cmp(dat[k * 2 + 1], dat[k * 2 + 2]))dat[k] = dat[k * 2 + 1];
		else dat[k] = dat[k * 2 + 2];
	}
	inline void update(int a, int b, T x, int k, int l, int r) {
		push(k);
		if (r <= a || b <= l)return;
		if (a <= l&&r <= b) {
			lazy[k] = x; push(k); return;
		}
		update(a, b, x, k * 2 + 1, l, (l + r) / 2);
		update(a, b, x, k * 2 + 2, (l + r) / 2, r);
		update_node(k);
	}
	inline T query(int a, int b, int k, int l, int r) {
		push(k);
		if (r <= a || b <= l)return DEFAULT;
		if (a <= l&&r <= b)return dat[k];
		T lb = query(a, b, k * 2 + 1, l, (l + r) / 2);
		T rb = query(a, b, k * 2 + 2, (l + r) / 2, r);
		update_node(k);
		if (cmp(lb, rb))return lb;
		return rb;
	}
	inline void update(int a, int b, T x) {
		update(a, b, x, 0, 0, n);
	}
	inline void update(int a, T x) {
		update(a, a + 1, x);
	}
	inline T query(int a, int b) {
		return query(a, b, 0, 0, n);
	}
	inline T query(int a) {
		return query(a, a + 1);
	}
};

RUQ_RMQ<int>seg;
P p[100000];
int main(){
	int w,h,n;scanf("%d%d%d",&w,&h,&n);
	seg.init(n,[](int a,int b){return a>b;},0);
	rep(i,n){
		scanf("%d%d",&p[i].first,&p[i].second);
	}
	sort(p,p+n,[](P a,P b){
		if(a.first==b.first)return a.second>b.second;
		return a.first<b.first;
	});
	rep(i,n){
		seg.update(i,p[i].second);
	}
	int Min=INT_MAX;
	rep(i,n+1){
		Min=min(Min,(i==0?0:p[i-1].first)+seg.query(i,n));
	}
	cout<<Min<<endl;
}

Measured memory_bytes: 6084
n = int(input())
l = [ int(input().rstrip()) for i in range(n)]

s = {}
for i in l:
    if i - 1 in s:
        s[i] = s[i - 1] + 1
        del s[i - 1]
    else:
            s[i] = 1
print(n - max(s.values()))


Measured memory_bytes: 29472
#include<bits/stdc++.h>
using namespace std; 
int main(){
	ios::sync_with_stdio(false);  
	cin.tie(0);  
	int k;  
	cin>>k; 
	for(int i=0;i<k;i++) 
		cout<<"ACL"; 
	cout<<'\n';  
	return 0; 
} 


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

int main(){
  int N,M;
  cin >> N;
  deque<int> dd,dt;
  for(int i=0;i<N;i++){
    int D;
    cin >> D;
    dd.push_back(D);
  }
  cin >> M;
  for(int i=0;i<M;i++){
    int T;
    cin >> T;
    dt.push_back(T);
  }
  sort(dd.begin(),dd.end());
  sort(dt.begin(),dt.end());
  while(1){
    if(dd.size()<dt.size()){
      cout << "NO" << endl;
      return 0;
    }
    if(dt.size()==0){
      break;
    }
    if(dd.front()==dt.front()){
      dd.pop_front();
      dt.pop_front();
    }else if(dd.front()>dt.front()){
      cout << "NO" << endl;
      return 0;
    }else{
      dd.pop_front();
    }
  }
  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 4820
import 'dart:io';

void main() {
    int k = int.parse(stdin.readLineSync());
    List<String> anb = stdin.readLineSync().split(" ");
    int a = int.parse(anb[0]);
    int b = int.parse(anb[1]);
    
    int largest = (b ~/ k) * k;
    if (a <= largest) {
      print('OK');
    } else {
      print('NG');
    }
}

Measured memory_bytes: 13148
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }

int main() {
  int n, W;
  cin >> n >> W;
  vector<int> weight(n);
  vector<int> value(n);
  for (int i=0; i<n; i++) {
    cin >> weight[i] >> value[i];
  }
  // dp[i+1][w]: i番目までの荷物の中での価値の最大値、重さがwを超えないように選んだ時の  
  ll dp[n+1][W+1];
  
  // dp initialize
  for (int w=0; w<=W; ++w) {
    dp[0][w] = 0;
  }

  // dp loop
  for (int i=0; i<n; ++i) {
    for (int w=0; w<=W; ++w) {
      if (w >= weight[i]) {
	dp[i+1][w] = max(dp[i][w-weight[i]] + value[i], dp[i][w]);
      } else {
	dp[i+1][w] = dp[i][w];
      }
    }
  }
  cout << dp[n][W] << endl;
  return 0;
}


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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  if(A == 5 && B == 5 && C ==7){
    cout << "YES" << endl;
  }
  else if(A == 5 && B == 7 && C ==5){
    cout << "YES" << endl;
  }
  else if(A == 7 && B == 5 && C ==5){
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

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

int main()
{
    int n = 0;
    int ar[4][14];
    for (int i = 0; i < 4; i++)
        for (int j = 0; j < 14; j++)
            ar[i][j] = 0;

    map<string, int> m;
    m["S"] = 0;
    m["H"] = 1;
    m["C"] = 2;
    m["D"] = 3;

    map<int, string> int2suit;
    int2suit[0] = "S";
    int2suit[1] = "H";
    int2suit[2] = "C";
    int2suit[3] = "D";

    cin >> n;
    for (int i = 0; i < n; i++)
    {
        string suit = "";
        int num;
        cin >> suit >> num;
        ar[m[suit]][num] = 1;
    }
    for (int i = 0; i < 4; i++)
    {
        for (int j = 1; j < 14; j++)
        {
            if (ar[i][j] == 0)
                cout << int2suit[i] << " " << j << endl;
        }
    }
}


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

int vec_find(vector<int> k,int x){
  int count=0;
  for(int i=0;i<k.size();i++){
    if(x==k.at(i))count++;
  }
  return count;
}

int main(){
  int s,i=0;
  cin >> s;
  vector<int> ans;
  while(1){
    i++;
    ans.push_back(s);
    if(s%2==0)s/=2;
    else if(s%2==1)s=3*s+1;
    if(vec_find(ans,s)!=0){
      cout << i+1 << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;
int t[26];
int main(){
    string a,b;cin>>a>>b;
    bool ok=true;
    lol(i,26)t[i]=-1;
    lol(i,a.size()){
	int x=a[i]-'a';
	int y=b[i]-'a';
	if((t[x]==-1||t[x]==y)){
	    t[x]=y;
	}
	else ok=0;
    }
    lol(i,26)t[i]=-1;
    lol(i,a.size()){
	int y=a[i]-'a';
	int x=b[i]-'a';
	if((t[x]==-1||t[x]==y)){
	    t[x]=y;
	}
	else ok=0;
    }
    cout<<(ok?"Yes":"No")<<endl;
    return 0;
}


Measured memory_bytes: 776
#include <iostream>
#include <vector>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    rep(i, 0, n) cin >> a[i];
    b = a;
    sort(b.rbegin(), b.rend());
    rep(i, 0, n){
        if(a[i] == b[0]){
            cout << b[1] << endl;
        }
        else cout << b[0] << endl;
    }
    return 0;
    
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> T;
typedef pair<long double , ll> Ps;
typedef pair<ll, bool> Pb;

const ll INF = 1e18;
const ll fact_table = 3200008;
long double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll, vector<ll>, greater<ll> > pqls;
priority_queue <P, vector<P>, greater<P> > pqps;
//small priority queue
//top pop

ll dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
ll dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};
char dir[] = "DRUL";
//↓,→,↑,←

/*
#define endl "\n"
#ifdef ENJAPMA
#undef endl
#endif
*/
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)();
#define pc(x) cout << x << ",";
#define rep(i, n) for (ll i = 0; i < (n); i ++)

const ll mod = 998244353ll;
// const ll mod = 1000000007ll;

ll mypow(ll a, ll b, ll mod) {ll x = 1; while (b) {while (!(b & 1)) {(a *= a) %= mod; b >>= 1;}(x *= a) %= mod; b--;} return x;}
void YES(bool cond) { if (cond) { p("YES");} else { p("NO");} return;}
void Yes(bool cond) { if (cond) { p("Yes");} else { p("No");} return;}
void line() { p("--------------------"); return;}

/*
ll fact[fact_table + 5],rfact[fact_table + 5];

void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table],mod - 2, mod);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/

bool multicase = false;

ll n, m, k, num, a, b, c, d, e, h, q, ans, sum;

typedef vector<ll> vec;
typedef vector<vector<ll>> mat;

ll x[500005], y[500005];
ll z[500005];

string s, t;

ll time(ll remain){
    if (remain < 0){
        return -INF;
    }
    ll ok = -1, ng = m;
    while(ng - ok > 1){
        ll mid = (ok + ng) / 2;
        if (remain >= z[mid]){
            ok = mid;
        }else{
            ng = mid;
        }
    }
    return ok + 1;
}

void solve() {
    cin >> n >> m >> k;
    for(ll i=0;i<n;i++){
        cin >> x[i];
    }
    for(ll i=0;i<m;i++){
        cin >> y[i];
        if (i != 0) z[i] = z[i-1] + y[i];
        if (i == 0) z[i] = y[i];
    }
    ll acctime = 0;
    ll ans = time(k);
    for(ll i=0;i<n;i++){
        acctime += x[i];
        // pe(acctime);
        // p(k - acctime);
        ans = max(ans, i + 1 + time(k - acctime));
    }
    p(ans);

    return;
}

int main() {
    // init();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll q, testcase = 1;
    if (multicase) {
        cin >> q;
    } else {
        q = 1;
    }
    while (q--) {
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }
    // solve();
    return 0;
}



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

int main(void){
    int n;
    cin >> n;
    string s[n];
    map<string,int>mp;
    for(int i = 0;i < n;i++){
        cin >> s[i];
        mp[s[i]]++;
    }
    int sum = 0;
    for(auto p:mp){
        sum++;
    }
    cout << sum;
}

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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    vll dp(n+1);
    dp[0] = 1000;
    for (int k=2; k<=n; ++k) {
        rep(i, k-1) {
            int mn = INF;
            for (int j=i+1; j<k; ++j) mn = min(mn, a[j-1]);
            dp[k] = max(dp[k], dp[i]/mn*a[k-1]+dp[i]%mn);
        }
    }
    ll ans = 0;
    rep(i, n+1) ans = max(ans, dp[i]);
    cout << ans << endl;
    return 0;
}


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

//vector <long long> v[1000000];

//stack <long long> pus, wyn;

long long int  x[1000000], y[1000000], z[1000000], czy=0, w, n, m;
char s[1000000];

int main()
{
    long long int a, b, c, d, k, i, j, q, t, p;

//    q=1;


//    scanf("%lld", &q);
//    for(t=0; t<q; t++)
    {
        scanf("%lld", &n);

        w=0;

        while(n>w)w+=1000;

        printf("%lld\n", w-n);
    }

    return(0);
}


Measured memory_bytes: 3816
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <list>
#include <unordered_map>
#include <vector>

using namespace std;

int main() {
    int n;
    int m;
    scanf("%d %d", &n, &m);
    bitset<200001> b;
    list<int> v;
    for (int i = 0; i < m; ++i) {
        int e;
        scanf("%d", &e);
        v.push_front(e);
    }

    for (auto&& i : v) {
        if (b[i]) {
        } else {
            printf("%d\n", i);
            b[i] = true;
        }
    }
    for (auto i = 1; i <= n; ++i) {
        if (!b[i]) {
            printf("%d\n", i);
        }
    }
}

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

using namespace std;

vector<int> S;
int main(void){
	int N;
	scanf("%d", &N);

	int sum = 0;
	for(int i = 0;i < N;++i){
		int t;
		scanf("%d", &t);
		S.push_back(t);
		sum += t;
	}

	sort(S.begin(), S.end());
	int i = 0;
	while(sum % 10 == 0){
		if(S[i] % 10 != 0){
			sum -= S[i];
		}
		if(i == N){
			sum = 0;
			break;
		}
		++i;
	}
	printf("%d\n", sum);

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long int ll;

double s(double z,double a,double b,double c){
	return sqrt(z*(z-a)*(z-b)*(z-c));
}

double dist(double a,double b,double c,double d){
	return sqrt((a-c)*(a-c)+(b-d)*(b-d));
}

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	vector<double> x,y;
	double p,q;
	char cc;
	while(cin >> p >> cc >> q){
		x.push_back(p);
		y.push_back(q);
	}
	int n=x.size();
	double ans=0.0;
	for(int i=1;i<n-1;i++){
		double a=dist(x[i],y[i],x[i+1],y[i+1]);
		double b=dist(x[i+1],y[i+1],x[0],y[0]);
		double c=dist(x[i],y[i],x[0],y[0]);
		double z=(a+b+c)/2.0;
		ans+=s(z,a,b,c);
	}
	printf("%.8f\n",ans);
}


Measured memory_bytes: 3244
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln =  '\n';

const int mx=100010;
const ll mod=1e9+7;

vector<ll> a(3010,0);
vector<vector<ll>> dp(3010, vector<ll>(3010,-longinf));
int n;

ll rec(int l, int r){
  if(dp[l][r]!=-longinf) return dp[l][r];
  if(l==r) return dp[l][r] = a[l]*(n%2==1?1:-1);
  int t = n-(r-l+1); //0:taro 1:ziro
  ll tmp = longinf*(t%2==1?1:-1);
  if(t%2==0){
    tmp = max(tmp, a[l]+rec(l+1,r));
    tmp = max(tmp, a[r]+rec(l,r-1));
  } else {
    tmp = min(tmp, -a[l]+rec(l+1,r));
    tmp = min(tmp, -a[r]+rec(l,r-1));
  }
  return dp[l][r] = tmp;
}


int main(){
  
  cin >> n;
  rep(i,n){
    cin>>a[i];
  }
  ll ans = rec(0,n-1);

  cout << ans << ln;
  return 0;
}

Measured memory_bytes: 71424
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
typedef pair<ll, ll> P;
const ll INF = (1LL<<62);

template<class T> bool chmin(T &a, const T &b){
    if(a > b) {a = b; return true;}
    else return false;
}
template<class T> bool chmax(T &a, const T &b){
    if(a < b) {a = b; return true;}
    else return false;
}

int main() {
    cin>>N;
    vec a(N), b(N);
    rep(i,N) cin>>a[i]>>b[i];
    vec sa(N), sb(N);
    rep(i,N) sa[i] = a[i], sb[i] = b[i];
    sort(ALL(sa)); sort(ALL(sb));
    reverse(ALL(sb));
    if(N&1){
        ll l = sa[N/2], r = sb[N/2];
        cout<<r - l + 1<<endl;
    }else{
        ll l1 = sa[N/2 - 1], r1 = sb[N/2 - 1];
        ll l2 = sa[N/2], r2  = sb[N/2];
        cout<<(r1 + r2) - (l1 + l2) + 1<<endl;
    }
}

Measured memory_bytes: 9540
using System;

namespace _2197
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int n = int.Parse(Console.ReadLine());
                if (n == 0) break;
                int ret = 0;
                for (int i = 1; i < 500; i++)
                {
                    for (int j = 1; true; j++)
                    {
                        if ((j + j + i) * (i + 1) == n * 2) ret++;
                        else if ((j + j + i) * (i + 1) > n * 2) break;
                    }
                }
                Console.WriteLine(ret);
            }
        }
    }
}


Measured memory_bytes: 9020
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();

		int count = 0;

		for(int i = 0; i <= a; i++){
			for(int j = 0; j <= b; j++){
				for(int k = 0; k <= c; k++){
					if(i*500 + j*100 + k*50 == x){
						count++;
						break;
					}
				}
			}
		}

		System.out.println(count);

	}
}


Measured memory_bytes: 21716
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <string>
#include <utility>
#include <map>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
typedef long long ll;
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
int inf=2020000000;

int N,M;

int pow(int a,int b){
	int c=1;
	Rep(i,b){
		c=c*a;
	}
	return c;
}



int main() {
	
	cin>>N>>M;
	int X=0;
	cout<<1900*M*pow(2,M)+100*(N-M)*pow(2,M)<<endl;
	

	return 0;
}

Measured memory_bytes: 256
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define mp make_pair
#define pi pair<int,int>
#define pl pair<long long int,long long int>
#define pb push_back
#define fi first
#define se second
#define len(a) (int)(a).length()
#define sz(a) (int)(a).size()

using namespace std;

const int M = 1e9 + 7;
int h, w, dp[1000][1000];
char g[1000][1000];

int ans (int i, int j) {
	if (dp[i][j] != -1) return dp[i][j];
	int ret = 0;
	if (i + 1 < h) ret = (ret + ans(i+1,j)) %M;
	if (j + 1 < w) ret = (ret + ans(i,j+1)) %M;
	return dp[i][j] = ret;
}

int main ()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> h >> w;
	memset(dp, -1, sizeof(dp));
	dp[h-1][w-1] = 1;
	for (int i=0; i<h; ++i)
		for (int j=0; j<w; ++j) {
			cin >> g[i][j];
			if (g[i][j] == '#')
				dp[i][j] = 0;
		}
	cout << ans(0, 0) << endl;
	return 0;
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
void insertionSort(vector<int> &A, int N){
    int v;
    for ( int i = 1; i < N; i++ ){
        v = A.at(i);
        int j = i - 1;
        while( j >= 0 && A.at(j) > v ){
            A.at(j+1) = A.at(j);
            j--;
        }
        A.at(j+1) = v;
        // Output
        for ( int i = 0; i < N - 1; i++ ){
            cout << A.at(i) << " ";
        }
        cout << A.at(N-1) << endl;
    }
}
int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for ( int i = 0; i < N; i++ ) cin >> A.at(i);
    
    for ( int i = 0; i < N - 1; i++ ){
        cout << A.at(i) << " ";
    }
    cout << A.at(N-1) << endl;

    insertionSort( A, N );

    return 0;
}


Measured memory_bytes: 3100
N, M, K = map(int, input().split())
mod = 998244353
# 全て異なる色で塗った場合のリストを作る
d = [0] * (N+1)
d[0] = M
for i in range(N):
    d[i+1] = d[i] * (M-1) % mod

def createFacArr(n, mod):
    fac = [0] * n
    finv = [0] * n
    inv = [0] * n
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, n):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[mod%i] * (mod // i) % mod
        finv[i] = finv[i-1] * inv[i] % mod
    return fac, finv

def comb(n ,k, mod, fac, finv):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod

fac, finv = createFacArr(N+10, mod)
ans = d[N-1]
#print(d)
for i in range(K):
    ans += d[N-2-i] * comb(N-1, i+1, mod, fac, finv)
    ans %= mod

print(ans)



Measured memory_bytes: 76272
s = input()
t = input()
anss = []
for i in range(len(s) - len(t) + 1):
  ans = 0
  for j in range(len(t)):
    if t[j] == s[i + j]:
      ans += 1
  anss.append(ans)
print(len(t) -max(anss))

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

int main() {
    
    int N;
    cin >> N;
    vector<long long> A(N,0);
    vector<long long> B(N,0);
    
    for(int i = 0; i < N;i++)cin >> A[i];
    for(int i = 0; i < N;i++)cin >> B[i];
    
    
    vector<long long> C;
    long long D = 0;
    long long Csum = 0;
    int Dcont = 0;
    for(int i = 0; i < N;i++){
        
        if(A[i]-B[i]>0){
            C.push_back(A[i]-B[i]);
            Csum += A[i]-B[i];
        }else if(A[i] - B[i] < 0){
            D+=(A[i]-B[i]);
            Dcont++;
        }
    }
    
    if(D==0){
        cout << 0 << endl;
        return 0;
    }
    
    if(Csum + D <0){
        cout << -1 << endl;
        return 0;
    }
    
    
    sort(C.begin(),C.end(),greater<int>());
    
    int ans = 0;
    int index = 0;
    //cout << D << endl;
    while(D<0){
        //cout << D <<" "<< endl;  
        D+=C[index];
        index++;
        
        
    }
    
    ans = index + Dcont;
    cout << ans << endl;
    //for(auto u:C)cout << u << " ";
    //cout << endl;

}

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

int a,b,c;
int Calc;
int main(){
 cin >> a >> b >> c;
  if(a >= b){
      if(a >= c){
           if(b >= c) Calc =(10*a + b) + c;
           else  Calc =(10*a + c) + b;
        }
      if(a < c) Calc =(10*c + a) + b;
  }
    
  if(a < b){
      if(b >= c){
           if(c >= a) Calc =(10*b + c) + a;
           else  Calc =(10*b + a) + c;
        } 
      if(b < c)  Calc =(10*c + b) + a;
  }
    
    cout << Calc << endl;
}

Measured memory_bytes: 256
N = int(raw_input())
a = map(int, raw_input().split())
lst = []
max = 0
for i in range(0, 100002):
	lst.append(0)

for i in range(0, N):
	lst[a[i]] = lst[a[i]] + 1

for i in range(1, 100001):
	if lst[i-1] + lst[i] + lst[i+1] > max:
		max = lst[i-1] + lst[i] + lst[i+1]

print max

Measured memory_bytes: 11328
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size() 

ll power(ll x,ll y,ll p) 
{ 
    ll res = 1;      
    x = x % p;  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
} 
ll a[200005];
int main()
{
    ios_base::sync_with_stdio(false);
	ll n,i,j,k,x,y,t,m,z;

	cin >> t;

	string s;
	cin >> s;

	ll ans=0;
	
	x=s[0]-'0';


	y=s[2]-'0';

	z=s[3]-'0';

	m=100*x+10*y+z;

	t=t*m;
	t=t/100;

	cout<<t<<endl;

}

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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define int ll
#define INF (ll)1e18
#define maxn 100001
#define MOD 1000000007
ll qexp(ll x, ll y) { 
ll res = 1; 
while (y > 0){
if (y & 1){
res = res*x; 
			res %= MOD;
        		}
        		y = y>>1;
        		x = x*x; 
        		x %= MOD;
} 
    return res; 
}

int S;
int fac[2001];

ll modinv(int a,int b){
	return (a * qexp(b,MOD-2)) % MOD;
}
int32_t main()
{
	cin>>S;
	
	fac[0] = 1;
	FOR(i,1,S) fac[i] = (fac[i-1] * i) % MOD;
	int ans = 0;
	for (int i = 1; 3 * i <= S; i++){
		int num = S - 3 * i;
		
		
		int n = num + 1, r = i - 1;
		ans += modinv(fac[r+n-1], (fac[r] * fac[n-1]) % MOD);
		ans %= MOD;
		
		
	}
	cout<<ans;
}


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

typedef long long ll;
typedef long long LL;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

#ifdef DEBUG
    #define cek(x) cout<<x
#else
    #define cek(x) if(false){}
#endif // DEBUG

#define fi first
#define se second
#define INF 1000000000
#define INFLL 1000000000000000000LL
#define EPS 1e-9
#define PI acos(-1.0)
#define pb push_back
#define TC() while(tc--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORN(i,n) for(int i=0;i<=n;i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define REPN(i,a,b) for(int i=a;i<=b;i++)
#define reset(a,b) memset(a,b,sizeof(a))
#define sc(x) scanf("%d",&x)

void open(){
	freopen("D:/Code/in.txt","r",stdin);
	freopen("D:/Code/out.txt", "w", stdout);
}
ll arr[2][100010];
int main(void){
	int n;
	sc(n);
	FOR(i,n){
		sc(arr[0][i]);
		sc(arr[1][i]);
	}

	ll tot = 0;

	for(int i = n-1;i>=0;i--){
		ll cur = tot + arr[0][i];
		ll need = cur % arr[1][i];
		if(need == 0)continue;
		tot += arr[1][i] - need;
	}
	cout << tot;
    return 0;
}




Measured memory_bytes: 1920
import java.io.*;

import java.util.*;

import java.math.*;



class Main{

	public static void calc_weight(int tw){
		int w=0;
		ArrayList <Integer> out = new ArrayList<Integer>();

		for(int i=9;i>=0;i--){
			if(tw < Math.pow(2,i)+w)continue;
			if(tw-w-Math.pow(2,i) >= 0){
				w += Math.pow(2,i);
				out.add(0,(int)Math.pow(2,i));
			}
			if(tw-w == 0)break;
		}
		for(int i=0;i<out.size();i++){
			if(i != out.size()-1)System.out.print(out.get(i) + " ");
			else System.out.println(out.get(i));
		}
	}

	


	public static void weight(ArrayList<Integer> list){
		for(int i=0;i<list.size();i++){
			calc_weight(list.get(i));	
		}
	}

		

	public static void main(String args[]) throws IOException{

		String str;

		ArrayList <Integer> inp = new ArrayList<Integer>();



		Scanner scan = new Scanner(System.in);

		

		while(scan.hasNext()){

			

			str = scan.next();

			int x = Integer.valueOf(str).intValue();

			inp.add(x);

		}

		weight(inp);

	}

}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
int a[100010];
int main() {
    int n, k;
    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> a[i];
    int gcd = a[0], maxi = a[0];
    for(int i = 1; i < n; i++) maxi = max(maxi, a[i]), gcd = __gcd(gcd, a[i]);
    if(k <= maxi && k % gcd == 0) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
using namespace std;

#define vi vector<int>

int main(){
  int i,j;
  int h,w;
  pair<int,pair<int,int> > p[22500];
  int n=0;
  for(i=1;i<=150;i++)
    for(j=i+1;j<=150;j++){
      p[n].first=i*i+j*j;
      p[n].second.first=i;
      p[n].second.second=j;
      n++;
    }
  sort(p,p+22500);
  while(1){
    cin>>h>>w;
    if(h==0&&w==0)break;
    for(i=0;i<22500;i++)
      if(p[i].second.first==h && p[i].second.second==w){
        cout<<p[i+1].second.first<<" "<<p[i+1].second.second<<endl;
        break;
      }
  }
}

Measured memory_bytes: 3332