akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include<cstdio>
#include<functional>
#include <bitset>
using namespace std;

int main()
{
	int A, B, C;

	cin >> A >> B >> C;
	if (A + B >= C) {
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	

	return 0;
}

Measured memory_bytes: 256
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        int h, w;
        char[][] mat;
        boolean[] rowVisible, colVisible;
        // 読み込み
        try(Scanner sn = new Scanner(System.in)) {
            h = sn.nextInt();
            w = sn.nextInt();
            mat = new char[h][w];
            rowVisible = new boolean[h];
            colVisible = new boolean[w];
            for (int i = 0; i < h; i++) {
                String row = sn.next();
                for (int j = 0; j < w; j++) {
                    mat[i][j] = row.charAt(j);
                    if (mat[i][j] == '#') {
                        rowVisible[i] = true;
                        colVisible[j] = true;
                    }
                }
            }
        }
        // 表示
        for (int i = 0; i < h; i++) {
            if (!rowVisible[i]) continue;
            for (int j = 0; j < w; j++) {
                if (!colVisible[j]) continue;
                System.out.print(mat[i][j]);
            }
            System.out.println();
        }
    }
}


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

N = int(input())
T = list(map(int, input().split()))
M = int(input())

for i in range(M):
    p, x = map(int, input().split())
    count = 0
    for j in range(len(T)):
        if j+1 == p:
            count = count + x
        else:
            count = count + T[j]
    print(count)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ls k<<1,l,mid
#define rs k<<1|1,mid+1,r
#define mp(x,y) make_pair(x,y)
#define r(x) read(x)
#define rrr(x,y,z) read(x);read(y);read(z)
#define FOR(i,l,r) for(int i=l;i<=r;i++)
using namespace std;
typedef long long LL;
typedef pair<int,int> pt;
const int N=2e5+5;
const int M=2e3+5;
const int INF=0x7fffffff;
const int mod=1e9+7;
const double eps=1e-8;
const double pi=acos(-1);
LL n,m;
int f[N];
template<class T>
inline void read(T &x)
{
    char c; x=1;
    while((c=getchar())<'0'||c>'9') if(c=='-') x=-1;
    T res=c-'0';
    while((c=getchar())>='0'&&c<='9') res=res*10+c-'0';
    x*=res;
}
int main()
{
    string a,b;
    cin>>a;
    FOR(i,0,a.length()-1) cout<<'x';
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
arr=[0]*(n*8)
for i in range(n):
	a, b,c = map(int, input().split())
	arr[n*0+i]=+a+b+c
	arr[n*1+i]=+a+b-c
	arr[n*2+i]=+a-b+c
	arr[n*3+i]=-a+b+c
	arr[n*4+i]=-a-b+c
	arr[n*5+i]=-a+b-c
	arr[n*6+i]=+a-b-c
	arr[n*7+i]=-a-b-c
ans=[sum(sorted(arr[n*i:n*i+n],key=lambda x:-x)[:m]) for i in range(8)]
print(max(ans))

Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
int main() {
  priority_queue<int> q[2];
  int a, sum[2] = {0};
  for(int i=0; i<2; i++) {
    for(int j=0; j<10; j++) {
      cin >> a;
      q[i].push(a);
    }
  }
  for(int i=0; i<2; i++) {
    for(int j=0; j<3; j++) {
      sum[i] += q[i].top(); q[i].pop();
    }
  }
  cout << sum[0] << " " << sum[1] << endl;
}

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

#ifdef VAMP
#define debug(...) _f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg> void _f(const char *name, Arg&& arg){
    cout<<name<<" = "<<arg<<endl;
}
template <typename Arg, typename... Args> void _f(const char *name, Arg&& arg, Args&&... args){
    const char *comma = strchr(name, ',');
    cout.write(name, comma - name)<<" = "<<arg<<" | ";
    _f(comma + 1, args...);
}
#else // VAMP
#define debug(...)
#endif

#define ll long long
#define MOD 1000000007
#define MAX

ll bigMod(ll b, ll p, ll m){
    ll res = 1;
    while(p){
        if(p&1) res = res * b % m;
        b = b * b % m;
        p>>=1;
    }
    return res;
}

ll nCr(ll n, ll r){
    ll lim = max(r, n-r);
    ll res = 1;
    for(ll i = n, j = 1; i > lim; i--, j++){
        res = res * i % MOD;
        res = res * bigMod(j, MOD - 2, MOD) % MOD;
    }
    return res;
}

int main(){
    #ifdef VAMP
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif // VAMP
    int n, a, b; while(scanf("%d %d %d", &n, &a, &b) == 3){
        ll res = bigMod(2, n, MOD);
        res = (res - nCr(n, a) + MOD) % MOD;
        res = (res - nCr(n, b) + MOD) % MOD;
        printf("%lld\n", (res + MOD - 1 ) % MOD);
    }
    return 0;
}


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

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
#define pii pair<ll , ll>
#define all(x) x.begin(),x.end()
#define nl "\n"
#define ump unordered_map
#define mtv(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)

vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out( 
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cout << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    stringstream ss; ss << H;
    cout << args[idx] << "- " << ss.str() << ", ";
    debug_out(args, idx + 1, LINE_NUM, T...);
}

void doit(){
	ll n, k;
	cin >> n >> k;
	ll l = max(-1000000LL,k - n + 1);
	ll r = min(1000000LL, k + n - 1);
	ll i;
	rep(i,l,r+1)cout << i << " ";
}

int main(){ 
#ifndef ONLINE_JUDGE
 //   freopen("input1.txt","r",stdin);
  //  freopen("output1.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t = 1;
    // cin >> t;
    for(ll i = 1; i <= t; i++){
        doit();
    }
}



Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
 
int main() {
  int N;
  cin >> N; 
  int sum=0;
  int D=N;
  for(int i=0;i<10;i++){
    sum+=D%10;
    D/=10;
  }

  if(N%sum == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
 
}


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

int main() {
    for( ; ; ) {
        int h, w;
        cin >> h >> w;
        if(h == 0 && w == 0) break;
        string s = "", t = "";
        for(int i=0; i<w; i++) {
            if(i % 2 == 0) {
                s += '#';
                t += '.';
            }
            else {
                s += '.';
                t += '#';
            }
        }
        for(int i=0; i<h/2; i++) {
            cout << s << endl;
            cout << t << endl;
        }
        if(h % 2 == 1) cout << s << endl;
        cout << endl;
    }
}


Measured memory_bytes: 3148
#include<iostream> 
#include<stdio.h> 
using namespace std; 
int main(){ 
  char moji,ch; 
  char t[10] = {'w','a','k','s','t','n','h','m','y','r'}; 
  int a; 
  while(1){ 
    scanf("%c",&ch); 
    if(ch=='\n')break; 
    a=ch-'0'; 
    scanf("%c",&moji); 
  
    if(a==0){ 
      if(moji=='U'){ 
    cout<<"nn"; 
      }else if(moji=='D'){ 
    cout<<"wo"; 
      }else{ 
    cout<<"wa"; 
      } 
      continue; 
    } 
  
    if(a!=1)cout<<t[a]; 
    if(moji=='T'){ 
      cout<<'a'; 
    }else if(moji=='L'){ 
      cout<<'i'; 
    }else if(moji=='U'){ 
      cout<<'u'; 
    }else if(moji=='R'){ 
      cout<<'e'; 
    }else if(moji=='D'){ 
      cout<<'o'; 
    } 
      
  } 
  cout<<endl; 
  return 0; 
}

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

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            SolveA(args);
            //SolveB(args);
            //SolveC(args);
            //SolveD(args);


        }
        private static int s_compareTotal = 0;
        static void SolveA(string[] args)
        {
            int.Parse(Console.ReadLine());
            int[] s = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            MergeSort(s, 0, s.Length);


            //Console.WriteLine(string.Join(" ", Array.ConvertAll(s, a=>a.ToString())));

            StringBuilder sb = new StringBuilder();
            for(int i=0;i<s.Length;++i)
            {
                sb.Append(s[i]);
                if (i != s.Length - 1)
                { sb.Append(" "); }
            }
            Console.WriteLine(sb.ToString());
            Console.WriteLine(s_compareTotal);
        }
        static void Merge(int[] a , int left, int mid, int right)
        {
            int n1 = mid - left;
            int n2 = right - mid;
            int[] L = new int[n1 + 1];
            int[] R = new int[n2 + 1];
            for (int i=0;i<n1;++i)
            {
                L[i] = a[left + i];
            }
            for(int i=0;i<n2;++i)
            {
                R[i] = a[mid + i];
            }
            L[n1] = int.MaxValue;
            R[n2] = int.MaxValue;

            {
                int i = 0;
                int j = 0;
                for(int k=left;k<right;++k)
                {
                    s_compareTotal++;
                    if (L[i] <= R[j])
                    {
                        a[k] = L[i];
                        i = i + 1;
                    }
                    else
                    {
                        a[k] = R[j];
                        j = j + 1;
                    }
                }
            }
        }
        static void MergeSort(int[] a, int left, int right)
        {
            if( left + 1 < right)
            {
                int mid = (left + right) / 2;
                MergeSort(a, left, mid);
                MergeSort(a, mid, right);
                Merge(a, left, mid, right);
            }
        }
    }

}



Measured memory_bytes: 103748
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long N;
  cin>>N;
  vector<long long>H(N);
  for(long long i=0;i<N;i++){
    cin>>H.at(N-i-1);
  }
  if(N==1){
    cout<<"Yes"<<endl;
  }
  else{
    for(int i=1;i<N;i++){
      if(H.at(i-1)<H.at(i)){
        H.at(i)=H.at(i)-1;
      }
    }
    bool flag=true;
    for(int i=0;i<N-1;i++){
      if(H.at(i)<H.at(i+1)){
        flag=false;
        break;
      }
    }
    if(flag==true){
      cout<<"Yes"<<endl;
    }
    else{
      cout<<"No"<<endl;
    }
  }
}
   

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

typedef long long ll;
typedef int keytype;

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

void quicksort(keytype a[], int first, int last)
{
    int i, j;
    keytype x, t;

    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}

int is_prime(int x){
    if(x <= 1) return 0;
    for(int i = 2; i * i <= x; i++){
        if(x % i == 0) return 0;
    }
    return 1;
}

int is_substr(char s[], char t[], int i){
    int flag = 1;

    if(s[i] == '\0') flag = 0;

    for(int j = 0; j < strlen(t); ++j, ++i){
        if(s[i] != t[j]){
            flag = 0;
            break;
        }
    }
    return flag;
}

// factor list, number of factors, natural number
void factorize(int ftr[], int *num, int n){
    int a = 2, cnt = 0;

    while(n >= a){
        if(n % a == 0){
            n = n / a;
            ftr[cnt++] = a;
        }else{
            a++;
        }
    }
    *num = cnt;
}

void comb(int size1, int size2, int v[size1][size2]){
  for(int i = 0; i < size1; i++){
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for(int k = 1; k < size1; k++){
    for(int j = 1; j < k; j++){
      v[k][j] = (v[k-1][j-1] + v[k-1][j]);
    }
  }
}

int abs_val(int a, int b){
    if(a > b) return a - b;
    else return b - a;
}

int main(){
    int n, m;
    int l[100001], r[100001];

    scanf("%d %d", &n, &m);
    for(int i = 0; i < m; ++i){
        scanf("%d %d", &l[i], &r[i]);
    }

    int left = 1, right = n;
    for(int i = 0; i < m; ++i){
        if(left <= l[i]) left = l[i];
        if(right >= r[i]) right = r[i];
    }
    int ans = right - left + 1;

    if(ans < 0) printf("%d\n", 0);
    else printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 2444
#include <stdio.h>
#define MAX_SIZE (1000001)
int prime[MAX_SIZE];
 
int main()
{
int n, i, j;
     
for (i = 0; i < MAX_SIZE; i++){
prime[i] = 1;
}
     
prime[0] = prime[1] = 0;
for (i = 2; i * i < MAX_SIZE; i++){
if (prime[i] == 1){
for (j = i * i; j < MAX_SIZE; j += i){
prime[j] = 0;
}
}
}
     
for (i = 1; i < MAX_SIZE - 1; i++){
prime[i + 1] += prime[i];
}
     
while (scanf("%d", &n) != EOF){
printf("%d\n", prime[n]);
}
     
return 0;
}

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

using namespace std;

int main() {
    vector<int> v(5);
    for (int i = 0; i < 5; i++) {
        cin >> v[i];
        if (v[i] == 0) {
            cout << i + 1 << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <numeric>
#include <set>
#include <iomanip>
#include <functional>
#define FOR(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
using namespace std;

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

	string A;
	int X = 0;

	cin >> A;

	for(int i = 1; i < A.length();i++)
	{
		if (A[i] == A[i - 1])
		{
			X = 1;
		}
	}

	if (X == 0)
	{
		cout << "Good\n";
	}
	else
	{
		cout << "Bad\n";
	}

	return 0;
}

Measured memory_bytes: 256
def cal(n, op)
  n *= -1 if op == '-'
  n
end

a, b, c, d = gets.split('').map(&:to_i)
['+', '-'].repeated_permutation(3).to_a.each do |z|
  x = a
  x += cal(b, z[0])
  x += cal(c, z[1])
  x += cal(d, z[2])
  if x == 7
    puts "#{a}#{z[0]}#{b}#{z[1]}#{c}#{z[2]}#{d}=7"
    exit
  end
end

Measured memory_bytes: 14384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl

int main(){
    ll a, b, c;
    cin >> a >> b >> c;
    cout << min(min(a+b,b+c),c+a) << endl;

    return 0;
}


Measured memory_bytes: 256
<?php
  
  $n = trim(fgets(STDIN));
  $array_s = [];
  for($i=0;$i<$n;$i++){
    $s = trim(fgets(STDIN));
    if(!isset($array_s[$s])){
      $array_s[$s]=0;
    }
    $array_s[$s]++;
  }

  arsort($array_s);

  $count=0;
  $c =[];
  foreach($array_s as $k => $v){
    if($count==0){
      $count = $v;
      $c[] = $k;
    }else{
      if($count == $v){
        $c[] = $k;
      }
    }
  }
  asort($c);
  foreach($c as $v){
    echo $v.PHP_EOL;
  }

  


Measured memory_bytes: 35316
Scanf.scanf "%d %s" (fun k s ->
    let n = String.length s in
    let z = 1_000_000_007 in
    let extgcd x y =
        let rec eg r0 r1 a0 a1 b0 b1 =
            if r1 = 0 then a0 else
                let q1 = r0 / r1 in
                eg r1 (r0 mod r1) a1 (a0 - q1 * a1) b1 (b0 - q1 * b1)
        in
        eg x y 1 0 0 1
    in
    let inv x y = (* 1/x in mod y *)
        let c = extgcd x y in
        if c < 0 then c + y else c
    in
    let ( +@) a b = (a + b) mod z in
    let ( *@) a b = (a * b) mod z in
    let ( /@) a b = a *@ inv b z in
    let rec loop i pre acc =
        if i > k then acc else loop (i + 1) (pre *@ (25 * (n + i)) /@ (1 + i)) (acc *@ 26 +@ pre)
    in
    loop 0 1 0 |> Printf.printf "%d\n"
)

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)    FOR (i,0,n)
#define ALL(f,x,...) ([&](decltype((x)) ALL) {                          \
            return (f)(begin(ALL), end(ALL), ## __VA_ARGS__); })(x)

using namespace std;

const string Yes = "Yes";
const string No = "No";

vector<int> A;

template<class T> void gc(T &x)
{
    char c;
    int s = 0;
    x = 0;

    c = getchar_unlocked();

    if (c == '-') s = 1;
    else if ('0' <= c && c <= '9')  x = c - '0';

    while (true)
    {
        c = getchar_unlocked();

        if (c < '0' || '9' < c) break;
        x = x * 10 + (c - '0');
    }

    if (s) x = -x;
}

int main()
{
    int N;

    gc(N);

    A.resize(N);

    int hatmin = N - 1;
    int hatmax = 1;

    REP(i, N)
    {
        cin >> A[i];

        if (A[i] < hatmin) hatmin = A[i];

        if (hatmax < A[i]) hatmax = A[i];
    }

    int cntmin = 0;
    int cntmax = 0;
    REP(i, N)
    {
        if (A[i] == hatmin) cntmin++;

        if (A[i] == hatmax) cntmax++;
    }

    // hatmax は hatの種類の数になる

    // 最小最大差 2以上
    // ありえない
    bool flg = false;

    // 最小最大差 1
    // 「全てがAlone」ではない、かつ「全てがAloneではない」ではない
    if (hatmax - hatmin == 1)
    {
        if (cntmin < hatmax && 2 * (hatmax - cntmin) <= cntmax)
        {
            flg = true;
        }
    }
    // 最小最大差 0
    // 全てがAlone 全てがAloneではない
    else if (hatmax == hatmin)
    {
        if (hatmin == N - 1 || 2 * hatmax <= N)
        {
            flg = true;
        }
    }

    cout << (flg ? Yes : No) << endl;
    return 0;
}


Measured memory_bytes: 640
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fcking interest
*******************************
I'm standing on top of my Monopoly board
That means I'm on top of my game and it don't stop
til my hip don't hop anymore
https://www.a2oj.com/Ladder16.html
*******************************
300iq as writer = Sad!
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class Main
   {
      public static void main(String hi[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int R = Integer.parseInt(st.nextToken());
         int C = Integer.parseInt(st.nextToken());
         int K = Integer.parseInt(st.nextToken());
         int[][] grid = new int[R][C];
         for(int i=0; i < K; i++)
         {
            st = new StringTokenizer(infile.readLine());
            int r = Integer.parseInt(st.nextToken())-1;
            int c = Integer.parseInt(st.nextToken())-1;
            int x = Integer.parseInt(st.nextToken());
            grid[r][c] = x;
         }
         long[][] dp = new long[C][4];
         for(int r=0; r < R; r++)
         {
            long[][] next = new long[C][4];
            for(int c=0; c < C; c++)
               for(int t=0; t < 4; t++)
               {
                  next[c][0] = Math.max(next[c][0], dp[c][t]);
                  if(grid[r][c] > 0)
                     next[c][1] = Math.max(next[c][1], dp[c][t]+grid[r][c]);
               }
            for(int c=1; c < C; c++)
               for(int t=0; t < 4; t++)
               {
                  next[c][t] = Math.max(next[c][t], next[c-1][t]);
                  if(t < 3 && grid[r][c] > 0)
                     next[c][t+1] = Math.max(next[c][t+1], next[c-1][t]+grid[r][c]);
               }
            dp = next;
         }
         long res = 0L;
         for(int t=0; t < 4; t++)
            res = Math.max(res, dp[C-1][t]);
         System.out.println(res);
      }
   }

Measured memory_bytes: 91576
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
    FASTINOUT;
    string s;
    cin>>s;
    if (s.find("RRR")!=-1)
        cout<<3<<endl;
    else if (s.find("RR")!=-1)
        cout<<2;
    else if (s.find("R")!=-1)
        cout<<1;
    else
        cout<<0;
    return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,a,k;
	cin>>n;
	int ans=0;
	for(int i=1;i<=n;i++){
		cin>>a>>k;
		while(true){
			a=a/k*k+a%k%(a/k+1);
			if(a%k){
				a=a-(a/k+1);
			}
			else{
				ans^=(a/k);
				break;
			}
		}
	}
	if(ans)
		cout<<"Takahashi"<<endl;
	else
		cout<<"Aoki"<<endl;
}



Measured memory_bytes: 256
import math

x = int(input())

a = 100
cnt = 0

#file = open('test.txt', 'w')

while a < x:
    a = a*1.01
    a = int(a)
    b = str(a)
#    file.write(b + '\n')
    cnt = cnt + 1

#file.close()
print(cnt)

Measured memory_bytes: 9176
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;


int main() {
    ll n; cin >> n;
    ll ans = 1;
    REP(i,1,n+1) {
        ans *= i;
        ans %= mod;
    }
    cout << ans << endl;
} 

Measured memory_bytes: 3596
#include <iostream>

using namespace std;

int main()
{
    int a,b,c,s=0;
    cin>>a>>b>>c;
    s=a+b+c;
    if(s>21)
    {
        cout<<"bust";
    }
    else
    {
        cout<<"win";
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
char a[5];
scanf("%s",a);

    if(!strcmp(a,"Sunny"))
    {
        printf("Cloudy\n");}

        else if(!strcmp(a,"Cloudy")){
        printf("Rainy\n");}
           else if(!strcmp(a,"Rainy"))
{
        printf("Sunny\n");}

    return 0;
    }


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

int val[300005];
int wt[300005];
int ans[1000][100005];

int main() {
#ifdef LOCAL_EXEC
//    freopen("sample.in", "r", stdin);
#else
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#endif

  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> val[i] >> wt[i];
  }

  for (int i = 1; i < min(n + 1, 1 << 9); i++) {
    for (int j = 0; j < wt[i]; j++) {
      ans[i][j] = ans[i/2][j];
    }
    for (int j = wt[i]; j <= 1e5; j++) {
      ans[i][j] = max(ans[i][j - 1], ans[i/2][j]);
      ans[i][j] = max(ans[i][j], val[i] + ans[i/2][j - wt[i]]);
    }
  }

  int q;
  cin >> q;
  while (q--) {
    int v, l;
    cin >> v >> l;
    if (v < (1 << 9)) cout << ans[v][l] << '\n';
    else {
      vector<pair<int,int>> vec;
      vec.emplace_back(0, 0);
      while (v >= (1 << 9)) {
        for (int j = vec.size() - 1; j >= 0; j--) {
          vec.emplace_back(vec[j].first + val[v], vec[j].second + wt[v]);
        }
        v /= 2;
      }

      int ret = 0;
      for (auto [value, weight] : vec) {
        if (weight > l) continue;
        ret = max(ret, ans[v][l - weight] + value);
      }
      cout << ret << '\n';
    }
  }

	return 0;
}

Measured memory_bytes: 205352
package main

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

func main() {
	sc := NewScanner(os.Stdin)
	N := sc.NextInt()
	sum := 0.0
	for i := 0; i < N; i++ {
		x, u := sc.NextFloat64(), sc.Next()
		if u == "JPY" {
			sum += x
		} else {
			sum += x * 380000
		}
	}
	fmt.Printf("%f\n", sum)
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

// scanner
type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner(r io.Reader) *Scanner {
	rdr := bufio.NewReaderSize(r, 1024)
	return &Scanner{r: rdr}
}

func (s *Scanner) ReadLine() {
	s.buf = make([]byte, 0)
	for {
		line, isp, err := s.r.ReadLine()
		if err != nil {
			os.Exit(1)
		}
		s.buf = append(s.buf, line...)
		if !isp {
			break
		}
	}
}

func (s *Scanner) NextInt() int {
	i, err := strconv.Atoi(s.Next())
	if err != nil {
		os.Exit(1)
	}
	return i
}

func (s *Scanner) NextFloat64() float64 {
	i, err := strconv.ParseFloat(s.Next(), 64)
	if err != nil {
		os.Exit(1)
	}
	return i
}

func (s *Scanner) Next() string {
	s.Pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	next := string(s.buf[start:s.p])
	s.p++
	return next
}

func (s *Scanner) Pre() {
	if s.p >= len(s.buf) {
		s.ReadLine()
		s.p = 0
	}
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<utility>
#include<functional>
#include<algorithm>
#include<queue>
#include<map>
#include<string>
#include<numeric>


#define FOR(i, a, b) for(int i=a; i<b; i++)
#define rep(i, n) for(int i=0; i<n; i++)
#define COUT(a) cout << a << endl;
#define PB push_back

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


int main() {
    ll N, T, A;
    cin >> N;
    cin >> T >> A;
    vector<ll> H(N);

    float ans = 100000;
    ll ans_ = 0; 

    rep(i, N){
        cin >> H[i];
        float value = T - H[i] * 0.006 - A;
        if (value < 0) value = -value;
        if (ans >= value)
        {  
            ans_ = i;
            ans = value;
        }
    }

    COUT(ans_+1);

}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#define SF scanf
#define PF printf
#define MAXN 210
#define INF 0x3FFFFFFF
using namespace std;
vector<int> a[MAXN],rev[MAXN],r[MAXN];
int n,m,s,t,d[MAXN],g[MAXN];
int dfs(int x,int f){
    if(x==t)
	    return f;
    for(int i=0;i<a[x].size();i++)
        if(r[x][i]>0&&d[a[x][i]]+1==d[x]){
            int res=dfs(a[x][i],min(f,r[x][i]));
            if(res>0){
	            r[x][i]-=res;
	            r[a[x][i]][rev[x][i]]+=res;
            	return res;
        	}
        }
    int les=MAXN;
    g[d[x]]--;
    if(g[d[x]]==0){
        d[s]=n;
        return 0;
    }
    for(int i=0;i<a[x].size();i++)
        if(r[x][i]>0)
            les=min(les,d[a[x][i]]);
    d[x]=les+1;
    g[d[x]]++;
    return 0;
}
int isap(){
    int res=0;
    g[0]=n;
    while(d[s]<n){
	    res+=dfs(s,INF);
    }
    return res;
}
int u,v,w;
int xa[MAXN],xb[MAXN],ya[MAXN],yb[MAXN];
void addlink(int x,int y,int val){
	a[x].push_back(y);
	a[y].push_back(x);
	rev[x].push_back(a[y].size()-1);
	rev[y].push_back(a[x].size()-1);
	r[x].push_back(val);
	r[y].push_back(0);
}
int main(){
    SF("%d",&n);
	for(int i=0;i<n;i++)
		SF("%d%d",&xa[i],&ya[i]);
	for(int i=0;i<n;i++)
		SF("%d%d",&xb[i],&yb[i]);
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			if(xa[i]<xb[j]&&ya[i]<yb[j])
				addlink(i,j+n,1);
    s=2*n;
    t=2*n+1;
    for(int i=0;i<n;i++){
    	addlink(s,i,1);
    	addlink(i+n,t,1);
    }
	n=2*n+1;
    PF("%d",isap());
}
 

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

int main()
{

    int arr2[3];
    int arr[3];
    arr[0] = 5;
    arr[1] = 5;
    arr[2] = 7;
    for(int i =0;i<3;++i)
        cin >> arr2[i];
    sort(arr2, arr2+3);
    int c =0;
    for(int i =0;i<3;++i)
    {
        if(arr[i] != arr2[i])
            c = 1;
    }
    if(c == 0)
        cout << "YES";
    else
        cout << "NO";

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define pb push_back
#define MAX INT_MAX
#define MIN INT_MIN
#define MOD 1000000007
#define FO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
void solve() {
	int h;
	cin >> h;
	int c = 0;
	while(h > 0) {
		h /= 2;
		c++;
	}
	cout << long(pow(2, c))-1;
    return;
}
int32_t main() {
    FO;
    solve();
    return 0;
}


Measured memory_bytes: 256
/// Bismillahir Rahmanir Rahim
//Author: Tanvir Hussain
//ICE,NSTU
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
const long long MOD = 1000000007;
#define SET(x) memset(x, 0, sizeof(x))
#define SET2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define SETBOOL(x) memset(x,false,sizeof(x))
#define CLR(x) memset(x, -1, sizeof(x))
#define CLR2d(x,m,n) memset(x, -1, sizeof(x[0][0]) * m * n)
#define mp make_pair
#define PII pair<int, int>
#define pf printf
#define sf scanf
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define np std::string::npos
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cases(cs,t) for(int cs=1;cs<=t;cs++)
#define PI acos(-1)
#define no1 __builtin_popcount
#define BOUNDARY(i, j) ((i >= 0 && i < row) && (j >= 0 && j < column))
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define sz(a) int(a.size())
#define ff first
#define ss second
#define endl "\n"
#define forch(it,s) for(auto it:s)
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define bits(n) __builtin_popcount(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >


int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const int maxx=100005;

//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
    return a.first>b.first;
}

template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}
double sq(double x) {return x*x;}
ll po(ll b,ll p){
    ll res=1;
    while(p){
        res*=b;
        p--;
    }
    return res;
}
ll lg2(ll x){
    ll res=0;
    while(x>1){
        res++;
        x/=2ll;
    }
    return res;
}
void solve(){
    int n;
    cin>>n;
    int x=(n+999)/1000;
    cout<<((x*1000)-n)<<endl;
}

signed main()

{
    IOS;
    /*#ifndef ONLINE_JUDGE
        freopen ("input.txt","r",stdin);
        freopen ("output.txt","w",stdout);
    #endif*/
    int t;
    t=1;
    while(t--){
        solve();
    }

     return 0;

}
///Alhamdulillah




Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long ll;
#define endl '\n'

void solve() {

    ll a, b, c, k;
    cin >> a >> b >> c >> k;

    ll res = 0;
    res += min(a, k);
    k -= min(a, k);

    if (k == 0) {
        cout << res << endl;
        return;
    }

    k -= min(b, k);
    if (k == 0) {
        cout << res << endl;
        return;
    }

    res -= min(c, k);
    k -= min(c, k);
    cout << res << endl;

}

int main() {
    FAST_IO;

    int t;
    // cin >> t;
    t = 1;

    while (t--) {
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 3652
from collections import defaultdict

def main():
    n, m = map(int, input().split())
    a = [int(s) for s in input().split()]
    cnt = defaultdict(int)

    for x in a:
        cnt[x] += 1
    
    for _ in range(m):
        b, c = map(int, input().split())
        cnt[c] += b
    
    rest = n
    s = 0
    for k in sorted(cnt.keys(), reverse=True):
        if cnt[k] >= rest:
            s += k * rest
            rest = 0
            break
        else:
            s += k * cnt[k]
            rest -= cnt[k]
    
    print(s)

main()


Measured memory_bytes: 32448
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
//#include <conio.h>
using namespace std;

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

#define rep(i,n)	for(ll i=0;i<(n);i++)
#define SZ(x) ((ll)x.size())
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define F first
#define S second
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// const ll MOD = INT_MAX;
const double PI = acos(-1);

void openfile(){
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
}

int mod;
const int N = 1e5+5;
vector<int> G[N], child[N];
vector<pll> prv[N], suf[N];
pll down[N], up[N];
// (all_white, sth_is_black)

int add(int a, int b){
	return (a + b) % mod;
}
int mul(int a, int b){
	return (ll)a * b % mod;
}

pll merge(const pll& a,const pll& b){
	// calculate subtrees, not considering the root
	pll p;
	p.F = mul(a.F, b.F);
	p.S = add(mul(a.S, add(b.F, b.S)), mul(a.F, b.S));
	return p;
}

pll ans(const pll& a){
	pll p;
	p.F = a.F;
	p.S = add(a.F, a.S);
	return p;
}
void dfs1(int a, int parent) {
	pll p = {1, 0};
	for(int b : G[a]){
		if(b != parent){
			child[a].pb(b);
			dfs1(b, a);
			p = merge(p, down[b]);
		}
	}
	
	down[a] = ans(p);
}

void dfs2(int a, int parent){
	rep(i, SZ(child[a])){
		pll p{1, 0};
		if(i != 0)	p = merge(p, prv[a][i-1]);
		if(i != SZ(child[a]) - 1)	p = merge(p, suf[a][i+1]);
		if(a != 1)	p = merge(p, up[a]);
		up[child[a][i]] = ans(p);
		dfs2(child[a][i], a);
	}
}


// O(2^n * n^2 * 3^n)
signed main(){
	IOS
	int n;
	scanf("%d%d", &n, &mod);
	rep(i,n-1){
		int a, b;
		scanf("%d%d", &a, &b);
		G[a].pb(b);
		G[b].pb(a);
	}
	dfs1(1, -1);

	// calculate prefix sums and suffix sums
	for(int a = 1; a <= n; a++){
		pll p{1, 0};
		for(int b = 0; b < SZ(child[a]); b++){
			p = merge(p, down[child[a][b]]);
			prv[a].pb(p);
		}
		p = {1, 0};
		for(int b = SZ(child[a]) - 1; b >= 0; b--){
			p = merge(p, down[child[a][b]]);
			suf[a].pb(p);
		}
		reverse(suf[a].begin(), suf[a].end());
	}
	dfs2(1, -1);
	for(int a = 1; a <= n; a++){
		pll p{1, 0};
		if(a != 1)	p = merge(p, up[a]);
		if(!child[a].empty())	p = merge(p, prv[a].back());
		p = ans(p);
		printf("%lld\n", p.S);
	}

}


Measured memory_bytes: 32128
#pragma GCC target ("avx2")
#pragma GCC optimize "trapv"
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define input(a,n) for(ll i1=0;i1<n;i1++)cin>>a[i1]
#define ll long long
#define pi 2 * acos(0.0)
#define usll unordered_set<ll>
#define sll set<ll>
#define vll vector<ll>
#define mll map<ll,ll>
#define pll pair<ll,ll>
#define umll unordered_map<ll,ll>
#define S second
#define sz size()
#define all(v) v.begin(),v.end()
#define Y cout<< "YES"<< "\n"
#define N cout<< "NO"<< "\n"
#define F first
#define mp make_pair
#define pb push_back
#define pf push_front
#define ld long double
#define mod 1000000007
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll a,b,c,d,mx;
    cin>>a>>b>>c>>d;
    mx=a*c;
    mx=max(a*d,mx);
    mx=max(b*c,mx);
    mx=max(b*d,mx);
    cout<<mx;
    return 0;
}


Measured memory_bytes: 3636
num = int(input())

a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

count = 0

for i in range(num):
    count += b[a[i]-1]
    
    if i > 0 and a[i-1] + 1 == a[i]:
        count += c[a[i]-2]

print(count)

Measured memory_bytes: 3064
# -*- coding: utf-8 -*-
import sys

H,W=map(int, sys.stdin.readline().split())
A=[ map(int, sys.stdin.readline().split()) for _ in range(H) ]
B=[ map(int, sys.stdin.readline().split()) for _ in range(H) ]

for h in range(H):
    for w in range(W):
        A[h][w]=abs(A[h][w]-B[h][w])

dp=[ [ 0 for _ in range(W) ] for __ in range(H) ]

Center=80*80      #中心地のセット マイナスの値もセットできるようにbitsetのゼロを80*80+1桁目に置く

#初期化
r,c=0,0
val=A[r][c]
dp[r][c]=1<<val+Center

D=[(1,0),(0,1)]

for r in range(H):
    for c in range(W):
        for dr,dc in D: #下に1つ移動したマス、右に1つ移動したマス
            if r+dr<H and c+dc<W:   #下のマスor右のマスが存在するならばif文内の処理を行う
                next_r=r+dr
                next_c=c+dc
                next_val=A[next_r][next_c]
                dp[next_r][next_c]|=dp[r][c]<<next_val  #次のマスの値が+の場合は、bitshift全体を左にシフト
                dp[next_r][next_c]|=dp[r][c]>>next_val  #次のマスの値が-の場合は、bitshift全体を右にシフト

ans=float("inf")
for i in range(Center*2):
    bit=dp[H-1][W-1]>>i&1
    if bit==1:
        ans=min(ans,abs(i-Center))

print ans


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



int main() {
	ll n;
	cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; i++)cin >> a[i];


	
	vector <ll > count;
	ll tmp=0;
	for (int i = 0; i<n-1; i++) {
		
		if (a[i]>=a[i+1]) {
			tmp++;
		}
		else {
			if (tmp != 0) {
				count.push_back(tmp);
				tmp = 0;
			}
		}
		
	}
	count.push_back(tmp);
	
	cout << endl;
	sort(count.rbegin(), count.rend());
	
	cout << endl;
	if (count.size() != 0) {
		cout << count.at(0) << endl;
	}
	else { cout << 0 << endl; }
}

Measured memory_bytes: 1660
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

void solve(long long N, std::vector<long long> a, std::vector<long long> b){
  map<ll, ll> m;
  for(int i=0; i<N-1; i++) {
    m[a[i]]++;
    m[b[i]]++;
  }
  ll k=-1;
  ll r;
  for(auto x:m) {
    if(k < x.second) {
      k = x.second;
      r = x.first;
    }
  }
  std::cout << k << std::endl;
  // std::cout << r << std::endl;
  vector<vector<ll>> g(N+1);
  for(int i=0; i<N-1; i++) {
    g[a[i]].push_back(b[i]);
    g[b[i]].push_back(a[i]);
  }
  queue<ll> q;
  vector<ll> c(N+1, 0);
  map<pair<ll, ll>, ll> ans;
  vector<ll> used(N+1, 0);
  used[r] = 1;
  q.push(r);
  while(!q.empty()) {
    ll x = q.front();
    q.pop();
    int col = 1;
    for(auto v:g[x]) {
      // std::cout << x<<":"<<v << std::endl;
      // std::cout << used[v] << std::endl;
      // std::cout << col << std::endl;
      // std::cout << c[x] << std::endl;
      if(used[v]) continue;
      if(col == c[x]) col++;
      c[v] = col;
      ans[make_pair(x, v)] = col;
      ans[make_pair(v, x)] = col;
      col++;
      used[v] = 1;
      q.push(v);
    }
  }
  for(int i=0; i<N-1; i++) {
    std::cout << ans[make_pair(a[i], b[i])] << std::endl;
  }
}

int main(){
  long long N;
  scanf("%lld",&N);
  std::vector<long long> a(N-1);
  std::vector<long long> b(N-1);
  for(int i = 0 ; i < N-1 ; i++){
    scanf("%lld",&a[i]);
    scanf("%lld",&b[i]);
  }
  solve(N, std::move(a), std::move(b));
  return 0;
}



Measured memory_bytes: 28416
import java.util.Scanner;
import java.io.*;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		
		int cnt = 0;
		for(int i = 0; i < n; i+=2) {
			if(a[i]%2 == 1) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}


Measured memory_bytes: 27048
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

enum MOD = (10 ^^ 9) + 7;

void main()
{
    long N, M;
    scan(N, M);
    long t = 1900 * M + 100 * (N - M);
    if (M == 0)
    {
        writeln(t);
        return;
    }
    long p = 1 << M;
    writeln(t * p);
    // long ans;
    // long i = 1;
    // while (true)
    // {
    //     long tmp = (i * t + ((p ^^ i) - 1)) / (p ^^ i);
    //     writeln(tmp);
    //     if (tmp == 0)
    //     {
    //         writeln(ans);
    //         return;
    //     }
    //     ans += tmp;
    //     i++;
    // }
}


Measured memory_bytes: 256
use std::io;
use std::collections::HashMap;

fn main() {
    let _ = read_vec::<i32>();
    let a = read_vec::<i32>();
    let _ = read_vec::<i32>();
    let m = read_vec::<i32>();

    let mut map = HashMap::new();
    let len = a.len();

    for s in 0..1 << len {
        let mut sum = 0;
        for i in 0..len {
            if s >> i & 1 == 1 {
                sum = sum + a[i];
            }
        }
        map.insert(sum, 0);
    }

    for num in m {
        if map.contains_key(&num) {
            println!("yes");
        } else {
            println!("no");
        }
    }
}


/// 標準入力から一行を読み取り、空白文字で分割し、各要素を指定の型に変換する関数
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut line = String::new();
    io::stdin().read_line(&mut line)
        .ok()
        .expect("Faild to read Vec");
    line.trim().split_whitespace()
        .map(|i| i.parse().ok().unwrap()).collect()
}



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

using namespace std;

typedef long long int ll;

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

typedef pair<int,int> pair;

int main(){
    int k,x; cin >> k >> x;

    k*=500;
    if(k>=x) puts("Yes");
    else puts("No");
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#define rg register
using namespace std;
template<typename T>inline void in(T &a)
{
	T ch=getchar(),f=1;
	for(a=0;!isdigit(ch);ch=getchar())
	  ch=='-'?f=-1:f=f;
	for(;isdigit(ch);ch=getchar())
	  a=(a<<3)+(a<<1)+ch-'0';
	a*=f;
}
template<typename T>inline void print(T x)
{
	if(x<0)
	  putchar('-'),x=-x;
	if(x>9)
	  print(x/10);
	putchar(x%10+'0');
}
long long a[55];
inline long long re(long long x)
{
	if(x<0)
	  return -1;
	long long tot=0;
	while(x>1)
	  tot++,x-=3,x/=2;
	return tot;
}
signed main()
{
	long long n,x;
	cin>>n>>x;
	long long r=1;
	a[0]=1;
	for(long long i=1;i<=n;i++)
	  r=3+2*r,a[i]=a[i-1]*2+1;
	long long mid,ans=0,l=1;
	while(l<=r)
	{
		mid=l+r>>1;
		if(mid<=x)
		{
			long long tmp=re(mid-l-1);
			if(tmp>=0)
			  ans+=a[tmp];
			ans++;
			l=mid+1,r--;
		}
		else
		{
			l++,r=mid-1;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
    int N, val, sum, max;
    cin>>N;
    sum = 0;
    max = 0;

    for(int i=0; i<N; i++) {
        cin>>val;
        sum = sum + val;
        if(val>max) {
            max = val;
        }
    }

    cout<<sum-max/2<<endl;


    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define M 10000000
#define R 1579
char s[M/2];
int main(){
    int i,j,k,n;
    for(i=0;i<R;i++)if(!s[i])for(k=i+i+3,j=k*(i+1)+i;j<=M/2;j+=k)s[j]=1;
    for(;scanf("%d",&n),n;printf("%d\n",i*2+3))for(i=(n-3)/2;s[i-4]||s[i-3]||s[i-1]||s[i];i--);
    return 0;
}

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

int main() 
{ 
    int n, a;
    cin >> n;
    while(n--)
    {
        cin >> a;
        if(a%2 == 0)
        {
            if(a%3 != 0 && a%5 != 0)
            {
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }
    cout << "APPROVED" << endl;
    
    return 0;
} 

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = (a); i < (n);i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
    int n,m,ans = 0,memo = 0;
    cin >> n >> m;
    int a[n],b[m],votes[n] = {0};
    
    rep(i,0,n){
        cin >> a[i];
    }
    rep(i,0,m){
        cin >> b[i];  
    }
    
    rep(i,0,m){
        rep(j,0,n){
            if(b[i] >= a[j]){
                votes[j]++;
                break;
            }
        }
    }
    
    rep(i,0,n){
        if(memo < votes[i]){
            memo = votes[i];
            ans = i + 1;
        }
    }
    
    cout << ans << endl;
    return 0;
    
    
}


Measured memory_bytes: 3136
// Five Antennas

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <ios>
#include <iomanip>
#include <string>
#include <numeric>

using namespace std;

long long ceil_up(long long n, long long div) {
    if (n % div == 0) {
        return n / div;
    }
    return (n / div) + 1;
}

int main() {
    long long n, a, b, c, d, e;
    cin >> n >> a >> b >> c >> d >> e;

    long long arr[5] = {a, b, c, d, e};

    long long min = 1000000000000001;
    for (int i = 0; i < 5; i++) {
        if (arr[i] < min) {
            min = arr[i];
        }
    }

    cout << ceil_up(n, min) + 4 << endl;
    return 0;
}


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

//#define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP0(i,n) for (ll i = 0; i <= (ll)(n); ++i)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) is >> x;
  //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいいです。
  return is;
}
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : " " );
  }
  return os;
}
/* }}} */

signed main() 
{
  int x,a,b;
  cin >> x >> a >> b;
  x-=a;
  x%=b;
  print(x);
  return 0;
}

Measured memory_bytes: 256