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

const int MOD = 1000000007;
const int INF = 1e9;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n, i##_len=(n); i>=0; i--)
#define FOR(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
} 

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

     for(int i = 0; i < 3; i++){ 
          if(S.at(i) == '1') S.at(i) = '9';
          else S.at(i) = '1';
     }

     print(S);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t;cin>>s>>t;
    string u=s+s;
    
    vvl a(26);
    
    rep(i,u.size()){
        a[u[i]-'a'].push_back(i+1);
    }

    ll ans=0,cur=0;
    rep(i,t.size()){
        ll c=t[i]-'a';
        ll p = upper_bound(all(a[c]), cur)-a[c].begin();
        if(p!=a[c].size()){
            ans+=a[c][p]-cur;
            cur=a[c][p];
        }else{
            ll p = upper_bound(all(a[c]), -1)-a[c].begin();
            if(p!=a[c].size()){
                ans+=a[c][p]+u.size()-cur;
                cur=a[c][p];
            }else{
                puta(-1);
                return 0;
            }
        }
    }
    puta(ans);
    return 0;
}

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

using namespace std;

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

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)

bool sort_by(vi c, vi d){
	return c.S < d.S;
}

int main() {
	vector<vi> a;
	int N;
	cin >> N;
	vi b;
	REP(i, 0, N){
		b.F = i;
		cin >> b.S;
		a.PB(b);
	}
	sort(a.begin(), a.end(), sort_by);
	REP(i, 0, N) cout << a[i].F+1 << " ";
	cout << "\n";
}


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

using namespace std;


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

	int n,m;

	cin >> n >> m;

	if(n==m)
	{
		cout << "Yes" << '\n';
	}
	else
	{
		cout << "No" << '\n';
	}
	
	return 0;
}

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

using namespace std;

int main()
{
    vector<int >a(100,0);
    int k=0;
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            a[k]=i*j;
            k++;
        }
    }
    int n;
    cin >> n;
    bool flg=false;
    for(int i=0;i<100;i++){
        if(n==a[i])flg=true;
    }
    if(flg)puts("Yes");
    else puts("No");
    return 0;
}


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

using namespace std;
 
#define int1(a) scanf("%d",&a)
#define int2(a,b) scanf("%d %d",&a,&b)
#define int3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define int4(a,b,c,d) scanf("%d %d %d %d",&a,&b,&c,&d)
 
#define lint1(a) scanf("%lld",&a)
#define lint2(a,b) scanf("%lld %lld",&a,&b)
#define lint3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define lint4(a,b,c,d) scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define ll long long int
#define lli long long int
 
#define pint(x) printf("%d",x)
#define plint(x) printf("%lld",x)
#define endl '\n'
#define nl printf("\n");
#define ps printf(" "); 
 
#define all(x) x.begin(),x.end()
#define pb push_back
#define Set(a, s) memset(a, s, sizeof (a))
#define mod1 (lli)(1e9 + 7)
#define mod2 (lli)(1e9 + 9)
#define EPS 1e-9

#define fore(i,n) for(int i=n; i>=0; i--)
#define fors(i,a,n) for(int i=a; i<n; i++)
#define fora(i,ele) for(auto i: ele)
 
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<lli> vli;
 
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
 
double tick(){static clock_t oldt,newt=clock();double diff=1.0*(newt-oldt)/CLOCKS_PER_SEC;oldt=newt;return diff;}
float roundoff(float val, float p){ return floor(val*pow(10.0,p)+0.5)/pow(10.0,p);}
lli power(lli a, lli b, lli mod){lli x=1,y=a; while(b > 0){if(b&1){x=(x*y)%mod;}y = (y*y)%mod; b /= 2;}return x;}
 
const int INF = 0x3f3f3f3f;
const float pi = 3.14159265;
 
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};
//int dx[]={1,-1,0,0}; int dy[]={0,0,1,-1};

int MinimumNumIncreasingSubsequences(int arr[], int n) 
{ 
    multiset<int> last; 
  
    // last element in each  increasing subsequence  
    // found so far 
    for (int i = 0; i < n; i++) { 
  
        // here our current element is arr[i] 
        multiset<int>::iterator it = last.lower_bound(arr[i]); 
  
        // iterator to the first element larger  
        // than or equal to arr[i] 
        if (it == last.begin()) 
  
            // if all the elements in last larger 
            // than or to arr[i] then insert it into last 
            last.insert(arr[i]); 
  
        else { 
            it--; 
  
            // the largest element smaller than arr[i] is the number 
            // before *it which is it-- 
            last.erase(it); // erase the largest element smaller than arr[i] 
            last.insert(arr[i]); // and replace it with arr[i] 
        } 
    } 
    return last.size(); // our answer is the size of last 
}

int main(){
    int n;
    int1(n);
    
    //~ priority_queue<pair<int,int> > pq;
    int arr[n];
    
    fors(i,0,n){
		int1(arr[i]);
	}
    
    cout<<MinimumNumIncreasingSubsequences(arr,n);
    return 0;
}


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

namespace AtCoderGC003 {
  class AtCoderGC003 {
    static void Main(string[] args) {
      new AtCoderGC003().solveA();
    }

    private void solveA() {
      int n = int.Parse(Console.ReadLine());
      List<long> a = new List<long>();
      for (int _ = 0; _ < n; _++) {
        int input = int.Parse(Console.ReadLine());
        a.Add(input);
      }

      long s = 0; long res = 0;
      for (int i = 0; i < n; i++) {
        if (a[i] == 0) {
          res += s / 2;
          s = 0;
        } else 
          s += a[i];
      }
      res += s / 2;
      Console.WriteLine(res);
    }//end M.
  }
}


Measured memory_bytes: 8536
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, Q; cin >> N >> Q;
    int curr = 0;
    vector<bool> poss(N);
    poss[0] = poss[1] = true;
    for (int i = 0; i < Q; i++) {
        int a, b; cin >> a >> b; a--, b--;
        swap(poss[a], poss[b]);
        if (curr == a) curr = b;
        else if (curr == b) curr = a;
        if (curr+1 < N) poss[curr+1] = true;
        if (curr-1 >= 0) poss[curr-1] = true;
    }
    cout << accumulate(begin(poss), end(poss), 0) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

ll modAdd(ll a, ll b, ll mod) {
	return ((a % mod) + (b % mod)) % mod;
}

ll modSub(ll a, ll b, ll mod) {
	ll c = ((a % mod) - (b % mod)) % mod;
	return ((c < 0) ? c + mod : c);
}

ll modMul(ll a, ll b, ll mod) {
	return ((a % mod) * (b % mod)) % mod;
}

ll modPow(ll a, ll n, ll mod) {
	ll res = 1;
	while (n > 0)
	{
		if (n & 1) {
			res = modMul(res, a, mod);
		}
		a = modMul(a, a, mod);
		n >>= 1;
	}
	return res;
}

ll modDiv(ll a, ll b, ll mod) {
	return modMul(a, modPow(b, mod - 2, mod), mod);
}

ll modCombination(ll n, ll r, ll mod) {
	if (r > n / 2)
		return modCombination(n, n - r, mod);
	ll res = 1;
	for (ll i = 1; i <= r; i++) {
		res = modMul(res, n - i + 1, mod);
		res = modDiv(res, i, mod);
	}
	return res;
}

ll kosuu(ll n, ll k, ll mod) {
	ll N = n + 1;
	ll a = k * (k - 1) / 2;
	ll b = n * (n + 1) / 2;
	ll c = (n - k) * (n - k + 1) / 2;
	ll d = modSub(b, c, mod);
	d = modSub(d, a, mod);
	d = modAdd(d, 1, mod);
	return d;
}

int main()
{
	ll mod = 1000000007;
	ll n, k;
	cin >> n >> k;
	ll c = 0;
	for (int i = k; i <= n + 1; i++) {
		c = modAdd(c, kosuu(n, i, mod), mod);
	}
	cout << c << endl;
	return 0;
}

Measured memory_bytes: 3616
#include<stdio.h>

int main(void)
{
   int a, b, c, d, s;

   scanf("%d",&a);
   scanf("%d",&b);
   scanf("%d",&c);
   scanf("%d",&d);

   if(a<b)
      b=a;
   else if(a>b)
            a=b;

   if(c<d)
      d=c;
   else if(c>d)
      c=d;

   s=a+c;

   printf("%d\n",s);

   return 0;
}



Measured memory_bytes: 128
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define SORT(obj) sort(ALL(obj))
#define GSORT(obj) sort(ALL(obj) , greater<int>())
#define P pair<int , int>
#define V vector<int>
#define VLL vector<long long>
#define M map<int, int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
    int A, B;  cin >> A >> B;
    cout << A * B << endl;
	return 0;
}

Measured memory_bytes: 3640
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n,m = map(int,input().split())

cmb_n = cmb(n,2) if n>=2 else 0
cmb_m = cmb(m,2) if m>=2 else 0

print(cmb_n+cmb_m)

Measured memory_bytes: 9500
#include <stdio.h>

int partition(int *,int,int);
void swap(int *,int *);

int main(int argc, char const *argv[]) {

  int p=0;
  int n;
  scanf("%d",&n);
  int A[n];
  int i;
  int v;

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

  v = partition(A,p,n);

  for( i = 0 ; i < v ; i++ ){
    printf("%d ",A[i]);
  }

  printf("[%d] ",A[v]);

  for( i = v+1 ; i < n-1 ; i++ ){
    printf("%d ",A[i]);
  }

  printf("%d\n",A[i]);



  return 0;
}

int partition(int *A, int p, int r){

  int x;
  int i,j;

  x = A[r-1];
  i = p-1;

  for( j = p ; j < r-1 ; j++ ){
    if( A[j] <= x ){
      i++;
      swap(&A[i],&A[j]);
    }
  }

  swap(&A[i+1],&A[r-1]);

  return i+1;

}

void swap(int *x, int *y){

  int temp;

  temp = *x;
  *x = *y;
  *y = temp;

}

Measured memory_bytes: 988
#include<stdio.h>
int main()
{
  long i, n,max,min,sum = 0;
  scanf("%ld",&n);
  long a[n];
  for (i=0; i<n; i++) {
    scanf("%ld" ,&a[i]);
  }

  max=a[0];
  min=a[0];
  for(i=0; i<n; i++){
    if(max<a[i]){
      max = a[i];
    }
     if(min>a[i]){
      min = a[i];
     }
     sum+=a[i];
  }

  printf("%ld %ld %ld\n" ,min ,max ,sum);

  return 0;
}

Measured memory_bytes: 676
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <cctype>
#include <map>
#include <set>
#include <bitset>
#include <utility> 
using namespace std;

int main() {
   string S; cin >> S;
   int N=S.size();
   int BWBW=0;
   for (int i=0;i<N;i++){
       if (i%2==0&&S[i]=='1') BWBW++;
       else if (i%2==1&&S[i]=='0') BWBW++;  
   }
   int WB=0;
   for (int i=0;i<N;i++){
       if (i%2==0&&S[i]=='0') WB++;
       else if (i%2==1&&S[i]=='1') WB++;  
   }
   cout << min(BWBW,WB) << endl;
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
#define yes(n) cout << ((n) ? "bust" : "win") << endl
int main()
{
    int n,m,l;
    cin >> n >> m >> l;
    if(n+m+l>=22)
        yes(true);
    else
    {
        yes(false);
    }
    
    
}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.*;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = Long.parseLong(sc.next().replaceAll("\\.", ""));
        String res =  new BigDecimal(a).multiply(new BigDecimal(b)).divide(new BigDecimal("100")).toPlainString();
        if(res.contains(".")) {
            res = res.substring(0, res.indexOf("."));
        }
        System.out.println(res);

    }
}

Measured memory_bytes: 36124
#include <iostream>
#include <stdio.h>
using namespace std;
 
typedef long long LL;
const int MAX_N = 1e5 + 6;
 
LL a[MAX_N];
 
int main() {
	LL n,A,B;
	scanf("%lld %lld %lld",&n,&A,&B);
	for (int i=1;n>=i;i++) {
		scanf("%lld",&a[i]);
	}
	LL L=0,R=1e9+7;   //R is the answer
	while (R-L!=1) {
		LL mid=(L+R)>>1;
		LL need_A = 0;
		for (int i=1;n>=i;i++) {
			if (A*mid < a[i]) {
				need_A += mid+1;
			}
			else if (B*mid >= a[i]) {
				need_A += 0;
			}
			else {
				need_A += (a[i]-B*mid + (A-B-1))/(A-B);
			}
		}
		if (need_A <= mid) R=mid;
		else L=mid;
	}
	printf("%lld\n",R);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int (i) = 0, i_len = n; (i) < (i_len); ++(i))
#define repp(i,n) for(int (i) = 1, i_len = n; (i) <= (i_len); ++(i))
#define per(i,n) for(int (i) = n-1; (i) >= 0; --(i))
#define perr(i,n) for(int (i) = n; (i) > 0; --(i))
#define sz(x) ((int)(x).size())
#define popcnt __builtin_popcount
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define Pi 3.1415926535
#define MOD = 1e9+7;
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
template<class T,class S> inline bool chmax(T& a, S b){if(a<b){a = b; return true;} return false;}
template<class T,class S> inline bool chmin(T& a, S b){if(a>b){a = b; return true;} return false;}
template<class T> T gcd(T a, T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/gcd(a,b);}

int solve(){
    int x; cin >> x;
    int ans = 0;
    ans += (x/500)*1000;
    x %= 500;
    ans += (x/5)*5;
    cout << ans << endl;

    return 0;
}

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


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

if n % 2:
    if a[0] != 0:
        print(0)
        exit()
    for i in range(1, n//2+1):
        if a[2*i-1] == a[2*i] and a[2*i-1] == 2*i:
            continue
        else:
            print(0)
            exit()

else:
    for i in range(1, n//2+1):
        if a[2*i-2] == a[2*i-1] and a[2*i-2] == 2*i-1:
            continue
        else:
            print(0)
            exit()

print((2**(n//2))%p)


Measured memory_bytes: 14008
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;


signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(20);

  int l;

  cin >> l;

  cout << pow(l / 3.0, 3) << endl;

  return 0;
}


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

int N=0;
int main() {
    cin >> N;
    int res = MAX;
    for (int i=1; i< N; i++){
      int a = i,b = N-i;
      int min = 0;
      while(a)
       min+=a%10,a/=10;
      while(b)
       min+=b%10,b/=10;
      if(min<res){
        res=min;
      }
    }
    cout<<res<<"\n";
}


Measured memory_bytes: 256
void main() {
	auto W = rs;
	ulong cnt;
	while(true) {
		auto s = rs;
		if(s == "END_OF_TEXT") break;
		foreach(v; s.split) {
			if(v.toLower == W.toLower) cnt++;
		}
	}
	cnt.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}



Measured memory_bytes: 2516
#include<bits/stdc++.h>
#define ll long long
#define F(i,a,b) for(i = a; i <= b; i ++)
#define RF(i,a,b) for(i = a; i >= b;i --)
#define sz(a) sizeof(a)
using namespace std;

typedef pair<int,int> pii;
typedef pair<char,int> pci;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef unordered_map<int,int> umii;
typedef unordered_map<char,int> umci;

ll n,w,v;
vector<pii> v_items;
ll dp[100][100001];
ll max_val(ll i,ll ps_w)
{
    if(i == n){
        if(ps_w <= w)
            return 0LL;
    }
    if((ps_w > w))
    {
        return -1LL;
    }
    if(dp[i][ps_w] != (-1LL))
        return dp[i][ps_w];
    ll sec = max_val(i + 1LL,ps_w + v_items[i].first);
    dp[i][ps_w] = max_val(i + 1LL, ps_w);
    if(sec != (-1LL))
        dp[i][ps_w] = max(dp[i][ps_w], sec + v_items[i].second);
    return dp[i][ps_w];
}
void solve()
{
    int i;
    cin>>n>>w;
    memset(dp,-1LL,sz(dp));
    F(i,0,n - 1)
    {
        pii item;
        cin>>item.first>>item.second;
        v_items.push_back(item);
    }
    cout<<max_val(0,0)<<'\n';
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //#else
    //#endif
    solve();
}


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

int main(){
    int X; cin >> X;
    int ans = 2;
    bool flag = true;
    if(ans>=X){
        cout << ans << endl;
    }else{
        for(int i=3;i<=100003;i+=2){
            flag = true;
            for(int j=3;j<i;j+=2){
                if(i%j==0){
                    flag = false;
                    break;
                }
            }
            if(flag){
                ans = i;
            }
            if(ans>=X){
                cout << ans << endl;
                break;
            }
        }
    }


}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
typedef long long LL;
using namespace std;

int main()
{
	//freopen("data_in.txt", "r", stdin);
	int n = 0;
	cin >> n;
	string s = to_string(n);
	int t = 0;
	for (auto c : s) {
		t += c - '0';
	}
	if (n%t) cout << "No";
	else cout << "Yes";
	return 0;
}

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

vector<vector<int>> vec(10001);
vector<int> l(10001,0);
vector<int> c(10001);
int d=0;

void dfs(int n){
  l.at(n)=c.at(d++);
  for(int i=0;i<vec.at(n).size();i++){
    if(l.at(vec.at(n).at(i))==0)
      dfs(vec.at(n).at(i));
  } 
}

int main(){
  int N,ans=0;
  cin>>N;
  
  vec.resize(N+1);
  l.resize(N+1);
  c.resize(N);
  
  for(int i=0;i<N-1;i++){
    int a,b;
    cin>>a>>b;
    vec.at(a).push_back(b);
    vec.at(b).push_back(a);
  }
  for(int i=0;i<N;i++)
  cin>>c.at(i);
  
  sort(c.begin(),c.end());
  for(int i=0;i<N-1;i++)
    ans += c.at(i);
  
  reverse(c.begin(),c.end());
  
  dfs(1);
  
  cout<<ans<<endl;
  
//  for(int i=0;i<N;i++)
//    cout<<c.at(i)<<" ";
//  cout<<endl;
//  for(int i=1;i<N+1;i++){
//    for(int j=0;j<vec.at(i).size();j++){
//      cout<<vec.at(i).at(j)<<" ";
//    }
//    cout<<endl;
//  }
  
  for(int i=1;i<N+1;i++)
    cout<<l.at(i)<<" ";
}


Measured memory_bytes: 1408
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().solve();
	}

	private void solve() throws IOException {
		try {
			//			solveA();
			//			solveB();
			solveC();
			//			 solveD();
			//			 solveE();
			//			 solveF();
		} finally {
			if (in != null) {
				in.close();
			}
			if (out != null) {
				out.flush();
				out.close();
			}
		}

	}

	private void solveA() {
		char x = next().charAt(0);
		char y = next().charAt(0);

		out.println(x < y ? "<" : x > y ? ">" : "=");
	}

	private void solveB() {
		int numX = nextInt();
		int numY = nextInt();
		int numZ = nextInt();

		int res = (numX - numZ) / (numY + numZ);

		out.println(res);
	}

	private void solveC() {
		int numN = nextInt();
		int numM = nextInt();

		long ans = 1900 * numM + 100 * (numN - numM);
		long res = (long) (ans * Math.pow(2, numM));
		out.println(res);
	}

	private void solveD() {
		int numN = nextInt();

		out.println("");
	}

	private void solveE() {
		int numN = nextInt();

		out.println("");
	}

	private void solveF() {
		int numN = nextInt();

		out.println("");
	}

	private final PrintWriter out = new PrintWriter(System.out);
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}

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

int N;
int A[100005];

int gcd(int a,int b){
	while(b!=0){
		int r = a%b;
		a=b;
		b=r;
	}
	return a;
}

int main(){
	cin >> N;
	for(int i=0;i<N;i++){
		cin >> A[i];
	}
	int ans = A[0];
	for(int i=1;i<N;i++){
		ans = gcd(A[i],ans);
	}
	cout << ans <<endl;
	return 0;
}

Measured memory_bytes: 640
#ifndef LOCAL
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#else
#include <iostream>
#include <iomanip> 
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}
#define fix(a) fixed << setprecision(a)
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'


void solve(){
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> a(n+1);
  forn(i,m){
    int b;
    cin >> b;
    a[b] = 1;
  }
  int cnt = 0;
  int ans = 0;
  forn(i,x){
    cnt += a[i];
  }
  rep(i, x, n+1){
    ans += a[i];
  }

  cout << min(cnt, ans);
}

int main() {
  ios::sync_with_stdio(false);
  int t = 1;
  // cin >> t;
  forn(i, t){
    solve();
  }
}

/* 

1
322123


n - 1
0 ... (n-1) [res ... res] S - (n-1) ... S


 */

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define REP(i,a,n) for(ll i=n;i>a;i--)
int main(void){
    double t_1,t_2;
    ll num1,num2;
    double judge_500[7]={35.50,37.50,40.00,43.00,50.00,55.00,70.00};
    double judge_1000[7]={71.00,77.00,83.00,89.00,105.00,116.00,148.00};
    string rank[8]={"AAA","AA","A","B","C","D","E","NA"};
    rep(j,0,100){
        t_1 = -1;
        t_2 = -1;
        num1=-1;
        num2=-1;
        cin>>t_1>>t_2;
        rep(i,0,7){
            if(t_1<judge_500[i]){
                num1=i;
                break;
            }
        }
        rep(i,0,7){
            if(t_2<judge_1000[i]){
                num2=i;
                break;
            }
        }
        if(num1==-1)num1=7;
        if(num2==-1)num2=7;
        
        if(t_1 == -1 && t_2 == -1) break;
        cout<<rank[max(num1,num2)]<<endl;
        
    }
    
}


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

int main(){
    int n,m;
    cin >> n >> m;
    int sum = 0;
    sum += n*(n-1)/2;
    sum += m*(m-1)/2;
    cout << sum << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <map>
#include <math.h>

using namespace std;

typedef signed long long ll;

int main(void)
{
    long long count = 0;
    int N = 0;
    cin >> N;

    vector<int> A(N, 0);
    vector<int> B(N, 0);
    vector<int> C(N, 0);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    for (int i = 0; i < N; i++)
    {
        cin >> B[i];
    }
    sort(B.begin(), B.end());
    for (int i = 0; i < N; i++)
    {
        cin >> C[i];
    }
    sort(C.begin(), C.end());

    long long ab = 0;
    long long bc = 0;
    for (int j = 0; j < N; j++, ab = 0, bc = 0)
    {
        auto it_A = lower_bound(A.begin(), A.end(), B[j]);
        ab = distance(A.begin(), it_A);
        auto it_C = upper_bound(C.begin(), C.end(), B[j]);
        bc = N - distance(C.begin(), it_C);

        count = count + (ab * bc);
    }

    cout << count << endl;

    return 0;
}


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

int main(){
  string S;
  cin >> S;
  if(S.at(0) != S.at(1) && S.at(1) != S.at(2) && S.at(0) != S.at(2)){
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define ff first
#define ss second
#define rep(i,l,r) for(int i = (int)l;i<(int)r;i++)
#define td(v) v.begin(),v.end()
//#define M   1000000007 // 1e9 + 7
#define MAXN 100100
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int exp(int a,int b,int m){
	
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);

}


int dp[110][100100];
int w[110],v[110];

int32_t main(){
	fastio;
	int n,p;
	cin>>n>>p;
	for(int i=1;i<=n;i++){
		cin>>w[i]>>v[i];
	}
	
	for(int i=0;i<110;i++){
		for(int j=0;j<100100;j++){
			dp[i][j] = -1e9;
		}
	}
	dp[0][0] = 0;
	for(int i=1;i<=n;i++){
		for(int j=p;j>=0;j--){
			dp[i][j] = dp[i-1][j];
			if(j+w[i]<=p)dp[i][j+w[i]] = max(dp[i][j+w[i]],dp[i-1][j] + v[i]);
		}
	}
	int r=0;
	for(int j=0;j<=p;j++)r=max(r,dp[n][j]);
	cout<<r<<endl;
}

Measured memory_bytes: 86272
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	char s[105];
	scanf("%s", s + 1);
	int a[30], b[30];
	for (int i = 1; i <= 26; ++i)
	{
		a[i] = 0;
		b[i] = 0;
	}
	int ans = 0, cnt;
	for (int i = 1; i <= n - 1; ++i)
	{
		for (int p = 1; p <= 26; ++p)
		{
			a[p] = 0;
			b[p] = 0;
		}
		cnt = 0;
		for (int j = 1; j <= i; ++j)
		{
			a[s[j] - 'a' + 1]++;
		}
		for (int j = i + 1; j <= n; ++j)
		{
			b[s[j] - 'a' + 1]++;
		}
		for (int j = 1; j <= 26; ++j)
		{
			if (a[j] != 0 && b[j] != 0)
			{
				++cnt;
			}
		}
		if (cnt > ans)
			ans = cnt;
	}
	cout << ans << endl;
	return 0;
}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
//#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
void vin(Vi &v){REP(i,0,(v).size()) cin>>v[i];}
void vin(Vi &v,Vi &v2){REP(i,0,(v).size()) cin>>v[i]>>v2[i];}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
void accum(Vi &v){REP(i,1,(v).size()) v[i]+=v[i-1];}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}


void solve(long long a, long long b){
    if(a>b) swap(a,b);
    REP(i,0,b) cout<<a;
    cout<<endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
signed main(){
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    solve(a, b);
    return 0;
}


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

int main() {
  vector<int> vec = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  cin >> K;
  cout << vec.at(K-1) << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
#define int long long
using namespace std;

signed main(void){
    int n,mone = 0,mtwo = 0;
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    vector<int> aligns(n);
    rep(i,n) {
        cin >> aligns[i];
    }
    sort(aligns.begin(),aligns.end());
  	if(n==2){
      cout << max(aligns[0]-aligns[1],aligns[1]-aligns[0]) << endl;
      return 0;
    }
    rep(i,n) {
        mone += aligns[n-1-i] - aligns[i];
        mtwo += aligns[n-1-i] - aligns[i];
        if(n-1-i-i == 2) {
            mone += aligns[n-1] - aligns[i+1];
            mtwo += aligns[i+1] - aligns[0];
            break;
        } else if(n-1-i-i == 3) {
            mone += aligns[n-2-i] - aligns[i];
            mtwo += aligns[n-1-i] - aligns[i+1];
            mone += aligns[n-1] - aligns[i+1];
            mtwo += aligns[i+2] - aligns[0];
            break;
        } else {
            mone += aligns[n-2-i] - aligns[i];
            mtwo += aligns[n-1-i] - aligns[i+1]; 
        }
    }
    cout << max(mone,mtwo) << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 1000000000000000005
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
int boss[100005],u[100005],v[100005];
ll size[100005],ans[100005];
int find(int x){
	int r=x,q;
	while(r!=boss[r]) r=boss[r];
	while(x!=r){
		q=boss[x];
		boss[x]=r;
		x=q;
	}
	return r;
}
ll findSize(int x){
	return size[find(x)];
}
void merge(int a,int b){
	size[find(b)]+=findSize(a);
	boss[find(a)]=find(b);
}
int main(){
	ll n,m;
	while(~scanf("%lld%lld",&n,&m)){
		FE(i,1,n) boss[i]=i,size[i]=1;
		ans[0]=n*(n-1)/2;
		int ptr=0,m1=m;
		while(m--) getII(u[m],v[m]);
		F(i,0,m1-1){
			ptr++;
			if(find(u[i])!=find(v[i])){
				ans[ptr]=ans[ptr-1]-findSize(u[i])*findSize(v[i]);
				merge(u[i],v[i]);
			}else ans[ptr]=ans[ptr-1];
		}
		for(int i=ptr;i>=0;i--) printf("%lld\n",ans[i]);
	}
}


Measured memory_bytes: 4096
package main
import (
  "fmt"
)
func main() {
  var n int
  fmt.Scan(&n)
  as := make([]int, n)
  for i := 0; i < n; i++ {
    fmt.Scan(&as[i])
  }
  setMap := make(map[int]int)
  for _, a := range as {
    setMap[a]++
  }
  var result int
  if len(setMap)%2 == 0 {
    result = len(setMap)-1
  } else {
    result = len(setMap)
  }
  fmt.Println(result)
}

Measured memory_bytes: 9088
#include<iostream>
#include<cstdio>
using namespace std;
const int MAX = 500000;
const int maxnum = 1000000010;

// 两个局部数组
int L[MAX / 2 + 2], R[MAX / 2 + 2];
int A[MAX], n;
long long cnt ;

// 排序和合并
void merge(int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;
    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] = R[n2] = maxnum;
    int i = 0, j = 0;
    // 合并
    for (int k = left; k < right; k++) {
        if (L[i] <= R[j])
            A[k] = L[i++];
        else {
            A[k] = R[j++];
            cnt += n1 - i;
        }
    }
}
// 分割
void mergeSort(int left, int right) {
    if (left + 1 < right) {
        int mid = (left + right) / 2;
        mergeSort(left, mid);
        mergeSort(mid, right);
        merge(left, mid, right);
    }
}
int main() {

    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", &A[i]);

    mergeSort(0, n);
    printf("%lld\n", cnt);
    return 0;
}


Measured memory_bytes: 4764
import numpy as np
n, k = map(int, input().split())
a = [list(map(int , input().split())) for _ in range(n)]
a = np.array(a, dtype=object)
p = 10**9 + 7

def mat_pow(a, n, mod):
    res = np.eye(len(a), dtype=object)
    while(n > 0):
        if(n & 1 == 1):
            res = np.dot(res, a) % mod#res.dot(a) % mod
        a = np.dot(a, a) % mod#a.dot(a) % mod
        n = n >> 1
    return res
ak = mat_pow(a, k, p)
#print(ak % p)
#print(ak.sum() % p)
ans = 0
for i in range(n):
    for j in range(n):
        ans += ak[i, j]
        ans %= p

print(ans)



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

using namespace std;

const int N = 100007;
const int INF = 1000000007;

int a[N], b[N], c[N], dp[N][3];

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

  for(int i = 1; i <= n; ++i) cin >> a[i] >> b[i] >> c[i];

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

  cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << "\n";
  return 0;
}


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

#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (ll i = m; i < (n); i++)

using ll = long long;
using pii = pair<int, int>;
using Vi = vector<int>;

int main() {
  int ans = 700;
  rep(i,3){
    char c;
    cin >> c;
    if(c=='o'){
      ans += 100;
    }
  }
  cout << ans << endl;
  
}      
  

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
	if(b==0)
	return a;
	return gcd(b,a%b);
}
int main() {
	int n;
	cin>>n;
	vector<int> arr(n);
	int gcd1=0;
	int ma=0;
	for(int i=0;i<n;i++){
		cin>>arr[i];
		gcd1=gcd(gcd1,arr[i]);
		ma=max(ma,arr[i]);
	}
	vector<int> dp(ma+1,0);
	int i=0;
	while(i<n){
		int flag=0;
		for(int j=1;j<=sqrt(arr[i]);j++){
			 if(arr[i]%j==0){
			 	if(dp[j]!=0&&j!=1){
			 		 flag++;
					 break;
				}
				if(arr[i]/j!=1&&dp[arr[i]/j]!=0){
					flag++;
					break;
				}
				dp[j]++;
				dp[arr[i]/j]++;
			 }
		}
		if(flag!=0)
		break;
		i++;
	}
	if(i==n){
		cout<<"pairwise coprime\n";
	}
	else if(gcd1==1){
		cout<<"setwise coprime\n";
	}
	else{
		cout<<"not coprime\n";
	}
    return 0;
}

Measured memory_bytes: 10992
#include <iostream>
#include <string>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;

int main(int argc, const char * argv[]) {
	int n;
	string s;
	cin >> n >> s;
	int cnt=0;
	REP(i,n-1){
		if(s.substr(i,3)=="ABC"){
			cnt++;
		}
	}
	println(cnt);
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define maxn 500010
using namespace std;
char b[maxn];
int a[maxn], dp[maxn];
int main() {
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)cin>>b[i];
    for(int i=1;i<=n;i++){
        if(b[i]=='0')a[i]=i;
        else a[i]=a[i-1];
    }
    for(int i=1;i<=n;i++){
        dp[i]=dp[i-1];
        if(b[i]=='1'){
            if(b[i-1]=='0'&&b[i-2]=='1'){
                dp[i]=max(dp[i],dp[a[i-2]]+(i-2)-a[i-2]);
                dp[i]=max(dp[i],dp[a[i-2]+1]+(i-2)-(a[i-2]+1));
            }
            else if(a[i]>1&&b[a[i]-1]=='1')
				dp[i]=max(dp[i],dp[a[i]-2]+i-a[i]);
        }
    }
    cout<<dp[n]<<endl;
    return 0;
}


Measured memory_bytes: 4608
n = int(input())
a = list(map(int,input().split()))

s = 0
for i in range(n):
  s += a[i]
  #sはaの和

t = 0
for i in range(n):
  t += a[i]**2
  #tはaの2乗和

ans = ((s**2 - t)//2) % (10**9 + 7)
print(ans)

Measured memory_bytes: 31596
#include "bits/stdc++.h"
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const long long mod = 1e9 + 7;

ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

ll powMod(ll n, ll k, ll m) {
	if (k == 0) {
		return 1;
	} else if (k % 2 == 1) {
		return powMod(n, k - 1, m) * n % m;
	} else {
		ll t = powMod(n, k / 2, m);
		return t * t % m;
	}
}

int main() {
	ll n, k;
	cin >> n >> k;
	
	ll ans;
	
	if (n % k == 0) {
		ans=0;
	} else if (abs(n - k) >= n) {
		ans=n;
	} else {
		ans=n%k;
		if (abs(ans - k) < ans) {
			ans= abs(ans - k);
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
from collections import Counter as c
n=int(input())
a=c(list(map(int,input().split())))
k=sorted(list(a.keys()))
b=[0,0]
for i in k:
  if a[i]>=2:
    b.append(i)
    if a[i]>=4:
      b.append(i)
l=len(b)
print(b[l-1]*b[l-2])

Measured memory_bytes: 18600
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

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

template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }

#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }




int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    long long N;
    while (cin >> N) {
        cout << 180LL * (N - 2) << endl;
    }
}


















Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define x first
#define y second
#define pb push_back

#define speed ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;


signed main()
{
    int a,b;cin>>a>>b;
    int tot=1,used=0;
    while(tot<b)
    {
    	tot-=1;
    	tot+=a;
    	used++;
    }
    cout<<used;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>


ll n, now;
int main() {
	cin >> n;
	REP(i, n) {
		ll a;
		cin >> a;
		now ^= a;
	}
	cout << (now == 0 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 200005
#define inf 1000000000
#define umax(x,y) x=max(x,y)
using namespace std;

int n;
int dp[N][3];
char s[N];

bool is_eq(int a,int b,int c,int d) {

	if(b-a!=d-c) return 0;

	for(int i=a;i<=b;i++) {

		if(s[i]!=s[c+i-a]) return 0;

	}

	return 1;

}

int main(int arg,char* argv[]) {

	scanf("%s",s+1);

	for(int i=1;i<=n;i++) for(int j=1;j<=2;j++) dp[i][j]=-inf;
	n=strlen(s+1);

	dp[2][2]=1;
	dp[1][1]=1;

	for(int i=1;i<=n;i++) {

		for(int j=1;j<=2;j++) {

			if(i-j<0) continue ; 

			for(int k=1;k<=2;k++) {

				if(!is_eq(i-j+1,i,i+1,i+k)) {

					umax(dp[i+k][k],dp[i][j]+1);

				}

			}

		}

	}

	printf("%d",max(dp[n][1],dp[n][2]));

}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
int x,rev=0;
cin>>n;
int m=n;
do{
    x=n%10;
    rev=(rev*10)+x;
    n=n/10;
}while(n!=0);
if(m==rev){
    cout<<" Yes ";
}
else{
    cout<<" No";
}
}


Measured memory_bytes: 256